summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/context2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/contextjit5
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/ctxtools2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/luatools2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrun27376
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrunjit5
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/pstopdf2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/texexec2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/stubs/unix/texmfstart2
-rwxr-xr-xMaster/bin/aarch64-linux/luametatexbin3117168 -> 3165648 bytes
-rwxr-xr-xMaster/bin/amd64-freebsd/luametatexbin2972064 -> 3045968 bytes
-rwxr-xr-xMaster/bin/armhf-linux/luametatexbin2367724 -> 2414360 bytes
-rwxr-xr-xMaster/bin/i386-freebsd/luametatexbin2651300 -> 2714536 bytes
-rwxr-xr-xMaster/bin/i386-linux/luametatexbin3822280 -> 3927316 bytes
-rwxr-xr-xMaster/bin/i386-solaris/luametatexbin2880096 -> 2944452 bytes
-rw-r--r--Master/bin/windows/context.lua82
-rwxr-xr-xMaster/bin/windows/luametatex.exebin3005146 -> 2886144 bytes
-rwxr-xr-xMaster/bin/windows/mtxrun.lua135
-rwxr-xr-xMaster/bin/x86_64-darwinlegacy/luametatexbin2823900 -> 2888284 bytes
-rwxr-xr-xMaster/bin/x86_64-linuxmusl/luametatexbin3084312 -> 3159520 bytes
-rwxr-xr-xMaster/bin/x86_64-solaris/luametatexbin3404712 -> 3481440 bytes
-rw-r--r--Master/source/luametatex-2.10.08.tar.xzbin0 -> 2297972 bytes
-rw-r--r--Master/source/luametatex-230310.tar.xzbin2035632 -> 0 bytes
-rw-r--r--Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-context.lua4
-rw-r--r--Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-metapost.lua2
-rw-r--r--Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-tex.lua2
-rw-r--r--Master/texmf-dist/context/data/scite/context/scite-context-data-context.properties460
-rw-r--r--Master/texmf-dist/context/data/scite/context/scite-context-data-metapost.properties11
-rw-r--r--Master/texmf-dist/context/data/scite/context/scite-context-data-tex.properties190
-rw-r--r--Master/texmf-dist/context/data/texfont/type-buy.dat146
-rw-r--r--Master/texmf-dist/context/data/texfont/type-fsf.dat25
-rw-r--r--Master/texmf-dist/context/data/texfont/type-ghz.dat78
-rw-r--r--Master/texmf-dist/context/data/texfont/type-tmf.dat75
-rw-r--r--Master/texmf-dist/doc/context/README.adoc18
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-alignments.pdfbin74661 -> 81652 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-boxes.pdfbin87679 -> 87671 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-buffers.pdfbin0 -> 58361 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-characters.pdfbin48469 -> 48441 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-conditionals.pdfbin96046 -> 96425 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-expansion.pdfbin86301 -> 86574 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-grouping.pdfbin28200 -> 28352 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-inserts.pdfbin38122 -> 38859 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-localboxes.pdfbin0 -> 61705 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-loops.pdfbin44159 -> 43942 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-macros.pdfbin88216 -> 88829 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-marks.pdfbin62989 -> 63346 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-paragraphs.pdfbin296883 -> 296768 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-registers.pdfbin43739 -> 46958 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-scope.pdfbin44386 -> 44359 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-security.pdfbin40571 -> 40613 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-tokens.pdfbin0 -> 68803 bytes
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/lowlevel.pdfbin657745 -> 837278 bytes
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkii/mptopdf.133
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man1.pdfbin16122 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.html1
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.man3
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.xml1
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/details/detcow.mp2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-tokens.tex540
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel.tex1
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-building.tex54
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex69
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex14
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex24
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex72
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex10
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-style.tex9
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-fonts.tex5
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-languages.tex4
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-lua.tex154
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-modifications.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-nodes.tex48
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/mycow.mp2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-hownotto.tex76
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-texlive.tex319
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-unicode.tex1584
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex1
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-dk.tex4
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-fairphone.tex58
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget.tex3
-rw-r--r--Master/texmf-dist/doc/man/man1/context.man1.pdfbin22743 -> 24004 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/luatools.178
-rw-r--r--Master/texmf-dist/doc/man/man1/luatools.man1.pdfbin18506 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdfbin17439 -> 16091 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-base.man1.pdfbin18528 -> 18229 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdfbin17344 -> 14816 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdfbin17395 -> 15618 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdfbin17374 -> 15799 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-check.man1.pdfbin17259 -> 15992 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdfbin17245 -> 14790 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-context.man1.pdfbin22743 -> 24004 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-dvi.man1.pdfbin17254 -> 15411 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdfbin17527 -> 16506 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-evohome.man1.pdfbin17523 -> 16117 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdfbin17608 -> 16750 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdfbin17293 -> 15764 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdfbin17935 -> 17338 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdfbin17490 -> 16454 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdfbin17983 -> 18085 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdfbin17443 -> 15743 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdfbin17487 -> 16136 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-package.man1.pdfbin17288 -> 15753 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdfbin17741 -> 16866 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-pdf.13
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdfbin17421 -> 16552 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdfbin17457 -> 15790 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdfbin17315 -> 16381 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdfbin17327 -> 15799 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdfbin17371 -> 15896 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-server.man1.pdfbin17484 -> 16020 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-spell.man1.pdfbin17396 -> 16180 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdfbin17347 -> 15305 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdfbin17347 -> 15487 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdfbin17837 -> 17772 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdfbin17281 -> 15216 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdfbin17276 -> 15387 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-update.man1.pdfbin18661 -> 17667 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-vscode.man1.pdfbin17463 -> 15907 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdfbin17583 -> 16590 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdfbin17531 -> 16145 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/mtxrun.man1.pdfbin20394 -> 20282 bytes
-rw-r--r--Master/texmf-dist/fonts/map/dvips/context/contnav.map1
-rw-r--r--Master/texmf-dist/fonts/map/luatex/context/demo-font.lum70
-rw-r--r--Master/texmf-dist/fonts/map/pdftex/context/original-context-symbol.map3
-rw-r--r--Master/texmf-dist/metapost/context/base/mpxl/mp-base.mpxl6
-rw-r--r--Master/texmf-dist/metapost/context/base/mpxl/mp-xbox.mpxl5
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-context.lua22
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-ctan.lua83
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-fonts.lua11
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-install-tikz.lua162
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-install.lua6
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-pdf.lua109
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-update.lua6
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtxrun.lua135
-rw-r--r--Master/texmf-dist/scripts/context/lua/texlua.lua141
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua9
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua18
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-def.lua1
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-ini.lua44
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-tex.lua44
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-utf.lua34
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/context.mkiv4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/core-con.lua10
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/core-dat.lua18
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/core-two.lua9
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/core-uti.lua28
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-con.lua24
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-res.lua33
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-tar.lua12
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua23
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-zip.lua18
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/file-ini.lua7
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/file-mod.lua16
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-afk.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-con.lua76
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua39
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-def.lua92
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-enc.lua42
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua47
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-ini.lua4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-log.lua9
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-nod.lua5
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-one.lua90
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-onr.lua40
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-ota.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-otc.lua7
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-otl.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-oto.lua11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-ots.lua225
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-sol.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-syn.lua31
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua29
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-trt.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-vir.lua11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/good-ini.lua44
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/l-dir.lua17
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv5
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua378
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lang-url.lua10
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua132
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua9
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua18
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua12
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua75
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua254
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/math-map.lua32
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua22
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua12
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua28
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mult-low.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua13
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/node-ini.lua64
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/node-res.lua5
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/node-tra.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua35
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi36
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi1
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi37
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi44
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi34
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi28
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua53
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv4
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua11
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua82
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/status-files.pdfbin24650 -> 24657 bytes
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/status-lua.pdfbin266630 -> 271357 bytes
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/syst-con.lua7
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv5
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua3
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua14
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-dim.lua234
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua70
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-prs.lua9
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sac.lua12
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-seq.lua14
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl5
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt134
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt18
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt40
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl5
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt104
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl13
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt122
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt1
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt187
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl36
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/context.mkxl119
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt225
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl50
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt160
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl68
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-two.lmt210
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl194
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt44
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt312
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt29
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl11
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/file-job.lmt167
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/file-job.mklx27
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-con.lmt83
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt75
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-def.lmt88
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx27
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-one.lmt90
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt42
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt556
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt227
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt12
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt30
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl14
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl23
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt190
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt12
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt14
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt36
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt8
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt89
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx120
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-act.lmt834
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl90
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl72
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx85
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl79
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt178
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl24
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl167
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-map.lmt32
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt99
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt68
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx341
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt368
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl251
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl76
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl46
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl1
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt33
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt87
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt32
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl20
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt9
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-res.lmt7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt8
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt153
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl22
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl42
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl32
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl42
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt1118
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl77
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl5
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt27
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt38
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl13
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl1
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl1
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx8
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt59
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt64
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl12
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl23
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt388
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx22
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt82
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl42
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt8
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt18
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl19
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl58
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt22
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt18
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt118
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt109
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl27
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt481
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt20
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt26
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl5
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt658
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.iccbin416 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.iccbin1992 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.iccbin700 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.iccbin1829093 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.iccbin1829077 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.iccbin60960 -> 0 bytes
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg173
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg61
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg45
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg249
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg11
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg23
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg30
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg58
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg44
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg59
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg29
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg81
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg3
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg130
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg16
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg30
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg57
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg132
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg48
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg59
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg225
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg348
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg41
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg62
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg39
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg63
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg77
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg34
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg85
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg60
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg43
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg185
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv64
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv46
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv10
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv28
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv60
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv179
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv14
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv71
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv136
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv100
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv16
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv8
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg34
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg62
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-bengali.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-bengali.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-braille.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-braille.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-devanagari.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-devanagari.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-euler.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-euler.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-gujarati.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-gujarati.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-indic.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-indic.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-kannada.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-kannada.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-malayalam.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-malayalam.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-tamil.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-tamil.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkxl/type-imp-telugu.mkxl (renamed from Master/texmf-dist/tex/context/base/mkxl/type-imp-telugu.mkxl)0
-rw-r--r--Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv7
-rw-r--r--Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex15
-rw-r--r--Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua4
-rw-r--r--Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv7
-rw-r--r--Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua17
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex2
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl40
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl112
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl90
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl72
-rw-r--r--Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua38
-rw-r--r--Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua70
-rw-r--r--Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua12
-rw-r--r--Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex10
-rw-r--r--Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex10
-rw-r--r--Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex10
-rw-r--r--Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc212
-rwxr-xr-xMaster/tlpkg/bin/tl-update-lmtx-bin46
-rw-r--r--Master/tlpkg/doc/releng.txt28
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds128
-rw-r--r--Master/tlpkg/tlpsrc/context.tlpsrc1
503 files changed, 17508 insertions, 33813 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/context b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/context
deleted file mode 100755
index fa62ba8d109..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/context
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --script context "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/contextjit b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/contextjit
deleted file mode 100755
index 5ac1947c78e..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/contextjit
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-luajittex --luaonly $(dirname $0)/mtxrun --script context "$@"
-
-# luajittex --luaonly ${0%contextjit}mtxrun --script context "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/ctxtools b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/ctxtools
deleted file mode 100755
index 2e6bd4afaa0..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/ctxtools
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --script ctxtools "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/luatools b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/luatools
deleted file mode 100755
index c17b483be53..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/luatools
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --script base "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrun b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrun
deleted file mode 100755
index 6fc17adb022..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrun
+++ /dev/null
@@ -1,27376 +0,0 @@
-#!/usr/bin/env texlua
-
-if not modules then modules = { } end modules ['mtxrun'] = {
- version = 1.001,
- comment = "runner, lua replacement for texmfstart.rb",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
--- one can make a stub:
-
--- mtxrun :
---
--- #!/bin/sh
--- env LUATEXDIR=/....../texmf/scripts/context/lua luatex --luaonly mtxrun.lua "$@"
-
--- mtxrun.cmd :
---
--- @luatex --luaonly %~d0%~p0mtxrun.lua %*
-
--- filename : mtxrun.lua
--- comment : companion to context.tex
--- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
--- copyright: PRAGMA ADE / ConTeXt Development Team
--- license : see context related readme files
-
--- This script is based on texmfstart.rb but does not use kpsewhich to locate files.
--- Although kpse is a library it never came to opening up its interface to other
--- programs (esp scripting languages) and so we do it ourselves. The lua variant
--- evolved out of an experimental ruby one. Interesting is that using a scripting
--- language instead of c does not have a speed penalty. Actually the lua variant is
--- more efficient, especially when multiple calls to kpsewhich are involved. The lua
--- library also gives way more control.
-
--- When libraries used here are updates you can run
---
--- mtxrun --selfmerge
---
--- to update the embedded code. After that you might need to run
---
--- mtxrun --selfupdate
---
--- to copy the new script (from scripts/context/lua) to location where
--- binaries are expected. If you want to remove the embedded code you can run
---
--- mtxxun --selfclean
-
--- to be done / considered
---
--- support for --exec or make it default
--- support for jar files (or maybe not, never used, too messy)
--- support for $RUBYINPUTS cum suis (if still needed)
--- remember for subruns: _CTX_K_V_#{original}_
--- remember for subruns: _CTX_K_S_#{original}_
--- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb]
-
--- begin library merge
-
-
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-bit32"] = package.loaded["l-bit32"] or true
-
--- original size: 3607, stripped down to: 3009
-
-if not modules then modules={} end modules ['l-bit32']={
- version=1.001,
- license="the same as regular Lua",
- source="bitwise.lua, v 1.24 2014/12/26 17:20:53 roberto",
- comment="drop-in for bit32, adapted a bit by Hans Hagen",
-}
-if bit32 then
-elseif utf8 then
- load ([[
-local select = select -- instead of: arg = { ... }
-bit32 = {
- bnot = function (a)
- return ~a & 0xFFFFFFFF
- end,
- band = function (x, y, z, ...)
- if not z then
- return ((x or -1) & (y or -1)) & 0xFFFFFFFF
- else
- local res = x & y & z
- for i=1,select("#",...) do
- res = res & select(i,...)
- end
- return res & 0xFFFFFFFF
- end
- end,
- bor = function (x, y, z, ...)
- if not z then
- return ((x or 0) | (y or 0)) & 0xFFFFFFFF
- else
- local res = x | y | z
- for i=1,select("#",...) do
- res = res | select(i,...)
- end
- return res & 0xFFFFFFFF
- end
- end,
- bxor = function (x, y, z, ...)
- if not z then
- return ((x or 0) ~ (y or 0)) & 0xFFFFFFFF
- else
- local res = x ~ y ~ z
- for i=1,select("#",...) do
- res = res ~ select(i,...)
- end
- return res & 0xFFFFFFFF
- end
- end,
- btest = function (x, y, z, ...)
- if not z then
- return (((x or -1) & (y or -1)) & 0xFFFFFFFF) ~= 0
- else
- local res = x & y & z
- for i=1,select("#",...) do
- res = res & select(i,...)
- end
- return (res & 0xFFFFFFFF) ~= 0
- end
- end,
- lshift = function (a, b)
- return ((a & 0xFFFFFFFF) << b) & 0xFFFFFFFF
- end,
- rshift = function (a, b)
- return ((a & 0xFFFFFFFF) >> b) & 0xFFFFFFFF
- end,
- arshift = function (a, b)
- a = a & 0xFFFFFFFF
- if b <= 0 or (a & 0x80000000) == 0 then
- return (a >> b) & 0xFFFFFFFF
- else
- return ((a >> b) | ~(0xFFFFFFFF >> b)) & 0xFFFFFFFF
- end
- end,
- lrotate = function (a ,b)
- b = b & 31
- a = a & 0xFFFFFFFF
- a = (a << b) | (a >> (32 - b))
- return a & 0xFFFFFFFF
- end,
- rrotate = function (a, b)
- b = -b & 31
- a = a & 0xFFFFFFFF
- a = (a << b) | (a >> (32 - b))
- return a & 0xFFFFFFFF
- end,
- extract = function (a, f, w)
- return (a >> f) & ~(-1 << (w or 1))
- end,
- replace = function (a, v, f, w)
- local mask = ~(-1 << (w or 1))
- return ((a & ~(mask << f)) | ((v & mask) << f)) & 0xFFFFFFFF
- end,
-}
- ]] ) ()
-elseif bit then
- load ([[
-local band, bnot, rshift, lshift = bit.band, bit.bnot, bit.rshift, bit.lshift
-bit32 = {
- arshift = bit.arshift,
- band = band,
- bnot = bnot,
- bor = bit.bor,
- bxor = bit.bxor,
- btest = function(...)
- return band(...) ~= 0
- end,
- extract = function(a,f,w)
- return band(rshift(a,f),2^(w or 1)-1)
- end,
- lrotate = bit.rol,
- lshift = lshift,
- replace = function(a,v,f,w)
- local mask = 2^(w or 1)-1
- return band(a,bnot(lshift(mask,f)))+lshift(band(v,mask),f)
- end,
- rrotate = bit.ror,
- rshift = rshift,
-}
- ]] ) ()
-else
- xpcall(function() local _,t=require("bit32") if t then bit32=t end return end,function() end)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-lua"] = package.loaded["l-lua"] or true
-
--- original size: 6405, stripped down to: 2865
-
-if not modules then modules={} end modules ['l-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 next,type,tonumber=next,type,tonumber
-LUAMAJORVERSION,LUAMINORVERSION=string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
-LUAMAJORVERSION=tonumber(LUAMAJORVERSION) or 5
-LUAMINORVERSION=tonumber(LUAMINORVERSION) or 1
-LUAVERSION=LUAMAJORVERSION+LUAMINORVERSION/10
-if LUAVERSION<5.2 and jit then
- MINORVERSION=2
- LUAVERSION=5.2
-end
-if not lpeg then
- lpeg=require("lpeg")
-end
-if loadstring then
- local loadnormal=load
- function load(first,...)
- if type(first)=="string" then
- return loadstring(first,...)
- else
- return loadnormal(first,...)
- end
- end
-else
- loadstring=load
-end
-if not ipairs then
- local function iterate(a,i)
- i=i+1
- local v=a[i]
- if v~=nil then
- return i,v
- end
- end
- function ipairs(a)
- return iterate,a,0
- end
-end
-if not pairs then
- function pairs(t)
- return next,t
- end
-end
-if not table.unpack then
- table.unpack=_G.unpack
-elseif not unpack then
- _G.unpack=table.unpack
-end
-if not package.loaders then
- package.loaders=package.searchers
-end
-local print,select,tostring=print,select,tostring
-local inspectors={}
-function setinspector(kind,inspector)
- inspectors[kind]=inspector
-end
-function inspect(...)
- for s=1,select("#",...) do
- local value=select(s,...)
- if value==nil then
- print("nil")
- else
- local done=false
- local kind=type(value)
- local inspector=inspectors[kind]
- if inspector then
- done=inspector(value)
- if done then
- break
- end
- end
- for kind,inspector in next,inspectors do
- done=inspector(value)
- if done then
- break
- end
- end
- if not done then
- print(tostring(value))
- end
- end
- end
-end
-local dummy=function() end
-function optionalrequire(...)
- local ok,result=xpcall(require,dummy,...)
- if ok then
- return result
- end
-end
-local flush=io.flush
-if flush then
- local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
- local exec=os.exec if exec then function os.exec (...) flush() return exec (...) end end
- local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end
- local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end
-end
-FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load
-if not FFISUPPORTED then
- local okay;okay,ffi=pcall(require,"ffi")
- FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load
-end
-if not FFISUPPORTED then
- ffi=nil
-elseif not ffi.number then
- ffi.number=tonumber
-end
-if LUAVERSION>5.3 then
-end
-if status and os.setenv then
- os.setenv("engine",string.lower(status.luatex_engine or "unknown"))
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-macro"] = package.loaded["l-macro"] or true
-
--- original size: 10130, stripped down to: 5990
-
-if not modules then modules={} end modules ['l-macros']={
- 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 S,P,R,V,C,Cs,Cc,Ct,Carg=lpeg.S,lpeg.P,lpeg.R,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg
-local lpegmatch=lpeg.match
-local concat=table.concat
-local format,sub,match=string.format,string.sub,string.match
-local next,load,type=next,load,type
-local newline=S("\n\r")^1
-local continue=P("\\")*newline
-local whitespace=S(" \t\n\r")
-local spaces=S(" \t")+continue
-local nametoken=R("az","AZ","__","09")
-local name=nametoken^1
-local body=((continue/""+1)-newline)^1
-local lparent=P("(")
-local rparent=P(")")
-local noparent=1-(lparent+rparent)
-local nested=P { lparent*(noparent+V(1))^0*rparent }
-local escaped=P("\\")*P(1)
-local squote=P("'")
-local dquote=P('"')
-local quoted=dquote*(escaped+(1-dquote))^0*dquote+squote*(escaped+(1-squote))^0*squote
-local arguments=lparent*Ct((Cs((nested+(quoted+1-S("),")))^1)+S(", "))^0)*rparent
-local macros=lua.macros or {}
-lua.macros=macros
-local patterns={}
-local definitions={}
-local resolve
-local subparser
-local report_lua=function(...)
- if logs and logs.reporter then
- report_lua=logs.reporter("system","lua")
- report_lua(...)
- else
- print(format(...))
- end
-end
-local safeguard=P("local")*whitespace^1*name*(whitespace+P("="))
-resolve=safeguard+C(C(name)*(arguments^-1))/function(raw,s,a)
- local d=definitions[s]
- if d then
- if a then
- local n=#a
- local p=patterns[s][n]
- if p then
- local d=d[n]
- for i=1,n do
- a[i]=lpegmatch(subparser,a[i]) or a[i]
- end
- return lpegmatch(p,d,1,a) or d
- else
- return raw
- end
- else
- return d[0] or raw
- end
- elseif a then
- for i=1,#a do
- a[i]=lpegmatch(subparser,a[i]) or a[i]
- end
- return s.."("..concat(a,",")..")"
- else
- return raw
- end
-end
-subparser=Cs((resolve+P(1))^1)
-local enddefine=P("#enddefine")/""
-local beginregister=(C(name)*(arguments+Cc(false))*C((1-enddefine)^1)*enddefine)/function(k,a,v)
- local n=0
- if a then
- n=#a
- local pattern=P(false)
- for i=1,n do
- pattern=pattern+(P(a[i])*Carg(1))/function(t) return t[i] end
- end
- pattern=Cs((pattern+P(1))^1)
- local p=patterns[k]
- if not p then
- p={ [0]=false,false,false,false,false,false,false,false,false }
- patterns[k]=p
- end
- p[n]=pattern
- end
- local d=definitions[k]
- if not d then
- d={ a=a,[0]=false,false,false,false,false,false,false,false,false }
- definitions[k]=d
- end
- d[n]=lpegmatch(subparser,v) or v
- return ""
-end
-local register=(Cs(name)*(arguments+Cc(false))*spaces^0*Cs(body))/function(k,a,v)
- local n=0
- if a then
- n=#a
- local pattern=P(false)
- for i=1,n do
- pattern=pattern+(P(a[i])*Carg(1))/function(t) return t[i] end
- end
- pattern=Cs((pattern+P(1))^1)
- local p=patterns[k]
- if not p then
- p={ [0]=false,false,false,false,false,false,false,false,false }
- patterns[k]=p
- end
- p[n]=pattern
- end
- local d=definitions[k]
- if not d then
- d={ a=a,[0]=false,false,false,false,false,false,false,false,false }
- definitions[k]=d
- end
- d[n]=lpegmatch(subparser,v) or v
- return ""
-end
-local unregister=(C(name)*spaces^0*(arguments+Cc(false)))/function(k,a)
- local n=0
- if a then
- n=#a
- local p=patterns[k]
- if p then
- p[n]=false
- end
- end
- local d=definitions[k]
- if d then
- d[n]=false
- end
- return ""
-end
-local begindefine=(P("begindefine")*spaces^0/"")*beginregister
-local define=(P("define" )*spaces^0/"")*register
-local undefine=(P("undefine" )*spaces^0/"")*unregister
-local parser=Cs((((P("#")/"")*(define+begindefine+undefine)*(newline^0/"") )+resolve+P(1) )^0 )
-function macros.reset()
- definitions={}
- patterns={}
-end
-function macros.showdefinitions()
- for name,list in table.sortedhash(definitions) do
- local arguments=list.a
- if arguments then
- arguments="("..concat(arguments,",")..")"
- else
- arguments=""
- end
- print("macro: "..name..arguments)
- for i=0,#list do
- local l=list[i]
- if l then
- print(" "..l)
- end
- end
- end
-end
-function macros.resolvestring(str)
- return lpegmatch(parser,str) or str
-end
-function macros.resolving()
- return next(patterns)
-end
-local function reload(path,name,data)
- local only=match(name,".-([^/]+)%.lua")
- if only and only~="" then
- local name=path.."/"..only
- local f=io.open(name,"wb")
- f:write(data)
- f:close()
- local f=loadfile(name)
- os.remove(name)
- return f
- end
-end
-local function reload(path,name,data)
- if path and path~="" then
- local only=string.match(name,".-([^/]+)%.lua")
- if only and only~="" then
- local name=path.."/"..only.."-macro.lua"
- local f=io.open(name,"wb")
- if f then
- f:write(data)
- f:close()
- local l=loadfile(name)
- os.remove(name)
- return l
- end
- end
- end
- return load(data,name)
-end
-local function loaded(name,trace,detail)
- local f=io.open(name,"rb")
- if not f then
- return false,format("file '%s' not found",name)
- end
- local c=f:read("*a")
- if not c then
- return false,format("file '%s' is invalid",name)
- end
- f:close()
- local n=lpegmatch(parser,c)
- if trace then
- if #n~=#c then
- report_lua("macros expanded in '%s' (%i => %i bytes)",name,#c,#n)
- if detail then
- report_lua()
- report_lua(n)
- report_lua()
- end
- elseif detail then
- report_lua("no macros expanded in '%s'",name)
- end
- end
- return reload(lfs and lfs.currentdir(),name,n)
-end
-macros.loaded=loaded
-function required(name,trace)
- local filename=file.addsuffix(name,"lua")
- local fullname=resolvers and resolvers.findfile(filename) or filename
- if not fullname or fullname=="" then
- return false
- end
- local codeblob=package.loaded[fullname]
- if codeblob then
- return codeblob
- end
- local code,message=loaded(fullname,macros,trace,trace)
- if type(code)=="function" then
- code=code()
- else
- report_lua("error when loading '%s'",fullname)
- return false,message
- end
- if code==nil then
- code=false
- end
- package.loaded[fullname]=code
- return code
-end
-macros.required=required
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-sandbox"] = package.loaded["l-sandbox"] or true
-
--- original size: 9604, stripped down to: 6394
-
-if not modules then modules={} end modules ['l-sandbox']={
- 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 global=_G
-local next=next
-local unpack=unpack or table.unpack
-local type=type
-local tprint=texio and texio.write_nl or print
-local tostring=tostring
-local format=string.format
-local concat=table.concat
-local sort=table.sort
-local gmatch=string.gmatch
-local gsub=string.gsub
-local requiem=require
-sandbox={}
-local sandboxed=false
-local overloads={}
-local skiploads={}
-local initializers={}
-local finalizers={}
-local originals={}
-local comments={}
-local trace=false
-local logger=false
-local blocked={}
-local function report(...)
- tprint("sandbox ! "..format(...))
-end
-sandbox.report=report
-function sandbox.setreporter(r)
- report=r
- sandbox.report=r
-end
-function sandbox.settrace(v)
- trace=v
-end
-function sandbox.setlogger(l)
- logger=type(l)=="function" and l or false
-end
-local function register(func,overload,comment)
- if type(func)=="function" then
- if type(overload)=="string" then
- comment=overload
- overload=nil
- end
- local function f(...)
- if sandboxed then
- local overload=overloads[f]
- if overload then
- if logger then
- local result={ overload(func,...) }
- logger {
- comment=comments[f] or tostring(f),
- arguments={... },
- result=result[1] and true or false,
- }
- return unpack(result)
- else
- return overload(func,...)
- end
- else
- end
- else
- return func(...)
- end
- end
- if comment then
- comments[f]=comment
- if trace then
- report("registering function: %s",comment)
- end
- end
- overloads[f]=overload or false
- originals[f]=func
- return f
- end
-end
-local function redefine(func,comment)
- if type(func)=="function" then
- skiploads[func]=comment or comments[func] or "unknown"
- if overloads[func]==false then
- overloads[func]=nil
- end
- end
-end
-sandbox.register=register
-sandbox.redefine=redefine
-function sandbox.original(func)
- return originals and originals[func] or func
-end
-function sandbox.overload(func,overload,comment)
- comment=comment or comments[func] or "?"
- if type(func)~="function" then
- if trace then
- report("overloading unknown function: %s",comment)
- end
- elseif type(overload)~="function" then
- if trace then
- report("overloading function with bad overload: %s",comment)
- end
- elseif overloads[func]==nil then
- if trace then
- report("function is not registered: %s",comment)
- end
- elseif skiploads[func] then
- if trace then
- report("function is not skipped: %s",comment)
- end
- else
- if trace then
- report("overloading function: %s",comment)
- end
- overloads[func]=overload
- end
- return func
-end
-local function whatever(specification,what,target)
- if type(specification)~="table" then
- report("%s needs a specification",what)
- elseif type(specification.category)~="string" or type(specification.action)~="function" then
- report("%s needs a category and action",what)
- elseif not sandboxed then
- target[#target+1]=specification
- elseif trace then
- report("already enabled, discarding %s",what)
- end
-end
-function sandbox.initializer(specification)
- whatever(specification,"initializer",initializers)
-end
-function sandbox.finalizer(specification)
- whatever(specification,"finalizer",finalizers)
-end
-function require(name)
- local n=gsub(name,"^.*[\\/]","")
- local n=gsub(n,"[%.].*$","")
- local b=blocked[n]
- if b==false then
- return nil
- elseif b then
- if trace then
- report("using blocked: %s",n)
- end
- return b
- else
- if trace then
- report("requiring: %s",name)
- end
- return requiem(name)
- end
-end
-function blockrequire(name,lib)
- if trace then
- report("preventing reload of: %s",name)
- end
- blocked[name]=lib or _G[name] or false
-end
-function sandbox.enable()
- if not sandboxed then
- debug={
- traceback=debug.traceback,
- }
- for i=1,#initializers do
- initializers[i].action()
- end
- for i=1,#finalizers do
- finalizers[i].action()
- end
- local nnot=0
- local nyes=0
- local cnot={}
- local cyes={}
- local skip={}
- for k,v in next,overloads do
- local c=comments[k]
- if v then
- if c then
- cyes[#cyes+1]=c
- else
- nyes=nyes+1
- end
- else
- if c then
- cnot[#cnot+1]=c
- else
- nnot=nnot+1
- end
- end
- end
- for k,v in next,skiploads do
- skip[#skip+1]=v
- end
- if #cyes>0 then
- sort(cyes)
- report("overloaded known: %s",concat(cyes," | "))
- end
- if nyes>0 then
- report("overloaded unknown: %s",nyes)
- end
- if #cnot>0 then
- sort(cnot)
- report("not overloaded known: %s",concat(cnot," | "))
- end
- if nnot>0 then
- report("not overloaded unknown: %s",nnot)
- end
- if #skip>0 then
- sort(skip)
- report("not overloaded redefined: %s",concat(skip," | "))
- end
- initializers=nil
- finalizers=nil
- originals=nil
- sandboxed=true
- end
-end
-blockrequire("lfs",lfs)
-blockrequire("io",io)
-blockrequire("os",os)
-blockrequire("ffi",ffi)
-local function supported(library)
- local l=_G[library]
- return l
-end
-loadfile=register(loadfile,"loadfile")
-if supported("lua") then
- lua.openfile=register(lua.openfile,"lua.openfile")
-end
-if supported("io") then
- io.open=register(io.open,"io.open")
- io.popen=register(io.popen,"io.popen")
- io.lines=register(io.lines,"io.lines")
- io.output=register(io.output,"io.output")
- io.input=register(io.input,"io.input")
-end
-if supported("os") then
- os.execute=register(os.execute,"os.execute")
- os.spawn=register(os.spawn,"os.spawn")
- os.exec=register(os.exec,"os.exec")
- os.rename=register(os.rename,"os.rename")
- os.remove=register(os.remove,"os.remove")
-end
-if supported("lfs") then
- lfs.chdir=register(lfs.chdir,"lfs.chdir")
- lfs.mkdir=register(lfs.mkdir,"lfs.mkdir")
- lfs.rmdir=register(lfs.rmdir,"lfs.rmdir")
- lfs.isfile=register(lfs.isfile,"lfs.isfile")
- lfs.isdir=register(lfs.isdir,"lfs.isdir")
- lfs.attributes=register(lfs.attributes,"lfs.attributes")
- lfs.dir=register(lfs.dir,"lfs.dir")
- lfs.lock_dir=register(lfs.lock_dir,"lfs.lock_dir")
- lfs.touch=register(lfs.touch,"lfs.touch")
- lfs.link=register(lfs.link,"lfs.link")
- lfs.setmode=register(lfs.setmode,"lfs.setmode")
- lfs.readlink=register(lfs.readlink,"lfs.readlink")
- lfs.shortname=register(lfs.shortname,"lfs.shortname")
- lfs.symlinkattributes=register(lfs.symlinkattributes,"lfs.symlinkattributes")
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-package"] = package.loaded["l-package"] or true
-
--- original size: 12566, stripped down to: 8937
-
-if not modules then modules={} end modules ['l-package']={
- 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,unpack=type,unpack
-local gsub,format,find=string.gsub,string.format,string.find
-local insert,remove=table.insert,table.remove
-local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
-local package=package
-local searchers=package.searchers or package.loaders
-local filejoin=file and file.join or function(path,name) return path.."/"..name end
-local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end
-local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end
-local function cleanpath(path)
- return path
-end
-local pattern=Cs((((1-S("\\/"))^0*(S("\\/")^1/"/"))^0*(P(".")^1/"/"+P(1))^1)*-1)
-local function lualibfile(name)
- return lpegmatch(pattern,name) or name
-end
-local offset=luarocks and 1 or 0
-local helpers=package.helpers or {
- cleanpath=cleanpath,
- lualibfile=lualibfile,
- trace=false,
- report=function(...) print(format(...)) end,
- builtin={
- ["preload table"]=searchers[1+offset],
- ["path specification"]=searchers[2+offset],
- ["cpath specification"]=searchers[3+offset],
- ["all in one fallback"]=searchers[4+offset],
- },
- methods={},
- sequence={
- "reset loaded",
- "already loaded",
- "preload table",
- "qualified path",
- "lua extra list",
- "lib extra list",
- "path specification",
- "cpath specification",
- "all in one fallback",
- "not loaded",
- }
-}
-package.helpers=helpers
-local methods=helpers.methods
-local builtin=helpers.builtin
-local extraluapaths={}
-local extralibpaths={}
-local checkedfiles={}
-local luapaths=nil
-local libpaths=nil
-local oldluapath=nil
-local oldlibpath=nil
-local nofextralua=-1
-local nofextralib=-1
-local nofpathlua=-1
-local nofpathlib=-1
-local function listpaths(what,paths)
- local nofpaths=#paths
- if nofpaths>0 then
- for i=1,nofpaths do
- helpers.report("using %s path %i: %s",what,i,paths[i])
- end
- else
- helpers.report("no %s paths defined",what)
- end
- return nofpaths
-end
-local function getextraluapaths()
- if helpers.trace and #extraluapaths~=nofextralua then
- nofextralua=listpaths("extra lua",extraluapaths)
- end
- return extraluapaths
-end
-local function getextralibpaths()
- if helpers.trace and #extralibpaths~=nofextralib then
- nofextralib=listpaths("extra lib",extralibpaths)
- end
- return extralibpaths
-end
-local function getluapaths()
- local luapath=package.path or ""
- if oldluapath~=luapath then
- luapaths=file.splitpath(luapath,";")
- oldluapath=luapath
- nofpathlua=-1
- end
- if helpers.trace and #luapaths~=nofpathlua then
- nofpathlua=listpaths("builtin lua",luapaths)
- end
- return luapaths
-end
-local function getlibpaths()
- local libpath=package.cpath or ""
- if oldlibpath~=libpath then
- libpaths=file.splitpath(libpath,";")
- oldlibpath=libpath
- nofpathlib=-1
- end
- if helpers.trace and #libpaths~=nofpathlib then
- nofpathlib=listpaths("builtin lib",libpaths)
- end
- return libpaths
-end
-package.luapaths=getluapaths
-package.libpaths=getlibpaths
-package.extraluapaths=getextraluapaths
-package.extralibpaths=getextralibpaths
-local hashes={
- lua={},
- lib={},
-}
-local function registerpath(tag,what,target,...)
- local pathlist={... }
- local cleanpath=helpers.cleanpath
- local trace=helpers.trace
- local report=helpers.report
- local hash=hashes[what]
- local function add(path)
- local path=cleanpath(path)
- if not hash[path] then
- target[#target+1]=path
- hash[path]=true
- if trace then
- report("registered %s path %s: %s",tag,#target,path)
- end
- else
- if trace then
- report("duplicate %s path: %s",tag,path)
- end
- end
- end
- for p=1,#pathlist do
- local path=pathlist[p]
- if type(path)=="table" then
- for i=1,#path do
- add(path[i])
- end
- else
- add(path)
- end
- end
-end
-local function pushpath(tag,what,target,path)
- local path=helpers.cleanpath(path)
- insert(target,1,path)
- if helpers.trace then
- helpers.report("pushing %s path in front: %s",tag,path)
- end
-end
-local function poppath(tag,what,target)
- local path=remove(target,1)
- if helpers.trace then
- if path then
- helpers.report("popping %s path from front: %s",tag,path)
- else
- helpers.report("no %s path to pop",tag)
- end
- end
-end
-helpers.registerpath=registerpath
-function package.extraluapath(...)
- registerpath("extra lua","lua",extraluapaths,...)
-end
-function package.pushluapath(path)
- pushpath("extra lua","lua",extraluapaths,path)
-end
-function package.popluapath()
- poppath("extra lua","lua",extraluapaths)
-end
-function package.extralibpath(...)
- registerpath("extra lib","lib",extralibpaths,...)
-end
-function package.pushlibpath(path)
- pushpath("extra lib","lib",extralibpaths,path)
-end
-function package.poplibpath()
- poppath("extra lib","lua",extralibpaths)
-end
-local function loadedaslib(resolved,rawname)
- local base=gsub(rawname,"%.","_")
- local init="luaopen_"..gsub(base,"%.","_")
- local data={ resolved,init,"" }
- checkedfiles[#checkedfiles+1]=data
- if helpers.trace then
- helpers.report("calling loadlib with '%s' with init '%s'",resolved,init)
- end
- local a,b,c=package.loadlib(resolved,init)
- if not a and type(b)=="string" then
- data[3]=string.fullstrip(b or "unknown error")
- end
- return a,b,c
-end
-helpers.loadedaslib=loadedaslib
-local function loadedbypath(name,rawname,paths,islib,what)
- local trace=helpers.trace
- for p=1,#paths do
- local path=paths[p]
- local resolved=filejoin(path,name)
- if trace then
- helpers.report("%s path, identifying '%s' on '%s'",what,name,path)
- end
- if isreadable(resolved) then
- if trace then
- helpers.report("%s path, '%s' found on '%s'",what,name,resolved)
- end
- if islib then
- return loadedaslib(resolved,rawname)
- else
- return loadfile(resolved)
- end
- end
- end
-end
-helpers.loadedbypath=loadedbypath
-local function loadedbyname(name,rawname)
- if find(name,"^/") or find(name,"^[a-zA-Z]:/") then
- local trace=helpers.trace
- if trace then
- helpers.report("qualified name, identifying '%s'",what,name)
- end
- if isreadable(name) then
- if trace then
- helpers.report("qualified name, '%s' found",what,name)
- end
- return loadfile(name)
- end
- end
-end
-helpers.loadedbyname=loadedbyname
-methods["reset loaded"]=function(name)
- checkedfiles={}
- return false
-end
-methods["already loaded"]=function(name)
- return package.loaded[name]
-end
-methods["preload table"]=function(name)
- local f=builtin["preload table"]
- if f then
- return f(name)
- end
-end
-methods["qualified path"]=function(name)
- return loadedbyname(addsuffix(lualibfile(name),"lua"),name)
-end
-methods["lua extra list"]=function(name)
- return loadedbypath(addsuffix(lualibfile(name),"lua"),name,getextraluapaths(),false,"lua")
-end
-methods["lib extra list"]=function(name)
- return loadedbypath(addsuffix(lualibfile(name),os.libsuffix),name,getextralibpaths(),true,"lib")
-end
-methods["path specification"]=function(name)
- local f=builtin["path specification"]
- if f then
- getluapaths()
- return f(name)
- end
-end
-methods["cpath specification"]=function(name)
- local f=builtin["cpath specification"]
- if f then
- getlibpaths()
- return f(name)
- end
-end
-methods["all in one fallback"]=function(name)
- local f=builtin["all in one fallback"]
- if f then
- return f(name)
- end
-end
-methods["not loaded"]=function(name)
- if helpers.trace then
- helpers.report("unable to locate '%s'",name or "?")
- for i=1,#checkedfiles do
- helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i]))
- end
- end
- return nil
-end
-local level=0
-local used={}
-helpers.traceused=false
-function helpers.loaded(name)
- local sequence=helpers.sequence
- level=level+1
- for i=1,#sequence do
- local method=sequence[i]
- local lookup=method and methods[method]
- if type(lookup)=="function" then
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
- end
- local result,rest=lookup(name)
- if type(result)=="function" then
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
- end
- if helpers.traceused then
- used[#used+1]={ level=level,name=name }
- end
- level=level-1
- return result,rest
- end
- end
- end
- level=level-1
- return nil
-end
-function helpers.showused()
- local n=#used
- if n>0 then
- helpers.report("%s libraries loaded:",n)
- helpers.report()
- for i=1,n do
- local u=used[i]
- helpers.report("%i %a",u.level,u.name)
- end
- helpers.report()
- end
-end
-function helpers.unload(name)
- if helpers.trace then
- if package.loaded[name] then
- helpers.report("unloading, name '%s', %s",name,"done")
- else
- helpers.report("unloading, name '%s', %s",name,"not loaded")
- end
- end
- package.loaded[name]=nil
-end
-table.insert(searchers,1,helpers.loaded)
-if context then
- package.path=""
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
-
--- original size: 38703, stripped down to: 19489
-
-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"
-}
-lpeg=require("lpeg")
-local lpeg=lpeg
-if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end
-local type,next,tostring=type,next,tostring
-local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format
-local floor=math.floor
-local P,R,S,V,Ct,C,Cs,Cc,Cp,Cmt=lpeg.P,lpeg.R,lpeg.S,lpeg.V,lpeg.Ct,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Cp,lpeg.Cmt
-local lpegtype,lpegmatch,lpegprint=lpeg.type,lpeg.match,lpeg.print
-if setinspector then
- setinspector("lpeg",function(v) if lpegtype(v) then lpegprint(v) return true end end)
-end
-lpeg.patterns=lpeg.patterns or {}
-local patterns=lpeg.patterns
-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 sign=S('+-')
-local zero=P('0')
-local digit=R('09')
-local digits=digit^1
-local octdigit=R("07")
-local octdigits=octdigit^1
-local lowercase=R("az")
-local uppercase=R("AZ")
-local underscore=P("_")
-local hexdigit=digit+lowercase+uppercase
-local hexdigits=hexdigit^1
-local cr,lf,crlf=P("\r"),P("\n"),P("\r\n")
-local newline=P("\r")*(P("\n")+P(true))+P("\n")
-local escaped=P("\\")*anything
-local squote=P("'")
-local dquote=P('"')
-local space=P(" ")
-local period=P(".")
-local comma=P(",")
-local utfbom_32_be=P('\000\000\254\255')
-local utfbom_32_le=P('\255\254\000\000')
-local utfbom_16_be=P('\254\255')
-local utfbom_16_le=P('\255\254')
-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*Cc("utf-32-be")+utfbom_32_le*Cc("utf-32-le")+utfbom_16_be*Cc("utf-16-be")+utfbom_16_le*Cc("utf-16-le")+utfbom_8*Cc("utf-8")+alwaysmatched*Cc("utf-8")
-local utfstricttype=utfbom_32_be*Cc("utf-32-be")+utfbom_32_le*Cc("utf-32-le")+utfbom_16_be*Cc("utf-16-be")+utfbom_16_le*Cc("utf-16-le")+utfbom_8*Cc("utf-8")
-local utfoffset=utfbom_32_be*Cc(4)+utfbom_32_le*Cc(4)+utfbom_16_be*Cc(2)+utfbom_16_le*Cc(2)+utfbom_8*Cc(3)+Cc(0)
-local utf8next=R("\128\191")
-patterns.utfbom_32_be=utfbom_32_be
-patterns.utfbom_32_le=utfbom_32_le
-patterns.utfbom_16_be=utfbom_16_be
-patterns.utfbom_16_le=utfbom_16_le
-patterns.utfbom_8=utfbom_8
-patterns.utf_16_be_nl=P("\000\r\000\n")+P("\000\r")+P("\000\n")
-patterns.utf_16_le_nl=P("\r\000\n\000")+P("\r\000")+P("\n\000")
-patterns.utf_32_be_nl=P("\000\000\000\r\000\000\000\n")+P("\000\000\000\r")+P("\000\000\000\n")
-patterns.utf_32_le_nl=P("\r\000\000\000\n\000\000\000")+P("\r\000\000\000")+P("\n\000\000\000")
-patterns.utf8one=R("\000\127")
-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
-patterns.utfstricttype=utfstricttype
-patterns.utfoffset=utfoffset
-local utf8char=patterns.utf8one+patterns.utf8two+patterns.utf8three+patterns.utf8four
-local validutf8char=utf8char^0*endofstring*Cc(true)+Cc(false)
-local utf8character=P(1)*R("\128\191")^0
-patterns.utf8=utf8char
-patterns.utf8char=utf8char
-patterns.utf8character=utf8character
-patterns.validutf8=validutf8char
-patterns.validutf8char=validutf8char
-local eol=S("\n\r")
-local spacer=S(" \t\f\v")
-local whitespace=eol+spacer
-local nonspacer=1-spacer
-local nonwhitespace=1-whitespace
-patterns.eol=eol
-patterns.spacer=spacer
-patterns.whitespace=whitespace
-patterns.nonspacer=nonspacer
-patterns.nonwhitespace=nonwhitespace
-local stripper=spacer^0*C((spacer^0*nonspacer^1)^0)
-local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0)
-local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0))
-local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0)
-local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0)
-local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0)
-local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
-local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0)
-local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0)
-local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0)
-local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
-local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0)
-patterns.stripper=stripper
-patterns.fullstripper=fullstripper
-patterns.collapser=collapser
-patterns.nospacer=nospacer
-patterns.b_collapser=b_collapser
-patterns.m_collapser=m_collapser
-patterns.e_collapser=e_collapser
-patterns.x_collapser=x_collapser
-patterns.b_stripper=b_stripper
-patterns.m_stripper=m_stripper
-patterns.e_stripper=e_stripper
-patterns.x_stripper=x_stripper
-patterns.lowercase=lowercase
-patterns.uppercase=uppercase
-patterns.letter=patterns.lowercase+patterns.uppercase
-patterns.space=space
-patterns.tab=P("\t")
-patterns.spaceortab=patterns.space+patterns.tab
-patterns.newline=newline
-patterns.emptyline=newline^1
-patterns.equal=P("=")
-patterns.comma=comma
-patterns.commaspacer=comma*spacer^0
-patterns.period=period
-patterns.colon=P(":")
-patterns.semicolon=P(";")
-patterns.underscore=underscore
-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
-patterns.unspacer=((patterns.spacer^1)/"")^0
-patterns.singlequoted=squote*patterns.nosquote*squote
-patterns.doublequoted=dquote*patterns.nodquote*dquote
-patterns.quoted=patterns.doublequoted+patterns.singlequoted
-patterns.digit=digit
-patterns.digits=digits
-patterns.octdigit=octdigit
-patterns.octdigits=octdigits
-patterns.hexdigit=hexdigit
-patterns.hexdigits=hexdigits
-patterns.sign=sign
-patterns.cardinal=digits
-patterns.integer=sign^-1*digits
-patterns.unsigned=digit^0*period*digits
-patterns.float=sign^-1*patterns.unsigned
-patterns.cunsigned=digit^0*comma*digits
-patterns.cpunsigned=digit^0*(period+comma)*digits
-patterns.cfloat=sign^-1*patterns.cunsigned
-patterns.cpfloat=sign^-1*patterns.cpunsigned
-patterns.number=patterns.float+patterns.integer
-patterns.cnumber=patterns.cfloat+patterns.integer
-patterns.cpnumber=patterns.cpfloat+patterns.integer
-patterns.oct=zero*octdigits
-patterns.octal=patterns.oct
-patterns.HEX=zero*P("X")*(digit+uppercase)^1
-patterns.hex=zero*P("x")*(digit+lowercase)^1
-patterns.hexadecimal=zero*S("xX")*hexdigits
-patterns.hexafloat=sign^-1*zero*S("xX")*(hexdigit^0*period*hexdigits+hexdigits*period*hexdigit^0+hexdigits)*(S("pP")*sign^-1*hexdigits)^-1
-patterns.decafloat=sign^-1*(digit^0*period*digits+digits*period*digit^0+digits)*S("eE")*sign^-1*digits
-patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring
-patterns.somecontent=(anything-newline-space)^1
-patterns.beginline=#(1-newline)
-patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(endofstring+Cc(" ")))^0))
-local function anywhere(pattern)
- return (1-P(pattern))^0*P(pattern)
-end
-lpeg.anywhere=anywhere
-function lpeg.instringchecker(p)
- p=anywhere(p)
- return function(str)
- return lpegmatch(p,str) and true or false
- end
-end
-function lpeg.splitter(pattern,action)
- if action then
- return (((1-P(pattern))^1)/action+1)^0
- else
- return (Cs((1-P(pattern))^1)+1)^0
- end
-end
-function lpeg.tsplitter(pattern,action)
- if action then
- return Ct((((1-P(pattern))^1)/action+1)^0)
- else
- return Ct((Cs((1-P(pattern))^1)+1)^0)
- end
-end
-local splitters_s,splitters_m,splitters_t={},{},{}
-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 any=anything
- splitter=other*(separator*C(any^0)+"")
- splitters_s[separator]=splitter
- else
- splitter=other*(separator*other)^0
- splitters_m[separator]=splitter
- end
- end
- return splitter
-end
-local function tsplitat(separator)
- local splitter=splitters_t[separator]
- if not splitter then
- splitter=Ct(splitat(separator))
- splitters_t[separator]=splitter
- end
- return splitter
-end
-lpeg.splitat=splitat
-lpeg.tsplitat=tsplitat
-function string.splitup(str,separator)
- if not separator then
- separator=","
- end
- return lpegmatch(splitters_m[separator] or splitat(separator),str)
-end
-local cache={}
-function lpeg.split(separator,str)
- local c=cache[separator]
- if not c then
- c=tsplitat(separator)
- cache[separator]=c
- end
- return lpegmatch(c,str)
-end
-function string.split(str,separator)
- if separator then
- local c=cache[separator]
- if not c then
- c=tsplitat(separator)
- cache[separator]=c
- end
- return lpegmatch(c,str)
- else
- return { str }
- end
-end
-local spacing=patterns.spacer^0*newline
-local empty=spacing*Cc("")
-local nonempty=Cs((1-spacing)^1)*spacing^-1
-local content=(empty+nonempty)^1
-patterns.textline=content
-local linesplitter=tsplitat(newline)
-patterns.linesplitter=linesplitter
-function string.splitlines(str)
- return lpegmatch(linesplitter,str)
-end
-local cache={}
-function lpeg.checkedsplit(separator,str)
- local c=cache[separator]
- if not c then
- separator=P(separator)
- local other=C((1-separator)^1)
- c=Ct(separator^0*other*(separator^1*other)^0)
- cache[separator]=c
- end
- return lpegmatch(c,str)
-end
-function string.checkedsplit(str,separator)
- local c=cache[separator]
- if not c then
- separator=P(separator)
- local other=C((1-separator)^1)
- c=Ct(separator^0*other*(separator^1*other)^0)
- cache[separator]=c
- end
- return lpegmatch(c,str)
-end
-local function f2(s) local c1,c2=byte(s,1,2) return c1*64+c2-12416 end
-local function f3(s) local c1,c2,c3=byte(s,1,3) return (c1*64+c2)*64+c3-925824 end
-local function f4(s) local c1,c2,c3,c4=byte(s,1,4) return ((c1*64+c2)*64+c3)*64+c4-63447168 end
-local utf8byte=patterns.utf8one/byte+patterns.utf8two/f2+patterns.utf8three/f3+patterns.utf8four/f4
-patterns.utf8byte=utf8byte
-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)
- return (P(str)+P(true))*Cs(anything^0)
-end
-function lpeg.endstripper(str)
- return Cs((1-P(str)*endofstring)^0)
-end
-function lpeg.replacer(one,two,makefunction,isutf)
- local pattern
- local u=isutf and utf8char or 1
- if type(one)=="table" then
- local no=#one
- local p=P(false)
- if no==0 then
- for k,v in next,one do
- p=p+P(k)/v
- end
- pattern=Cs((p+u)^0)
- elseif no==1 then
- local o=one[1]
- one,two=P(o[1]),o[2]
- pattern=Cs((one/two+u)^0)
- else
- for i=1,no do
- local o=one[i]
- p=p+P(o[1])/o[2]
- end
- pattern=Cs((p+u)^0)
- end
- else
- pattern=Cs((P(one)/(two or "")+u)^0)
- end
- if makefunction then
- return function(str)
- return lpegmatch(pattern,str)
- end
- else
- return pattern
- end
-end
-function lpeg.finder(lst,makefunction,isutf)
- local pattern
- if type(lst)=="table" then
- pattern=P(false)
- if #lst==0 then
- for k,v in next,lst do
- pattern=pattern+P(k)
- end
- else
- for i=1,#lst do
- pattern=pattern+P(lst[i])
- end
- end
- else
- pattern=P(lst)
- end
- if isutf then
- pattern=((utf8char or 1)-pattern)^0*pattern
- else
- pattern=(1-pattern)^0*pattern
- end
- if makefunction then
- return function(str)
- return lpegmatch(pattern,str)
- end
- else
- return pattern
- end
-end
-local splitters_f,splitters_s={},{}
-function lpeg.firstofsplit(separator)
- local splitter=splitters_f[separator]
- if not splitter then
- local pattern=P(separator)
- splitter=C((1-pattern)^0)
- splitters_f[separator]=splitter
- end
- return splitter
-end
-function lpeg.secondofsplit(separator)
- local splitter=splitters_s[separator]
- if not splitter then
- local pattern=P(separator)
- splitter=(1-pattern)^0*pattern*C(anything^0)
- splitters_s[separator]=splitter
- end
- return splitter
-end
-local splitters_s,splitters_p={},{}
-function lpeg.beforesuffix(separator)
- local splitter=splitters_s[separator]
- if not splitter then
- local pattern=P(separator)
- splitter=C((1-pattern)^0)*pattern*endofstring
- splitters_s[separator]=splitter
- end
- return splitter
-end
-function lpeg.afterprefix(separator)
- local splitter=splitters_p[separator]
- if not splitter then
- local pattern=P(separator)
- splitter=pattern*C(anything^0)
- splitters_p[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
-function lpeg.counter(pattern,action)
- local n=0
- local pattern=(P(pattern)/function() n=n+1 end+anything)^0
- if action then
- return function(str) n=0;lpegmatch(pattern,str);action(n) end
- else
- return function(str) n=0;lpegmatch(pattern,str);return n end
- end
-end
-function lpeg.is_lpeg(p)
- return p and lpegtype(p)=="pattern"
-end
-function lpeg.oneof(list,...)
- if type(list)~="table" then
- list={ list,... }
- end
- local p=P(list[1])
- for l=2,#list do
- p=p+P(list[l])
- end
- return p
-end
-local sort=table.sort
-local function copyindexed(old)
- local new={}
- for i=1,#old do
- new[i]=old
- end
- return new
-end
-local function sortedkeys(tab)
- local keys,s={},0
- for key,_ in next,tab do
- s=s+1
- keys[s]=key
- end
- sort(keys)
- return keys
-end
-function lpeg.append(list,pp,delayed,checked)
- local p=pp
- if #list>0 then
- local keys=copyindexed(list)
- sort(keys)
- for i=#keys,1,-1 do
- local k=keys[i]
- if p then
- p=P(k)+p
- else
- p=P(k)
- end
- end
- elseif delayed then
- local keys=sortedkeys(list)
- if p then
- for i=1,#keys,1 do
- local k=keys[i]
- local v=list[k]
- p=P(k)/list+p
- end
- else
- for i=1,#keys do
- local k=keys[i]
- local v=list[k]
- if p then
- p=P(k)+p
- else
- p=P(k)
- end
- end
- if p then
- p=p/list
- end
- end
- elseif checked then
- local keys=sortedkeys(list)
- for i=1,#keys do
- local k=keys[i]
- local v=list[k]
- if p then
- if k==v then
- p=P(k)+p
- else
- p=P(k)/v+p
- end
- else
- if k==v then
- p=P(k)
- else
- p=P(k)/v
- end
- end
- end
- else
- local keys=sortedkeys(list)
- for i=1,#keys do
- local k=keys[i]
- local v=list[k]
- if p then
- p=P(k)/v+p
- else
- p=P(k)/v
- end
- end
- end
- return p
-end
-local p_false=P(false)
-local p_true=P(true)
-local lower=utf and utf.lower or string.lower
-local upper=utf and utf.upper or string.upper
-function lpeg.setutfcasers(l,u)
- lower=l or lower
- upper=u or upper
-end
-local function make1(t,rest)
- local p=p_false
- local keys=sortedkeys(t)
- for i=1,#keys do
- local k=keys[i]
- if k~="" then
- local v=t[k]
- if v==true then
- p=p+P(k)*p_true
- elseif v==false then
- else
- p=p+P(k)*make1(v,v[""])
- end
- end
- end
- if rest then
- p=p+p_true
- end
- return p
-end
-local function make2(t,rest)
- local p=p_false
- local keys=sortedkeys(t)
- for i=1,#keys do
- local k=keys[i]
- if k~="" then
- local v=t[k]
- if v==true then
- p=p+(P(lower(k))+P(upper(k)))*p_true
- elseif v==false then
- else
- p=p+(P(lower(k))+P(upper(k)))*make2(v,v[""])
- end
- end
- end
- if rest then
- p=p+p_true
- end
- return p
-end
-local function utfchartabletopattern(list,insensitive)
- local tree={}
- local n=#list
- if n==0 then
- for s in next,list do
- local t=tree
- local p,pk
- for c in gmatch(s,".") do
- if t==true then
- t={ [c]=true,[""]=true }
- p[pk]=t
- p=t
- t=false
- elseif t==false then
- t={ [c]=false }
- p[pk]=t
- p=t
- t=false
- else
- local tc=t[c]
- if not tc then
- tc=false
- t[c]=false
- end
- p=t
- t=tc
- end
- pk=c
- end
- if t==false then
- p[pk]=true
- elseif t==true then
- else
- t[""]=true
- end
- end
- else
- for i=1,n do
- local s=list[i]
- local t=tree
- local p,pk
- for c in gmatch(s,".") do
- if t==true then
- t={ [c]=true,[""]=true }
- p[pk]=t
- p=t
- t=false
- elseif t==false then
- t={ [c]=false }
- p[pk]=t
- p=t
- t=false
- else
- local tc=t[c]
- if not tc then
- tc=false
- t[c]=false
- end
- p=t
- t=tc
- end
- pk=c
- end
- if t==false then
- p[pk]=true
- elseif t==true then
- else
- t[""]=true
- end
- end
- end
- return (insensitive and make2 or make1)(tree)
-end
-lpeg.utfchartabletopattern=utfchartabletopattern
-function lpeg.utfreplacer(list,insensitive)
- local pattern=Cs((utfchartabletopattern(list,insensitive)/list+utf8character)^0)
- return function(str)
- return lpegmatch(pattern,str) or str
- end
-end
-patterns.containseol=lpeg.finder(eol)
-local function nextstep(n,step,result)
- local m=n%step
- local d=floor(n/step)
- if d>0 then
- local v=V(tostring(step))
- local s=result.start
- for i=1,d do
- if s then
- s=v*s
- else
- s=v
- end
- end
- result.start=s
- end
- if step>1 and result.start then
- local v=V(tostring(step/2))
- result[tostring(step)]=v*v
- end
- if step>0 then
- return nextstep(m,step/2,result)
- else
- return result
- end
-end
-function lpeg.times(pattern,n)
- return P(nextstep(n,2^16,{ "start",["1"]=pattern }))
-end
-do
- local trailingzeros=zero^0*-digit
- local stripper=Cs((
- digits*(
- period*trailingzeros/""+period*(digit-trailingzeros)^1*(trailingzeros/"")
- )+1
- )^0)
- lpeg.patterns.stripzeros=stripper
- local nonzero=digit-zero
- local trailingzeros=zero^1*endofstring
- local stripper=Cs((1-period)^0*(
- period*trailingzeros/""+period*(nonzero^1+(trailingzeros/"")+zero^1)^0+endofstring
- ))
- lpeg.patterns.stripzero=stripper
-end
-local byte_to_HEX={}
-local byte_to_hex={}
-local byte_to_dec={}
-local hex_to_byte={}
-for i=0,255 do
- local H=format("%02X",i)
- local h=format("%02x",i)
- local d=format("%03i",i)
- local c=char(i)
- byte_to_HEX[c]=H
- byte_to_hex[c]=h
- byte_to_dec[c]=d
- hex_to_byte[h]=c
- hex_to_byte[H]=c
-end
-local hextobyte=P(2)/hex_to_byte
-local bytetoHEX=P(1)/byte_to_HEX
-local bytetohex=P(1)/byte_to_hex
-local bytetodec=P(1)/byte_to_dec
-local hextobytes=Cs(hextobyte^0)
-local bytestoHEX=Cs(bytetoHEX^0)
-local bytestohex=Cs(bytetohex^0)
-local bytestodec=Cs(bytetodec^0)
-patterns.hextobyte=hextobyte
-patterns.bytetoHEX=bytetoHEX
-patterns.bytetohex=bytetohex
-patterns.bytetodec=bytetodec
-patterns.hextobytes=hextobytes
-patterns.bytestoHEX=bytestoHEX
-patterns.bytestohex=bytestohex
-patterns.bytestodec=bytestodec
-function string.toHEX(s)
- if not s or s=="" then
- return s
- else
- return lpegmatch(bytestoHEX,s)
- end
-end
-function string.tohex(s)
- if not s or s=="" then
- return s
- else
- return lpegmatch(bytestohex,s)
- end
-end
-function string.todec(s)
- if not s or s=="" then
- return s
- else
- return lpegmatch(bytestodec,s)
- end
-end
-function string.tobytes(s)
- if not s or s=="" then
- return s
- else
- return lpegmatch(hextobytes,s)
- end
-end
-local patterns={}
-local function containsws(what)
- local p=patterns[what]
- if not p then
- local p1=P(what)*(whitespace+endofstring)*Cc(true)
- local p2=whitespace*P(p1)
- p=P(p1)+P(1-p2)^0*p2+Cc(false)
- patterns[what]=p
- end
- return p
-end
-lpeg.containsws=containsws
-function string.containsws(str,what)
- return lpegmatch(patterns[what] or containsws(what),str)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-function"] = package.loaded["l-function"] or true
-
--- original size: 361, stripped down to: 317
-
-if not modules then modules={} end modules ['l-functions']={
- 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"
-}
-functions=functions or {}
-function functions.dummy() end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-string"] = package.loaded["l-string"] or true
-
--- original size: 6644, stripped down to: 3410
-
-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 string=string
-local sub,gmatch,format,char,byte,rep,lower=string.sub,string.gmatch,string.format,string.char,string.byte,string.rep,string.lower
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
-local P,S,C,Ct,Cc,Cs=lpeg.P,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cc,lpeg.Cs
-local unquoted=patterns.squote*C(patterns.nosquote)*patterns.squote+patterns.dquote*C(patterns.nodquote)*patterns.dquote
-function string.unquoted(str)
- return lpegmatch(unquoted,str) or str
-end
-function string.quoted(str)
- return format("%q",str)
-end
-function string.count(str,pattern)
- local n=0
- for _ in gmatch(str,pattern) do
- n=n+1
- end
- return n
-end
-function string.limit(str,n,sentinel)
- if #str>n then
- sentinel=sentinel or "..."
- return sub(str,1,(n-#sentinel))..sentinel
- else
- return str
- end
-end
-local stripper=patterns.stripper
-local fullstripper=patterns.fullstripper
-local collapser=patterns.collapser
-local nospacer=patterns.nospacer
-local longtostring=patterns.longtostring
-function string.strip(str)
- return str and lpegmatch(stripper,str) or ""
-end
-function string.fullstrip(str)
- return str and lpegmatch(fullstripper,str) or ""
-end
-function string.collapsespaces(str)
- return str and lpegmatch(collapser,str) or ""
-end
-function string.nospaces(str)
- return str and lpegmatch(nospacer,str) or ""
-end
-function string.longtostring(str)
- return str and lpegmatch(longtostring,str) or ""
-end
-local pattern=P(" ")^0*P(-1)
-function string.is_empty(str)
- if not str or str=="" then
- return true
- else
- return lpegmatch(pattern,str) and true or false
- end
-end
-local anything=patterns.anything
-local moreescapes=Cc("%")*S(".-+%?()[]*$^{}")
-local allescapes=Cc("%")*S(".-+%?()[]*")
-local someescapes=Cc("%")*S(".-+%()[]")
-local matchescapes=Cc(".")*S("*?")
-local pattern_m=Cs ((moreescapes+anything )^0 )
-local pattern_a=Cs ((allescapes+anything )^0 )
-local pattern_b=Cs ((someescapes+matchescapes+anything )^0 )
-local pattern_c=Cs (Cc("^")*(someescapes+matchescapes+anything )^0*Cc("$") )
-function string.escapedpattern(str,simple)
- return lpegmatch(simple and pattern_b or pattern_a,str)
-end
-function string.topattern(str,lowercase,strict)
- if str=="" or type(str)~="string" then
- return ".*"
- elseif strict=="all" then
- str=lpegmatch(pattern_m,str)
- elseif strict then
- str=lpegmatch(pattern_c,str)
- else
- str=lpegmatch(pattern_b,str)
- end
- if lowercase then
- return lower(str)
- else
- return str
- end
-end
-function string.valid(str,default)
- return (type(str)=="string" and str~="" and str) or default or nil
-end
-string.itself=function(s) return s end
-local pattern_c=Ct(C(1)^0)
-local pattern_b=Ct((C(1)/byte)^0)
-function string.totable(str,bytes)
- return lpegmatch(bytes and pattern_b or pattern_c,str)
-end
-local replacer=lpeg.replacer("@","%%")
-function string.tformat(fmt,...)
- return format(lpegmatch(replacer,fmt),...)
-end
-string.quote=string.quoted
-string.unquote=string.unquoted
-if not string.bytetable then
- local limit=5000
- function string.bytetable(str)
- local n=#str
- if n>limit then
- local t={ byte(str,1,limit) }
- for i=limit+1,n do
- t[i]=byte(str,i)
- end
- return t
- else
- return { byte(str,1,n) }
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-table"] = package.loaded["l-table"] or true
-
--- original size: 41758, stripped down to: 22643
-
-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,select,rawget=type,next,tostring,tonumber,select,rawget
-local table,string=table,string
-local concat,sort=table.concat,table.sort
-local format,lower,dump=string.format,string.lower,string.dump
-local getmetatable,setmetatable=getmetatable,setmetatable
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
-local floor=math.floor
-local stripper=patterns.stripper
-function table.getn(t)
- return t and #t
-end
-function table.strip(tab)
- local lst={}
- local l=0
- for i=1,#tab do
- local s=lpegmatch(stripper,tab[i]) or ""
- if s=="" then
- else
- l=l+1
- lst[l]=s
- end
- end
- return lst
-end
-function table.keys(t)
- if t then
- local keys={}
- local k=0
- for key in next,t do
- k=k+1
- keys[k]=key
- end
- return keys
- else
- return {}
- end
-end
-local function compare(a,b)
- local ta=type(a)
- if ta=="number" then
- local tb=type(b)
- if ta==tb then
- return a<b
- elseif tb=="string" then
- return tostring(a)<b
- end
- elseif ta=="string" then
- local tb=type(b)
- if ta==tb then
- return a<b
- else
- return a<tostring(b)
- end
- end
- return tostring(a)<tostring(b)
-end
-local function sortedkeys(tab)
- if tab then
- local srt={}
- local category=0
- local s=0
- for key in next,tab do
- s=s+1
- srt[s]=key
- if category~=3 then
- local tkey=type(key)
- if category==1 then
- if tkey~="string" then
- category=3
- end
- elseif category==2 then
- if tkey~="number" then
- category=3
- end
- else
- if tkey=="string" then
- category=1
- elseif tkey=="number" then
- category=2
- else
- category=3
- end
- end
- end
- end
- if s<2 then
- elseif category==3 then
- sort(srt,compare)
- else
- sort(srt)
- end
- return srt
- else
- return {}
- end
-end
-local function sortedhashonly(tab)
- if tab then
- local srt={}
- local s=0
- for key in next,tab do
- if type(key)=="string" then
- s=s+1
- srt[s]=key
- end
- end
- if s>1 then
- sort(srt)
- end
- return srt
- else
- return {}
- end
-end
-local function sortedindexonly(tab)
- if tab then
- local srt={}
- local s=0
- for key in next,tab do
- if type(key)=="number" then
- s=s+1
- srt[s]=key
- end
- end
- if s>1 then
- sort(srt)
- end
- return srt
- else
- return {}
- end
-end
-local function sortedhashkeys(tab,cmp)
- if tab then
- local srt={}
- local s=0
- for key in next,tab do
- if key then
- s=s+1
- srt[s]=key
- end
- end
- if s>1 then
- sort(srt,cmp)
- end
- return srt
- else
- return {}
- end
-end
-function table.allkeys(t)
- local keys={}
- for k,v in next,t do
- for k in next,v do
- keys[k]=true
- end
- end
- return sortedkeys(keys)
-end
-table.sortedkeys=sortedkeys
-table.sortedhashonly=sortedhashonly
-table.sortedindexonly=sortedindexonly
-table.sortedhashkeys=sortedhashkeys
-local function nothing() end
-local function sortedhash(t,cmp)
- if t then
- local s
- if cmp then
- s=sortedhashkeys(t,function(a,b) return cmp(t,a,b) end)
- else
- s=sortedkeys(t)
- end
- local m=#s
- if m==1 then
- return next,t
- elseif m>0 then
- local n=0
- return function()
- if n<m then
- n=n+1
- local k=s[n]
- return k,t[k]
- end
- end
- end
- end
- return nothing
-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,...)
- if not t then
- t={}
- end
- for i=1,select("#",...) do
- for k,v in next,(select(i,...)) do
- t[k]=v
- end
- end
- return t
-end
-function table.merged(...)
- local t={}
- for i=1,select("#",...) do
- for k,v in next,(select(i,...)) do
- t[k]=v
- end
- end
- return t
-end
-function table.imerge(t,...)
- local nt=#t
- for i=1,select("#",...) do
- local nst=select(i,...)
- for j=1,#nst do
- nt=nt+1
- t[nt]=nst[j]
- end
- end
- return t
-end
-function table.imerged(...)
- local tmp={}
- local ntmp=0
- for i=1,select("#",...) do
- local nst=select(i,...)
- for j=1,#nst do
- ntmp=ntmp+1
- tmp[ntmp]=nst[j]
- end
- end
- return tmp
-end
-local function fastcopy(old,metatabletoo)
- if old then
- local new={}
- for k,v in next,old do
- if type(v)=="table" then
- new[k]=fastcopy(v,metatabletoo)
- else
- new[k]=v
- end
- end
- if metatabletoo then
- local mt=getmetatable(old)
- if mt then
- setmetatable(new,mt)
- end
- end
- return new
- else
- return {}
- end
-end
-local function copy(t,tables)
- if not tables then
- tables={}
- end
- local tcopy={}
- if not tables[t] then
- tables[t]=tcopy
- end
- for i,v in next,t do
- 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
-function table.derive(parent)
- local child={}
- if parent then
- setmetatable(child,{ __index=parent })
- end
- return child
-end
-function table.tohash(t,value)
- local h={}
- if t then
- if value==nil then value=true end
- for _,v in next,t do
- h[v]=value
- end
- end
- return h
-end
-function table.fromhash(t)
- local hsh={}
- local h=0
- for k,v in next,t do
- if v then
- h=h+1
- hsh[h]=k
- end
- end
- return hsh
-end
-local noquotes,hexify,handle,compact,inline,functions,metacheck,accurate
-local reserved=table.tohash {
- 'and','break','do','else','elseif','end','false','for','function','if',
- 'in','local','nil','not','or','repeat','return','then','true','until','while',
- 'NaN','goto','const',
-}
-local function is_simple_table(t,hexify,accurate)
- local nt=#t
- if nt>0 then
- local n=0
- for _,v in next,t do
- n=n+1
- if type(v)=="table" then
- return nil
- end
- end
- local haszero=rawget(t,0)
- if n==nt then
- local tt={}
- for i=1,nt do
- local v=t[i]
- local tv=type(v)
- if tv=="number" then
- if hexify then
- tt[i]=format("0x%X",v)
- elseif accurate then
- tt[i]=format("%q",v)
- else
- tt[i]=v
- end
- elseif tv=="string" then
- tt[i]=format("%q",v)
- elseif tv=="boolean" then
- tt[i]=v and "true" or "false"
- else
- return nil
- end
- end
- return tt
- elseif haszero and (n==nt+1) then
- local tt={}
- for i=0,nt do
- local v=t[i]
- local tv=type(v)
- if tv=="number" then
- if hexify then
- tt[i+1]=format("0x%X",v)
- elseif accurate then
- tt[i+1]=format("%q",v)
- else
- tt[i+1]=v
- end
- elseif tv=="string" then
- tt[i+1]=format("%q",v)
- elseif tv=="boolean" then
- tt[i+1]=v and "true" or "false"
- else
- return nil
- end
- end
- tt[1]="[0] = "..tt[1]
- return tt
- end
- end
- return nil
-end
-table.is_simple_table=is_simple_table
-local propername=patterns.propername
-local function dummy() end
-local function do_serialize(root,name,depth,level,indexed)
- if level>0 then
- depth=depth.." "
- if indexed then
- handle(format("%s{",depth))
- else
- local tn=type(name)
- if tn=="number" then
- if hexify then
- handle(format("%s[0x%X]={",depth,name))
- else
- handle(format("%s[%s]={",depth,name))
- end
- elseif tn=="string" then
- if noquotes and not reserved[name] and lpegmatch(propername,name) then
- handle(format("%s%s={",depth,name))
- else
- handle(format("%s[%q]={",depth,name))
- end
- elseif tn=="boolean" then
- handle(format("%s[%s]={",depth,name and "true" or "false"))
- else
- handle(format("%s{",depth))
- end
- end
- end
- if root and next(root)~=nil then
- local first=nil
- local last=0
- if compact then
- last=#root
- for k=1,last do
- if rawget(root,k)==nil then
- last=k-1
- break
- end
- end
- if last>0 then
- first=1
- end
- end
- local sk=sortedkeys(root)
- for i=1,#sk do
- local k=sk[i]
- local v=root[k]
- local tv=type(v)
- local tk=type(k)
- if compact and first and tk=="number" and k>=first and k<=last then
- if tv=="number" then
- if hexify then
- handle(format("%s 0x%X,",depth,v))
- elseif accurate then
- handle(format("%s %q,",depth,v))
- else
- handle(format("%s %s,",depth,v))
- end
- elseif tv=="string" then
- handle(format("%s %q,",depth,v))
- elseif tv=="table" then
- if next(v)==nil then
- handle(format("%s {},",depth))
- elseif inline then
- local st=is_simple_table(v,hexify,accurate)
- 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 tv=="boolean" then
- handle(format("%s %s,",depth,v and "true" or "false"))
- elseif tv=="function" then
- if functions then
- handle(format('%s load(%q),',depth,dump(v)))
- else
- handle(format('%s "function",',depth))
- end
- else
- handle(format("%s %q,",depth,tostring(v)))
- end
- elseif k=="__p__" then
- if false then
- handle(format("%s __p__=nil,",depth))
- end
- elseif tv=="number" then
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]=0x%X,",depth,k,v))
- elseif accurate then
- handle(format("%s [%s]=%q,",depth,k,v))
- else
- handle(format("%s [%s]=%s,",depth,k,v))
- end
- elseif tk=="boolean" then
- if hexify then
- handle(format("%s [%s]=0x%X,",depth,k and "true" or "false",v))
- elseif accurate then
- handle(format("%s [%s]=%q,",depth,k and "true" or "false",v))
- else
- handle(format("%s [%s]=%s,",depth,k and "true" or "false",v))
- end
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- if hexify then
- handle(format("%s %s=0x%X,",depth,k,v))
- elseif accurate then
- handle(format("%s %s=%q,",depth,k,v))
- else
- handle(format("%s %s=%s,",depth,k,v))
- end
- else
- if hexify then
- handle(format("%s [%q]=0x%X,",depth,k,v))
- elseif accurate then
- handle(format("%s [%q]=%q,",depth,k,v))
- else
- handle(format("%s [%q]=%s,",depth,k,v))
- end
- end
- elseif tv=="string" then
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]=%q,",depth,k,v))
- elseif accurate then
- handle(format("%s [%q]=%q,",depth,k,v))
- else
- handle(format("%s [%s]=%q,",depth,k,v))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]=%q,",depth,k and "true" or "false",v))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- handle(format("%s %s=%q,",depth,k,v))
- else
- handle(format("%s [%q]=%q,",depth,k,v))
- end
- elseif tv=="table" then
- if next(v)==nil then
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]={},",depth,k))
- elseif accurate then
- handle(format("%s [%q]={},",depth,k))
- else
- handle(format("%s [%s]={},",depth,k))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]={},",depth,k and "true" or "false"))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- handle(format("%s %s={},",depth,k))
- else
- handle(format("%s [%q]={},",depth,k))
- end
- elseif inline then
- local st=is_simple_table(v,hexify,accurate)
- if st then
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]={ %s },",depth,k,concat(st,", ")))
- elseif accurate then
- handle(format("%s [%q]={ %s },",depth,k,concat(st,", ")))
- else
- handle(format("%s [%s]={ %s },",depth,k,concat(st,", ")))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]={ %s },",depth,k and "true" or "false",concat(st,", ")))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) 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 tv=="boolean" then
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]=%s,",depth,k,v and "true" or "false"))
- elseif accurate then
- handle(format("%s [%q]=%s,",depth,k,v and "true" or "false"))
- else
- handle(format("%s [%s]=%s,",depth,k,v and "true" or "false"))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]=%s,",depth,tostring(k),v and "true" or "false"))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- handle(format("%s %s=%s,",depth,k,v and "true" or "false"))
- else
- handle(format("%s [%q]=%s,",depth,k,v and "true" or "false"))
- end
- elseif tv=="function" then
- if functions then
- local getinfo=debug and debug.getinfo
- if getinfo then
- local f=getinfo(v).what=="C" and dump(dummy) or dump(v)
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]=load(%q),",depth,k,f))
- elseif accurate then
- handle(format("%s [%q]=load(%q),",depth,k,f))
- else
- handle(format("%s [%s]=load(%q),",depth,k,f))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]=load(%q),",depth,k and "true" or "false",f))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- handle(format("%s %s=load(%q),",depth,k,f))
- else
- handle(format("%s [%q]=load(%q),",depth,k,f))
- end
- end
- end
- else
- if tk=="number" then
- if hexify then
- handle(format("%s [0x%X]=%q,",depth,k,tostring(v)))
- elseif accurate then
- handle(format("%s [%q]=%q,",depth,k,tostring(v)))
- else
- handle(format("%s [%s]=%q,",depth,k,tostring(v)))
- end
- elseif tk=="boolean" then
- handle(format("%s [%s]=%q,",depth,k and "true" or "false",tostring(v)))
- elseif tk~="string" then
- elseif noquotes and not reserved[k] and lpegmatch(propername,k) then
- handle(format("%s %s=%q,",depth,k,tostring(v)))
- else
- handle(format("%s [%q]=%q,",depth,k,tostring(v)))
- end
- end
- end
- end
- if level>0 then
- handle(format("%s},",depth))
- end
-end
-local function serialize(_handle,root,name,specification)
- local tname=type(name)
- if type(specification)=="table" then
- noquotes=specification.noquotes
- hexify=specification.hexify
- accurate=specification.accurate
- handle=_handle or specification.handle or print
- functions=specification.functions
- compact=specification.compact
- inline=specification.inline and compact
- metacheck=specification.metacheck
- if functions==nil then
- functions=true
- end
- if compact==nil then
- compact=true
- end
- if inline==nil then
- inline=compact
- end
- if metacheck==nil then
- metacheck=true
- end
- else
- noquotes=false
- hexify=false
- handle=_handle or print
- compact=true
- inline=true
- functions=true
- metacheck=true
- end
- if tname=="string" then
- if name=="return" then
- handle("return {")
- else
- handle(name.."={")
- end
- elseif tname=="number" then
- if hexify then
- handle(format("[0x%X]={",name))
- else
- handle("["..name.."]={")
- end
- elseif tname=="boolean" then
- if name then
- handle("return {")
- else
- handle("{")
- end
- else
- handle("t={")
- end
- if root then
- if metacheck and getmetatable(root) then
- local dummy=root._w_h_a_t_e_v_e_r_
- root._w_h_a_t_e_v_e_r_=nil
- end
- if next(root)~=nil then
- do_serialize(root,name,"",0)
- end
- end
- handle("}")
-end
-function table.serialize(root,name,specification)
- local t={}
- local n=0
- local function flush(s)
- n=n+1
- t[n]=s
- end
- serialize(flush,root,name,specification)
- return concat(t,"\n")
-end
-table.tohandle=serialize
-local maxtab=2*1024
-function table.tofile(filename,root,name,specification)
- local f=io.open(filename,'w')
- if f then
- if maxtab>1 then
- local t={}
- local n=0
- local function flush(s)
- n=n+1
- t[n]=s
- if n>maxtab then
- f:write(concat(t,"\n"),"\n")
- t={}
- n=0
- end
- end
- serialize(flush,root,name,specification)
- f:write(concat(t,"\n"),"\n")
- else
- local function flush(s)
- f:write(s,"\n")
- end
- serialize(flush,root,name,specification)
- end
- f:close()
- io.flush()
- end
-end
-local function flattened(t,f,depth)
- if f==nil then
- f={}
- depth=0xFFFF
- elseif tonumber(f) then
- 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
- end
- end
- end
- for k=1,#t do
- local v=t[k]
- if depth>0 and type(v)=="table" then
- flattened(v,f,depth-1)
- else
- f[#f+1]=v
- end
- end
- return f
-end
-table.flattened=flattened
-local function collapsed(t,f,h)
- if f==nil then
- f={}
- h={}
- end
- for k=1,#t do
- local v=t[k]
- if type(v)=="table" then
- collapsed(v,f,h)
- elseif not h[v] then
- f[#f+1]=v
- h[v]=true
- end
- end
- return f
-end
-local function collapsedhash(t,h)
- if h==nil then
- h={}
- end
- for k=1,#t do
- local v=t[k]
- if type(v)=="table" then
- collapsedhash(v,h)
- else
- h[v]=true
- end
- end
- return h
-end
-table.collapsed=collapsed
-table.collapsedhash=collapsedhash
-local function unnest(t,f)
- if not f then
- f={}
- 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
- end
- return f
-end
-function table.unnest(t)
- return unnest(t)
-end
-local function are_equal(a,b,n,m)
- if a==b then
- return true
- elseif a and b and #a==#b then
- if not n then
- n=1
- end
- if not m then
- m=#a
- end
- for i=n,m do
- local ai,bi=a[i],b[i]
- if ai==bi then
- 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)
- if a~=b then
- for ka,va in next,a do
- local vb=b[ka]
- if va==vb then
- elseif type(va)=="table" and type(vb)=="table" then
- if not identical(va,vb) then
- return false
- end
- else
- return false
- end
- end
- end
- return true
-end
-table.identical=identical
-table.are_equal=are_equal
-local function sparse(old,nest,keeptables)
- local new={}
- for k,v in next,old do
- if not (v=="" or v==false) then
- if nest and type(v)=="table" then
- v=sparse(v,nest)
- if keeptables or next(v)~=nil then
- new[k]=v
- end
- else
- new[k]=v
- end
- end
- end
- return new
-end
-table.sparse=sparse
-function table.compact(t)
- return sparse(t,true,true)
-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=0
- for k,v in next,t do
- n=n+1
- end
- return n
-end
-function table.swapped(t,s)
- local n={}
- if s then
- for k,v in next,s do
- n[k]=v
- end
- end
- for k,v in next,t do
- n[v]=k
- end
- return n
-end
-function table.hashed(t)
- for i=1,#t do
- t[t[i]]=i
- end
- return t
-end
-function table.mirrored(t)
- local n={}
- for k,v in next,t do
- n[v]=k
- n[k]=v
- end
- return n
-end
-function table.reversed(t)
- if t then
- local tt={}
- local 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
-end
-function table.reverse(t)
- if t then
- local n=#t
- local m=n+1
- for i=1,floor(n/2) do
- local j=m-i
- t[i],t[j]=t[j],t[i]
- end
- return t
- end
-end
-local function sequenced(t,sep,simple)
- if not t then
- return ""
- elseif type(t)~="table" then
- return t
- end
- local n=#t
- local s={}
- if n>0 then
- for i=1,n do
- local v=t[i]
- if type(v)=="table" then
- s[i]="{"..sequenced(v,sep,simple).."}"
- else
- s[i]=tostring(t[i])
- end
- end
- else
- 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
- if type(v)=="table" then
- s[n]=k.."={"..sequenced(v,sep,simple).."}"
- else
- s[n]=k.."="..tostring(v)
- end
- end
- else
- n=n+1
- if type(v)=="table" then
- s[n]=k.."={"..sequenced(v,sep,simple).."}"
- else
- s[n]=k.."="..tostring(v)
- end
- end
- end
- end
- if sep==true then
- return "{ "..concat(s,", ").." }"
- else
- return concat(s,sep or " | ")
- end
-end
-table.sequenced=sequenced
-function table.print(t,...)
- if type(t)~="table" then
- print(tostring(t))
- else
- serialize(print,t,...)
- end
-end
-if setinspector then
- setinspector("table",function(v) if type(v)=="table" then serialize(print,v,"table") return true end end)
-end
-function table.sub(t,i,j)
- return { unpack(t,i,j) }
-end
-function table.is_empty(t)
- return not t or next(t)==nil
-end
-function table.has_one_entry(t)
- return t and next(t,next(t))==nil
-end
-function table.loweredkeys(t)
- local l={}
- for k,v in next,t do
- l[lower(k)]=v
- end
- return l
-end
-function table.unique(old)
- local hash={}
- local new={}
- local n=0
- for i=1,#old do
- local oi=old[i]
- if not hash[oi] then
- n=n+1
- new[n]=oi
- hash[oi]=true
- end
- end
- return new
-end
-function table.sorted(t,...)
- sort(t,...)
- return t
-end
-function table.values(t,s)
- if t then
- local values={}
- local keys={}
- local v=0
- for key,value in next,t do
- if not keys[value] then
- v=v+1
- values[v]=value
- keys[k]=key
- end
- end
- if s then
- sort(values)
- end
- return values
- else
- return {}
- end
-end
-function table.filtered(t,pattern,sort,cmp)
- if t and type(pattern)=="string" then
- if sort then
- local s
- if cmp then
- s=sortedhashkeys(t,function(a,b) return cmp(t,a,b) end)
- else
- s=sortedkeys(t)
- end
- local n=0
- local m=#s
- local function kv(s)
- while n<m do
- n=n+1
- local k=s[n]
- if find(k,pattern) then
- return k,t[k]
- end
- end
- end
- return kv,s
- else
- local n=next(t)
- local function iterator()
- while n~=nil do
- local k=n
- n=next(t,k)
- if find(k,pattern) then
- return k,t[k]
- end
- end
- end
- return iterator,t
- end
- else
- return nothing
- end
-end
-if not table.move then
- function table.move(a1,f,e,t,a2)
- if a2 and a1~=a2 then
- for i=f,e do
- a2[t]=a1[i]
- t=t+1
- end
- return a2
- else
- t=t+e-f
- for i=e,f,-1 do
- a1[t]=a1[i]
- t=t-1
- end
- return a1
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-io"] = package.loaded["l-io"] or true
-
--- original size: 11829, stripped down to: 6331
-
-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 io=io
-local open,flush,write,read=io.open,io.flush,io.write,io.read
-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") or "",";",1,true) then
- io.fileseparator,io.pathseparator="\\",";"
-else
- io.fileseparator,io.pathseparator="/",":"
-end
-local large=0x01000000
-local medium=0x00100000
-local small=0x00020000
-local function readall(f)
- local size=f:seek("end")
- if size>0 then
- f:seek("set",0)
- return f:read(size)
- else
- return ""
- end
-end
-io.readall=readall
-function io.loaddata(filename,textmode)
- local f=open(filename,(textmode and 'r') or 'rb')
- if f then
- local size=f:seek("end")
- local data=nil
- if size>0 then
- f:seek("set",0)
- data=f:read(size)
- end
- f:close()
- return data
- end
-end
-function io.copydata(source,target,action)
- local f=open(source,"rb")
- if f then
- local g=open(target,"wb")
- if g then
- local size=f:seek("end")
- if size>0 then
- f:seek("set",0)
- local data=f:read(size)
- if action then
- data=action(data)
- end
- if data then
- g:write(data)
- end
- end
- g:close()
- end
- f:close()
- flush()
- end
-end
-function io.savedata(filename,data,joiner)
- local f=open(filename,"wb")
- if f then
- if type(data)=="table" then
- f:write(concat(data,joiner or ""))
- elseif type(data)=="function" then
- data(f)
- else
- f:write(data or "")
- end
- f:close()
- flush()
- return true
- else
- return false
- end
-end
-if fio and fio.readline then
- local readline=fio.readline
- function io.loadlines(filename,n)
- local f=open(filename,'r')
- if not f then
- elseif n then
- local lines={}
- for i=1,n do
- local line=readline(f)
- if line then
- lines[i]=line
- else
- break
- end
- end
- f:close()
- lines=concat(lines,"\n")
- if #lines>0 then
- return lines
- end
- else
- local line=readline(f)
- f:close()
- if line and #line>0 then
- return line
- end
- end
- end
-else
- function io.loadlines(filename,n)
- local f=open(filename,'r')
- if not f then
- elseif n then
- local lines={}
- for i=1,n do
- local line=f:read("*lines")
- if line then
- lines[i]=line
- else
- break
- end
- end
- f:close()
- lines=concat(lines,"\n")
- if #lines>0 then
- return lines
- end
- else
- local line=f:read("*line") or ""
- f:close()
- if #line>0 then
- return line
- end
- end
- end
-end
-function io.loadchunk(filename,n)
- local f=open(filename,'rb')
- if f then
- local data=f:read(n or 1024)
- f:close()
- if #data>0 then
- return data
- end
- end
-end
-function io.exists(filename)
- local f=open(filename)
- if f==nil then
- return false
- else
- f:close()
- return true
- end
-end
-function io.size(filename)
- local f=open(filename)
- if f==nil then
- return 0
- else
- local s=f:seek("end")
- f:close()
- return s
- end
-end
-local function noflines(f)
- if type(f)=="string" then
- local f=open(filename)
- if f then
- local n=f and noflines(f) or 0
- f:close()
- return n
- else
- return 0
- end
- else
- local n=0
- for _ in f:lines() do
- n=n+1
- end
- f:seek('set',0)
- return n
- end
-end
-io.noflines=noflines
-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
- 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)
- 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)
- end
- end,
- [1]=function (f)
- local a=f:read(1)
- if a then
- return byte(a)
- end
- end,
- [-2]=function (f)
- local a,b=f:read(1,1)
- if b then
- return byte(b),byte(a)
- 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)
- 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
- write(question)
- if options then
- write(format(" [%s]",concat(options,"|")))
- end
- if default then
- write(format(" [%s]",default))
- end
- write(format(" "))
- flush()
- local answer=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
-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 0x100*a+b
- elseif n==3 then
- local a,b,c=byte(f:read(3),1,3)
- return 0x10000*a+0x100*b+c
- elseif n==4 then
- local a,b,c,d=byte(f:read(4),1,4)
- return 0x1000000*a+0x10000*b+0x100*c+d
- elseif n==8 then
- local a,b=readnumber(f,4),readnumber(f,4)
- return 0x100*a+b
- elseif n==12 then
- local a,b,c=readnumber(f,4),readnumber(f,4),readnumber(f,4)
- return 0x10000*a+0x100*b+c
- elseif n==-2 then
- local b,a=byte(f:read(2),1,2)
- return 0x100*a+b
- elseif n==-3 then
- local c,b,a=byte(f:read(3),1,3)
- return 0x10000*a+0x100*b+c
- elseif n==-4 then
- local d,c,b,a=byte(f:read(4),1,4)
- return 0x1000000*a+0x10000*b+0x100*c+d
- elseif n==-8 then
- local h,g,f,e,d,c,b,a=byte(f:read(8),1,8)
- return 0x100000000000000*a+0x1000000000000*b+0x10000000000*c+0x100000000*d+0x1000000*e+0x10000*f+0x100*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),"\000","")
- return str
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-number"] = package.loaded["l-number"] or true
-
--- original size: 5720, stripped down to: 2176
-
-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,tonumber=tostring,tonumber
-local format,floor,match,rep=string.format,math.floor,string.match,string.rep
-local concat,insert=table.concat,table.insert
-local lpegmatch=lpeg.match
-local floor=math.floor
-number=number or {}
-local number=number
-if bit32 then
- local bextract=bit32.extract
- local t={
- "0","0","0","0","0","0","0","0",
- "0","0","0","0","0","0","0","0",
- "0","0","0","0","0","0","0","0",
- "0","0","0","0","0","0","0","0",
- }
- function number.tobitstring(b,m,w)
- if not w then
- w=32
- end
- local n=w
- for i=0,w-1 do
- local v=bextract(b,i)
- local k=w-i
- if v==1 then
- n=k
- t[k]="1"
- else
- t[k]="0"
- end
- end
- if w then
- return concat(t,"",1,w)
- elseif m then
- m=33-m*8
- if m<1 then
- m=1
- end
- return concat(t,"",1,m)
- elseif n<8 then
- return concat(t)
- elseif n<16 then
- return concat(t,"",9)
- elseif n<24 then
- return concat(t,"",17)
- else
- return concat(t,"",25)
- end
- end
-else
- function number.tobitstring(n,m)
- if n>0 then
- 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)
- elseif m then
- rep("00000000",m)
- else
- return "00000000"
- end
- end
-end
-function number.valid(str,default)
- return tonumber(str) or default or nil
-end
-function number.toevenhex(n)
- local s=format("%X",n)
- if #s%2==0 then
- return s
- else
- return "0"..s
- end
-end
-function number.bytetodecimal(b)
- local d=floor(b*100/255+0.5)
- if d>100 then
- return 100
- elseif d<-100 then
- return -100
- else
- return d
- end
-end
-function number.decimaltobyte(d)
- local b=floor(d*255/100+0.5)
- if b>255 then
- return 255
- elseif b<-255 then
- return -255
- else
- return b
- end
-end
-function number.idiv(i,d)
- return floor(i/d)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-set"] = package.loaded["l-set"] or true
-
--- original size: 1923, stripped down to: 1044
-
-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=""
- for k,v in next,t do
- if v then
- 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,n={},0
- for k,v in next,tabs[n] do
- if v then
- n=n+1
- t[n]=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
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-os"] = package.loaded["l-os"] or true
-
--- original size: 19409, stripped down to: 10419
-
-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"
-}
-local os=os
-local date,time=os.date,os.time
-local find,format,gsub,upper,gmatch=string.find,string.format,string.gsub,string.upper,string.gmatch
-local concat=table.concat
-local random,ceil,randomseed=math.random,math.ceil,math.randomseed
-local type,setmetatable,tonumber,tostring=type,setmetatable,tonumber,tostring
-do
- local selfdir=os.selfdir
- if selfdir=="" then
- selfdir=nil
- end
- if not selfdir then
- if arg then
- for i=1,#arg do
- local a=arg[i]
- if find(a,"^%-%-[c:]*texmfbinpath=") then
- selfdir=gsub(a,"^.-=","")
- break
- end
- end
- end
- if not selfdir then
- selfdir=os.selfbin or "luatex"
- if find(selfdir,"[/\\]") then
- selfdir=gsub(selfdir,"[/\\][^/\\]*$","")
- elseif os.getenv then
- local path=os.getenv("PATH")
- local name=gsub(selfdir,"^.*[/\\][^/\\]","")
- local patt="[^:]+"
- if os.type=="windows" then
- patt="[^;]+"
- name=name..".exe"
- end
- local isfile
- if lfs then
- local attributes=lfs.attributes
- isfile=function(name)
- local a=attributes(name,"mode")
- return a=="file" or a=="link" or nil
- end
- else
- local open=io.open
- isfile=function(name)
- local f=open(name)
- if f then
- f:close()
- return true
- end
- end
- end
- for p in gmatch(path,patt) do
- if isfile(p.."/"..name) then
- selfdir=p
- break
- end
- end
- end
- end
- os.selfdir=selfdir or "."
- end
-end
-math.initialseed=tonumber(string.sub(string.reverse(tostring(ceil(socket and socket.gettime()*10000 or time()))),1,6))
-randomseed(math.initialseed)
-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
- 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,";")
- 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
-local execute=os.execute
-local iopopen=io.popen
-local function resultof(command)
- local handle=iopopen(command,"r")
- if handle then
- local result=handle:read("*all") or ""
- handle:close()
- return result
- else
- return ""
- end
-end
-os.resultof=resultof
-function os.pipeto(command)
- return iopopen(command,"w")
-end
-if not io.fileseparator then
- if find(os.getenv("PATH"),";",1,true) then
- io.fileseparator,io.pathseparator,os.type="\\",";",os.type or "windows"
- 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,os.binsuffixes='dll','exe',{ 'exe','cmd','bat' }
-else
- os.libsuffix,os.binsuffix,os.binsuffixes='so','',{ '' }
-end
-local launchers={
- windows="start %s",
- macosx="open %s",
- unix="xdg-open %s &> /dev/null &",
-}
-function os.launch(str)
- local command=format(launchers[os.name] or launchers.unix,str)
- execute(command)
-end
-local gettimeofday=os.gettimeofday or os.clock
-os.gettimeofday=gettimeofday
-local startuptime=gettimeofday()
-function os.runtime()
- return gettimeofday()-startuptime
-end
-local resolvers=os.resolvers or {}
-os.resolvers=resolvers
-setmetatable(os,{ __index=function(t,k)
- local r=resolvers[k]
- return r and r(t,k) or nil
-end })
-local name,platform=os.name or "linux",os.getenv("MTX_PLATFORM") or ""
-if platform~="" then
- os.platform=platform
-elseif os.type=="windows" then
- function resolvers.platform(t,k)
- local architecture=os.getenv("PROCESSOR_ARCHITECTURE") or ""
- local platform=""
- if find(architecture,"AMD64",1,true) then
- platform="win64"
- else
- platform="mswin"
- end
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-elseif name=="linux" then
- function resolvers.platform(t,k)
- local architecture=os.getenv("HOSTTYPE") or resultof("uname -m") or ""
- local platform=os.getenv("MTX_PLATFORM") or ""
- local musl=find(os.selfdir or "","linuxmusl")
- if platform~="" then
- elseif find(architecture,"x86_64",1,true) then
- platform=musl and "linuxmusl" or "linux-64"
- elseif find(architecture,"ppc",1,true) then
- platform="linux-ppc"
- else
- platform=musl and "linuxmusl" or "linux"
- end
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-elseif name=="macosx" then
- function resolvers.platform(t,k)
- local architecture=resultof("echo $HOSTTYPE") or ""
- local platform=""
- if architecture=="" then
- platform="osx-intel"
- elseif find(architecture,"i386",1,true) then
- platform="osx-intel"
- elseif find(architecture,"x86_64",1,true) then
- platform="osx-64"
- elseif find(architecture,"arm64",1,true) 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 resolvers.platform(t,k)
- local architecture=resultof("uname -m") or ""
- local platform=""
- if find(architecture,"sparc",1,true) then
- platform="solaris-sparc"
- else
- platform="solaris-intel"
- end
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-elseif name=="freebsd" then
- function resolvers.platform(t,k)
- local architecture=resultof("uname -m") or ""
- local platform=""
- if find(architecture,"amd64",1,true) then
- platform="freebsd-amd64"
- else
- platform="freebsd"
- end
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-elseif name=="kfreebsd" then
- function resolvers.platform(t,k)
- local architecture=os.getenv("HOSTTYPE") or resultof("uname -m") or ""
- local platform=""
- if find(architecture,"x86_64",1,true) then
- platform="kfreebsd-amd64"
- else
- platform="kfreebsd-i386"
- end
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-else
- function resolvers.platform(t,k)
- local platform="linux"
- os.setenv("MTX_PLATFORM",platform)
- os.platform=platform
- return platform
- end
-end
-os.newline=name=="windows" and "\013\010" or "\010"
-function resolvers.bits(t,k)
- local bits=find(os.platform,"64",1,true) and 64 or 32
- os.bits=bits
- return bits
-end
-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(date("%H")) or 0)-(tonumber(date("!%H")) or 0))
- if delta then
- if d>0 then
- return format("+%02i:00",d)
- else
- return format("-%02i:00",-d)
- end
- else
- return 1
- end
-end
-local timeformat=format("%%s%s",os.timezone(true))
-local dateformat="!%Y-%m-%d %H:%M:%S"
-local lasttime=nil
-local lastdate=nil
-function os.fulltime(t,default)
- t=t and tonumber(t) or 0
- if t>0 then
- elseif default then
- return default
- else
- t=time()
- end
- if t~=lasttime then
- lasttime=t
- lastdate=format(timeformat,date(dateformat))
- end
- return lastdate
-end
-local dateformat="%Y-%m-%d %H:%M:%S"
-local lasttime=nil
-local lastdate=nil
-function os.localtime(t,default)
- t=t and tonumber(t) or 0
- if t>0 then
- elseif default then
- return default
- else
- t=time()
- end
- if t~=lasttime then
- lasttime=t
- lastdate=date(dateformat,t)
- end
- return lastdate
-end
-function os.converttime(t,default)
- local t=tonumber(t)
- if t and t>0 then
- return date(dateformat,t)
- else
- return default or "-"
- end
-end
-local memory={}
-local function which(filename)
- local fullname=memory[filename]
- if fullname==nil then
- local suffix=file.suffix(filename)
- local suffixes=suffix=="" and os.binsuffixes or { suffix }
- for directory in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
- local df=file.join(directory,filename)
- for i=1,#suffixes do
- local dfs=file.addsuffix(df,suffixes[i])
- if io.exists(dfs) then
- fullname=dfs
- break
- end
- end
- end
- if not fullname then
- fullname=false
- end
- memory[filename]=fullname
- end
- return fullname
-end
-os.which=which
-os.where=which
-function os.today()
- return date("!*t")
-end
-function os.now()
- return date("!%Y-%m-%d %H:%M:%S")
-end
-if not os.sleep then
- local socket=socket
- function os.sleep(n)
- if not socket then
- socket=require("socket")
- end
- socket.sleep(n)
- end
-end
-local function isleapyear(year)
- return (year%4==0) and (year%100~=0 or year%400==0)
-end
-os.isleapyear=isleapyear
-local days={ 31,28,31,30,31,30,31,31,30,31,30,31 }
-local function nofdays(year,month,day)
- if not month then
- return isleapyear(year) and 365 or 364
- elseif not day then
- return month==2 and isleapyear(year) and 29 or days[month]
- else
- for i=1,month-1 do
- day=day+days[i]
- end
- if month>2 and isleapyear(year) then
- day=day+1
- end
- return day
- end
-end
-os.nofdays=nofdays
-function os.weekday(day,month,year)
- return date("%w",time { year=year,month=month,day=day })+1
-end
-function os.validdate(year,month,day)
- if month<1 then
- month=1
- elseif month>12 then
- month=12
- end
- if day<1 then
- day=1
- else
- local max=nofdays(year,month)
- if day>max then
- day=max
- end
- end
- return year,month,day
-end
-function os.date(fmt,...)
- if not fmt then
- fmt="%Y-%m-%d %H:%M"
- end
- return date(fmt,...)
-end
-local osexit=os.exit
-local exitcode=nil
-function os.setexitcode(code)
- exitcode=code
-end
-function os.exit(c)
- if exitcode~=nil then
- return osexit(exitcode)
- end
- if c~=nil then
- return osexit(c)
- end
- return osexit()
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-file"] = package.loaded["l-file"] or true
-
--- original size: 22175, stripped down to: 10302
-
-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"
-}
-file=file or {}
-local file=file
-if not lfs then
- lfs=optionalrequire("lfs")
-end
-local insert,concat=table.insert,table.concat
-local match,find,gmatch=string.match,string.find,string.gmatch
-local lpegmatch=lpeg.match
-local getcurrentdir,attributes=lfs.currentdir,lfs.attributes
-local checkedsplit=string.checkedsplit
-local P,R,S,C,Cs,Cp,Cc,Ct=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Cp,lpeg.Cc,lpeg.Ct
-local attributes=lfs.attributes
-function lfs.isdir(name)
- if name then
- return attributes(name,"mode")=="directory"
- end
-end
-function lfs.isfile(name)
- if name then
- local a=attributes(name,"mode")
- return a=="file" or a=="link" or nil
- end
-end
-function lfs.isfound(name)
- if name then
- local a=attributes(name,"mode")
- return (a=="file" or a=="link") and name or nil
- end
-end
-function lfs.modification(name)
- return name and attributes(name,"modification") or nil
-end
-if sandbox then
- sandbox.redefine(lfs.isfile,"lfs.isfile")
- sandbox.redefine(lfs.isdir,"lfs.isdir")
- sandbox.redefine(lfs.isfound,"lfs.isfound")
-end
-local colon=P(":")
-local period=P(".")
-local periods=P("..")
-local fwslash=P("/")
-local bwslash=P("\\")
-local slashes=S("\\/")
-local noperiod=1-period
-local noslashes=1-slashes
-local name=noperiod^1
-local suffix=period/""*(1-period-slashes)^1*-1
-local pattern=C((1-(slashes^1*noslashes^1*-1))^1)*P(1)
-local function pathpart(name,default)
- return name and lpegmatch(pattern,name) or default or ""
-end
-local pattern=(noslashes^0*slashes)^1*C(noslashes^1)*-1
-local function basename(name)
- return name and lpegmatch(pattern,name) or name
-end
-local pattern=(noslashes^0*slashes^1)^0*Cs((1-suffix)^1)*suffix^0
-local function nameonly(name)
- return name and lpegmatch(pattern,name) or name
-end
-local pattern=(noslashes^0*slashes)^0*(noperiod^1*period)^1*C(noperiod^1)*-1
-local function suffixonly(name)
- return name and lpegmatch(pattern,name) or ""
-end
-local pattern=(noslashes^0*slashes)^0*noperiod^1*((period*C(noperiod^1))^1)*-1+Cc("")
-local function suffixesonly(name)
- if name then
- return lpegmatch(pattern,name)
- else
- return ""
- end
-end
-file.pathpart=pathpart
-file.basename=basename
-file.nameonly=nameonly
-file.suffixonly=suffixonly
-file.suffix=suffixonly
-file.suffixesonly=suffixesonly
-file.suffixes=suffixesonly
-file.dirname=pathpart
-file.extname=suffixonly
-local drive=C(R("az","AZ"))*colon
-local path=C((noslashes^0*slashes)^0)
-local suffix=period*C(P(1-period)^0*P(-1))
-local base=C((1-suffix)^0)
-local rest=C(P(1)^0)
-drive=drive+Cc("")
-path=path+Cc("")
-base=base+Cc("")
-suffix=suffix+Cc("")
-local pattern_a=drive*path*base*suffix
-local pattern_b=path*base*suffix
-local pattern_c=C(drive*path)*C(base*suffix)
-local pattern_d=path*rest
-function file.splitname(str,splitdrive)
- if not str then
- elseif splitdrive then
- return lpegmatch(pattern_a,str)
- else
- return lpegmatch(pattern_b,str)
- end
-end
-function file.splitbase(str)
- if str then
- return lpegmatch(pattern_d,str)
- else
- return "",str
- end
-end
-function file.nametotable(str,splitdrive)
- if str then
- local path,drive,subpath,name,base,suffix=lpegmatch(pattern_c,str)
- if splitdrive then
- return {
- path=path,
- drive=drive,
- subpath=subpath,
- name=name,
- base=base,
- suffix=suffix,
- }
- else
- return {
- path=path,
- name=name,
- base=base,
- suffix=suffix,
- }
- end
- end
-end
-local pattern=Cs(((period*(1-period-slashes)^1*-1)/""+1)^1)
-function file.removesuffix(name)
- return name and lpegmatch(pattern,name)
-end
-local suffix=period/""*(1-period-slashes)^1*-1
-local pattern=Cs((noslashes^0*slashes^1)^0*((1-suffix)^1))*Cs(suffix)
-function file.addsuffix(filename,suffix,criterium)
- if not filename or not suffix or suffix=="" then
- return filename
- elseif criterium==true then
- return filename.."."..suffix
- elseif not criterium then
- local n,s=lpegmatch(pattern,filename)
- if not s or s=="" then
- return filename.."."..suffix
- else
- return filename
- end
- else
- local n,s=lpegmatch(pattern,filename)
- if s and s~="" then
- local t=type(criterium)
- if t=="table" then
- for i=1,#criterium do
- if s==criterium[i] then
- return filename
- end
- end
- elseif t=="string" then
- if s==criterium then
- return filename
- end
- end
- end
- return (n or filename).."."..suffix
- end
-end
-local suffix=period*(1-period-slashes)^1*-1
-local pattern=Cs((1-suffix)^0)
-function file.replacesuffix(name,suffix)
- if name and suffix and suffix~="" then
- return lpegmatch(pattern,name).."."..suffix
- else
- return name
- end
-end
-local reslasher=lpeg.replacer(P("\\"),"/")
-function file.reslash(str)
- return str and lpegmatch(reslasher,str)
-end
-if lfs.isreadablefile and lfs.iswritablefile then
- file.is_readable=lfs.isreadablefile
- file.is_writable=lfs.iswritablefile
-else
- function file.is_writable(name)
- if not name then
- elseif lfs.isdir(name) then
- name=name.."/m_t_x_t_e_s_t.tmp"
- local f=io.open(name,"wb")
- if f then
- f:close()
- os.remove(name)
- return true
- end
- elseif lfs.isfile(name) then
- local f=io.open(name,"ab")
- if f then
- f:close()
- return true
- end
- else
- local f=io.open(name,"ab")
- if f then
- f:close()
- os.remove(name)
- return true
- end
- end
- return false
- end
- local readable=P("r")*Cc(true)
- function file.is_readable(name)
- if name then
- local a=attributes(name)
- return a and lpegmatch(readable,a.permissions) or false
- else
- return false
- end
- end
-end
-file.isreadable=file.is_readable
-file.iswritable=file.is_writable
-function file.size(name)
- if name then
- local a=attributes(name)
- return a and a.size or 0
- else
- return 0
- end
-end
-function file.splitpath(str,separator)
- return str and checkedsplit(lpegmatch(reslasher,str),separator or io.pathseparator)
-end
-function file.joinpath(tab,separator)
- return tab and concat(tab,separator or io.pathseparator)
-end
-local someslash=S("\\/")
-local stripper=Cs(P(fwslash)^0/""*reslasher)
-local isnetwork=someslash*someslash*(1-someslash)+(1-fwslash-colon)^1*colon
-local isroot=fwslash^1*-1
-local hasroot=fwslash^1
-local reslasher=lpeg.replacer(S("\\/"),"/")
-local deslasher=lpeg.replacer(S("\\/")^1,"/")
-function file.join(one,two,three,...)
- if not two then
- return one=="" and one or lpegmatch(reslasher,one)
- end
- if one=="" then
- return lpegmatch(stripper,three and concat({ two,three,... },"/") or two)
- end
- if lpegmatch(isnetwork,one) then
- local one=lpegmatch(reslasher,one)
- local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two)
- if lpegmatch(hasroot,two) then
- return one..two
- else
- return one.."/"..two
- end
- elseif lpegmatch(isroot,one) then
- local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two)
- if lpegmatch(hasroot,two) then
- return two
- else
- return "/"..two
- end
- else
- return lpegmatch(deslasher,concat({ one,two,three,... },"/"))
- end
-end
-local drivespec=R("az","AZ")^1*colon
-local anchors=fwslash+drivespec
-local untouched=periods+(1-period)^1*P(-1)
-local mswindrive=Cs(drivespec*(bwslash/"/"+fwslash)^0)
-local mswinuncpath=(bwslash+fwslash)*(bwslash+fwslash)*Cc("//")
-local splitstarter=(mswindrive+mswinuncpath+Cc(false))*Ct(lpeg.splitat(S("/\\")^1))
-local absolute=fwslash
-function file.collapsepath(str,anchor)
- if not str then
- return
- end
- if anchor==true and not lpegmatch(anchors,str) then
- str=getcurrentdir().."/"..str
- end
- if str=="" or str=="." then
- return "."
- elseif lpegmatch(untouched,str) then
- return lpegmatch(reslasher,str)
- end
- local starter,oldelements=lpegmatch(splitstarter,str)
- local newelements={}
- local i=#oldelements
- while i>0 do
- local element=oldelements[i]
- if element=='.' then
- 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 lpegmatch(absolute,str) then
- return "/"..concat(newelements,'/')
- else
- newelements=concat(newelements,'/')
- if anchor=="." and find(str,"^%./") then
- return "./"..newelements
- else
- return newelements
- end
- end
-end
-local validchars=R("az","09","AZ","--","..")
-local pattern_a=lpeg.replacer(1-validchars)
-local pattern_a=Cs((validchars+P(1)/"-")^1)
-local whatever=P("-")^0/""
-local pattern_b=Cs(whatever*(1-whatever*-1)^1)
-function file.robustname(str,strict)
- if str then
- str=lpegmatch(pattern_a,str) or str
- if strict then
- return lpegmatch(pattern_b,str) or str
- else
- return str
- end
- end
-end
-local loaddata=io.loaddata
-local savedata=io.savedata
-file.readdata=loaddata
-file.savedata=savedata
-function file.copy(oldname,newname)
- if oldname and newname then
- local data=loaddata(oldname)
- if data and data~="" then
- savedata(newname,data)
- end
- end
-end
-local letter=R("az","AZ")+S("_-+")
-local separator=P("://")
-local qualified=period^0*fwslash+letter*colon+letter^1*separator+letter^1*fwslash
-local rootbased=fwslash+letter*colon
-lpeg.patterns.qualified=qualified
-lpeg.patterns.rootbased=rootbased
-function file.is_qualified_path(filename)
- return filename and lpegmatch(qualified,filename)~=nil
-end
-function file.is_rootbased_path(filename)
- return filename and lpegmatch(rootbased,filename)~=nil
-end
-function file.strip(name,dir)
- if name then
- local b,a=match(name,"^(.-)"..dir.."(.*)$")
- return a~="" and a or name
- end
-end
-function lfs.mkdirs(path)
- local full=""
- for sub in gmatch(path,"(/*[^\\/]+)") do
- full=full..sub
- lfs.mkdir(full)
- end
-end
-function file.withinbase(path)
- local l=0
- if not find(path,"^/") then
- path="/"..path
- end
- for dir in gmatch(path,"/([^/]+)") do
- if dir==".." then
- l=l-1
- elseif dir~="." then
- l=l+1
- end
- if l<0 then
- return false
- end
- end
- return true
-end
-local symlinkattributes=lfs.symlinkattributes
-function lfs.readlink(name)
- return symlinkattributes(name,"target") or nil
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-gzip"] = package.loaded["l-gzip"] or true
-
--- original size: 5115, stripped down to: 1699
-
-if not modules then modules={} end modules ['l-gzip']={
- version=1.001,
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-gzip=gzip or {}
-if not zlib then
- zlib=xzip
-elseif not xzip then
- xzip=zlib
-end
-if zlib then
- local suffix=file.suffix
- local suffixes=file.suffixes
- local find=string.find
- local openfile=io.open
- local gzipwindow=15+16
- local gziplevel=3
- local identifier="^\x1F\x8B\x08"
- local compress=zlib.compress
- local decompress=zlib.decompress
- function gzip.load(filename)
- local f=openfile(filename,"rb")
- if not f then
- else
- local data=f:read("*all")
- f:close()
- if data and data~="" then
- if suffix(filename)=="gz" then
- data=decompress(data,gzipwindow)
- end
- return data
- end
- end
- end
- function gzip.save(filename,data,level)
- if suffix(filename)~="gz" then
- filename=filename..".gz"
- end
- local f=openfile(filename,"wb")
- if f then
- data=compress(data or "",level or gziplevel,nil,gzipwindow)
- f:write(data)
- f:close()
- return #data
- end
- end
- function gzip.suffix(filename)
- local suffix,extra=suffixes(filename)
- local gzipped=extra=="gz"
- return suffix,gzipped
- end
- function gzip.compressed(s)
- return s and find(s,identifier)
- end
- function gzip.compress(s,level)
- if s and not find(s,identifier) then
- if not level then
- level=gziplevel
- elseif level<=0 then
- return s
- elseif level>9 then
- level=9
- end
- return compress(s,level or gziplevel,nil,gzipwindow) or s
- end
- end
- function gzip.decompress(s)
- if s and find(s,identifier) then
- return decompress(s,gzipwindow)
- else
- return s
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-md5"] = package.loaded["l-md5"] or true
-
--- original size: 3414, stripped down to: 2307
-
-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"
-}
-if not md5 then
- md5=optionalrequire("md5")
-end
-if not md5 then
- md5={
- sum=function(str) print("error: md5 is not loaded (sum ignored)") return str end,
- sumhexa=function(str) print("error: md5 is not loaded (sumhexa ignored)") return str end,
- }
-end
-local md5,file=md5,file
-local gsub=string.gsub
-local modification,isfile,touch=lfs.modification,lfs.isfile,lfs.touch
-local loaddata,savedata=io.loaddata,io.savedata
-do
- local patterns=lpeg and lpeg.patterns
- if patterns then
- local bytestoHEX=patterns.bytestoHEX
- local bytestohex=patterns.bytestohex
- local bytestodec=patterns.bytestodec
- local lpegmatch=lpeg.match
- local md5sum=md5.sum
- if not md5.HEX then function md5.HEX(str) if str then return lpegmatch(bytestoHEX,md5sum(str)) end end end
- if not md5.hex then function md5.hex(str) if str then return lpegmatch(bytestohex,md5sum(str)) end end end
- if not md5.dec then function md5.dec(str) if str then return lpegmatch(bytestodec,md5sum(str)) end end end
- md5.sumhexa=md5.hex
- md5.sumHEXA=md5.HEX
- end
-end
-local md5HEX=md5.HEX
-function file.needsupdating(oldname,newname,threshold)
- local oldtime=modification(oldname)
- if oldtime then
- local newtime=modification(newname)
- if not newtime then
- return true
- elseif newtime>=oldtime then
- return false
- elseif oldtime-newtime<(threshold or 1) then
- return false
- else
- return true
- end
- else
- return false
- end
-end
-file.needs_updating=file.needsupdating
-function file.syncmtimes(oldname,newname)
- local oldtime=modification(oldname)
- if oldtime and isfile(newname) then
- touch(newname,oldtime,oldtime)
- end
-end
-local function checksum(name)
- if md5 then
- local data=loaddata(name)
- if data then
- return md5HEX(data)
- end
- end
- return nil
-end
-file.checksum=checksum
-function file.loadchecksum(name)
- if md5 then
- local data=loaddata(name..".md5")
- return data and (gsub(data,"%s",""))
- end
- return nil
-end
-function file.savechecksum(name,checksum)
- if not checksum then checksum=checksum(name) end
- if checksum then
- savedata(name..".md5",checksum)
- return checksum
- end
- return nil
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-sha"] = package.loaded["l-sha"] or true
-
--- original size: 1085, stripped down to: 969
-
-if not modules then modules={} end modules ['l-sha']={
- 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 sha2 then
- local lpegmatch=lpeg.match
- local lpegpatterns=lpeg.patterns
- local bytestohex=lpegpatterns.bytestohex
- local bytestoHEX=lpegpatterns.bytestoHEX
- local digest256=sha2.digest256
- local digest384=sha2.digest384
- local digest512=sha2.digest512
- sha2.hash256=function(str) return lpegmatch(bytestohex,digest256(str)) end
- sha2.hash384=function(str) return lpegmatch(bytestohex,digest384(str)) end
- sha2.hash512=function(str) return lpegmatch(bytestohex,digest512(str)) end
- sha2.HASH256=function(str) return lpegmatch(bytestoHEX,digest256(str)) end
- sha2.HASH384=function(str) return lpegmatch(bytestoHEX,digest384(str)) end
- sha2.HASH512=function(str) return lpegmatch(bytestoHEX,digest512(str)) end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-url"] = package.loaded["l-url"] or true
-
--- original size: 14755, stripped down to: 6981
-
-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,format,byte=string.char,string.format,string.byte
-local concat=table.concat
-local tonumber,type,next=tonumber,type,next
-local P,C,R,S,Cs,Cc,Ct,Cf,Cg,V=lpeg.P,lpeg.C,lpeg.R,lpeg.S,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Cf,lpeg.Cg,lpeg.V
-local lpegmatch,lpegpatterns,replacer=lpeg.match,lpeg.patterns,lpeg.replacer
-local sortedhash=table.sortedhash
-url=url or {}
-local url=url
-local unescapes={}
-local escapes={}
-setmetatable(unescapes,{ __index=function(t,k)
- local v=char(tonumber(k,16))
- t[k]=v
- return v
-end })
-setmetatable(escapes,{ __index=function(t,k)
- local v=format("%%%02X",byte(k))
- t[k]=v
- return v
-end })
-local colon=P(":")
-local qmark=P("?")
-local hash=P("#")
-local slash=P("/")
-local atsign=P("@")
-local percent=P("%")
-local endofstring=P(-1)
-local hexdigit=R("09","AF","af")
-local plus=P("+")
-local nothing=Cc("")
-local okay=R("09","AZ","az")+S("-_.,:=+*~!'()@&$")
-local escapedchar=(percent*C(hexdigit*hexdigit))/unescapes
-local unescapedchar=P(1)/escapes
-local escaped=(plus/" ")+escapedchar
-local noslash=P("/")/""
-local plustospace=P("+")/" "
-local decoder=Cs((
- plustospace+escapedchar+P("\r\n")/"\n"+P(1)
- )^0 )
-local encoder=Cs((
- R("09","AZ","az")^1+S("-./_")^1+P(" ")/"+"+P("\n")/"\r\n"+unescapedchar
- )^0 )
-lpegpatterns.urldecoder=decoder
-lpegpatterns.urlencoder=encoder
-function url.decode (str) return str and lpegmatch(decoder,str) or str end
-function url.encode (str) return str and lpegmatch(encoder,str) or str end
-function url.unescape(str) return str and lpegmatch(unescaper,str) or str end
-local schemestr=Cs((escaped+(1-colon-slash-qmark-hash))^2)
-local authoritystr=Cs((escaped+(1- slash-qmark-hash))^0)
-local pathstr=Cs((escaped+(1- qmark-hash))^0)
-local querystr=Cs(((1- hash))^0)
-local fragmentstr=Cs((escaped+(1- endofstring))^0)
-local scheme=schemestr*colon+nothing
-local authority=slash*slash*authoritystr+nothing
-local path=slash*pathstr+nothing
-local query=qmark*querystr+nothing
-local fragment=hash*fragmentstr+nothing
-local validurl=scheme*authority*path*query*fragment
-local parser=Ct(validurl)
-lpegpatterns.url=validurl
-lpegpatterns.urlsplitter=parser
-local escaper=Cs((R("09","AZ","az")^1+P(" ")/"%%20"+S("-./_:")^1+P(1)/escapes)^0)
-local unescaper=Cs((escapedchar+1)^0)
-local getcleaner=Cs((P("+++")/"%%2B"+P("+")/"%%20"+P(1))^1)
-lpegpatterns.urlunescaped=escapedchar
-lpegpatterns.urlescaper=escaper
-lpegpatterns.urlunescaper=unescaper
-lpegpatterns.urlgetcleaner=getcleaner
-function url.unescapeget(str)
- return lpegmatch(getcleaner,str)
-end
-local function split(str)
- return (type(str)=="string" and lpegmatch(parser,str)) or str
-end
-local isscheme=schemestr*colon*slash*slash
-local function hasscheme(str)
- if str then
- local scheme=lpegmatch(isscheme,str)
- return scheme~="" and scheme or false
- else
- return false
- end
-end
-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 equal=P("=")
-local amp=P("&")
-local key=Cs(((plustospace+escapedchar+1)-equal )^0)
-local value=Cs(((plustospace+escapedchar+1)-amp-endofstring)^0)
-local splitquery=Cf (Ct("")*P { "sequence",
- sequence=V("pair")*(amp*V("pair"))^0,
- pair=Cg(key*equal*value),
-},rawset)
-local userpart=(1-atsign-colon)^1
-local serverpart=(1-colon)^1
-local splitauthority=((Cs(userpart)*colon*Cs(userpart)+Cs(userpart)*Cc(nil))*atsign+Cc(nil)*Cc(nil))*Cs(serverpart)*(colon*(serverpart/tonumber)+Cc(nil))
-local function hashed(str)
- if not str or str=="" then
- return {
- scheme="invalid",
- original=str,
- }
- end
- local detailed=split(str)
- local rawscheme=""
- local rawquery=""
- local somescheme=false
- local somequery=false
- if detailed then
- rawscheme=detailed[1]
- rawquery=detailed[4]
- somescheme=rawscheme~=""
- somequery=rawquery~=""
- end
- if not somescheme and not somequery then
- return {
- scheme="file",
- authority="",
- path=str,
- query="",
- fragment="",
- original=str,
- noscheme=true,
- filename=str,
- }
- end
- local authority=detailed[2]
- local path=detailed[3]
- local filename
- local username
- local password
- local host
- local port
- if authority~="" then
- username,password,host,port=lpegmatch(splitauthority,authority)
- end
- if authority=="" then
- filename=path
- elseif path=="" then
- filename=""
- else
- filename=authority.."/"..path
- end
- return {
- scheme=rawscheme,
- authority=authority,
- path=path,
- query=lpegmatch(unescaper,rawquery),
- queries=lpegmatch(splitquery,rawquery),
- fragment=detailed[5],
- original=str,
- noscheme=false,
- filename=filename,
- host=host,
- port=port,
- }
-end
-url.split=split
-url.hasscheme=hasscheme
-url.hashed=hashed
-function url.addscheme(str,scheme)
- if hasscheme(str) then
- return str
- elseif not scheme then
- return "file:///"..str
- else
- return scheme..":///"..str
- end
-end
-function url.construct(hash)
- local result,r={},0
- local scheme=hash.scheme
- local authority=hash.authority
- local path=hash.path
- local queries=hash.queries
- local fragment=hash.fragment
- if scheme and scheme~="" then
- r=r+1;result[r]=lpegmatch(escaper,scheme)
- r=r+1;result[r]="://"
- end
- if authority and authority~="" then
- r=r+1;result[r]=lpegmatch(escaper,authority)
- end
- if path and path~="" then
- r=r+1;result[r]="/"
- r=r+1;result[r]=lpegmatch(escaper,path)
- end
- if queries then
- local done=false
- for k,v in sortedhash(queries) do
- r=r+1;result[r]=done and "&" or "?"
- r=r+1;result[r]=lpegmatch(escaper,k)
- r=r+1;result[r]="="
- r=r+1;result[r]=lpegmatch(escaper,v)
- done=true
- end
- end
- if fragment and fragment~="" then
- r=r+1;result[r]="#"
- r=r+1;result[r]=lpegmatch(escaper,fragment)
- end
- return concat(result)
-end
-local pattern=Cs(slash^-1/""*R("az","AZ")*((S(":|")/":")+P(":"))*slash*P(1)^0)
-function url.filename(filename)
- local spec=hashed(filename)
- local path=spec.path
- return (spec.scheme=="file" and path and lpegmatch(pattern,path)) or filename
-end
-local function escapestring(str)
- return lpegmatch(escaper,str)
-end
-url.escape=escapestring
-function url.query(str)
- if type(str)=="string" then
- return lpegmatch(splitquery,str) or ""
- else
- return str
- end
-end
-function url.toquery(data)
- local td=type(data)
- if td=="string" then
- return #str and escape(data) or nil
- elseif td=="table" then
- if next(data) then
- local t={}
- for k,v in next,data do
- t[#t+1]=format("%s=%s",k,escapestring(v))
- end
- return concat(t,"&")
- end
- else
- end
-end
-local pattern=Cs(noslash^0*(1-noslash*P(-1))^0)
-function url.barepath(path)
- if not path or path=="" then
- return ""
- else
- return lpegmatch(pattern,path)
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-dir"] = package.loaded["l-dir"] or true
-
--- original size: 18253, stripped down to: 10816
-
-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"
-}
-local type,select=type,select
-local find,gmatch,match,gsub,sub=string.find,string.gmatch,string.match,string.gsub,string.sub
-local concat,insert,remove,unpack=table.concat,table.insert,table.remove,table.unpack
-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 currentdir=lfs.currentdir
-local chdir=lfs.chdir
-local mkdir=lfs.mkdir
-local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true)
-if onwindows then
- local tricky=S("/\\")*P(-1)
- isdir=function(name)
- if lpegmatch(tricky,name) then
- return attributes(name,"mode")=="directory"
- else
- return attributes(name.."/.","mode")=="directory"
- end
- end
- isfile=function(name)
- return attributes(name,"mode")=="file"
- end
- lfs.isdir=isdir
- lfs.isfile=isfile
-else
- isdir=function(name)
- return attributes(name,"mode")=="directory"
- end
- isfile=function(name)
- return attributes(name,"mode")=="file"
- end
- lfs.isdir=isdir
- lfs.isfile=isfile
-end
-function dir.current()
- return (gsub(currentdir(),"\\","/"))
-end
-local function glob_pattern_function(path,patt,recurse,action)
- if isdir(path) then
- local usedpath
- if path=="/" then
- usedpath="/."
- elseif not find(path,"/$") then
- usedpath=path.."/."
- path=path.."/"
- else
- usedpath=path
- end
- local dirs
- local nofdirs=0
- for name,mode,size,time in walkdir(usedpath) do
- if name~="." and name~=".." then
- local full=path..name
- if mode==nil then
- mode=attributes(full,'mode')
- end
- if mode=='file' then
- if not patt or find(full,patt) then
- action(full,size,time)
- end
- elseif recurse and mode=="directory" then
- if dirs then
- nofdirs=nofdirs+1
- dirs[nofdirs]=full
- else
- nofdirs=1
- dirs={ full }
- end
- end
- end
- end
- if dirs then
- for i=1,nofdirs do
- glob_pattern_function(dirs[i],patt,recurse,action)
- end
- end
- end
-end
-local function glob_pattern_table(path,patt,recurse,result)
- if not result then
- result={}
- end
- local usedpath
- if path=="/" then
- usedpath="/."
- elseif not find(path,"/$") then
- usedpath=path.."/."
- path=path.."/"
- else
- usedpath=path
- end
- local dirs
- local nofdirs=0
- local noffiles=#result
- for name,mode in walkdir(usedpath) do
- if name~="." and name~=".." then
- local full=path..name
- if mode==nil then
- mode=attributes(full,'mode')
- end
- if mode=='file' then
- if not patt or find(full,patt) then
- noffiles=noffiles+1
- result[noffiles]=full
- end
- elseif recurse and mode=="directory" then
- if dirs then
- nofdirs=nofdirs+1
- dirs[nofdirs]=full
- else
- nofdirs=1
- dirs={ full }
- end
- end
- end
- end
- if dirs then
- for i=1,nofdirs do
- glob_pattern_table(dirs[i],patt,recurse,result)
- end
- end
- return result
-end
-local function globpattern(path,patt,recurse,method)
- local kind=type(method)
- if patt and sub(patt,1,-3)==path then
- patt=false
- end
- local okay=isdir(path)
- if kind=="function" then
- return okay and glob_pattern_function(path,patt,recurse,method) or {}
- elseif kind=="table" then
- return okay and glob_pattern_table(path,patt,recurse,method) or method
- else
- return okay and glob_pattern_table(path,patt,recurse,{}) or {}
- end
-end
-dir.globpattern=globpattern
-local function collectpattern(path,patt,recurse,result)
- local ok,scanner
- result=result or {}
- if path=="/" then
- ok,scanner,first=xpcall(function() return walkdir(path..".") end,function() end)
- else
- ok,scanner,first=xpcall(function() return walkdir(path) end,function() end)
- end
- if ok and type(scanner)=="function" then
- if not find(path,"/$") then
- path=path..'/'
- end
- for name in scanner,first do
- if name=="." then
- elseif name==".." then
- else
- 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" then
- attr.list=collectpattern(full,patt,recurse)
- result[name]=attr
- end
- end
- end
- end
- return result
-end
-dir.collectpattern=collectpattern
-local separator,pattern
-if onwindows then
- local slash=S("/\\")/"/"
- pattern={
- [1]=(Cs(P(".")+slash^1)+Cs(R("az","AZ")*P(":")*slash^0)+Cc("./"))*V(2)*V(3),
- [2]=Cs(((1-S("*?/\\"))^0*slash)^0),
- [3]=Cs(P(1)^0)
- }
-else
- pattern={
- [1]=(C(P(".")+P("/")^1)+Cc("./"))*V(2)*V(3),
- [2]=C(((1-S("*?/"))^0*P("/"))^0),
- [3]=C(P(1)^0)
- }
-end
-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 isfile(str) then
- t(str)
- else
- local root,path,base=lpegmatch(pattern,str)
- if root and path and base then
- local recurse=find(base,"**",1,true)
- local start=root..path
- local result=lpegmatch(filter,start..base)
- globpattern(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 isfile(str) then
- if t then
- t[#t+1]=str
- return t
- else
- return { str }
- end
- else
- local root,path,base=lpegmatch(pattern,str)
- if root and path and base then
- local recurse=find(base,"**",1,true)
- local start=root..path
- local result=lpegmatch(filter,start..base)
- return globpattern(start,result,recurse,t)
- else
- return {}
- end
- end
- end
-end
-dir.glob=glob
-local function globfiles(path,recurse,func,files)
- if type(func)=="string" then
- local s=func
- func=function(name) return find(name,s) end
- end
- files=files or {}
- local noffiles=#files
- for name,mode in walkdir(path) do
- if find(name,"^%.") then
- else
- if mode==nil then
- mode=attributes(name,'mode')
- end
- if mode=="directory" then
- if recurse then
- globfiles(path.."/"..name,recurse,func,files)
- end
- elseif mode=="file" then
- if not func or func(name) then
- noffiles=noffiles+1
- files[noffiles]=path.."/"..name
- end
- end
- end
- end
- return files
-end
-dir.globfiles=globfiles
-local function globdirs(path,recurse,func,files)
- if type(func)=="string" then
- local s=func
- func=function(name) return find(name,s) end
- end
- files=files or {}
- local noffiles=#files
- for name,mode in walkdir(path) do
- if find(name,"^%.") then
- else
- if mode==nil then
- mode=attributes(name,'mode')
- end
- if mode=="directory" then
- if not func or func(name) then
- noffiles=noffiles+1
- files[noffiles]=path.."/"..name
- if recurse then
- globdirs(path.."/"..name,recurse,func,files)
- end
- end
- end
- end
- end
- return files
-end
-dir.globdirs=globdirs
-function dir.ls(pattern)
- return concat(glob(pattern),"\n")
-end
-local make_indeed=true
-if onwindows then
- function dir.mkdirs(...)
- local n=select("#",...)
- local str
- if n==1 then
- str=select(1,...)
- if isdir(str) then
- return str,true
- end
- else
- str=""
- for i=1,n do
- local s=select(i,...)
- if s=="" then
- elseif str=="" then
- str=s
- else
- str=str.."/"..s
- end
- end
- end
- local pth=""
- local drive=false
- local first,middle,last=match(str,"^(//)(//*)(.*)$")
- if first then
- 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 isdir(pth) then
- mkdir(pth)
- end
- end
- return pth,(isdir(pth)==true)
- end
-else
- function dir.mkdirs(...)
- local n=select("#",...)
- local str,pth
- if n==1 then
- str=select(1,...)
- if isdir(str) then
- return str,true
- end
- else
- str=""
- for i=1,n do
- local s=select(i,...)
- if s and s~="" then
- if str~="" then
- str=str.."/"..s
- else
- str=s
- end
- 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 isdir(pth) then
- mkdir(pth)
- end
- end
- else
- pth="."
- for s in gmatch(str,"[^/]+") do
- pth=pth.."/"..s
- if make_indeed and not isdir(pth) then
- mkdir(pth)
- end
- end
- end
- return pth,(isdir(pth)==true)
- end
-end
-dir.makedirs=dir.mkdirs
-do
- local chdir=sandbox and sandbox.original(chdir) or chdir
- if onwindows then
- local xcurrentdir=dir.current
- function dir.expandname(str)
- local first,nothing,last=match(str,"^(//)(//*)(.*)$")
- if first then
- first=xcurrentdir().."/"
- 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=xcurrentdir()
- end
- chdir(d)
- end
- end
- if not first then
- first,last=xcurrentdir(),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)
- if not find(str,"^/") then
- str=currentdir().."/"..str
- end
- str=gsub(str,"//","/")
- str=gsub(str,"/%./","/")
- str=gsub(str,"(.)/%.$","%1")
- return str
- end
- end
-end
-file.expandname=dir.expandname
-local stack={}
-function dir.push(newdir)
- local curdir=currentdir()
- insert(stack,curdir)
- if newdir and newdir~="" and chdir(newdir) then
- return newdir
- else
- return curdir
- end
-end
-function dir.pop()
- local d=remove(stack)
- if d then
- chdir(d)
- end
- return d
-end
-local function found(...)
- for i=1,select("#",...) do
- local path=select(i,...)
- local kind=type(path)
- if kind=="string" then
- if isdir(path) then
- return path
- end
- elseif kind=="table" then
- local path=found(unpack(path))
- if path then
- return path
- end
- end
- end
-end
-dir.found=found
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-boolean"] = package.loaded["l-boolean"] or true
-
--- original size: 1850, stripped down to: 1498
-
-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"
-}
-local type,tonumber=type,tonumber
-boolean=boolean or {}
-local boolean=boolean
-function boolean.tonumber(b)
- if b then return 1 else return 0 end
-end
-function toboolean(str,tolerant)
- if str==nil then
- return false
- elseif str==false then
- return false
- elseif str==true then
- return true
- elseif str=="true" then
- return true
- elseif str=="false" then
- return false
- elseif not tolerant then
- return false
- elseif str==0 then
- return false
- elseif (tonumber(str) or 0)>0 then
- return true
- else
- return str=="yes" or str=="on" or str=="t"
- end
-end
-string.toboolean=toboolean
-function string.booleanstring(str)
- if str=="0" then
- return false
- elseif str=="1" then
- return true
- elseif str=="" then
- return false
- elseif str=="false" then
- return false
- elseif str=="true" then
- return true
- elseif (tonumber(str) or 0)>0 then
- return true
- else
- return str=="yes" or str=="on" or str=="t"
- end
-end
-function string.is_boolean(str,default,strict)
- if type(str)=="string" then
- if str=="true" or str=="yes" or str=="on" or str=="t" or (not strict and str=="1") then
- return true
- elseif str=="false" or str=="no" or str=="off" or str=="f" or (not strict and str=="0") then
- return false
- end
- end
- return default
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
-
--- original size: 41303, stripped down to: 17277
-
-if not modules then modules={} end modules ['l-unicode']={
- version=1.001,
- optimize=true,
- 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"
-}
-utf=utf or {}
-unicode=nil
-if not string.utfcharacters then
- local gmatch=string.gmatch
- function string.characters(str)
- return gmatch(str,".[\128-\191]*")
- end
-end
-utf.characters=string.utfcharacters
-local type=type
-local char,byte,format,sub,gmatch=string.char,string.byte,string.format,string.sub,string.gmatch
-local concat=table.concat
-local P,C,R,Cs,Ct,Cmt,Cc,Carg,Cp=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Ct,lpeg.Cmt,lpeg.Cc,lpeg.Carg,lpeg.Cp
-local lpegmatch=lpeg.match
-local patterns=lpeg.patterns
-local tabletopattern=lpeg.utfchartabletopattern
-local bytepairs=string.bytepairs
-local finder=lpeg.finder
-local replacer=lpeg.replacer
-local p_utftype=patterns.utftype
-local p_utfstricttype=patterns.utfstricttype
-local p_utfoffset=patterns.utfoffset
-local p_utf8character=patterns.utf8character
-local p_utf8char=patterns.utf8char
-local p_utf8byte=patterns.utf8byte
-local p_utfbom=patterns.utfbom
-local p_newline=patterns.newline
-local p_whitespace=patterns.whitespace
-if not utf.char then
- utf.char=string.utfcharacter or (utf8 and utf8.char)
- if not utf.char then
- local char=string.char
- if bit32 then
- local rshift=bit32.rshift
- function utf.char(n)
- if n<0x80 then
- return char(n)
- elseif n<0x800 then
- return char(
- 0xC0+rshift(n,6),
- 0x80+(n%0x40)
- )
- elseif n<0x10000 then
- return char(
- 0xE0+rshift(n,12),
- 0x80+(rshift(n,6)%0x40),
- 0x80+(n%0x40)
- )
- elseif n<0x200000 then
- return char(
- 0xF0+rshift(n,18),
- 0x80+(rshift(n,12)%0x40),
- 0x80+(rshift(n,6)%0x40),
- 0x80+(n%0x40)
- )
- else
- return ""
- end
- end
- else
- local floor=math.floor
- function utf.char(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<0x200000 then
- return char(
- 0xF0+floor(n/0x40000),
- 0x80+(floor(n/0x1000)%0x40),
- 0x80+(floor(n/0x40)%0x40),
- 0x80+(n%0x40)
- )
- else
- return ""
- end
- end
- end
- end
-end
-if not utf.byte then
- utf.byte=string.utfvalue or (utf8 and utf8.codepoint)
- if not utf.byte then
- function utf.byte(c)
- return lpegmatch(p_utf8byte,c)
- end
- end
-end
-local utfchar,utfbyte=utf.char,utf.byte
-function utf.filetype(data)
- return data and lpegmatch(p_utftype,data) or "unknown"
-end
-local toentities=Cs (
- (
- patterns.utf8one+(
- patterns.utf8two+patterns.utf8three+patterns.utf8four
- )/function(s) local b=utfbyte(s) if b<127 then return s else return format("&#%X;",b) end end
- )^0
-)
-patterns.toentities=toentities
-function utf.toentities(str)
- return lpegmatch(toentities,str)
-end
-local one=P(1)
-local two=C(1)*C(1)
-local four=C(R(utfchar(0xD8),utfchar(0xFF)))*C(1)*C(1)*C(1)
-local pattern=P("\254\255")*Cs((
- four/function(a,b,c,d)
- local ab=0xFF*byte(a)+byte(b)
- local cd=0xFF*byte(c)+byte(d)
- return utfchar((ab-0xD800)*0x400+(cd-0xDC00)+0x10000)
- end+two/function(a,b)
- return utfchar(byte(a)*256+byte(b))
- end+one
- )^1 )+P("\255\254")*Cs((
- four/function(b,a,d,c)
- local ab=0xFF*byte(a)+byte(b)
- local cd=0xFF*byte(c)+byte(d)
- return utfchar((ab-0xD800)*0x400+(cd-0xDC00)+0x10000)
- end+two/function(b,a)
- return utfchar(byte(a)*256+byte(b))
- end+one
- )^1 )
-function string.toutf(s)
- return lpegmatch(pattern,s) or s
-end
-local validatedutf=Cs (
- (
- patterns.utf8one+patterns.utf8two+patterns.utf8three+patterns.utf8four+P(1)/"�"
- )^0
-)
-patterns.validatedutf=validatedutf
-function utf.is_valid(str)
- return type(str)=="string" and lpegmatch(validatedutf,str) or false
-end
-if not utf.len then
- utf.len=string.utflength or (utf8 and utf8.len)
- if not utf.len then
- local n,f=0,1
- local utfcharcounter=patterns.utfbom^-1*Cmt (
- Cc(1)*patterns.utf8one^1+Cc(2)*patterns.utf8two^1+Cc(3)*patterns.utf8three^1+Cc(4)*patterns.utf8four^1,
- function(_,t,d)
- n=n+(t-f)/d
- f=t
- return true
- end
- )^0
- function utf.len(str)
- n,f=0,1
- lpegmatch(utfcharcounter,str or "")
- return n
- end
- end
-end
-utf.length=utf.len
-if not utf.sub then
- local utflength=utf.length
- local b,e,n,first,last=0,0,0,0,0
- local function slide_zero(s,p)
- n=n+1
- if n>=last then
- e=p-1
- else
- return p
- end
- end
- local function slide_one(s,p)
- n=n+1
- if n==first then
- b=p
- end
- if n>=last then
- e=p-1
- else
- return p
- end
- end
- local function slide_two(s,p)
- n=n+1
- if n==first then
- b=p
- else
- return true
- end
- end
- local pattern_zero=Cmt(p_utf8character,slide_zero)^0
- local pattern_one=Cmt(p_utf8character,slide_one )^0
- local pattern_two=Cmt(p_utf8character,slide_two )^0
- local pattern_first=C(p_utf8character)
- function utf.sub(str,start,stop)
- if not start then
- return str
- end
- if start==0 then
- start=1
- end
- if not stop then
- if start<0 then
- local l=utflength(str)
- start=l+start
- else
- start=start-1
- end
- b,n,first=0,0,start
- lpegmatch(pattern_two,str)
- if n>=first then
- return sub(str,b)
- else
- return ""
- end
- end
- if start<0 or stop<0 then
- local l=utf.length(str)
- if start<0 then
- start=l+start
- if start<=0 then
- start=1
- else
- start=start+1
- end
- end
- if stop<0 then
- stop=l+stop
- if stop==0 then
- stop=1
- else
- stop=stop+1
- end
- end
- end
- if start==1 and stop==1 then
- return lpegmatch(pattern_first,str) or ""
- elseif start>stop then
- return ""
- elseif start>1 then
- b,e,n,first,last=0,0,0,start-1,stop
- lpegmatch(pattern_one,str)
- if n>=first and e==0 then
- e=#str
- end
- return sub(str,b,e)
- else
- b,e,n,last=1,0,0,stop
- lpegmatch(pattern_zero,str)
- if e==0 then
- e=#str
- end
- return sub(str,b,e)
- end
- end
-end
-function utf.remapper(mapping,option,action)
- local variant=type(mapping)
- if variant=="table" then
- action=action or mapping
- if option=="dynamic" then
- local pattern=false
- table.setmetatablenewindex(mapping,function(t,k,v) rawset(t,k,v) pattern=false end)
- return function(str)
- if not str or str=="" then
- return ""
- else
- if not pattern then
- pattern=Cs((tabletopattern(mapping)/action+p_utf8character)^0)
- end
- return lpegmatch(pattern,str)
- end
- end
- elseif option=="pattern" then
- return Cs((tabletopattern(mapping)/action+p_utf8character)^0)
- else
- local pattern=Cs((tabletopattern(mapping)/action+p_utf8character)^0)
- return function(str)
- if not str or str=="" then
- return ""
- else
- return lpegmatch(pattern,str)
- end
- end,pattern
- end
- elseif variant=="function" then
- if option=="pattern" then
- return Cs((p_utf8character/mapping+p_utf8character)^0)
- else
- local pattern=Cs((p_utf8character/mapping+p_utf8character)^0)
- return function(str)
- if not str or str=="" then
- return ""
- else
- return lpegmatch(pattern,str)
- end
- end,pattern
- end
- else
- return function(str)
- return str or ""
- end
- end
-end
-function utf.replacer(t)
- local r=replacer(t,false,false,true)
- return function(str)
- return lpegmatch(r,str)
- end
-end
-function utf.subtituter(t)
- local f=finder (t)
- local r=replacer(t,false,false,true)
- return function(str)
- local i=lpegmatch(f,str)
- if not i then
- return str
- elseif i>#str then
- return str
- else
- return lpegmatch(r,str)
- end
- end
-end
-local utflinesplitter=p_utfbom^-1*lpeg.tsplitat(p_newline)
-local utfcharsplitter_ows=p_utfbom^-1*Ct(C(p_utf8character)^0)
-local utfcharsplitter_iws=p_utfbom^-1*Ct((p_whitespace^1+C(p_utf8character))^0)
-local utfcharsplitter_raw=Ct(C(p_utf8character)^0)
-patterns.utflinesplitter=utflinesplitter
-function utf.splitlines(str)
- return lpegmatch(utflinesplitter,str or "")
-end
-function utf.split(str,ignorewhitespace)
- if ignorewhitespace then
- return lpegmatch(utfcharsplitter_iws,str or "")
- else
- return lpegmatch(utfcharsplitter_ows,str or "")
- end
-end
-function utf.totable(str)
- return lpegmatch(utfcharsplitter_raw,str)
-end
-function utf.magic(f)
- local str=f:read(4) or ""
- local off=lpegmatch(p_utfoffset,str)
- if off<4 then
- f:seek('set',off)
- end
- return lpegmatch(p_utftype,str)
-end
-local utf16_to_utf8_be,utf16_to_utf8_le
-local utf32_to_utf8_be,utf32_to_utf8_le
-local utf_16_be_getbom=patterns.utfbom_16_be^-1
-local utf_16_le_getbom=patterns.utfbom_16_le^-1
-local utf_32_be_getbom=patterns.utfbom_32_be^-1
-local utf_32_le_getbom=patterns.utfbom_32_le^-1
-local utf_16_be_linesplitter=utf_16_be_getbom*lpeg.tsplitat(patterns.utf_16_be_nl)
-local utf_16_le_linesplitter=utf_16_le_getbom*lpeg.tsplitat(patterns.utf_16_le_nl)
-local utf_32_be_linesplitter=utf_32_be_getbom*lpeg.tsplitat(patterns.utf_32_be_nl)
-local utf_32_le_linesplitter=utf_32_le_getbom*lpeg.tsplitat(patterns.utf_32_le_nl)
-local more=0
-local p_utf16_to_utf8_be=C(1)*C(1)/function(left,right)
- local now=256*byte(left)+byte(right)
- if more>0 then
- now=(more-0xD800)*0x400+(now-0xDC00)+0x10000
- more=0
- return utfchar(now)
- elseif now>=0xD800 and now<=0xDBFF then
- more=now
- return ""
- else
- return utfchar(now)
- end
-end
-local p_utf16_to_utf8_le=C(1)*C(1)/function(right,left)
- local now=256*byte(left)+byte(right)
- if more>0 then
- now=(more-0xD800)*0x400+(now-0xDC00)+0x10000
- more=0
- return utfchar(now)
- elseif now>=0xD800 and now<=0xDBFF then
- more=now
- return ""
- else
- return utfchar(now)
- end
-end
-local p_utf32_to_utf8_be=C(1)*C(1)*C(1)*C(1)/function(a,b,c,d)
- return utfchar(256*256*256*byte(a)+256*256*byte(b)+256*byte(c)+byte(d))
-end
-local p_utf32_to_utf8_le=C(1)*C(1)*C(1)*C(1)/function(a,b,c,d)
- return utfchar(256*256*256*byte(d)+256*256*byte(c)+256*byte(b)+byte(a))
-end
-p_utf16_to_utf8_be=P(true)/function() more=0 end*utf_16_be_getbom*Cs(p_utf16_to_utf8_be^0)
-p_utf16_to_utf8_le=P(true)/function() more=0 end*utf_16_le_getbom*Cs(p_utf16_to_utf8_le^0)
-p_utf32_to_utf8_be=P(true)/function() more=0 end*utf_32_be_getbom*Cs(p_utf32_to_utf8_be^0)
-p_utf32_to_utf8_le=P(true)/function() more=0 end*utf_32_le_getbom*Cs(p_utf32_to_utf8_le^0)
-patterns.utf16_to_utf8_be=p_utf16_to_utf8_be
-patterns.utf16_to_utf8_le=p_utf16_to_utf8_le
-patterns.utf32_to_utf8_be=p_utf32_to_utf8_be
-patterns.utf32_to_utf8_le=p_utf32_to_utf8_le
-utf16_to_utf8_be=function(s)
- if s and s~="" then
- return lpegmatch(p_utf16_to_utf8_be,s)
- else
- return s
- end
-end
-local utf16_to_utf8_be_t=function(t)
- if not t then
- return nil
- elseif type(t)=="string" then
- t=lpegmatch(utf_16_be_linesplitter,t)
- end
- for i=1,#t do
- local s=t[i]
- if s~="" then
- t[i]=lpegmatch(p_utf16_to_utf8_be,s)
- end
- end
- return t
-end
-utf16_to_utf8_le=function(s)
- if s and s~="" then
- return lpegmatch(p_utf16_to_utf8_le,s)
- else
- return s
- end
-end
-local utf16_to_utf8_le_t=function(t)
- if not t then
- return nil
- elseif type(t)=="string" then
- t=lpegmatch(utf_16_le_linesplitter,t)
- end
- for i=1,#t do
- local s=t[i]
- if s~="" then
- t[i]=lpegmatch(p_utf16_to_utf8_le,s)
- end
- end
- return t
-end
-utf32_to_utf8_be=function(s)
- if s and s~="" then
- return lpegmatch(p_utf32_to_utf8_be,s)
- else
- return s
- end
-end
-local utf32_to_utf8_be_t=function(t)
- if not t then
- return nil
- elseif type(t)=="string" then
- t=lpegmatch(utf_32_be_linesplitter,t)
- end
- for i=1,#t do
- local s=t[i]
- if s~="" then
- t[i]=lpegmatch(p_utf32_to_utf8_be,s)
- end
- end
- return t
-end
-utf32_to_utf8_le=function(s)
- if s and s~="" then
- return lpegmatch(p_utf32_to_utf8_le,s)
- else
- return s
- end
-end
-local utf32_to_utf8_le_t=function(t)
- if not t then
- return nil
- elseif type(t)=="string" then
- t=lpegmatch(utf_32_le_linesplitter,t)
- end
- for i=1,#t do
- local s=t[i]
- if s~="" then
- t[i]=lpegmatch(p_utf32_to_utf8_le,s)
- end
- end
- return t
-end
-utf.utf16_to_utf8_le_t=utf16_to_utf8_le_t
-utf.utf16_to_utf8_be_t=utf16_to_utf8_be_t
-utf.utf32_to_utf8_le_t=utf32_to_utf8_le_t
-utf.utf32_to_utf8_be_t=utf32_to_utf8_be_t
-utf.utf16_to_utf8_le=utf16_to_utf8_le
-utf.utf16_to_utf8_be=utf16_to_utf8_be
-utf.utf32_to_utf8_le=utf32_to_utf8_le
-utf.utf32_to_utf8_be=utf32_to_utf8_be
-function utf.utf8_to_utf8_t(t)
- return type(t)=="string" and lpegmatch(utflinesplitter,t) or t
-end
-function utf.utf16_to_utf8_t(t,endian)
- return endian and utf16_to_utf8_be_t(t) or utf16_to_utf8_le_t(t) or t
-end
-function utf.utf32_to_utf8_t(t,endian)
- return endian and utf32_to_utf8_be_t(t) or utf32_to_utf8_le_t(t) or t
-end
-if bit32 then
- local rshift=bit32.rshift
- local function little(b)
- if b<0x10000 then
- return char(b%256,rshift(b,8))
- else
- b=b-0x10000
- local b1=rshift(b,10)+0xD800
- local b2=b%1024+0xDC00
- return char(b1%256,rshift(b1,8),b2%256,rshift(b2,8))
- end
- end
- local function big(b)
- if b<0x10000 then
- return char(rshift(b,8),b%256)
- else
- b=b-0x10000
- local b1=rshift(b,10)+0xD800
- local b2=b%1024+0xDC00
- return char(rshift(b1,8),b1%256,rshift(b2,8),b2%256)
- end
- end
- local l_remap=Cs((p_utf8byte/little+P(1)/"")^0)
- local b_remap=Cs((p_utf8byte/big+P(1)/"")^0)
- local function utf8_to_utf16_be(str,nobom)
- if nobom then
- return lpegmatch(b_remap,str)
- else
- return char(254,255)..lpegmatch(b_remap,str)
- end
- end
- local function utf8_to_utf16_le(str,nobom)
- if nobom then
- return lpegmatch(l_remap,str)
- else
- return char(255,254)..lpegmatch(l_remap,str)
- end
- end
- utf.utf8_to_utf16_be=utf8_to_utf16_be
- utf.utf8_to_utf16_le=utf8_to_utf16_le
- function utf.utf8_to_utf16(str,littleendian,nobom)
- if littleendian then
- return utf8_to_utf16_le(str,nobom)
- else
- return utf8_to_utf16_be(str,nobom)
- end
- end
-end
-local pattern=Cs (
- (p_utf8byte/function(unicode ) return format("0x%04X",unicode) end)*(p_utf8byte*Carg(1)/function(unicode,separator) return format("%s0x%04X",separator,unicode) end)^0
-)
-function utf.tocodes(str,separator)
- return lpegmatch(pattern,str,1,separator or " ")
-end
-function utf.ustring(s)
- return format("U+%05X",type(s)=="number" and s or utfbyte(s))
-end
-function utf.xstring(s)
- return format("0x%05X",type(s)=="number" and s or utfbyte(s))
-end
-function utf.toeight(str)
- if not str or str=="" then
- return nil
- end
- local utftype=lpegmatch(p_utfstricttype,str)
- if utftype=="utf-8" then
- return sub(str,4)
- elseif utftype=="utf-16-be" then
- return utf16_to_utf8_be(str)
- elseif utftype=="utf-16-le" then
- return utf16_to_utf8_le(str)
- else
- return str
- end
-end
-do
- local p_nany=p_utf8character/""
- local cache={}
- function utf.count(str,what)
- if type(what)=="string" then
- local p=cache[what]
- if not p then
- p=Cs((P(what)/" "+p_nany)^0)
- cache[p]=p
- end
- return #lpegmatch(p,str)
- else
- return #lpegmatch(Cs((P(what)/" "+p_nany)^0),str)
- end
- end
-end
-if not string.utfvalues then
- local find=string.find
- local dummy=function()
- end
- function string.utfvalues(str)
- local n=#str
- if n==0 then
- return dummy
- elseif n==1 then
- return function() return utfbyte(str) end
- else
- local p=1
- return function()
- local b,e=find(str,".[\128-\191]*",p)
- if b then
- p=e+1
- return utfbyte(sub(str,b,e))
- end
- end
- end
- end
-end
-utf.values=string.utfvalues
-function utf.chrlen(u)
- return
- (u<0x80 and 1) or
- (u<0xE0 and 2) or
- (u<0xF0 and 3) or
- (u<0xF8 and 4) or
- (u<0xFC and 5) or
- (u<0xFE and 6) or 0
-end
-if bit32 then
- local extract=bit32.extract
- local char=string.char
- function utf.toutf32string(n)
- if n<=0xFF then
- return
- char(n).."\000\000\000"
- elseif n<=0xFFFF then
- return
- char(extract(n,0,8))..char(extract(n,8,8)).."\000\000"
- elseif n<=0xFFFFFF then
- return
- char(extract(n,0,8))..char(extract(n,8,8))..char(extract(n,16,8)).."\000"
- else
- return
- char(extract(n,0,8))..char(extract(n,8,8))..char(extract(n,16,8))..char(extract(n,24,8))
- end
- end
-end
-local len=utf.len
-local rep=rep
-function string.utfpadd(s,n)
- if n and n~=0 then
- local l=len(s)
- if n>0 then
- local d=n-l
- if d>0 then
- return rep(c or " ",d)..s
- end
- else
- local d=- n-l
- if d>0 then
- return s..rep(c or " ",d)
- end
- end
- end
- return s
-end
-do
- local utfcharacters=utf.characters or string.utfcharacters
- local utfchar=utf.char or string.utfcharacter
- lpeg.UP=P
- if utfcharacters then
- function lpeg.US(str)
- local p=P(false)
- for uc in utfcharacters(str) do
- p=p+P(uc)
- end
- return p
- end
- else
- function lpeg.US(str)
- local p=P(false)
- local f=function(uc)
- p=p+P(uc)
- end
- lpegmatch((p_utf8char/f)^0,str)
- return p
- end
- end
- local range=p_utf8byte*p_utf8byte+Cc(false)
- function lpeg.UR(str,more)
- local first,last
- if type(str)=="number" then
- first=str
- last=more or first
- else
- first,last=lpegmatch(range,str)
- if not last then
- return P(str)
- end
- end
- if first==last then
- return P(str)
- end
- if not utfchar then
- utfchar=utf.char
- end
- if utfchar and (last-first<8) then
- local p=P(false)
- for i=first,last do
- p=p+P(utfchar(i))
- end
- return p
- else
- local f=function(b)
- return b>=first and b<=last
- end
- return p_utf8byte/f
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["l-math"] = package.loaded["l-math"] or true
-
--- original size: 2555, stripped down to: 1831
-
-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"
-}
-if not math.ceiling then
- math.ceiling=math.ceil
-end
-if not math.round then
- local floor=math.floor
- function math.round(x) return floor(x+0.5) end
-end
-if not math.div then
- local floor=math.floor
- 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
-if not math.sind then
- local sin,cos,tan=math.sin,math.cos,math.tan
- 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
-if not math.odd then
- function math.odd (n) return n%2~=0 end
- function math.even(n) return n%2==0 end
-end
-if not math.cosh then
- local exp=math.exp
- function math.cosh(x)
- local xx=exp(x)
- return (xx+1/xx)/2
- end
- function math.sinh(x)
- local xx=exp(x)
- return (xx-1/xx)/2
- end
- function math.tanh(x)
- local xx=exp(x)
- return (xx-1/xx)/(xx+1/xx)
- end
-end
-if not math.pow then
- function math.pow(x,y)
- return x^y
- end
-end
-if not math.atan2 then
- math.atan2=math.atan
-end
-if not math.ldexp then
- function math.ldexp(x,e)
- return x*2.0^e
- end
-end
-if not math.log10 then
- local log=math.log
- function math.log10(x)
- return log(x,10)
- end
-end
-if not math.type then
- function math.type()
- return "float"
- end
-end
-if not math.tointeger then
- math.mininteger=-0x4FFFFFFFFFFF
- math.maxinteger=0x4FFFFFFFFFFF
- local floor=math.floor
- function math.tointeger(n)
- local f=floor(n)
- return f==n and f or nil
- end
-end
-if not math.ult then
- local floor=math.floor
- function math.tointeger(m,n)
- return floor(m)<floor(n)
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-str"] = package.loaded["util-str"] or true
-
--- original size: 45129, stripped down to: 23525
-
-if not modules then modules={} end modules ['util-str']={
- 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.strings=utilities.strings or {}
-local strings=utilities.strings
-local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find
-local load,dump=load,string.dump
-local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable
-local unpack,concat=table.unpack,table.concat
-local P,V,C,S,R,Ct,Cs,Cp,Carg,Cc=lpeg.P,lpeg.V,lpeg.C,lpeg.S,lpeg.R,lpeg.Ct,lpeg.Cs,lpeg.Cp,lpeg.Carg,lpeg.Cc
-local patterns,lpegmatch=lpeg.patterns,lpeg.match
-local utfchar,utfbyte,utflen=utf.char,utf.byte,utf.len
-local loadstripped=function(str,shortcuts)
- if shortcuts then
- return load(dump(load(str),true),nil,nil,shortcuts)
- else
- return load(dump(load(str),true))
- end
-end
-if not number then number={} end
-local stripzero=patterns.stripzero
-local stripzeros=patterns.stripzeros
-local newline=patterns.newline
-local endofstring=patterns.endofstring
-local anything=patterns.anything
-local whitespace=patterns.whitespace
-local space=patterns.space
-local spacer=patterns.spacer
-local spaceortab=patterns.spaceortab
-local digit=patterns.digit
-local sign=patterns.sign
-local period=patterns.period
-local ptf=1/65536
-local bpf=(7200/7227)/65536
-local function points(n)
- if n==0 then
- return "0pt"
- end
- n=tonumber(n)
- if not n or n==0 then
- return "0pt"
- end
- n=n*ptf
- if n%1==0 then
- return format("%ipt",n)
- else
- return lpegmatch(stripzeros,format("%.5fpt",n))
- end
-end
-local function nupoints(n)
- if n==0 then
- return "0"
- end
- n=tonumber(n)
- if not n or n==0 then
- return "0"
- end
- n=n*ptf
- if n%1==0 then
- return format("%i",n)
- else
- return format("%.5f",n)
- end
-end
-local function basepoints(n)
- if n==0 then
- return "0bp"
- end
- n=tonumber(n)
- if not n or n==0 then
- return "0bp"
- end
- n=n*bpf
- if n%1==0 then
- return format("%ibp",n)
- else
- return lpegmatch(stripzeros,format("%.5fbp",n))
- end
-end
-local function nubasepoints(n)
- if n==0 then
- return "0"
- end
- n=tonumber(n)
- if not n or n==0 then
- return "0"
- end
- n=n*bpf
- if n%1==0 then
- return format("%i",n)
- else
- return format("%.5f",n)
- end
-end
-number.points=points
-number.nupoints=nupoints
-number.basepoints=basepoints
-number.nubasepoints=nubasepoints
-local rubish=spaceortab^0*newline
-local anyrubish=spaceortab+newline
-local stripped=(spaceortab^1/"")*newline
-local leading=rubish^0/""
-local trailing=(anyrubish^1*endofstring)/""
-local redundant=rubish^3/"\n"
-local pattern=Cs(leading*(trailing+redundant+stripped+anything)^0)
-function strings.collapsecrlf(str)
- return lpegmatch(pattern,str)
-end
-local repeaters={}
-function strings.newrepeater(str,offset)
- offset=offset or 0
- local s=repeaters[str]
- if not s then
- s={}
- repeaters[str]=s
- end
- local t=s[offset]
- if t then
- return t
- end
- t={}
- setmetatable(t,{ __index=function(t,k)
- if not k then
- return ""
- end
- local n=k+offset
- local s=n>0 and rep(str,n) or ""
- t[k]=s
- return s
- end })
- s[offset]=t
- return t
-end
-local extra,tab,start=0,0,4,0
-local nspaces=strings.newrepeater(" ")
-string.nspaces=nspaces
-local pattern=Carg(1)/function(t)
- extra,tab,start=0,t or 7,1
- end*Cs((
- Cp()*patterns.tab/function(position)
- local current=(position-start+1)+extra
- local spaces=tab-(current-1)%tab
- if spaces>0 then
- extra=extra+spaces-1
- return nspaces[spaces]
- else
- return ""
- end
- end+newline*Cp()/function(position)
- extra,start=0,position
- end+anything
- )^1)
-function strings.tabtospace(str,tab)
- return lpegmatch(pattern,str,1,tab or 7)
-end
-function string.utfpadding(s,n)
- if not n or n==0 then
- return ""
- end
- local l=utflen(s)
- if n>0 then
- return nspaces[n-l]
- else
- return nspaces[-n-l]
- end
-end
-local optionalspace=spacer^0
-local nospace=optionalspace/""
-local endofline=nospace*newline
-local stripend=(whitespace^1*endofstring)/""
-local normalline=(nospace*((1-optionalspace*(newline+endofstring))^1)*nospace)
-local stripempty=endofline^1/""
-local normalempty=endofline^1
-local singleempty=endofline*(endofline^0/"")
-local doubleempty=endofline*endofline^-1*(endofline^0/"")
-local stripstart=stripempty^0
-local intospace=whitespace^1/" "
-local noleading=whitespace^1/""
-local notrailing=noleading*endofstring
-local p_prune_normal=Cs (stripstart*(stripend+normalline+normalempty )^0 )
-local p_prune_collapse=Cs (stripstart*(stripend+normalline+doubleempty )^0 )
-local p_prune_noempty=Cs (stripstart*(stripend+normalline+singleempty )^0 )
-local p_prune_intospace=Cs (noleading*(notrailing+intospace+1 )^0 )
-local p_retain_normal=Cs ((normalline+normalempty )^0 )
-local p_retain_collapse=Cs ((normalline+doubleempty )^0 )
-local p_retain_noempty=Cs ((normalline+singleempty )^0 )
-local striplinepatterns={
- ["prune"]=p_prune_normal,
- ["prune and collapse"]=p_prune_collapse,
- ["prune and no empty"]=p_prune_noempty,
- ["prune and to space"]=p_prune_intospace,
- ["retain"]=p_retain_normal,
- ["retain and collapse"]=p_retain_collapse,
- ["retain and no empty"]=p_retain_noempty,
- ["collapse"]=patterns.collapser,
-}
-setmetatable(striplinepatterns,{ __index=function(t,k) return p_prune_collapse end })
-strings.striplinepatterns=striplinepatterns
-function strings.striplines(str,how)
- return str and lpegmatch(striplinepatterns[how],str) or str
-end
-function strings.collapse(str)
- return str and lpegmatch(p_prune_intospace,str) or str
-end
-strings.striplong=strings.striplines
-function strings.nice(str)
- str=gsub(str,"[:%-+_]+"," ")
- return str
-end
-local n=0
-local sequenced=table.sequenced
-function string.autodouble(s,sep)
- if s==nil then
- return '""'
- end
- local t=type(s)
- if t=="number" then
- return tostring(s)
- end
- if t=="table" then
- return ('"'..sequenced(s,sep or ",")..'"')
- end
- return ('"'..tostring(s)..'"')
-end
-function string.autosingle(s,sep)
- if s==nil then
- return "''"
- end
- local t=type(s)
- if t=="number" then
- return tostring(s)
- end
- if t=="table" then
- return ("'"..sequenced(s,sep or ",").."'")
- end
- return ("'"..tostring(s).."'")
-end
-local tracedchars={ [0]=
- "[null]","[soh]","[stx]","[etx]","[eot]","[enq]","[ack]","[bel]",
- "[bs]","[ht]","[lf]","[vt]","[ff]","[cr]","[so]","[si]",
- "[dle]","[dc1]","[dc2]","[dc3]","[dc4]","[nak]","[syn]","[etb]",
- "[can]","[em]","[sub]","[esc]","[fs]","[gs]","[rs]","[us]",
- "[space]",
-}
-string.tracedchars=tracedchars
-strings.tracers=tracedchars
-function string.tracedchar(b)
- if type(b)=="number" then
- return tracedchars[b] or (utfchar(b).." (U+"..format("%05X",b)..")")
- else
- local c=utfbyte(b)
- return tracedchars[c] or (b.." (U+"..(c and format("%05X",c) or "?????")..")")
- end
-end
-function number.signed(i)
- if i>0 then
- return "+",i
- else
- return "-",-i
- end
-end
-local two=digit*digit
-local three=two*digit
-local prefix=(Carg(1)*three)^1
-local splitter=Cs (
- (((1-(three^1*period))^1+C(three))*prefix+C((1-period)^1))*(anything/""*Carg(2))*C(2)
-)
-local splitter3=Cs (
- three*prefix*endofstring+two*prefix*endofstring+digit*prefix*endofstring+three+two+digit
-)
-patterns.formattednumber=splitter
-function number.formatted(n,sep1,sep2)
- if sep1==false then
- if type(n)=="number" then
- n=tostring(n)
- end
- return lpegmatch(splitter3,n,1,sep2 or ".")
- else
- if type(n)=="number" then
- n=format("%0.2f",n)
- end
- if sep1==true then
- return lpegmatch(splitter,n,1,".",",")
- elseif sep1=="." then
- return lpegmatch(splitter,n,1,sep1,sep2 or ",")
- elseif sep1=="," then
- return lpegmatch(splitter,n,1,sep1,sep2 or ".")
- else
- return lpegmatch(splitter,n,1,sep1 or ",",sep2 or ".")
- end
- end
-end
-local p=Cs(
- P("-")^0*(P("0")^1/"")^0*(1-period)^0*(period*P("0")^1*endofstring/""+period^0)*P(1-P("0")^1*endofstring)^0
- )
-function number.compactfloat(n,fmt)
- if n==0 then
- return "0"
- elseif n==1 then
- return "1"
- end
- n=lpegmatch(p,format(fmt or "%0.3f",n))
- if n=="." or n=="" or n=="-" then
- return "0"
- end
- return n
-end
-local zero=P("0")^1/""
-local plus=P("+")/""
-local minus=P("-")
-local separator=period
-local trailing=zero^1*#S("eE")
-local exponent=(S("eE")*(plus+Cs((minus*zero^0*endofstring)/"")+minus)*zero^0*(endofstring*Cc("0")+anything^1))
-local pattern_a=Cs(minus^0*digit^1*(separator/""*trailing+separator*(trailing+digit)^0)*exponent)
-local pattern_b=Cs((exponent+anything)^0)
-function number.sparseexponent(f,n)
- if not n then
- n=f
- f="%e"
- end
- local tn=type(n)
- if tn=="string" then
- local m=tonumber(n)
- if m then
- return lpegmatch((f=="%e" or f=="%E") and pattern_a or pattern_b,format(f,m))
- end
- elseif tn=="number" then
- return lpegmatch((f=="%e" or f=="%E") and pattern_a or pattern_b,format(f,n))
- end
- return tostring(n)
-end
-local hf={}
-local hs={}
-setmetatable(hf,{ __index=function(t,k)
- local v="%."..k.."f"
- t[k]=v
- return v
-end } )
-setmetatable(hs,{ __index=function(t,k)
- local v="%"..k.."s"
- t[k]=v
- return v
-end } )
-function number.formattedfloat(n,b,a)
- local s=format(hf[a],n)
- local l=(b or 0)+(a or 0)+1
- if #s<l then
- return format(hs[l],s)
- else
- return s
- end
-end
-local template=[[
-%s
-%s
-return function(%s) return %s end
-]]
-local pattern=Cs(Cc('"')*(
- (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r'
-)^0*Cc('"'))
-patterns.escapedquotes=pattern
-function string.escapedquotes(s)
- return lpegmatch(pattern,s)
-end
-local preamble=""
-local environment={
- global=global or _G,
- lpeg=lpeg,
- type=type,
- tostring=tostring,
- tonumber=tonumber,
- format=string.format,
- concat=table.concat,
- signed=number.signed,
- points=number.points,
- nupoints=number.nupoints,
- basepoints=number.basepoints,
- nubasepoints=number.nubasepoints,
- utfchar=utf.char,
- utfbyte=utf.byte,
- lpegmatch=lpeg.match,
- nspaces=string.nspaces,
- utfpadding=string.utfpadding,
- tracedchar=string.tracedchar,
- autosingle=string.autosingle,
- autodouble=string.autodouble,
- sequenced=table.sequenced,
- formattednumber=number.formatted,
- sparseexponent=number.sparseexponent,
- formattedfloat=number.formattedfloat,
- stripzero=patterns.stripzero,
- stripzeros=patterns.stripzeros,
- escapedquotes=string.escapedquotes,
- FORMAT=string.f6,
-}
-local arguments={ "a1" }
-setmetatable(arguments,{ __index=function(t,k)
- local v=t[k-1]..",a"..k
- t[k]=v
- return v
- end
-})
-local prefix_any=C((sign+space+period+digit)^0)
-local prefix_sub=(C((sign+digit)^0)+Cc(0))*period*(C((sign+digit)^0)+Cc(0))
-local prefix_tab=P("{")*C((1-P("}"))^0)*P("}")+C((1-R("az","AZ","09","%%"))^0)
-local format_s=function(f)
- n=n+1
- if f and f~="" then
- return format("format('%%%ss',a%s)",f,n)
- else
- return format("(a%s or '')",n)
- end
-end
-local format_S=function(f)
- n=n+1
- if f and f~="" then
- return format("format('%%%ss',tostring(a%s))",f,n)
- else
- return format("tostring(a%s)",n)
- end
-end
-local format_right=function(f)
- n=n+1
- f=tonumber(f)
- if not f or f==0 then
- return format("(a%s or '')",n)
- elseif f>0 then
- return format("utfpadding(a%s,%i)..a%s",n,f,n)
- else
- return format("a%s..utfpadding(a%s,%i)",n,n,f)
- end
-end
-local format_left=function(f)
- n=n+1
- f=tonumber(f)
- if not f or f==0 then
- return format("(a%s or '')",n)
- end
- if f<0 then
- return format("utfpadding(a%s,%i)..a%s",n,-f,n)
- else
- return format("a%s..utfpadding(a%s,%i)",n,n,-f)
- end
-end
-local format_q=JITSUPPORTED and function()
- n=n+1
- return format("(a%s ~= nil and format('%%q',tostring(a%s)) or '')",n,n)
-end or function()
- n=n+1
- return format("(a%s ~= nil and format('%%q',a%s) or '')",n,n)
-end
-local format_Q=function()
- n=n+1
- return format("escapedquotes(tostring(a%s))",n)
-end
-local format_i=function(f)
- n=n+1
- if f and f~="" then
- return format("format('%%%si',a%s)",f,n)
- else
- return format("format('%%i',a%s)",n)
- end
-end
-local format_d=format_i
-local format_I=function(f)
- n=n+1
- return format("format('%%s%%%si',signed(a%s))",f,n)
-end
-local format_f=function(f)
- n=n+1
- return format("format('%%%sf',a%s)",f,n)
-end
-local format_F=function(f)
- n=n+1
- if not f or f=="" then
- return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
- else
- return format("format((a%s %% 1 == 0) and '%%i' or '%%%sf',a%s)",n,f,n)
- end
-end
-local format_k=function(b,a)
- n=n+1
- return format("formattedfloat(a%s,%s,%s)",n,b or 0,a or 0)
-end
-local format_g=function(f)
- n=n+1
- return format("format('%%%sg',a%s)",f,n)
-end
-local format_G=function(f)
- n=n+1
- return format("format('%%%sG',a%s)",f,n)
-end
-local format_e=function(f)
- n=n+1
- return format("format('%%%se',a%s)",f,n)
-end
-local format_E=function(f)
- n=n+1
- return format("format('%%%sE',a%s)",f,n)
-end
-local format_j=function(f)
- n=n+1
- return format("sparseexponent('%%%se',a%s)",f,n)
-end
-local format_J=function(f)
- n=n+1
- return format("sparseexponent('%%%sE',a%s)",f,n)
-end
-local format_x=function(f)
- n=n+1
- return format("format('%%%sx',a%s)",f,n)
-end
-local format_X=function(f)
- n=n+1
- return format("format('%%%sX',a%s)",f,n)
-end
-local format_o=function(f)
- n=n+1
- return format("format('%%%so',a%s)",f,n)
-end
-local format_c=function()
- n=n+1
- return format("utfchar(a%s)",n)
-end
-local format_C=function()
- n=n+1
- return format("tracedchar(a%s)",n)
-end
-local format_r=function(f)
- n=n+1
- return format("format('%%%s.0f',a%s)",f,n)
-end
-local format_h=function(f)
- n=n+1
- if f=="-" then
- f=sub(f,2)
- return format("format('%%%sx',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- else
- return format("format('0x%%%sx',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- end
-end
-local format_H=function(f)
- n=n+1
- if f=="-" then
- f=sub(f,2)
- return format("format('%%%sX',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- else
- return format("format('0x%%%sX',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- end
-end
-local format_u=function(f)
- n=n+1
- if f=="-" then
- f=sub(f,2)
- return format("format('%%%sx',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- else
- return format("format('u+%%%sx',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- end
-end
-local format_U=function(f)
- n=n+1
- if f=="-" then
- f=sub(f,2)
- return format("format('%%%sX',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- else
- return format("format('U+%%%sX',type(a%s) == 'number' and a%s or utfbyte(a%s))",f=="" and "05" or f,n,n,n)
- end
-end
-local format_p=function()
- n=n+1
- return format("points(a%s)",n)
-end
-local format_P=function()
- n=n+1
- return format("nupoints(a%s)",n)
-end
-local format_b=function()
- n=n+1
- return format("basepoints(a%s)",n)
-end
-local format_B=function()
- n=n+1
- return format("nubasepoints(a%s)",n)
-end
-local format_t=function(f)
- n=n+1
- if f and f~="" then
- return format("concat(a%s,%q)",n,f)
- else
- return format("concat(a%s)",n)
- end
-end
-local format_T=function(f)
- n=n+1
- if f and f~="" then
- return format("sequenced(a%s,%q)",n,f)
- else
- return format("sequenced(a%s)",n)
- end
-end
-local format_l=function()
- n=n+1
- return format("(a%s and 'true' or 'false')",n)
-end
-local format_L=function()
- n=n+1
- return format("(a%s and 'TRUE' or 'FALSE')",n)
-end
-local format_n=function()
- n=n+1
- return format("((a%s %% 1 == 0) and format('%%i',a%s) or tostring(a%s))",n,n,n)
-end
-local format_N if environment.FORMAT then
- format_N=function(f)
- n=n+1
- if not f or f=="" then
- return format("FORMAT(a%s,'%%.9f')",n)
- elseif f==".6" or f=="0.6" then
- return format("FORMAT(a%s)",n)
- else
- return format("FORMAT(a%s,'%%%sf')",n,f)
- end
- end
-else
- format_N=function(f)
- n=n+1
- if not f or f=="" then
- f=".9"
- end
- return format("(((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripzero,format('%%%sf',a%s)))",n,n,f,n)
- end
-end
-local format_a=function(f)
- n=n+1
- if f and f~="" then
- return format("autosingle(a%s,%q)",n,f)
- else
- return format("autosingle(a%s)",n)
- end
-end
-local format_A=function(f)
- n=n+1
- if f and f~="" then
- return format("autodouble(a%s,%q)",n,f)
- else
- return format("autodouble(a%s)",n)
- end
-end
-local format_w=function(f)
- n=n+1
- f=tonumber(f)
- if f then
- return format("nspaces[%s+a%s]",f,n)
- else
- return format("nspaces[a%s]",n)
- end
-end
-local format_W=function(f)
- return format("nspaces[%s]",tonumber(f) or 0)
-end
-local format_m=function(f)
- n=n+1
- if not f or f=="" then
- f=","
- end
- if f=="0" then
- return format([[formattednumber(a%s,false)]],n)
- else
- return format([[formattednumber(a%s,%q,".")]],n,f)
- end
-end
-local format_M=function(f)
- n=n+1
- if not f or f=="" then
- f="."
- end
- if f=="0" then
- return format([[formattednumber(a%s,false)]],n)
- else
- return format([[formattednumber(a%s,%q,",")]],n,f)
- end
-end
-local format_z=function(f)
- n=n+(tonumber(f) or 1)
- return "''"
-end
-local format_rest=function(s)
- return format("%q",s)
-end
-local format_extension=function(extensions,f,name)
- local extension=extensions[name] or "tostring(%s)"
- local f=tonumber(f) or 1
- local w=find(extension,"%.%.%.")
- if f==0 then
- if w then
- extension=gsub(extension,"%.%.%.","")
- end
- return extension
- elseif f==1 then
- if w then
- extension=gsub(extension,"%.%.%.","%%s")
- end
- n=n+1
- local a="a"..n
- return format(extension,a,a)
- elseif f<0 then
- if w then
- extension=gsub(extension,"%.%.%.","")
- return extension
- else
- local a="a"..(n+f+1)
- return format(extension,a,a)
- end
- else
- if w then
- extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
- end
- local t={}
- for i=1,f do
- n=n+1
- t[i]="a"..n
- end
- return format(extension,unpack(t))
- end
-end
-local builder=Cs { "start",
- start=(
- (
- P("%")/""*(
- V("!")
-+V("s")+V("q")+V("i")+V("d")+V("f")+V("F")+V("g")+V("G")+V("e")+V("E")+V("x")+V("X")+V("o")
-+V("c")+V("C")+V("S")
-+V("Q")
-+V("n")
-+V("N")
-+V("k")
-+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
-+V("W")
-+V("a")
-+V("A")
-+V("j")+V("J")
-+V("m")+V("M")
-+V("z")
-+V(">")
-+V("<")
- )+V("*")
- )*(endofstring+Carg(1))
- )^0,
- ["s"]=(prefix_any*P("s"))/format_s,
- ["q"]=(prefix_any*P("q"))/format_q,
- ["i"]=(prefix_any*P("i"))/format_i,
- ["d"]=(prefix_any*P("d"))/format_d,
- ["f"]=(prefix_any*P("f"))/format_f,
- ["F"]=(prefix_any*P("F"))/format_F,
- ["g"]=(prefix_any*P("g"))/format_g,
- ["G"]=(prefix_any*P("G"))/format_G,
- ["e"]=(prefix_any*P("e"))/format_e,
- ["E"]=(prefix_any*P("E"))/format_E,
- ["x"]=(prefix_any*P("x"))/format_x,
- ["X"]=(prefix_any*P("X"))/format_X,
- ["o"]=(prefix_any*P("o"))/format_o,
- ["S"]=(prefix_any*P("S"))/format_S,
- ["Q"]=(prefix_any*P("Q"))/format_Q,
- ["n"]=(prefix_any*P("n"))/format_n,
- ["N"]=(prefix_any*P("N"))/format_N,
- ["k"]=(prefix_sub*P("k"))/format_k,
- ["c"]=(prefix_any*P("c"))/format_c,
- ["C"]=(prefix_any*P("C"))/format_C,
- ["r"]=(prefix_any*P("r"))/format_r,
- ["h"]=(prefix_any*P("h"))/format_h,
- ["H"]=(prefix_any*P("H"))/format_H,
- ["u"]=(prefix_any*P("u"))/format_u,
- ["U"]=(prefix_any*P("U"))/format_U,
- ["p"]=(prefix_any*P("p"))/format_p,
- ["P"]=(prefix_any*P("P"))/format_P,
- ["b"]=(prefix_any*P("b"))/format_b,
- ["B"]=(prefix_any*P("B"))/format_B,
- ["t"]=(prefix_tab*P("t"))/format_t,
- ["T"]=(prefix_tab*P("T"))/format_T,
- ["l"]=(prefix_any*P("l"))/format_l,
- ["L"]=(prefix_any*P("L"))/format_L,
- ["I"]=(prefix_any*P("I"))/format_I,
- ["w"]=(prefix_any*P("w"))/format_w,
- ["W"]=(prefix_any*P("W"))/format_W,
- ["j"]=(prefix_any*P("j"))/format_j,
- ["J"]=(prefix_any*P("J"))/format_J,
- ["m"]=(prefix_any*P("m"))/format_m,
- ["M"]=(prefix_any*P("M"))/format_M,
- ["z"]=(prefix_any*P("z"))/format_z,
- ["a"]=(prefix_any*P("a"))/format_a,
- ["A"]=(prefix_any*P("A"))/format_A,
- ["<"]=(prefix_any*P("<"))/format_left,
- [">"]=(prefix_any*P(">"))/format_right,
- ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest,
- ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest,
- ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension,
-}
-local xx=setmetatable({},{ __index=function(t,k) local v=format("%02x",k) t[k]=v return v end })
-local XX=setmetatable({},{ __index=function(t,k) local v=format("%02X",k) t[k]=v return v end })
-local preset={
- ["%02x"]=function(n) return xx[n] end,
- ["%02X"]=function(n) return XX[n] end,
-}
-local direct=P("%")*(sign+space+period+digit)^0*S("sqidfgGeExXo")*endofstring/[[local format = string.format return function(str) return format("%0",str) end]]
-local function make(t,str)
- local f=preset[str]
- if f then
- return f
- end
- local p=lpegmatch(direct,str)
- if p then
- f=loadstripped(p)()
- else
- n=0
- p=lpegmatch(builder,str,1,t._connector_,t._extensions_)
- if n>0 then
- p=format(template,preamble,t._preamble_,arguments[n],p)
- f=loadstripped(p,t._environment_)()
- else
- f=function() return str end
- end
- end
- t[str]=f
- return f
-end
-local function use(t,fmt,...)
- return t[fmt](...)
-end
-strings.formatters={}
-function strings.formatters.new(noconcat)
- local e={}
- for k,v in next,environment do
- e[k]=v
- end
- local t={
- _type_="formatter",
- _connector_=noconcat and "," or "..",
- _extensions_={},
- _preamble_="",
- _environment_=e,
- }
- setmetatable(t,{ __index=make,__call=use })
- return t
-end
-local formatters=strings.formatters.new()
-string.formatters=formatters
-string.formatter=function(str,...) return formatters[str](...) end
-local function add(t,name,template,preamble)
- if type(t)=="table" and t._type_=="formatter" then
- t._extensions_[name]=template or "%s"
- if type(preamble)=="string" then
- t._preamble_=preamble.."\n"..t._preamble_
- elseif type(preamble)=="table" then
- for k,v in next,preamble do
- t._environment_[k]=v
- end
- end
- end
-end
-strings.formatters.add=add
-patterns.xmlescape=Cs((P("<")/"&lt;"+P(">")/"&gt;"+P("&")/"&amp;"+P('"')/"&quot;"+anything)^0)
-patterns.texescape=Cs((C(S("#$%\\{}"))/"\\%1"+anything)^0)
-patterns.luaescape=Cs(((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0)
-patterns.luaquoted=Cs(Cc('"')*((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0*Cc('"'))
-add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],{ xmlescape=patterns.xmlescape })
-add(formatters,"tex",[[lpegmatch(texescape,%s)]],{ texescape=patterns.texescape })
-add(formatters,"lua",[[lpegmatch(luaescape,%s)]],{ luaescape=patterns.luaescape })
-local dquote=patterns.dquote
-local equote=patterns.escaped+dquote/'\\"'+1
-local cquote=Cc('"')
-local pattern=Cs(dquote*(equote-P(-2))^0*dquote)
-+Cs(cquote*(equote-space)^0*space*equote^0*cquote)
-function string.optionalquoted(str)
- return lpegmatch(pattern,str) or str
-end
-local pattern=Cs((newline/(os.newline or "\r")+1)^0)
-function string.replacenewlines(str)
- return lpegmatch(pattern,str)
-end
-function strings.newcollector()
- local result,r={},0
- return
- function(fmt,str,...)
- r=r+1
- result[r]=str==nil and fmt or formatters[fmt](str,...)
- end,
- function(connector)
- if result then
- local str=concat(result,connector)
- result,r={},0
- return str
- end
- end
-end
-local f_16_16=formatters["%0.5N"]
-function number.to16dot16(n)
- return f_16_16(n/65536.0)
-end
-if not string.explode then
- local tsplitat=lpeg.tsplitat
- local p_utf=patterns.utf8character
- local p_check=C(p_utf)*(P("+")*Cc(true))^0
- local p_split=Ct(C(p_utf)^0)
- local p_space=Ct((C(1-P(" ")^1)+P(" ")^1)^0)
- function string.explode(str,symbol)
- if symbol=="" then
- return lpegmatch(p_split,str)
- elseif symbol then
- local a,b=lpegmatch(p_check,symbol)
- if b then
- return lpegmatch(tsplitat(P(a)^1),str)
- else
- return lpegmatch(tsplitat(a),str)
- end
- else
- return lpegmatch(p_space,str)
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-tab"] = package.loaded["util-tab"] or true
-
--- original size: 32815, stripped down to: 18257
-
-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"
-}
-utilities=utilities or {}
-utilities.tables=utilities.tables or {}
-local tables=utilities.tables
-local format,gmatch,gsub,sub=string.format,string.gmatch,string.gsub,string.sub
-local concat,insert,remove,sort=table.concat,table.insert,table.remove,table.sort
-local setmetatable,getmetatable,tonumber,tostring,rawget=setmetatable,getmetatable,tonumber,tostring,rawget
-local type,next,rawset,tonumber,tostring,load,select=type,next,rawset,tonumber,tostring,load,select
-local lpegmatch,P,Cs,Cc=lpeg.match,lpeg.P,lpeg.Cs,lpeg.Cc
-local sortedkeys,sortedpairs=table.sortedkeys,table.sortedpairs
-local formatters=string.formatters
-local utftoeight=utf.toeight
-local splitter=lpeg.tsplitat(".")
-function utilities.tables.definetable(target,nofirst,nolast)
- local composed=nil
- local t={}
- local snippets=lpegmatch(splitter,target)
- for i=1,#snippets-(nolast and 1 or 0) do
- local name=snippets[i]
- if composed then
- composed=composed.."."..name
- t[#t+1]=formatters["if not %s then %s = { } end"](composed,composed)
- else
- composed=name
- if not nofirst then
- t[#t+1]=formatters["%s = %s or { }"](composed,composed)
- end
- end
- end
- if composed then
- if nolast then
- composed=composed.."."..snippets[#snippets]
- end
- return concat(t,"\n"),composed
- else
- return "",target
- end
-end
-function tables.definedtable(...)
- local t=_G
- for i=1,select("#",...) do
- local li=select(i,...)
- local tl=t[li]
- if not tl then
- tl={}
- t[li]=tl
- end
- t=tl
- end
- return t
-end
-function tables.accesstable(target,root)
- local t=root or _G
- for name in gmatch(target,"([^%.]+)") do
- t=t[name]
- if not t then
- return
- end
- end
- return t
-end
-function tables.migratetable(target,v,root)
- local t=root or _G
- local names=lpegmatch(splitter,target)
- for i=1,#names-1 do
- local name=names[i]
- t[name]=t[name] or {}
- t=t[name]
- if not t then
- return
- end
- end
- t[names[#names]]=v
-end
-function tables.removevalue(t,value)
- if value then
- for i=1,#t do
- if t[i]==value then
- remove(t,i)
- end
- end
- end
-end
-function tables.replacevalue(t,oldvalue,newvalue)
- if oldvalue and newvalue then
- for i=1,#t do
- if t[i]==oldvalue then
- t[i]=newvalue
- end
- end
- end
-end
-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 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 escape=Cs(Cc('"')*((P('"')/'""'+P(1))^0)*Cc('"'))
-function table.tocsv(t,specification)
- if t and #t>0 then
- local result={}
- local r={}
- specification=specification or {}
- local fields=specification.fields
- if type(fields)~="string" then
- fields=sortedkeys(t[1])
- end
- local separator=specification.separator or ","
- local noffields=#fields
- if specification.preamble==true then
- for f=1,noffields do
- r[f]=lpegmatch(escape,tostring(fields[f]))
- end
- result[1]=concat(r,separator)
- end
- for i=1,#t do
- local ti=t[i]
- for f=1,noffields do
- local field=ti[fields[f]]
- if type(field)=="string" then
- r[f]=lpegmatch(escape,field)
- else
- r[f]=tostring(field)
- end
- end
- result[i+1]=concat(r,separator)
- end
- return concat(result,"\n")
- else
- return ""
- end
-end
-local nspaces=utilities.strings.newrepeater(" ")
-local function toxml(t,d,result,step)
- local r=#result
- for k,v in sortedpairs(t) do
- local s=nspaces[d]
- local tk=type(k)
- local tv=type(v)
- if tv=="table" then
- if tk=="number" then
- r=r+1 result[r]=formatters["%s<entry n='%s'>"](s,k)
- toxml(v,d+step,result,step)
- r=r+1 result[r]=formatters["%s</entry>"](s,k)
- else
- r=r+1 result[r]=formatters["%s<%s>"](s,k)
- toxml(v,d+step,result,step)
- r=r+1 result[r]=formatters["%s</%s>"](s,k)
- end
- elseif tv=="string" then
- if tk=="number" then
- r=r+1 result[r]=formatters["%s<entry n='%s'>%!xml!</entry>"](s,k,v,k)
- else
- r=r+1 result[r]=formatters["%s<%s>%!xml!</%s>"](s,k,v,k)
- end
- elseif tk=="number" then
- r=r+1 result[r]=formatters["%s<entry n='%s'>%S</entry>"](s,k,v,k)
- else
- r=r+1 result[r]=formatters["%s<%s>%S</%s>"](s,k,v,k)
- end
- end
-end
-function table.toxml(t,specification)
- specification=specification or {}
- local name=specification.name
- local noroot=name==false
- local result=(specification.nobanner or noroot) and {} or { "<?xml version='1.0' standalone='yes' ?>" }
- local indent=specification.indent or 0
- local spaces=specification.spaces or 1
- if noroot then
- toxml(t,indent,result,spaces)
- else
- toxml({ [name or "data"]=t },indent,result,spaces)
- end
- return concat(result,"\n")
-end
-function tables.encapsulate(core,capsule,protect)
- if type(capsule)~="table" then
- protect=true
- capsule={}
- end
- for key,value in next,core do
- if capsule[key] then
- print(formatters["\ninvalid %s %a in %a"]("inheritance",key,core))
- os.exit()
- else
- capsule[key]=value
- end
- end
- if protect then
- for key,value in next,core do
- core[key]=nil
- end
- setmetatable(core,{
- __index=capsule,
- __newindex=function(t,key,value)
- if capsule[key] then
- print(formatters["\ninvalid %s %a' in %a"]("overload",key,core))
- os.exit()
- else
- rawset(t,key,value)
- end
- end
- } )
- end
-end
-if JITSUPPORTED then
- local f_hashed_string=formatters["[%Q]=%Q,"]
- local f_hashed_number=formatters["[%Q]=%s,"]
- local f_hashed_boolean=formatters["[%Q]=%l,"]
- local f_hashed_table=formatters["[%Q]="]
- local f_indexed_string=formatters["[%s]=%Q,"]
- local f_indexed_number=formatters["[%s]=%s,"]
- local f_indexed_boolean=formatters["[%s]=%l,"]
- local f_indexed_table=formatters["[%s]="]
- local f_ordered_string=formatters["%Q,"]
- local f_ordered_number=formatters["%s,"]
- local f_ordered_boolean=formatters["%l,"]
- function table.fastserialize(t,prefix)
- local r={ type(prefix)=="string" and prefix or "return" }
- local m=1
- local function fastserialize(t,outer)
- local n=#t
- m=m+1
- r[m]="{"
- if n>0 then
- local v=t[0]
- if v then
- local tv=type(v)
- if tv=="string" then
- m=m+1 r[m]=f_indexed_string(0,v)
- elseif tv=="number" then
- m=m+1 r[m]=f_indexed_number(0,v)
- elseif tv=="table" then
- m=m+1 r[m]=f_indexed_table(0)
- fastserialize(v)
- m=m+1 r[m]=f_indexed_table(0)
- elseif tv=="boolean" then
- m=m+1 r[m]=f_indexed_boolean(0,v)
- end
- end
- for i=1,n do
- local v=t[i]
- local tv=type(v)
- if tv=="string" then
- m=m+1 r[m]=f_ordered_string(v)
- elseif tv=="number" then
- m=m+1 r[m]=f_ordered_number(v)
- elseif tv=="table" then
- fastserialize(v)
- elseif tv=="boolean" then
- m=m+1 r[m]=f_ordered_boolean(v)
- end
- end
- end
- for k,v in next,t do
- local tk=type(k)
- if tk=="number" then
- if k>n or k<0 then
- local tv=type(v)
- if tv=="string" then
- m=m+1 r[m]=f_indexed_string(k,v)
- elseif tv=="number" then
- m=m+1 r[m]=f_indexed_number(k,v)
- elseif tv=="table" then
- m=m+1 r[m]=f_indexed_table(k)
- fastserialize(v)
- elseif tv=="boolean" then
- m=m+1 r[m]=f_indexed_boolean(k,v)
- end
- end
- else
- local tv=type(v)
- if tv=="string" then
- m=m+1 r[m]=f_hashed_string(k,v)
- elseif tv=="number" then
- m=m+1 r[m]=f_hashed_number(k,v)
- elseif tv=="table" then
- m=m+1 r[m]=f_hashed_table(k)
- fastserialize(v)
- elseif tv=="boolean" then
- m=m+1 r[m]=f_hashed_boolean(k,v)
- end
- end
- end
- m=m+1
- if outer then
- r[m]="}"
- else
- r[m]="},"
- end
- return r
- end
- return concat(fastserialize(t,true))
- end
-else
- local f_v=formatters["[%q]=%q,"]
- local f_t=formatters["[%q]="]
- local f_q=formatters["%q,"]
- function table.fastserialize(t,prefix)
- local r={ type(prefix)=="string" and prefix or "return" }
- local m=1
- local function fastserialize(t,outer)
- local n=#t
- m=m+1
- r[m]="{"
- if n>0 then
- local v=t[0]
- if v then
- m=m+1
- r[m]="[0]='"
- if type(v)=="table" then
- fastserialize(v)
- else
- r[m]=format("%q,",v)
- end
- end
- for i=1,n do
- local v=t[i]
- m=m+1
- if type(v)=="table" then
- r[m]=format("[%i]=",i)
- fastserialize(v)
- else
- r[m]=format("[%i]=%q,",i,v)
- end
- end
- end
- for k,v in next,t do
- local tk=type(k)
- if tk=="number" then
- if k>n or k<0 then
- m=m+1
- if type(v)=="table" then
- r[m]=format("[%i]=",k)
- fastserialize(v)
- else
- r[m]=format("[%i]=%q,",k,v)
- end
- end
- else
- m=m+1
- if type(v)=="table" then
- r[m]=format("[%q]=",k)
- fastserialize(v)
- else
- r[m]=format("[%q]=%q,",k,v)
- end
- end
- end
- m=m+1
- if outer then
- r[m]="}"
- else
- r[m]="},"
- end
- return r
- end
- return concat(fastserialize(t,true))
- end
-end
-function table.deserialize(str)
- if not str or str=="" then
- return
- end
- local code=load(str)
- if not code then
- return
- end
- code=code()
- if not code then
- return
- end
- return code
-end
-function table.load(filename,loader)
- if filename then
- local t=(loader or io.loaddata)(filename)
- if t and t~="" then
- local t=utftoeight(t)
- t=load(t)
- if type(t)=="function" then
- t=t()
- if type(t)=="table" then
- return t
- end
- end
- end
- end
-end
-function table.save(filename,t,n,...)
- io.savedata(filename,table.serialize(t,n==nil and true or n,...))
-end
-local f_key_value=formatters["%s=%q"]
-local f_add_table=formatters[" {%t},\n"]
-local f_return_table=formatters["return {\n%t}"]
-local function slowdrop(t)
- local r={}
- local l={}
- for i=1,#t do
- local ti=t[i]
- local j=0
- for k,v in next,ti do
- j=j+1
- l[j]=f_key_value(k,v)
- end
- r[i]=f_add_table(l)
- end
- return f_return_table(r)
-end
-local function fastdrop(t)
- local r={ "return {\n" }
- local m=1
- for i=1,#t do
- local ti=t[i]
- m=m+1 r[m]=" {"
- for k,v in next,ti do
- m=m+1 r[m]=f_key_value(k,v)
- end
- m=m+1 r[m]="},\n"
- end
- m=m+1
- r[m]="}"
- return concat(r)
-end
-function table.drop(t,slow)
- if #t==0 then
- return "return { }"
- elseif slow==true then
- return slowdrop(t)
- else
- return fastdrop(t)
- end
-end
-local selfmapper={ __index=function(t,k) t[k]=k return k end }
-function table.twowaymapper(t)
- if not t then
- t={}
- else
- local zero=rawget(t,0)
- for i=zero and 0 or 1,#t do
- local ti=t[i]
- if ti then
- local i=tostring(i)
- t[i]=ti
- t[ti]=i
- end
- end
- end
- setmetatable(t,selfmapper)
- return t
-end
-local f_start_key_idx=formatters["%w{"]
-local f_start_key_num=JITSUPPORTED and formatters["%w[%s]={"] or formatters["%w[%q]={"]
-local f_start_key_str=formatters["%w[%q]={"]
-local f_start_key_boo=formatters["%w[%l]={"]
-local f_start_key_nop=formatters["%w{"]
-local f_stop=formatters["%w},"]
-local f_key_num_value_num=JITSUPPORTED and formatters["%w[%s]=%s,"] or formatters["%w[%s]=%q,"]
-local f_key_str_value_num=JITSUPPORTED and formatters["%w[%Q]=%s,"] or formatters["%w[%Q]=%q,"]
-local f_key_boo_value_num=JITSUPPORTED and formatters["%w[%l]=%s,"] or formatters["%w[%l]=%q,"]
-local f_key_num_value_str=JITSUPPORTED and formatters["%w[%s]=%Q,"] or formatters["%w[%q]=%Q,"]
-local f_key_str_value_str=formatters["%w[%Q]=%Q,"]
-local f_key_boo_value_str=formatters["%w[%l]=%Q,"]
-local f_key_num_value_boo=JITSUPPORTED and formatters["%w[%s]=%l,"] or formatters["%w[%q]=%l,"]
-local f_key_str_value_boo=formatters["%w[%Q]=%l,"]
-local f_key_boo_value_boo=formatters["%w[%l]=%l,"]
-local f_key_num_value_not=JITSUPPORTED and formatters["%w[%s]={},"] or formatters["%w[%q]={},"]
-local f_key_str_value_not=formatters["%w[%Q]={},"]
-local f_key_boo_value_not=formatters["%w[%l]={},"]
-local f_key_num_value_seq=JITSUPPORTED and formatters["%w[%s]={ %, t },"] or formatters["%w[%q]={ %, t },"]
-local f_key_str_value_seq=formatters["%w[%Q]={ %, t },"]
-local f_key_boo_value_seq=formatters["%w[%l]={ %, t },"]
-local f_val_num=JITSUPPORTED and formatters["%w%s,"] or formatters["%w%q,"]
-local f_val_str=formatters["%w%Q,"]
-local f_val_boo=formatters["%w%l,"]
-local f_val_not=formatters["%w{},"]
-local f_val_seq=formatters["%w{ %, t },"]
-local f_fin_seq=formatters[" %, t }"]
-local f_table_return=formatters["return {"]
-local f_table_name=formatters["%s={"]
-local f_table_direct=formatters["{"]
-local f_table_entry=formatters["[%Q]={"]
-local f_table_finish=formatters["}"]
-local spaces=utilities.strings.newrepeater(" ")
-local original_serialize=table.serialize
-local is_simple_table=table.is_simple_table
-local function serialize(root,name,specification)
- if type(specification)=="table" then
- return original_serialize(root,name,specification)
- end
- local t
- local n=1
- local unknown=false
- local function do_serialize(root,name,depth,level,indexed)
- if level>0 then
- n=n+1
- if indexed then
- t[n]=f_start_key_idx(depth)
- else
- local tn=type(name)
- if tn=="number" then
- t[n]=f_start_key_num(depth,name)
- elseif tn=="string" then
- t[n]=f_start_key_str(depth,name)
- elseif tn=="boolean" then
- t[n]=f_start_key_boo(depth,name)
- else
- t[n]=f_start_key_nop(depth)
- end
- end
- depth=depth+1
- end
- if root and next(root)~=nil then
- local first=nil
- local last=#root
- if last>0 then
- for k=1,last do
- if rawget(root,k)==nil then
- last=k-1
- break
- end
- end
- if last>0 then
- first=1
- end
- end
- local sk=sortedkeys(root)
- for i=1,#sk do
- local k=sk[i]
- local v=root[k]
- local tv=type(v)
- local tk=type(k)
- if first and tk=="number" and k<=last and k>=first then
- if tv=="number" then
- n=n+1 t[n]=f_val_num(depth,v)
- elseif tv=="string" then
- n=n+1 t[n]=f_val_str(depth,v)
- elseif tv=="table" then
- if next(v)==nil then
- n=n+1 t[n]=f_val_not(depth)
- else
- local st=is_simple_table(v)
- if st then
- n=n+1 t[n]=f_val_seq(depth,st)
- else
- do_serialize(v,k,depth,level+1,true)
- end
- end
- elseif tv=="boolean" then
- n=n+1 t[n]=f_val_boo(depth,v)
- elseif unknown then
- n=n+1 t[n]=f_val_str(depth,tostring(v))
- end
- elseif tv=="number" then
- if tk=="number" then
- n=n+1 t[n]=f_key_num_value_num(depth,k,v)
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_num(depth,k,v)
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_num(depth,k,v)
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_num(depth,tostring(k),v)
- end
- elseif tv=="string" then
- if tk=="number" then
- n=n+1 t[n]=f_key_num_value_str(depth,k,v)
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_str(depth,k,v)
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_str(depth,k,v)
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_str(depth,tostring(k),v)
- end
- elseif tv=="table" then
- if next(v)==nil then
- if tk=="number" then
- n=n+1 t[n]=f_key_num_value_not(depth,k)
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_not(depth,k)
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_not(depth,k)
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_not(depth,tostring(k))
- end
- else
- local st=is_simple_table(v)
- if not st then
- do_serialize(v,k,depth,level+1)
- elseif tk=="number" then
- n=n+1 t[n]=f_key_num_value_seq(depth,k,st)
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_seq(depth,k,st)
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_seq(depth,k,st)
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_seq(depth,tostring(k),st)
- end
- end
- elseif tv=="boolean" then
- if tk=="number" then
- n=n+1 t[n]=f_key_num_value_boo(depth,k,v)
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_boo(depth,k,v)
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_boo(depth,k,v)
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_boo(depth,tostring(k),v)
- end
- else
- if tk=="number" then
- n=n+1 t[n]=f_key_num_value_str(depth,k,tostring(v))
- elseif tk=="string" then
- n=n+1 t[n]=f_key_str_value_str(depth,k,tostring(v))
- elseif tk=="boolean" then
- n=n+1 t[n]=f_key_boo_value_str(depth,k,tostring(v))
- elseif unknown then
- n=n+1 t[n]=f_key_str_value_str(depth,tostring(k),tostring(v))
- end
- end
- end
- end
- if level>0 then
- n=n+1 t[n]=f_stop(depth-1)
- end
- end
- local tname=type(name)
- if tname=="string" then
- if name=="return" then
- t={ f_table_return() }
- else
- t={ f_table_name(name) }
- end
- elseif tname=="number" then
- t={ f_table_entry(name) }
- elseif tname=="boolean" then
- if name then
- t={ f_table_return() }
- else
- t={ f_table_direct() }
- end
- else
- t={ f_table_name("t") }
- end
- if root then
- if getmetatable(root) then
- local dummy=root._w_h_a_t_e_v_e_r_
- root._w_h_a_t_e_v_e_r_=nil
- end
- if next(root)~=nil then
- local st=is_simple_table(root)
- if st then
- return t[1]..f_fin_seq(st)
- else
- do_serialize(root,name,1,0)
- end
- end
- end
- n=n+1
- t[n]=f_table_finish()
- return concat(t,"\n")
-end
-table.serialize=serialize
-if setinspector then
- setinspector("table",function(v)
- if type(v)=="table" then
- print(serialize(v,"table",{ metacheck=false }))
- return true
- end
- end)
-end
-local mt={
- __newindex=function(t,k,v)
- local n=t.last+1
- t.last=n
- t.list[n]=k
- t.hash[k]=v
- end,
- __index=function(t,k)
- return t.hash[k]
- end,
- __len=function(t)
- return t.last
- end,
-}
-function table.orderedhash()
- return setmetatable({ list={},hash={},last=0 },mt)
-end
-function table.ordered(t)
- local n=t.last
- if n>0 then
- local l=t.list
- local i=1
- local h=t.hash
- local f=function()
- if i<=n then
- local k=i
- local v=h[l[k]]
- i=i+1
- return k,v
- end
- end
- return f,1,h[l[1]]
- else
- return function() end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-fil"] = package.loaded["util-fil"] or true
-
--- original size: 11552, stripped down to: 9023
-
-if not modules then modules={} end modules ['util-fil']={
- version=1.001,
- optimize=true,
- 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 tonumber=tonumber
-local byte=string.byte
-local char=string.char
-utilities=utilities or {}
-local files={}
-utilities.files=files
-local zerobased={}
-function files.open(filename,zb)
- local f=io.open(filename,"rb")
- if f then
- zerobased[f]=zb or false
- end
- return f
-end
-function files.close(f)
- zerobased[f]=nil
- f:close()
-end
-function files.size(f)
- local current=f:seek()
- local size=f:seek("end")
- f:seek("set",current)
- return size
-end
-files.getsize=files.size
-function files.setposition(f,n)
- if zerobased[f] then
- f:seek("set",n)
- else
- f:seek("set",n-1)
- end
-end
-function files.getposition(f)
- if zerobased[f] then
- return f:seek()
- else
- return f:seek()+1
- end
-end
-function files.look(f,n,chars)
- local p=f:seek()
- local s=f:read(n)
- f:seek("set",p)
- if chars then
- return s
- else
- return byte(s,1,#s)
- end
-end
-function files.skip(f,n)
- if n==1 then
- f:read(n)
- else
- f:seek("set",f:seek()+n)
- end
-end
-function files.readbyte(f)
- return byte(f:read(1))
-end
-function files.readbytes(f,n)
- return byte(f:read(n),1,n)
-end
-function files.readbytetable(f,n)
- local s=f:read(n or 1)
- return { byte(s,1,#s) }
-end
-function files.readchar(f)
- return f:read(1)
-end
-function files.readstring(f,n)
- return f:read(n or 1)
-end
-function files.readinteger1(f)
- local n=byte(f:read(1))
- if n>=0x80 then
- return n-0x100
- else
- return n
- end
-end
-files.readcardinal1=files.readbyte
-files.readcardinal=files.readcardinal1
-files.readinteger=files.readinteger1
-files.readsignedbyte=files.readinteger1
-function files.readcardinal2(f)
- local a,b=byte(f:read(2),1,2)
- return 0x100*a+b
-end
-function files.readcardinal2le(f)
- local b,a=byte(f:read(2),1,2)
- return 0x100*a+b
-end
-function files.readinteger2(f)
- local a,b=byte(f:read(2),1,2)
- if a>=0x80 then
- return 0x100*a+b-0x10000
- else
- return 0x100*a+b
- end
-end
-function files.readinteger2le(f)
- local b,a=byte(f:read(2),1,2)
- if a>=0x80 then
- return 0x100*a+b-0x10000
- else
- return 0x100*a+b
- end
-end
-function files.readcardinal3(f)
- local a,b,c=byte(f:read(3),1,3)
- return 0x10000*a+0x100*b+c
-end
-function files.readcardinal3le(f)
- local c,b,a=byte(f:read(3),1,3)
- return 0x10000*a+0x100*b+c
-end
-function files.readinteger3(f)
- local a,b,c=byte(f:read(3),1,3)
- if a>=0x80 then
- return 0x10000*a+0x100*b+c-0x1000000
- else
- return 0x10000*a+0x100*b+c
- end
-end
-function files.readinteger3le(f)
- local c,b,a=byte(f:read(3),1,3)
- if a>=0x80 then
- return 0x10000*a+0x100*b+c-0x1000000
- else
- return 0x10000*a+0x100*b+c
- end
-end
-function files.readcardinal4(f)
- local a,b,c,d=byte(f:read(4),1,4)
- return 0x1000000*a+0x10000*b+0x100*c+d
-end
-function files.readcardinal4le(f)
- local d,c,b,a=byte(f:read(4),1,4)
- return 0x1000000*a+0x10000*b+0x100*c+d
-end
-function files.readinteger4(f)
- local a,b,c,d=byte(f:read(4),1,4)
- if a>=0x80 then
- return 0x1000000*a+0x10000*b+0x100*c+d-0x100000000
- else
- return 0x1000000*a+0x10000*b+0x100*c+d
- end
-end
-function files.readinteger4le(f)
- local d,c,b,a=byte(f:read(4),1,4)
- if a>=0x80 then
- return 0x1000000*a+0x10000*b+0x100*c+d-0x100000000
- else
- return 0x1000000*a+0x10000*b+0x100*c+d
- end
-end
-function files.readfixed2(f)
- local a,b=byte(f:read(2),1,2)
- if a>=0x80 then
- tonumber((a-0x100).."."..b)
- else
- tonumber((a ).."."..b)
- end
-end
-function files.readfixed4(f)
- local a,b,c,d=byte(f:read(4),1,4)
- if a>=0x80 then
- tonumber((0x100*a+b-0x10000).."."..(0x100*c+d))
- else
- tonumber((0x100*a+b ).."."..(0x100*c+d))
- end
-end
-if bit32 then
- local extract=bit32.extract
- local band=bit32.band
- function files.read2dot14(f)
- local a,b=byte(f:read(2),1,2)
- if a>=0x80 then
- local n=-(0x100*a+b)
- return-(extract(n,14,2)+(band(n,0x3FFF)/16384.0))
- else
- local n=0x100*a+b
- return (extract(n,14,2)+(band(n,0x3FFF)/16384.0))
- end
- end
-end
-function files.skipshort(f,n)
- f:read(2*(n or 1))
-end
-function files.skiplong(f,n)
- f:read(4*(n or 1))
-end
-if bit32 then
- local rshift=bit32.rshift
- function files.writecardinal2(f,n)
- local a=char(n%256)
- n=rshift(n,8)
- local b=char(n%256)
- f:write(b,a)
- end
- function files.writecardinal4(f,n)
- local a=char(n%256)
- n=rshift(n,8)
- local b=char(n%256)
- n=rshift(n,8)
- local c=char(n%256)
- n=rshift(n,8)
- local d=char(n%256)
- f:write(d,c,b,a)
- end
- function files.writecardinal2le(f,n)
- local a=char(n%256)
- n=rshift(n,8)
- local b=char(n%256)
- f:write(a,b)
- end
- function files.writecardinal4le(f,n)
- local a=char(n%256)
- n=rshift(n,8)
- local b=char(n%256)
- n=rshift(n,8)
- local c=char(n%256)
- n=rshift(n,8)
- local d=char(n%256)
- f:write(a,b,c,d)
- end
-else
- local floor=math.floor
- function files.writecardinal2(f,n)
- local a=char(n%256)
- n=floor(n/256)
- local b=char(n%256)
- f:write(b,a)
- end
- function files.writecardinal4(f,n)
- local a=char(n%256)
- n=floor(n/256)
- local b=char(n%256)
- n=floor(n/256)
- local c=char(n%256)
- n=floor(n/256)
- local d=char(n%256)
- f:write(d,c,b,a)
- end
- function files.writecardinal2le(f,n)
- local a=char(n%256)
- n=floor(n/256)
- local b=char(n%256)
- f:write(a,b)
- end
- function files.writecardinal4le(f,n)
- local a=char(n%256)
- n=floor(n/256)
- local b=char(n%256)
- n=floor(n/256)
- local c=char(n%256)
- n=floor(n/256)
- local d=char(n%256)
- f:write(a,b,c,d)
- end
-end
-function files.writestring(f,s)
- f:write(char(byte(s,1,#s)))
-end
-function files.writebyte(f,b)
- f:write(char(b))
-end
-if fio and fio.readcardinal1 then
- files.readcardinal1=fio.readcardinal1
- files.readcardinal2=fio.readcardinal2
- files.readcardinal3=fio.readcardinal3
- files.readcardinal4=fio.readcardinal4
- files.readcardinal1le=fio.readcardinal1le or files.readcardinal1le
- files.readcardinal2le=fio.readcardinal2le or files.readcardinal2le
- files.readcardinal3le=fio.readcardinal3le or files.readcardinal3le
- files.readcardinal4le=fio.readcardinal4le or files.readcardinal4le
- files.readinteger1=fio.readinteger1
- files.readinteger2=fio.readinteger2
- files.readinteger3=fio.readinteger3
- files.readinteger4=fio.readinteger4
- files.readinteger1le=fio.readinteger1le or files.readinteger1le
- files.readinteger2le=fio.readinteger2le or files.readinteger2le
- files.readinteger3le=fio.readinteger3le or files.readinteger3le
- files.readinteger4le=fio.readinteger4le or files.readinteger4le
- files.readfixed2=fio.readfixed2
- files.readfixed4=fio.readfixed4
- files.read2dot14=fio.read2dot14
- files.setposition=fio.setposition
- files.getposition=fio.getposition
- files.readbyte=files.readcardinal1
- files.readsignedbyte=files.readinteger1
- files.readcardinal=files.readcardinal1
- files.readinteger=files.readinteger1
- local skipposition=fio.skipposition
- files.skipposition=skipposition
- files.readbytes=fio.readbytes
- files.readbytetable=fio.readbytetable
- function files.skipshort(f,n)
- skipposition(f,2*(n or 1))
- end
- function files.skiplong(f,n)
- skipposition(f,4*(n or 1))
- end
-end
-if fio and fio.writecardinal1 then
- files.writecardinal1=fio.writecardinal1
- files.writecardinal2=fio.writecardinal2
- files.writecardinal3=fio.writecardinal3
- files.writecardinal4=fio.writecardinal4
- files.writecardinal1le=fio.writecardinal1le
- files.writecardinal2le=fio.writecardinal2le
- files.writecardinal3le=fio.writecardinal3le
- files.writecardinal4le=fio.writecardinal4le
- files.writeinteger1=fio.writeinteger1 or fio.writecardinal1
- files.writeinteger2=fio.writeinteger2 or fio.writecardinal2
- files.writeinteger3=fio.writeinteger3 or fio.writecardinal3
- files.writeinteger4=fio.writeinteger4 or fio.writecardinal4
- files.writeinteger1le=files.writeinteger1le or fio.writecardinal1le
- files.writeinteger2le=files.writeinteger2le or fio.writecardinal2le
- files.writeinteger3le=files.writeinteger3le or fio.writecardinal3le
- files.writeinteger4le=files.writeinteger4le or fio.writecardinal4le
-end
-if fio and fio.readcardinaltable then
- files.readcardinaltable=fio.readcardinaltable
- files.readintegertable=fio.readintegertable
-else
- local readcardinal1=files.readcardinal1
- local readcardinal2=files.readcardinal2
- local readcardinal3=files.readcardinal3
- local readcardinal4=files.readcardinal4
- function files.readcardinaltable(f,n,b)
- local t={}
- if b==1 then for i=1,n do t[i]=readcardinal1(f) end
- elseif b==2 then for i=1,n do t[i]=readcardinal2(f) end
- elseif b==3 then for i=1,n do t[i]=readcardinal3(f) end
- elseif b==4 then for i=1,n do t[i]=readcardinal4(f) end end
- return t
- end
- local readinteger1=files.readinteger1
- local readinteger2=files.readinteger2
- local readinteger3=files.readinteger3
- local readinteger4=files.readinteger4
- function files.readintegertable(f,n,b)
- local t={}
- if b==1 then for i=1,n do t[i]=readinteger1(f) end
- elseif b==2 then for i=1,n do t[i]=readinteger2(f) end
- elseif b==3 then for i=1,n do t[i]=readinteger3(f) end
- elseif b==4 then for i=1,n do t[i]=readinteger4(f) end end
- return t
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-sac"] = package.loaded["util-sac"] or true
-
--- original size: 12968, stripped down to: 9523
-
-if not modules then modules={} end modules ['util-sac']={
- version=1.001,
- optimize=true,
- 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,sub=string.byte,string.sub
-local tonumber=tonumber
-utilities=utilities or {}
-local streams={}
-utilities.streams=streams
-function streams.open(filename,zerobased)
- local f=filename and io.loaddata(filename)
- if f then
- return { f,1,#f,zerobased or false }
- end
-end
-function streams.openstring(f,zerobased)
- if f then
- return { f,1,#f,zerobased or false }
- end
-end
-function streams.getstring(f)
- if f then
- return f[1]
- end
-end
-function streams.close()
-end
-function streams.size(f)
- return f and f[3] or 0
-end
-streams.getsize=streams.size
-function streams.setposition(f,i)
- if f[4] then
- if i<=0 then
- f[2]=1
- else
- f[2]=i+1
- end
- else
- if i<=1 then
- f[2]=1
- else
- f[2]=i
- end
- end
-end
-function streams.getposition(f)
- if f[4] then
- return f[2]-1
- else
- return f[2]
- end
-end
-function streams.look(f,n,chars)
- local b=f[2]
- local e=b+n-1
- if chars then
- return sub(f[1],b,e)
- else
- return byte(f[1],b,e)
- end
-end
-function streams.skip(f,n)
- f[2]=f[2]+n
-end
-function streams.readbyte(f)
- local i=f[2]
- f[2]=i+1
- return byte(f[1],i)
-end
-function streams.readbytes(f,n)
- local i=f[2]
- local j=i+n
- f[2]=j
- return byte(f[1],i,j-1)
-end
-function streams.readbytetable(f,n)
- local i=f[2]
- local j=i+n
- f[2]=j
- return { byte(f[1],i,j-1) }
-end
-function streams.skipbytes(f,n)
- f[2]=f[2]+n
-end
-function streams.readchar(f)
- local i=f[2]
- f[2]=i+1
- return sub(f[1],i,i)
-end
-function streams.readstring(f,n)
- local i=f[2]
- local j=i+n
- f[2]=j
- return sub(f[1],i,j-1)
-end
-function streams.readinteger1(f)
- local i=f[2]
- f[2]=i+1
- local n=byte(f[1],i)
- if n>=0x80 then
- return n-0x100
- else
- return n
- end
-end
-streams.readcardinal1=streams.readbyte
-streams.readcardinal=streams.readcardinal1
-streams.readinteger=streams.readinteger1
-function streams.readcardinal2(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local a,b=byte(f[1],i,j)
- return 0x100*a+b
-end
-function streams.readcardinal2le(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local b,a=byte(f[1],i,j)
- return 0x100*a+b
-end
-function streams.readinteger2(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local a,b=byte(f[1],i,j)
- if a>=0x80 then
- return 0x100*a+b-0x10000
- else
- return 0x100*a+b
- end
-end
-function streams.readinteger2le(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local b,a=byte(f[1],i,j)
- if a>=0x80 then
- return 0x100*a+b-0x10000
- else
- return 0x100*a+b
- end
-end
-function streams.readcardinal3(f)
- local i=f[2]
- local j=i+2
- f[2]=j+1
- local a,b,c=byte(f[1],i,j)
- return 0x10000*a+0x100*b+c
-end
-function streams.readcardinal3le(f)
- local i=f[2]
- local j=i+2
- f[2]=j+1
- local c,b,a=byte(f[1],i,j)
- return 0x10000*a+0x100*b+c
-end
-function streams.readinteger3(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local a,b,c=byte(f[1],i,j)
- if a>=0x80 then
- return 0x10000*a+0x100*b+c-0x1000000
- else
- return 0x10000*a+0x100*b+c
- end
-end
-function streams.readinteger3le(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local c,b,a=byte(f[1],i,j)
- if a>=0x80 then
- return 0x10000*a+0x100*b+c-0x1000000
- else
- return 0x10000*a+0x100*b+c
- end
-end
-function streams.readcardinal4(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local a,b,c,d=byte(f[1],i,j)
- return 0x1000000*a+0x10000*b+0x100*c+d
-end
-function streams.readcardinal4le(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local d,c,b,a=byte(f[1],i,j)
- return 0x1000000*a+0x10000*b+0x100*c+d
-end
-function streams.readinteger4(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local a,b,c,d=byte(f[1],i,j)
- if a>=0x80 then
- return 0x1000000*a+0x10000*b+0x100*c+d-0x100000000
- else
- return 0x1000000*a+0x10000*b+0x100*c+d
- end
-end
-function streams.readinteger4le(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local d,c,b,a=byte(f[1],i,j)
- if a>=0x80 then
- return 0x1000000*a+0x10000*b+0x100*c+d-0x100000000
- else
- return 0x1000000*a+0x10000*b+0x100*c+d
- end
-end
-function streams.readfixed2(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local a,b=byte(f[1],i,j)
- if a>=0x80 then
- return tonumber((a-0x100).."."..b) or 0
- else
- return tonumber((a ).."."..b) or 0
- end
-end
-function streams.readfixed4(f)
- local i=f[2]
- local j=i+3
- f[2]=j+1
- local a,b,c,d=byte(f[1],i,j)
- if a>=0x80 then
- return tonumber((0x100*a+b-0x10000).."."..(0x100*c+d)) or 0
- else
- return tonumber((0x100*a+b ).."."..(0x100*c+d)) or 0
- end
-end
-if bit32 then
- local extract=bit32.extract
- local band=bit32.band
- function streams.read2dot14(f)
- local i=f[2]
- local j=i+1
- f[2]=j+1
- local a,b=byte(f[1],i,j)
- if a>=0x80 then
- local n=-(0x100*a+b)
- return-(extract(n,14,2)+(band(n,0x3FFF)/16384.0))
- else
- local n=0x100*a+b
- return (extract(n,14,2)+(band(n,0x3FFF)/16384.0))
- end
- end
-end
-function streams.skipshort(f,n)
- f[2]=f[2]+2*(n or 1)
-end
-function streams.skiplong(f,n)
- f[2]=f[2]+4*(n or 1)
-end
-if sio and sio.readcardinal2 then
- local readcardinal1=sio.readcardinal1
- local readcardinal2=sio.readcardinal2
- local readcardinal3=sio.readcardinal3
- local readcardinal4=sio.readcardinal4
- local readinteger1=sio.readinteger1
- local readinteger2=sio.readinteger2
- local readinteger3=sio.readinteger3
- local readinteger4=sio.readinteger4
- local readfixed2=sio.readfixed2
- local readfixed4=sio.readfixed4
- local read2dot14=sio.read2dot14
- local readbytes=sio.readbytes
- local readbytetable=sio.readbytetable
- function streams.readcardinal1(f)
- local i=f[2]
- f[2]=i+1
- return readcardinal1(f[1],i)
- end
- function streams.readcardinal2(f)
- local i=f[2]
- f[2]=i+2
- return readcardinal2(f[1],i)
- end
- function streams.readcardinal3(f)
- local i=f[2]
- f[2]=i+3
- return readcardinal3(f[1],i)
- end
- function streams.readcardinal4(f)
- local i=f[2]
- f[2]=i+4
- return readcardinal4(f[1],i)
- end
- function streams.readinteger1(f)
- local i=f[2]
- f[2]=i+1
- return readinteger1(f[1],i)
- end
- function streams.readinteger2(f)
- local i=f[2]
- f[2]=i+2
- return readinteger2(f[1],i)
- end
- function streams.readinteger3(f)
- local i=f[2]
- f[2]=i+3
- return readinteger3(f[1],i)
- end
- function streams.readinteger4(f)
- local i=f[2]
- f[2]=i+4
- return readinteger4(f[1],i)
- end
- function streams.readfixed2(f)
- local i=f[2]
- f[2]=i+2
- return readfixed2(f[1],i)
- end
- function streams.readfixed4(f)
- local i=f[2]
- f[2]=i+4
- return readfixed4(f[1],i)
- end
- function streams.read2dot4(f)
- local i=f[2]
- f[2]=i+2
- return read2dot4(f[1],i)
- end
- function streams.readbytes(f,n)
- local i=f[2]
- local s=f[3]
- local p=i+n
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- return readbytes(f[1],i,n)
- end
- function streams.readbytetable(f,n)
- local i=f[2]
- local s=f[3]
- local p=i+n
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- return readbytetable(f[1],i,n)
- end
- streams.readbyte=streams.readcardinal1
- streams.readsignedbyte=streams.readinteger1
- streams.readcardinal=streams.readcardinal1
- streams.readinteger=streams.readinteger1
-end
-if sio and sio.readcardinaltable then
- local readcardinaltable=sio.readcardinaltable
- local readintegertable=sio.readintegertable
- function utilities.streams.readcardinaltable(f,n,b)
- local i=f[2]
- local s=f[3]
- local p=i+n*b
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- return readcardinaltable(f[1],i,n,b)
- end
- function utilities.streams.readintegertable(f,n,b)
- local i=f[2]
- local s=f[3]
- local p=i+n*b
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- return readintegertable(f[1],i,n,b)
- end
-else
- local readcardinal1=streams.readcardinal1
- local readcardinal2=streams.readcardinal2
- local readcardinal3=streams.readcardinal3
- local readcardinal4=streams.readcardinal4
- function streams.readcardinaltable(f,n,b)
- local i=f[2]
- local s=f[3]
- local p=i+n*b
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- local t={}
- if b==1 then for i=1,n do t[i]=readcardinal1(f[1],i) end
- elseif b==2 then for i=1,n do t[i]=readcardinal2(f[1],i) end
- elseif b==3 then for i=1,n do t[i]=readcardinal3(f[1],i) end
- elseif b==4 then for i=1,n do t[i]=readcardinal4(f[1],i) end end
- return t
- end
- local readinteger1=streams.readinteger1
- local readinteger2=streams.readinteger2
- local readinteger3=streams.readinteger3
- local readinteger4=streams.readinteger4
- function streams.readintegertable(f,n,b)
- local i=f[2]
- local s=f[3]
- local p=i+n*b
- if p>s then
- f[2]=s+1
- else
- f[2]=p
- end
- local t={}
- if b==1 then for i=1,n do t[i]=readinteger1(f[1],i) end
- elseif b==2 then for i=1,n do t[i]=readinteger2(f[1],i) end
- elseif b==3 then for i=1,n do t[i]=readinteger3(f[1],i) end
- elseif b==4 then for i=1,n do t[i]=readinteger4(f[1],i) end end
- return t
- end
-end
-do
- local files=utilities.files
- if files then
- local openfile=files.open
- local openstream=streams.open
- local openstring=streams.openstring
- local setmetatable=setmetatable
- function io.newreader(str,method)
- local f,m
- if method=="string" then
- f=openstring(str)
- m=streams
- elseif method=="stream" then
- f=openstream(str)
- m=streams
- else
- f=openfile(str,"rb")
- m=files
- end
- if f then
- local t={}
- setmetatable(t,{
- __index=function(t,k)
- local r=m[k]
- if k=="close" then
- if f then
- m.close(f)
- f=nil
- end
- return function() end
- elseif r then
- local v=function(_,a,b) return r(f,a,b) end
- t[k]=v
- return v
- else
- print("unknown key",k)
- end
- end
- } )
- return t
- end
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-sto"] = package.loaded["util-sto"] or true
-
--- original size: 6661, stripped down to: 3074
-
-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"
-}
-local setmetatable,getmetatable,rawset,type=setmetatable,getmetatable,rawset,type
-utilities=utilities or {}
-utilities.storage=utilities.storage or {}
-local storage=utilities.storage
-function storage.mark(t)
- if not t then
- print("\nfatal error: storage cannot be marked\n")
- os.exit()
- return
- end
- local m=getmetatable(t)
- if not m then
- m={}
- setmetatable(t,m)
- end
- m.__storage__=true
- return t
-end
-function storage.allocate(t)
- t=t or {}
- local m=getmetatable(t)
- if not m then
- m={}
- setmetatable(t,m)
- end
- m.__storage__=true
- return t
-end
-function storage.marked(t)
- local m=getmetatable(t)
- return m and m.__storage__
-end
-function storage.checked(t)
- if not t then
- report("\nfatal error: storage has not been allocated\n")
- os.exit()
- return
- end
- return t
-end
-function storage.setinitializer(data,initialize)
- local m=getmetatable(data) or {}
- m.__index=function(data,k)
- m.__index=nil
- initialize()
- return data[k]
- end
- setmetatable(data,m)
-end
-local keyisvalue={ __index=function(t,k)
- t[k]=k
- return k
-end }
-function storage.sparse(t)
- t=t or {}
- setmetatable(t,keyisvalue)
- return t
-end
-local function f_empty () return "" end
-local function f_self (t,k) t[k]=k return k end
-local function f_table (t,k) local v={} t[k]=v return v end
-local function f_number(t,k) t[k]=0 return 0 end
-local function f_ignore() end
-local f_index={
- ["empty"]=f_empty,
- ["self"]=f_self,
- ["table"]=f_table,
- ["number"]=f_number,
-}
-function table.setmetatableindex(t,f)
- if type(t)~="table" then
- f,t=t,{}
- end
- local m=getmetatable(t)
- local i=f_index[f] or f
- if m then
- m.__index=i
- else
- setmetatable(t,{ __index=i })
- end
- return t
-end
-local f_index={
- ["ignore"]=f_ignore,
-}
-function table.setmetatablenewindex(t,f)
- if type(t)~="table" then
- f,t=t,{}
- end
- local m=getmetatable(t)
- local i=f_index[f] or f
- if m then
- m.__newindex=i
- else
- setmetatable(t,{ __newindex=i })
- end
- return t
-end
-function table.setmetatablecall(t,f)
- if type(t)~="table" then
- f,t=t,{}
- end
- local m=getmetatable(t)
- if m then
- m.__call=f
- else
- setmetatable(t,{ __call=f })
- end
- return t
-end
-function table.setmetatableindices(t,f,n,c)
- if type(t)~="table" then
- f,t=t,{}
- end
- local m=getmetatable(t)
- local i=f_index[f] or f
- if m then
- m.__index=i
- m.__newindex=n
- m.__call=c
- else
- setmetatable(t,{
- __index=i,
- __newindex=n,
- __call=c,
- })
- end
- return t
-end
-function table.setmetatablekey(t,key,value)
- local m=getmetatable(t)
- if not m then
- m={}
- setmetatable(t,m)
- end
- m[key]=value
- return t
-end
-function table.getmetatablekey(t,key,value)
- local m=getmetatable(t)
- return m and m[key]
-end
-function table.makeweak(t)
- if not t then
- t={}
- end
- local m=getmetatable(t)
- if m then
- m.__mode="v"
- else
- setmetatable(t,{ __mode="v" })
- end
- return t
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-prs"] = package.loaded["util-prs"] or true
-
--- original size: 24683, stripped down to: 16431
-
-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 lpeg,table,string=lpeg,table,string
-local P,R,V,S,C,Ct,Cs,Carg,Cc,Cg,Cf,Cp=lpeg.P,lpeg.R,lpeg.V,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cc,lpeg.Cg,lpeg.Cf,lpeg.Cp
-local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
-local concat,gmatch,find=table.concat,string.gmatch,string.find
-local tonumber,tostring,type,next,rawset=tonumber,tostring,type,next,rawset
-local mod,div=math.mod,math.div
-utilities=utilities or {}
-local parsers=utilities.parsers or {}
-utilities.parsers=parsers
-local patterns=parsers.patterns or {}
-parsers.patterns=patterns
-local setmetatableindex=table.setmetatableindex
-local sortedhash=table.sortedhash
-local sortedkeys=table.sortedkeys
-local tohash=table.tohash
-local hashes={}
-parsers.hashes=hashes
-local digit=R("09")
-local space=P(' ')
-local equal=P("=")
-local colon=P(":")
-local comma=P(",")
-local lbrace=P("{")
-local rbrace=P("}")
-local lparent=P("(")
-local rparent=P(")")
-local lbracket=P("[")
-local rbracket=P("]")
-local period=S(".")
-local punctuation=S(".,:;")
-local spacer=lpegpatterns.spacer
-local whitespace=lpegpatterns.whitespace
-local newline=lpegpatterns.newline
-local anything=lpegpatterns.anything
-local endofstring=lpegpatterns.endofstring
-local nobrace=1-(lbrace+rbrace )
-local noparent=1-(lparent+rparent)
-local nobracket=1-(lbracket+rbracket)
-local escape,left,right=P("\\"),P('{'),P('}')
-lpegpatterns.balanced=P {
- [1]=((escape*(left+right))+(1-(left+right))+V(2))^0,
- [2]=left*V(1)*right
-}
-local nestedbraces=P { lbrace*(nobrace+V(1))^0*rbrace }
-local nestedparents=P { lparent*(noparent+V(1))^0*rparent }
-local nestedbrackets=P { lbracket*(nobracket+V(1))^0*rbracket }
-local spaces=space^0
-local argument=Cs((lbrace/"")*((nobrace+nestedbraces)^0)*(rbrace/""))
-local content=(1-endofstring)^0
-lpegpatterns.nestedbraces=nestedbraces
-lpegpatterns.nestedparents=nestedparents
-lpegpatterns.nested=nestedbraces
-lpegpatterns.argument=argument
-lpegpatterns.content=content
-local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+(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 pattern_d=(space+comma)^0*(key*(equal+colon)*value+key*C(""))
-local key=C((1-space-equal-comma)^1)
-local pattern_b=spaces*comma^0*spaces*(key*((spaces*equal*spaces*value)+C("")))
-local hash={}
-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
-local pattern_d_s=(pattern_d/set)^1
-patterns.settings_to_hash_a=pattern_a_s
-patterns.settings_to_hash_b=pattern_b_s
-patterns.settings_to_hash_c=pattern_c_s
-patterns.settings_to_hash_d=pattern_d_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 not str or str=="" then
- return {}
- elseif type(str)=="table" then
- if existing then
- for k,v in next,str do
- existing[k]=v
- end
- return exiting
- else
- return str
- end
- else
- hash=existing or {}
- lpegmatch(pattern_a_s,str)
- return hash
- end
-end
-function parsers.settings_to_hash_colon_too(str)
- if not str or str=="" then
- return {}
- elseif type(str)=="table" then
- return str
- else
- hash={}
- lpegmatch(pattern_d_s,str)
- return hash
- end
-end
-function parsers.settings_to_hash_tolerant(str,existing)
- if not str or str=="" then
- return {}
- elseif type(str)=="table" then
- if existing then
- for k,v in next,str do
- existing[k]=v
- end
- return exiting
- else
- return str
- end
- else
- hash=existing or {}
- lpegmatch(pattern_b_s,str)
- return hash
- end
-end
-function parsers.settings_to_hash_strict(str,existing)
- if not str or str=="" then
- return nil
- elseif type(str)=="table" then
- if existing then
- for k,v in next,str do
- existing[k]=v
- end
- return exiting
- else
- return str
- end
- elseif str and str~="" then
- hash=existing or {}
- lpegmatch(pattern_c_s,str)
- return next(hash) and hash
- end
-end
-local separator=comma*space^0
-local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+(1-comma))^0)
-local pattern=spaces*Ct(value*(separator*value)^0)
-patterns.settings_to_array=pattern
-function parsers.settings_to_array(str,strict)
- if not str or str=="" then
- return {}
- elseif type(str)=="table" then
- return str
- elseif strict then
- if find(str,"{",1,true) then
- return lpegmatch(pattern,str)
- else
- return { str }
- end
- elseif find(str,",",1,true) then
- return lpegmatch(pattern,str)
- else
- return { str }
- end
-end
-function parsers.settings_to_numbers(str)
- if not str or str=="" then
- return {}
- end
- if type(str)=="table" then
- elseif find(str,",",1,true) then
- str=lpegmatch(pattern,str)
- else
- return { tonumber(str) }
- end
- for i=1,#str do
- str[i]=tonumber(str[i])
- end
- return str
-end
-local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+nestedbrackets+nestedparents+(1-comma))^0)
-local pattern=spaces*Ct(value*(separator*value)^0)
-function parsers.settings_to_array_obey_fences(str)
- return lpegmatch(pattern,str)
-end
-local cache_a={}
-local cache_b={}
-function parsers.groupedsplitat(symbol,withaction)
- if not symbol then
- symbol=","
- end
- local pattern=(withaction and cache_b or cache_a)[symbol]
- if not pattern then
- local symbols=S(symbol)
- local separator=space^0*symbols*space^0
- local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+(1-(space^0*(symbols+P(-1)))))^0)
- if withaction then
- local withvalue=Carg(1)*value/function(f,s) return f(s) end
- pattern=spaces*withvalue*(separator*withvalue)^0
- cache_b[symbol]=pattern
- else
- pattern=spaces*Ct(value*(separator*value)^0)
- cache_a[symbol]=pattern
- end
- end
- return pattern
-end
-local pattern_a=parsers.groupedsplitat(",",false)
-local pattern_b=parsers.groupedsplitat(",",true)
-function parsers.stripped_settings_to_array(str)
- if not str or str=="" then
- return {}
- else
- return lpegmatch(pattern_a,str)
- end
-end
-function parsers.process_stripped_settings(str,action)
- if not str or str=="" then
- return {}
- else
- return lpegmatch(pattern_b,str,1,action)
- 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={}
- local tn=0
- local s=sortedkeys(h)
- omit=omit and 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
-local pattern=Cf(Ct("")*Cg(C((1-S(", "))^1)*S(", ")^0*Cc(true))^1,rawset)
-function parsers.settings_to_set(str)
- return str and lpegmatch(pattern,str) or {}
-end
-hashes.settings_to_set=table.setmetatableindex(function(t,k)
- local v=k and lpegmatch(pattern,k) or {}
- t[k]=v
- return v
-end)
-getmetatable(hashes.settings_to_set).__mode="kv"
-function parsers.simple_hash_to_string(h,separator)
- local t={}
- local 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 str=Cs(lpegpatterns.unquoted)+C((1-whitespace-equal)^1)
-local setting=Cf(Carg(1)*(whitespace^0*Cg(str*whitespace^0*(equal*whitespace^0*str+Cc(""))))^1,rawset)
-local splitter=setting^1
-function parsers.options_to_hash(str,target)
- return str and lpegmatch(splitter,str,1,target or {}) or {}
-end
-local splitter=lpeg.tsplitat(" ")
-function parsers.options_to_array(str)
- return str and lpegmatch(splitter,str) or {}
-end
-local value=P(lbrace*C((nobrace+nestedbraces)^0)*rbrace)+C(digit^1*lparent*(noparent+nestedparents)^1*rparent)+C((nestedbraces+(1-comma))^1)
-local pattern_a=spaces*Ct(value*(separator*value)^0)
-local function repeater(n,str)
- if not n then
- return str
- else
- local s=lpegmatch(pattern_a,str)
- if n==1 then
- return unpack(s)
- else
- local t={}
- local tn=0
- for i=1,n do
- for j=1,#s do
- tn=tn+1
- t[tn]=s[j]
- end
- end
- return unpack(t)
- end
- end
-end
-local value=P(lbrace*C((nobrace+nestedbraces)^0)*rbrace)+(C(digit^1)/tonumber*lparent*Cs((noparent+nestedparents)^1)*rparent)/repeater+C((nestedbraces+(1-comma))^1)
-local pattern_b=spaces*Ct(value*(separator*value)^0)
-function parsers.settings_to_array_with_repeat(str,expand)
- if expand then
- return lpegmatch(pattern_b,str) or {}
- else
- return lpegmatch(pattern_a,str) or {}
- end
-end
-local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace
-local pattern=Ct((space+value)^0)
-function parsers.arguments_to_table(str)
- return lpegmatch(pattern,str)
-end
-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
-local pattern=Cs { "start",
- start=V("one")+V("two")+V("three"),
- rest=(Cc(",")*V("thousand"))^0*(P(".")+endofstring)*anything^0,
- thousand=digit*digit*digit,
- one=digit*V("rest"),
- two=digit*digit*V("rest"),
- three=V("thousand")*V("rest"),
-}
-lpegpatterns.splitthousands=pattern
-function parsers.splitthousands(str)
- return lpegmatch(pattern,str) or str
-end
-local optionalwhitespace=whitespace^0
-lpegpatterns.words=Ct((Cs((1-punctuation-whitespace)^1)+anything)^1)
-lpegpatterns.sentences=Ct((optionalwhitespace*Cs((1-period)^0*period))^1)
-lpegpatterns.paragraphs=Ct((optionalwhitespace*Cs((whitespace^1*endofstring/""+1-(spacer^0*newline*newline))^1))^1)
-local dquote=P('"')
-local equal=P('=')
-local escape=P('\\')
-local separator=S(' ,')
-local key=C((1-equal)^1)
-local value=dquote*C((1-dquote-escape*dquote)^0)*dquote
-local pattern=Cf(Ct("")*(Cg(key*equal*value)*separator^0)^1,rawset)^0*P(-1)
-function parsers.keq_to_hash(str)
- if str and str~="" then
- return lpegmatch(pattern,str)
- else
- return {}
- end
-end
-local defaultspecification={ separator=",",quote='"' }
-function parsers.csvsplitter(specification)
- specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
- local separator=specification.separator
- local quotechar=specification.quote
- local numbers=specification.numbers
- local separator=S(separator~="" and separator or ",")
- local whatever=C((1-separator-newline)^0)
- if quotechar and quotechar~="" then
- local quotedata=nil
- for chr in gmatch(quotechar,".") do
- local quotechar=P(chr)
- local quoteitem=(1-quotechar)^0
- local quoteword=quotechar*(numbers and (quoteitem/tonumber) or C(quoteitem))*quotechar
- if quotedata then
- quotedata=quotedata+quoteword
- else
- quotedata=quoteword
- end
- end
- whatever=quotedata+whatever
- end
- local parser=Ct((Ct(whatever*(separator*whatever)^0)*S("\n\r")^1)^0 )
- return function(data)
- return lpegmatch(parser,data)
- end
-end
-function parsers.rfc4180splitter(specification)
- specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
- local numbers=specification.numbers
- local separator=specification.separator
- local quotechar=P(specification.quote)
- local dquotechar=quotechar*quotechar
-/specification.quote
- local separator=S(separator~="" and separator or ",")
- local whatever=(dquotechar+(1-quotechar))^0
- local escaped=quotechar*(numbers and (whatever/tonumber) or Cs(whatever))*quotechar
- local non_escaped=C((1-quotechar-newline-separator)^1)
- local field=escaped+non_escaped+Cc("")
- local record=Ct(field*(separator*field)^1)
- local headerline=record*Cp()
- local morerecords=(newline^(specification.strict and -1 or 1)*record)^0
- local headeryes=Ct(morerecords)
- local headernop=Ct(record*morerecords)
- return function(data,getheader)
- if getheader then
- local header,position=lpegmatch(headerline,data)
- local data=lpegmatch(headeryes,data,position)
- return data,header
- else
- return lpegmatch(headernop,data)
- end
- end
-end
-local function ranger(first,last,n,action)
- if not first then
- elseif last==true then
- for i=first,n or first do
- action(i)
- end
- elseif last then
- for i=first,last do
- action(i)
- end
- else
- action(first)
- end
-end
-local cardinal=lpegpatterns.cardinal/tonumber
-local spacers=lpegpatterns.spacer^0
-local endofstring=lpegpatterns.endofstring
-local stepper=spacers*(cardinal*(spacers*S(":-")*spacers*(cardinal+Cc(true) )+Cc(false) )*Carg(1)*Carg(2)/ranger*S(", ")^0 )^1
-local stepper=spacers*(cardinal*(spacers*S(":-")*spacers*(cardinal+(P("*")+endofstring)*Cc(true) )+Cc(false) )*Carg(1)*Carg(2)/ranger*S(", ")^0 )^1*endofstring
-function parsers.stepper(str,n,action)
- if type(n)=="function" then
- lpegmatch(stepper,str,1,false,n or print)
- else
- lpegmatch(stepper,str,1,n,action or print)
- end
-end
-local pattern_math=Cs((P("%")/"\\percent "+P("^")*Cc("{")*lpegpatterns.integer*Cc("}")+anything)^0)
-local pattern_text=Cs((P("%")/"\\percent "+(P("^")/"\\high")*Cc("{")*lpegpatterns.integer*Cc("}")+anything)^0)
-patterns.unittotex=pattern
-function parsers.unittotex(str,textmode)
- return lpegmatch(textmode and pattern_text or pattern_math,str)
-end
-local pattern=Cs((P("^")/"<sup>"*lpegpatterns.integer*Cc("</sup>")+anything)^0)
-function parsers.unittoxml(str)
- return lpegmatch(pattern,str)
-end
-local cache={}
-local spaces=lpegpatterns.space^0
-local dummy=function() end
-setmetatableindex(cache,function(t,k)
- local separator=P(k)
- local value=(1-separator)^0
- local pattern=spaces*C(value)*separator^0*Cp()
- t[k]=pattern
- return pattern
-end)
-local commalistiterator=cache[","]
-function parsers.iterator(str,separator)
- local n=#str
- if n==0 then
- return dummy
- else
- local pattern=separator and cache[separator] or commalistiterator
- local p=1
- return function()
- if p<=n then
- local s,e=lpegmatch(pattern,str,p)
- if e then
- p=e
- return s
- end
- end
- end
- end
-end
-local function initialize(t,name)
- local source=t[name]
- if source then
- local result={}
- for k,v in next,t[name] do
- result[k]=v
- end
- return result
- else
- return {}
- end
-end
-local function fetch(t,name)
- return t[name] or {}
-end
-local function process(result,more)
- for k,v in next,more do
- result[k]=v
- end
- return result
-end
-local name=C((1-S(", "))^1)
-local parser=(Carg(1)*name/initialize)*(S(", ")^1*(Carg(1)*name/fetch))^0
-local merge=Cf(parser,process)
-function parsers.mergehashes(hash,list)
- return lpegmatch(merge,list,1,hash)
-end
-function parsers.runtime(time)
- if not time then
- time=os.runtime()
- end
- local days=div(time,24*60*60)
- time=mod(time,24*60*60)
- local hours=div(time,60*60)
- time=mod(time,60*60)
- local minutes=div(time,60)
- local seconds=mod(time,60)
- return days,hours,minutes,seconds
-end
-local spacing=whitespace^0
-local apply=P("->")
-local method=C((1-apply)^1)
-local token=lbrace*C((1-rbrace)^1)*rbrace+C(anything^1)
-local pattern=spacing*(method*spacing*apply+Carg(1))*spacing*token
-function parsers.splitmethod(str,default)
- if str then
- return lpegmatch(pattern,str,1,default or false)
- else
- return default or false,""
- end
-end
-local p_year=lpegpatterns.digit^4/tonumber
-local pattern=Cf(Ct("")*(
- (Cg(Cc("year")*p_year)*S("-/")*Cg(Cc("month")*cardinal)*S("-/")*Cg(Cc("day")*cardinal)
- )+(Cg(Cc("day")*cardinal)*S("-/")*Cg(Cc("month")*cardinal)*S("-/")*Cg(Cc("year")*p_year)
- )
- )*P(" ")*Cg(Cc("hour")*cardinal)*P(":")*Cg(Cc("min")*cardinal)*(P(":")*Cg(Cc("sec")*cardinal))^-1
-,rawset)
-lpegpatterns.splittime=pattern
-function parsers.totime(str)
- return lpegmatch(pattern,str)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
-
--- original size: 2541, stripped down to: 1624
-
-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 lpegmatch=lpeg.match
-local stripper=lpeg.patterns.stripzeros
-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
- rj=tostring(rj)
- elseif 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
-
-package.loaded["util-soc-imp-reset"] = package.loaded["util-soc-imp-reset"] or true
-
--- original size: 374, stripped down to: 282
-
-local loaded=package.loaded
-loaded["socket"]=nil
-loaded["copas"]=nil
-loaded["ltn12"]=nil
-loaded["mbox"]=nil
-loaded["mime"]=nil
-loaded["socket.url"]=nil
-loaded["socket.headers"]=nil
-loaded["socket.tp"]=nil
-loaded["socket.http"]=nil
-loaded["socket.ftp"]=nil
-loaded["socket.smtp"]=nil
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-socket"] = package.loaded["util-soc-imp-socket"] or true
-
--- original size: 4905, stripped down to: 3562
-
-
-local type,tostring,setmetatable=type,tostring,setmetatable
-local min=math.min
-local format=string.format
-local socket=socket or package.loaded.socket or require("socket.core")
-local connect=socket.connect
-local tcp4=socket.tcp4
-local tcp6=socket.tcp6
-local getaddrinfo=socket.dns.getaddrinfo
-local defaulthost="0.0.0.0"
-local function report(fmt,first,...)
- if logs then
- report=logs and logs.reporter("socket")
- report(fmt,first,...)
- elseif fmt then
- fmt="socket: "..fmt
- if first then
- print(format(fmt,first,...))
- else
- print(fmt)
- end
- end
-end
-socket.report=report
-function socket.connect4(address,port,laddress,lport)
- return connect(address,port,laddress,lport,"inet")
-end
-function socket.connect6(address,port,laddress,lport)
- return connect(address,port,laddress,lport,"inet6")
-end
-function socket.bind(host,port,backlog)
- if host=="*" or host=="" then
- host=defaulthost
- end
- local addrinfo,err=getaddrinfo(host)
- if not addrinfo then
- return nil,err
- end
- for i=1,#addrinfo do
- local alt=addrinfo[i]
- local sock,err=(alt.family=="inet" and tcp4 or tcp6)()
- if not sock then
- return nil,err or "unknown error"
- end
- sock:setoption("reuseaddr",true)
- local res,err=sock:bind(alt.addr,port)
- if res then
- res,err=sock:listen(backlog)
- if res then
- return sock
- else
- sock:close()
- end
- else
- sock:close()
- end
- end
- return nil,"invalid address"
-end
-socket.try=socket.newtry()
-function socket.choose(list)
- return function(name,opt1,opt2)
- if type(name)~="string" then
- name,opt1,opt2="default",name,opt1
- end
- local f=list[name or "nil"]
- if f then
- return f(opt1,opt2)
- else
- report("error: unknown key '%s'",tostring(name))
- end
- end
-end
-local sourcet={}
-local sinkt={}
-socket.sourcet=sourcet
-socket.sinkt=sinkt
-socket.BLOCKSIZE=2048
-sinkt["close-when-done"]=function(sock)
- return setmetatable (
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },
- {
- __call=function(self,chunk,err)
- if chunk then
- return sock:send(chunk)
- else
- sock:close()
- return 1
- end
- end
- }
- )
-end
-sinkt["keep-open"]=function(sock)
- return setmetatable (
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },{
- __call=function(self,chunk,err)
- if chunk then
- return sock:send(chunk)
- else
- return 1
- end
- end
- }
- )
-end
-sinkt["default"]=sinkt["keep-open"]
-socket.sink=socket.choose(sinkt)
-sourcet["by-length"]=function(sock,length)
- local blocksize=socket.BLOCKSIZE
- return setmetatable (
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },
- {
- __call=function()
- if length<=0 then
- return nil
- end
- local chunk,err=sock:receive(min(blocksize,length))
- if err then
- return nil,err
- end
- length=length-#chunk
- return chunk
- end
- }
- )
-end
-sourcet["until-closed"]=function(sock)
- local blocksize=socket.BLOCKSIZE
- local done=false
- return setmetatable (
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },{
- __call=function()
- if done then
- return nil
- end
- local chunk,status,partial=sock:receive(blocksize)
- if not status then
- return chunk
- elseif status=="closed" then
- sock:close()
- done=true
- return partial
- else
- return nil,status
- end
- end
- }
- )
-end
-sourcet["default"]=sourcet["until-closed"]
-socket.source=socket.choose(sourcet)
-_G.socket=socket
-package.loaded["socket"]=socket
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-copas"] = package.loaded["util-soc-imp-copas"] or true
-
--- original size: 26186, stripped down to: 14893
-
-
-local socket=socket or require("socket")
-local ssl=ssl or nil
-local WATCH_DOG_TIMEOUT=120
-local UDP_DATAGRAM_MAX=8192
-local type,next,pcall,getmetatable,tostring=type,next,pcall,getmetatable,tostring
-local min,max,random=math.min,math.max,math.random
-local find=string.find
-local insert,remove=table.insert,table.remove
-local gettime=socket.gettime
-local selectsocket=socket.select
-local createcoroutine=coroutine.create
-local resumecoroutine=coroutine.resume
-local yieldcoroutine=coroutine.yield
-local runningcoroutine=coroutine.running
-local function report(fmt,first,...)
- if logs then
- report=logs and logs.reporter("copas")
- report(fmt,first,...)
- elseif fmt then
- fmt="copas: "..fmt
- if first then
- print(format(fmt,first,...))
- else
- print(fmt)
- end
- end
-end
-local copas={
- _COPYRIGHT="Copyright (C) 2005-2016 Kepler Project",
- _DESCRIPTION="Coroutine Oriented Portable Asynchronous Services",
- _VERSION="Copas 2.0.1",
- autoclose=true,
- running=false,
- report=report,
- trace=false,
-}
-local function statushandler(status,...)
- if status then
- return...
- end
- local err=(...)
- if type(err)=="table" then
- err=err[1]
- end
- if copas.trace then
- report("error: %s",tostring(err))
- end
- return nil,err
-end
-function socket.protect(func)
- return function(...)
- return statushandler(pcall(func,...))
- end
-end
-function socket.newtry(finalizer)
- return function (...)
- local status=(...)
- if not status then
- local detail=select(2,...)
- pcall(finalizer,detail)
- if copas.trace then
- report("error: %s",tostring(detail))
- end
- return
- end
- return...
- end
-end
-local function newset()
- local reverse={}
- local set={}
- local queue={}
- setmetatable(set,{
- __index={
- insert=function(set,value)
- if not reverse[value] then
- local n=#set+1
- set[n]=value
- reverse[value]=n
- end
- end,
- remove=function(set,value)
- local index=reverse[value]
- if index then
- reverse[value]=nil
- local n=#set
- local top=set[n]
- set[n]=nil
- if top~=value then
- reverse[top]=index
- set[index]=top
- end
- end
- end,
- push=function (set,key,itm)
- local entry=queue[key]
- if entry==nil then
- queue[key]={ itm }
- else
- entry[#entry+1]=itm
- end
- end,
- pop=function (set,key)
- local top=queue[key]
- if top~=nil then
- local ret=remove(top,1)
- if top[1]==nil then
- queue[key]=nil
- end
- return ret
- end
- end
- }
- } )
- return set
-end
-local _sleeping={
- times={},
- cos={},
- lethargy={},
- insert=function()
- end,
- remove=function()
- end,
- push=function(self,sleeptime,co)
- if not co then
- return
- end
- if sleeptime<0 then
- self.lethargy[co]=true
- return
- else
- sleeptime=gettime()+sleeptime
- end
- local t=self.times
- local c=self.cos
- local i=1
- local n=#t
- while i<=n and t[i]<=sleeptime do
- i=i+1
- end
- insert(t,i,sleeptime)
- insert(c,i,co)
- end,
- getnext=
- function(self)
- local t=self.times
- local delay=t[1] and t[1]-gettime() or nil
- return delay and max(delay,0) or nil
- end,
- pop=
- function(self,time)
- local t=self.times
- local c=self.cos
- if #t==0 or time<t[1] then
- return
- end
- local co=c[1]
- remove(t,1)
- remove(c,1)
- return co
- end,
- wakeup=function(self,co)
- local let=self.lethargy
- if let[co] then
- self:push(0,co)
- let[co]=nil
- else
- local c=self.cos
- local t=self.times
- for i=1,#c do
- if c[i]==co then
- remove(c,i)
- remove(t,i)
- self:push(0,co)
- return
- end
- end
- end
- end
-}
-local _servers=newset()
-local _reading=newset()
-local _writing=newset()
-local _reading_log={}
-local _writing_log={}
-local _is_timeout={
- timeout=true,
- wantread=true,
- wantwrite=true,
-}
-local function isTCP(socket)
- return not find(tostring(socket),"^udp")
-end
-local function copasreceive(client,pattern,part)
- if not pattern or pattern=="" then
- pattern="*l"
- end
- local current_log=_reading_log
- local s,err
- repeat
- s,err,part=client:receive(pattern,part)
- if s or (not _is_timeout[err]) then
- current_log[client]=nil
- return s,err,part
- end
- if err=="wantwrite" then
- current_log=_writing_log
- current_log[client]=gettime()
- yieldcoroutine(client,_writing)
- else
- current_log=_reading_log
- current_log[client]=gettime()
- yieldcoroutine(client,_reading)
- end
- until false
-end
-local function copasreceivefrom(client,size)
- local s,err,port
- if not size or size==0 then
- size=UDP_DATAGRAM_MAX
- end
- repeat
- s,err,port=client:receivefrom(size)
- if s or err~="timeout" then
- _reading_log[client]=nil
- return s,err,port
- end
- _reading_log[client]=gettime()
- yieldcoroutine(client,_reading)
- until false
-end
-local function copasreceivepartial(client,pattern,part)
- if not pattern or pattern=="" then
- pattern="*l"
- end
- local logger=_reading_log
- local queue=_reading
- local s,err
- repeat
- s,err,part=client:receive(pattern,part)
- if s or (type(pattern)=="number" and part~="" and part) or not _is_timeout[err] then
- logger[client]=nil
- return s,err,part
- end
- if err=="wantwrite" then
- logger=_writing_log
- queue=_writing
- else
- logger=_reading_log
- queue=_reading
- end
- logger[client]=gettime()
- yieldcoroutine(client,queue)
- until false
-end
-local function copassend(client,data,from,to)
- if not from then
- from=1
- end
- local lastIndex=from-1
- local logger=_writing_log
- local queue=_writing
- local s,err
- repeat
- s,err,lastIndex=client:send(data,lastIndex+1,to)
- if random(100)>90 then
- logger[client]=gettime()
- yieldcoroutine(client,queue)
- end
- if s or not _is_timeout[err] then
- logger[client]=nil
- return s,err,lastIndex
- end
- if err=="wantread" then
- logger=_reading_log
- queue=_reading
- else
- logger=_writing_log
- queue=_writing
- end
- logger[client]=gettime()
- yieldcoroutine(client,queue)
- until false
-end
-local function copassendto(client,data,ip,port)
- repeat
- local s,err=client:sendto(data,ip,port)
- if random(100)>90 then
- _writing_log[client]=gettime()
- yieldcoroutine(client,_writing)
- end
- if s or err~="timeout" then
- _writing_log[client]=nil
- return s,err
- end
- _writing_log[client]=gettime()
- yieldcoroutine(client,_writing)
- until false
-end
-local function copasconnect(skt,host,port)
- skt:settimeout(0)
- local ret,err,tried_more_than_once
- repeat
- ret,err=skt:connect (host,port)
- if ret or (err~="timeout" and err~="Operation already in progress") then
- if not ret and err=="already connected" and tried_more_than_once then
- ret=1
- err=nil
- end
- _writing_log[skt]=nil
- return ret,err
- end
- tried_more_than_once=tried_more_than_once or true
- _writing_log[skt]=gettime()
- yieldcoroutine(skt,_writing)
- until false
-end
-local function copasdohandshake(skt,sslt)
- if not ssl then
- ssl=require("ssl")
- end
- if not ssl then
- report("error: no ssl library")
- return
- end
- local nskt,err=ssl.wrap(skt,sslt)
- if not nskt then
- report("error: %s",tostring(err))
- return
- end
- nskt:settimeout(0)
- local queue
- repeat
- local success,err=nskt:dohandshake()
- if success then
- return nskt
- elseif err=="wantwrite" then
- queue=_writing
- elseif err=="wantread" then
- queue=_reading
- else
- report("error: %s",tostring(err))
- return
- end
- yieldcoroutine(nskt,queue)
- until false
-end
-local function copasflush(client)
-end
-copas.connect=copassconnect
-copas.send=copassend
-copas.sendto=copassendto
-copas.receive=copasreceive
-copas.receivefrom=copasreceivefrom
-copas.copasreceivepartial=copasreceivepartial
-copas.copasreceivePartial=copasreceivepartial
-copas.dohandshake=copasdohandshake
-copas.flush=copasflush
-local function _skt_mt_tostring(self)
- return tostring(self.socket).." (copas wrapped)"
-end
-local _skt_mt_tcp_index={
- send=function(self,data,from,to)
- return copassend (self.socket,data,from,to)
- end,
- receive=function (self,pattern,prefix)
- if self.timeout==0 then
- return copasreceivePartial(self.socket,pattern,prefix)
- else
- return copasreceive(self.socket,pattern,prefix)
- end
- end,
- flush=function (self)
- return copasflush(self.socket)
- end,
- settimeout=function (self,time)
- self.timeout=time
- return true
- end,
- connect=function(self,...)
- local res,err=copasconnect(self.socket,...)
- if res and self.ssl_params then
- res,err=self:dohandshake()
- end
- return res,err
- end,
- close=function(self,...)
- return self.socket:close(...)
- end,
- bind=function(self,...)
- return self.socket:bind(...)
- end,
- getsockname=function(self,...)
- return self.socket:getsockname(...)
- end,
- getstats=function(self,...)
- return self.socket:getstats(...)
- end,
- setstats=function(self,...)
- return self.socket:setstats(...)
- end,
- listen=function(self,...)
- return self.socket:listen(...)
- end,
- accept=function(self,...)
- return self.socket:accept(...)
- end,
- setoption=function(self,...)
- return self.socket:setoption(...)
- end,
- getpeername=function(self,...)
- return self.socket:getpeername(...)
- end,
- shutdown=function(self,...)
- return self.socket:shutdown(...)
- end,
- dohandshake=function(self,sslt)
- self.ssl_params=sslt or self.ssl_params
- local nskt,err=copasdohandshake(self.socket,self.ssl_params)
- if not nskt then
- return nskt,err
- end
- self.socket=nskt
- return self
- end,
-}
-local _skt_mt_tcp={
- __tostring=_skt_mt_tostring,
- __index=_skt_mt_tcp_index,
-}
-local _skt_mt_udp_index={
- sendto=function (self,...)
- return copassendto(self.socket,...)
- end,
- receive=function (self,size)
- return copasreceive(self.socket,size or UDP_DATAGRAM_MAX)
- end,
- receivefrom=function (self,size)
- return copasreceivefrom(self.socket,size or UDP_DATAGRAM_MAX)
- end,
- setpeername=function(self,...)
- return self.socket:getpeername(...)
- end,
- setsockname=function(self,...)
- return self.socket:setsockname(...)
- end,
- close=function(self,...)
- return true
- end
-}
-local _skt_mt_udp={
- __tostring=_skt_mt_tostring,
- __index=_skt_mt_udp_index,
-}
-for k,v in next,_skt_mt_tcp_index do
- if not _skt_mt_udp_index[k] then
- _skt_mt_udp_index[k]=v
- end
-end
-local function wrap(skt,sslt)
- if getmetatable(skt)==_skt_mt_tcp or getmetatable(skt)==_skt_mt_udp then
- return skt
- end
- skt:settimeout(0)
- if isTCP(skt) then
- return setmetatable ({ socket=skt,ssl_params=sslt },_skt_mt_tcp)
- else
- return setmetatable ({ socket=skt },_skt_mt_udp)
- end
-end
-copas.wrap=wrap
-function copas.handler(handler,sslparams)
- return function (skt,...)
- skt=wrap(skt)
- if sslparams then
- skt:dohandshake(sslparams)
- end
- return handler(skt,...)
- end
-end
-local _errhandlers={}
-function copas.setErrorHandler(err)
- local co=runningcoroutine()
- if co then
- _errhandlers[co]=err
- end
-end
-local function _deferror (msg,co,skt)
- report("%s (%s) (%s)",msg,tostring(co),tostring(skt))
-end
-local function _doTick (co,skt,...)
- if not co then
- return
- end
- local ok,res,new_q=resumecoroutine(co,skt,...)
- if ok and res and new_q then
- new_q:insert(res)
- new_q:push(res,co)
- else
- if not ok then
- pcall(_errhandlers[co] or _deferror,res,co,skt)
- end
- if skt and copas.autoclose and isTCP(skt) then
- skt:close()
- end
- _errhandlers[co]=nil
- end
-end
-local function _accept(input,handler)
- local client=input:accept()
- if client then
- client:settimeout(0)
- local co=createcoroutine(handler)
- _doTick (co,client)
- end
- return client
-end
-local function _tickRead(skt)
- _doTick(_reading:pop(skt),skt)
-end
-local function _tickWrite(skt)
- _doTick(_writing:pop(skt),skt)
-end
-local function addTCPserver(server,handler,timeout)
- server:settimeout(timeout or 0)
- _servers[server]=handler
- _reading:insert(server)
-end
-local function addUDPserver(server,handler,timeout)
- server:settimeout(timeout or 0)
- local co=createcoroutine(handler)
- _reading:insert(server)
- _doTick(co,server)
-end
-function copas.addserver(server,handler,timeout)
- if isTCP(server) then
- addTCPserver(server,handler,timeout)
- else
- addUDPserver(server,handler,timeout)
- end
-end
-function copas.removeserver(server,keep_open)
- local s=server
- local mt=getmetatable(server)
- if mt==_skt_mt_tcp or mt==_skt_mt_udp then
- s=server.socket
- end
- _servers[s]=nil
- _reading:remove(s)
- if keep_open then
- return true
- end
- return server:close()
-end
-function copas.addthread(handler,...)
- local thread=createcoroutine(function(_,...) return handler(...) end)
- _doTick(thread,nil,...)
- return thread
-end
-local _tasks={}
-local function addtaskRead(task)
- task.def_tick=_tickRead
- _tasks[task]=true
-end
-local function addtaskWrite(task)
- task.def_tick=_tickWrite
- _tasks[task]=true
-end
-local function tasks()
- return next,_tasks
-end
-local _readable_t={
- events=function(self)
- local i=0
- return function ()
- i=i+1
- return self._evs[i]
- end
- end,
- tick=function(self,input)
- local handler=_servers[input]
- if handler then
- input=_accept(input,handler)
- else
- _reading:remove(input)
- self.def_tick(input)
- end
- end
-}
-addtaskRead(_readable_t)
-local _writable_t={
- events=function(self)
- local i=0
- return function()
- i=i+1
- return self._evs[i]
- end
- end,
- tick=function(self,output)
- _writing:remove(output)
- self.def_tick(output)
- end
-}
-addtaskWrite(_writable_t)
-local _sleeping_t={
- tick=function(self,time,...)
- _doTick(_sleeping:pop(time),...)
- end
-}
-function copas.sleep(sleeptime)
- yieldcoroutine((sleeptime or 0),_sleeping)
-end
-function copas.wakeup(co)
- _sleeping:wakeup(co)
-end
-local last_cleansing=0
-local function _select(timeout)
- local now=gettime()
- local r_evs,w_evs,err=selectsocket(_reading,_writing,timeout)
- _readable_t._evs=r_evs
- _writable_t._evs=w_evs
- if (last_cleansing-now)>WATCH_DOG_TIMEOUT then
- last_cleansing=now
- for skt,time in next,_reading_log do
- if not r_evs[skt] and (time-now)>WATCH_DOG_TIMEOUT then
- local n=#r_evs+1
- _reading_log[skt]=nil
- r_evs[n]=skt
- r_evs[skt]=n
- end
- end
- for skt,time in next,_writing_log do
- if not w_evs[skt] and (time-now)>WATCH_DOG_TIMEOUT then
- local n=#w_evs+1
- _writing_log[skt]=nil
- w_evs[n]=skt
- w_evs[skt]=n
- end
- end
- end
- if err=="timeout" and #r_evs+#w_evs>0 then
- return nil
- else
- return err
- end
-end
-local function copasfinished()
- return not (next(_reading) or next(_writing) or _sleeping:getnext())
-end
-local function copasstep(timeout)
- _sleeping_t:tick(gettime())
- local nextwait=_sleeping:getnext()
- if nextwait then
- timeout=timeout and min(nextwait,timeout) or nextwait
- elseif copasfinished() then
- return false
- end
- local err=_select(timeout)
- if err then
- if err=="timeout" then
- return false
- end
- return nil,err
- end
- for task in tasks() do
- for event in task:events() do
- task:tick(event)
- end
- end
- return true
-end
-copas.finished=copasfinished
-copas.step=copasstep
-function copas.loop(timeout)
- copas.running=true
- while not copasfinished() do
- copasstep(timeout)
- end
- copas.running=false
-end
-package.loaded["copas"]=copas
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-ltn12"] = package.loaded["util-soc-imp-ltn12"] or true
-
--- original size: 8709, stripped down to: 5411
-
-
-local select,unpack=select,unpack
-local insert,remove=table.insert,table.remove
-local sub=string.sub
-local function report(fmt,first,...)
- if logs then
- report=logs and logs.reporter("ltn12")
- report(fmt,first,...)
- elseif fmt then
- fmt="ltn12: "..fmt
- if first then
- print(format(fmt,first,...))
- else
- print(fmt)
- end
- end
-end
-local filter={}
-local source={}
-local sink={}
-local pump={}
-local ltn12={
- _VERSION="LTN12 1.0.3",
- BLOCKSIZE=2048,
- filter=filter,
- source=source,
- sink=sink,
- pump=pump,
- report=report,
-}
-function filter.cycle(low,ctx,extra)
- if low then
- return function(chunk)
- return (low(ctx,chunk,extra))
- end
- end
-end
-function filter.chain(...)
- local arg={... }
- local n=select('#',...)
- local top=1
- local index=1
- local retry=""
- return function(chunk)
- retry=chunk and retry
- while true do
- local action=arg[index]
- if index==top then
- chunk=action(chunk)
- if chunk=="" or top==n then
- return chunk
- elseif chunk then
- index=index+1
- else
- top=top+1
- index=top
- end
- else
- chunk=action(chunk or "")
- if chunk=="" then
- index=index-1
- chunk=retry
- elseif chunk then
- if index==n then
- return chunk
- else
- index=index+1
- end
- else
- report("error: filter returned inappropriate 'nil'")
- return
- end
- end
- end
- end
-end
-local function empty()
- return nil
-end
-function source.empty()
- return empty
-end
-local function sourceerror(err)
- return function()
- return nil,err
- end
-end
-source.error=sourceerror
-function source.file(handle,io_err)
- if handle then
- local blocksize=ltn12.BLOCKSIZE
- return function()
- local chunk=handle:read(blocksize)
- if not chunk then
- handle:close()
- end
- return chunk
- end
- else
- return sourceerror(io_err or "unable to open file")
- end
-end
-function source.simplify(src)
- return function()
- local chunk,err_or_new=src()
- if err_or_new then
- src=err_or_new
- end
- if chunk then
- return chunk
- else
- return nil,err_or_new
- end
- end
-end
-function source.string(s)
- if s then
- local blocksize=ltn12.BLOCKSIZE
- local i=1
- return function()
- local nexti=i+blocksize
- local chunk=sub(s,i,nexti-1)
- i=nexti
- if chunk~="" then
- return chunk
- else
- return nil
- end
- end
- else return source.empty() end
-end
-function source.rewind(src)
- local t={}
- return function(chunk)
- if chunk then
- insert(t,chunk)
- else
- chunk=remove(t)
- if chunk then
- return chunk
- else
- return src()
- end
- end
- end
-end
-function source.chain(src,f,...)
- if... then
- f=filter.chain(f,...)
- end
- local last_in=""
- local last_out=""
- local state="feeding"
- local err
- return function()
- if not last_out then
- report("error: source is empty")
- return
- end
- while true do
- if state=="feeding" then
- last_in,err=src()
- if err then
- return nil,err
- end
- last_out=f(last_in)
- if not last_out then
- if last_in then
- report("error: filter returned inappropriate 'nil'")
- end
- return nil
- elseif last_out~="" then
- state="eating"
- if last_in then
- last_in=""
- end
- return last_out
- end
- else
- last_out=f(last_in)
- if last_out=="" then
- if last_in=="" then
- state="feeding"
- else
- report("error: filter returned nothing")
- return
- end
- elseif not last_out then
- if last_in then
- report("filter returned inappropriate 'nil'")
- end
- return nil
- else
- return last_out
- end
- end
- end
- end
-end
-function source.cat(...)
- local arg={... }
- local src=remove(arg,1)
- return function()
- while src do
- local chunk,err=src()
- if chunk then
- return chunk
- end
- if err then
- return nil,err
- end
- src=remove(arg,1)
- end
- end
-end
-function sink.table(t)
- if not t then
- t={}
- end
- local f=function(chunk,err)
- if chunk then
- insert(t,chunk)
- end
- return 1
- end
- return f,t
-end
-function sink.simplify(snk)
- return function(chunk,err)
- local ret,err_or_new=snk(chunk,err)
- if not ret then
- return nil,err_or_new
- end
- if err_or_new then
- snk=err_or_new
- end
- return 1
- end
-end
-local function null()
- return 1
-end
-function sink.null()
- return null
-end
-local function sinkerror(err)
- return function()
- return nil,err
- end
-end
-sink.error=sinkerror
-function sink.file(handle,io_err)
- if handle then
- return function(chunk,err)
- if not chunk then
- handle:close()
- return 1
- else
- return handle:write(chunk)
- end
- end
- else
- return sinkerror(io_err or "unable to open file")
- end
-end
-function sink.chain(f,snk,...)
- if... then
- local args={ f,snk,... }
- snk=remove(args,#args)
- f=filter.chain(unpack(args))
- end
- return function(chunk,err)
- if chunk~="" then
- local filtered=f(chunk)
- local done=chunk and ""
- while true do
- local ret,snkerr=snk(filtered,err)
- if not ret then
- return nil,snkerr
- end
- if filtered==done then
- return 1
- end
- filtered=f(done)
- end
- else
- return 1
- end
- end
-end
-function pump.step(src,snk)
- local chunk,src_err=src()
- local ret,snk_err=snk(chunk,src_err)
- if chunk and ret then
- return 1
- else
- return nil,src_err or snk_err
- end
-end
-function pump.all(src,snk,step)
- if not step then
- step=pump.step
- end
- while true do
- local ret,err=step(src,snk)
- if not ret then
- if err then
- return nil,err
- else
- return 1
- end
- end
- end
-end
-package.loaded["ltn12"]=ltn12
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-mime"] = package.loaded["util-soc-imp-mime"] or true
-
--- original size: 2373, stripped down to: 1931
-
-
-local type,tostring=type,tostring
-local mime=mime or package.loaded.mime or require("mime.core")
-local ltn12=ltn12 or package.loaded.ltn12 or require("ltn12")
-local filtercycle=ltn12.filter.cycle
-local function report(fmt,first,...)
- if logs then
- report=logs and logs.reporter("mime")
- report(fmt,first,...)
- elseif fmt then
- fmt="mime: "..fmt
- if first then
- print(format(fmt,first,...))
- else
- print(fmt)
- end
- end
-end
-mime.report=report
-local encodet={}
-local decodet={}
-local wrapt={}
-mime.encodet=encodet
-mime.decodet=decodet
-mime.wrapt=wrapt
-local mime_b64=mime.b64
-local mime_qp=mime.qp
-local mime_unb64=mime.unb64
-local mime_unqp=mime.unqp
-local mime_wrp=mime.wrp
-local mime_qpwrp=mime.qpwrp
-local mime_eol=mime_eol
-local mime_dot=mime_dot
-encodet['base64']=function()
- return filtercycle(mime_b64,"")
-end
-encodet['quoted-printable']=function(mode)
- return filtercycle(mime_qp,"",mode=="binary" and "=0D=0A" or "\r\n")
-end
-decodet['base64']=function()
- return filtercycle(mime_unb64,"")
-end
-decodet['quoted-printable']=function()
- return filtercycle(mime_unqp,"")
-end
-local wraptext=function(length)
- if not length then
- length=76
- end
- return filtercycle(mime_wrp,length,length)
-end
-local wrapquoted=function()
- return filtercycle(mime_qpwrp,76,76)
-end
-wrapt['text']=wraptext
-wrapt['base64']=wraptext
-wrapt['default']=wraptext
-wrapt['quoted-printable']=wrapquoted
-function mime.normalize(marker)
- return filtercycle(mime_eol,0,marker)
-end
-function mime.stuff()
- return filtercycle(mime_dot,2)
-end
-local function choose(list)
- return function(name,opt1,opt2)
- if type(name)~="string" then
- name,opt1,opt2="default",name,opt1
- end
- local filter=list[name or "nil"]
- if filter then
- return filter(opt1,opt2)
- else
- report("error: unknown key '%s'",tostring(name))
- end
- end
-end
-mime.encode=choose(encodet)
-mime.decode=choose(decodet)
-mime.wrap=choose(wrapt)
-package.loaded["mime"]=mime
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-url"] = package.loaded["util-soc-imp-url"] or true
-
--- original size: 6863, stripped down to: 5269
-
-
-local tonumber,tostring,type=tonumber,tostring,type
-local gsub,sub,match,find,format,byte,char=string.gsub,string.sub,string.match,string.find,string.format,string.byte,string.char
-local insert=table.insert
-local socket=socket or require("socket")
-local url={
- _VERSION="URL 1.0.3",
-}
-socket.url=url
-function url.escape(s)
- return (gsub(s,"([^A-Za-z0-9_])",function(c)
- return format("%%%02x",byte(c))
- end))
-end
-local function make_set(t)
- local s={}
- for i=1,#t do
- s[t[i]]=true
- end
- return s
-end
-local segment_set=make_set {
- "-","_",".","!","~","*","'","(",
- ")",":","@","&","=","+","$",",",
-}
-local function protect_segment(s)
- return gsub(s,"([^A-Za-z0-9_])",function(c)
- if segment_set[c] then
- return c
- else
- return format("%%%02X",byte(c))
- end
- end)
-end
-function url.unescape(s)
- return (gsub(s,"%%(%x%x)",function(hex)
- return char(tonumber(hex,16))
- end))
-end
-local function absolute_path(base_path,relative_path)
- if find(relative_path,"^/") then
- return relative_path
- end
- local path=gsub(base_path,"[^/]*$","")
- path=path..relative_path
- path=gsub(path,"([^/]*%./)",function (s)
- if s~="./" then
- return s
- else
- return ""
- end
- end)
- path=gsub(path,"/%.$","/")
- local reduced
- while reduced~=path do
- reduced=path
- path=gsub(reduced,"([^/]*/%.%./)",function (s)
- if s~="../../" then
- return ""
- else
- return s
- end
- end)
- end
- path=gsub(reduced,"([^/]*/%.%.)$",function (s)
- if s~="../.." then
- return ""
- else
- return s
- end
- end)
- return path
-end
-function url.parse(url,default)
- local parsed={}
- for k,v in next,default or parsed do
- parsed[k]=v
- end
- if not url or url=="" then
- return nil,"invalid url"
- end
- url=gsub(url,"#(.*)$",function(f)
- parsed.fragment=f
- return ""
- end)
- url=gsub(url,"^([%w][%w%+%-%.]*)%:",function(s)
- parsed.scheme=s
- return ""
- end)
- url=gsub(url,"^//([^/]*)",function(n)
- parsed.authority=n
- return ""
- end)
- url=gsub(url,"%?(.*)",function(q)
- parsed.query=q
- return ""
- end)
- url=gsub(url,"%;(.*)",function(p)
- parsed.params=p
- return ""
- end)
- if url~="" then
- parsed.path=url
- end
- local authority=parsed.authority
- if not authority then
- return parsed
- end
- authority=gsub(authority,"^([^@]*)@",function(u)
- parsed.userinfo=u
- return ""
- end)
- authority=gsub(authority,":([^:%]]*)$",function(p)
- parsed.port=p
- return ""
- end)
- if authority~="" then
- parsed.host=match(authority,"^%[(.+)%]$") or authority
- end
- local userinfo=parsed.userinfo
- if not userinfo then
- return parsed
- end
- userinfo=gsub(userinfo,":([^:]*)$",function(p)
- parsed.password=p
- return ""
- end)
- parsed.user=userinfo
- return parsed
-end
-function url.build(parsed)
- local url=parsed.path or ""
- if parsed.params then
- url=url..";"..parsed.params
- end
- if parsed.query then
- url=url.."?"..parsed.query
- end
- local authority=parsed.authority
- if parsed.host then
- authority=parsed.host
- if find(authority,":") then
- authority="["..authority.."]"
- end
- if parsed.port then
- authority=authority..":"..tostring(parsed.port)
- end
- local userinfo=parsed.userinfo
- if parsed.user then
- userinfo=parsed.user
- if parsed.password then
- userinfo=userinfo..":"..parsed.password
- end
- end
- if userinfo then authority=userinfo.."@"..authority end
- end
- if authority then
- url="//"..authority..url
- end
- if parsed.scheme then
- url=parsed.scheme..":"..url
- end
- if parsed.fragment then
- url=url.."#"..parsed.fragment
- end
- return url
-end
-function url.absolute(base_url,relative_url)
- local base_parsed
- if type(base_url)=="table" then
- base_parsed=base_url
- base_url=url.build(base_parsed)
- else
- base_parsed=url.parse(base_url)
- end
- local relative_parsed=url.parse(relative_url)
- if not base_parsed then
- return relative_url
- elseif not relative_parsed then
- return base_url
- elseif relative_parsed.scheme then
- return relative_url
- else
- relative_parsed.scheme=base_parsed.scheme
- if not relative_parsed.authority then
- relative_parsed.authority=base_parsed.authority
- if not relative_parsed.path then
- relative_parsed.path=base_parsed.path
- if not relative_parsed.params then
- relative_parsed.params=base_parsed.params
- if not relative_parsed.query then
- relative_parsed.query=base_parsed.query
- end
- end
- else
- relative_parsed.path=absolute_path(base_parsed.path or "",relative_parsed.path)
- end
- end
- return url.build(relative_parsed)
- end
-end
-function url.parse_path(path)
- local parsed={}
- path=path or ""
- gsub(path,"([^/]+)",function (s)
- insert(parsed,s)
- end)
- for i=1,#parsed do
- parsed[i]=url.unescape(parsed[i])
- end
- if sub(path,1,1)=="/" then
- parsed.is_absolute=1
- end
- if sub(path,-1,-1)=="/" then
- parsed.is_directory=1
- end
- return parsed
-end
-function url.build_path(parsed,unsafe)
- local path=""
- local n=#parsed
- if unsafe then
- for i=1,n-1 do
- path=path..parsed[i].."/"
- end
- if n>0 then
- path=path..parsed[n]
- if parsed.is_directory then
- path=path.."/"
- end
- end
- else
- for i=1,n-1 do
- path=path..protect_segment(parsed[i]).."/"
- end
- if n>0 then
- path=path..protect_segment(parsed[n])
- if parsed.is_directory then
- path=path.."/"
- end
- end
- end
- if parsed.is_absolute then
- path="/"..path
- end
- return path
-end
-package.loaded["socket.url"]=url
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-headers"] = package.loaded["util-soc-imp-headers"] or true
-
--- original size: 5721, stripped down to: 3754
-
-
-local next=next
-local lower=string.lower
-local concat=table.concat
-local socket=socket or require("socket")
-local headers={}
-socket.headers=headers
-local canonic={
- ["accept"]="Accept",
- ["accept-charset"]="Accept-Charset",
- ["accept-encoding"]="Accept-Encoding",
- ["accept-language"]="Accept-Language",
- ["accept-ranges"]="Accept-Ranges",
- ["action"]="Action",
- ["alternate-recipient"]="Alternate-Recipient",
- ["age"]="Age",
- ["allow"]="Allow",
- ["arrival-date"]="Arrival-Date",
- ["authorization"]="Authorization",
- ["bcc"]="Bcc",
- ["cache-control"]="Cache-Control",
- ["cc"]="Cc",
- ["comments"]="Comments",
- ["connection"]="Connection",
- ["content-description"]="Content-Description",
- ["content-disposition"]="Content-Disposition",
- ["content-encoding"]="Content-Encoding",
- ["content-id"]="Content-ID",
- ["content-language"]="Content-Language",
- ["content-length"]="Content-Length",
- ["content-location"]="Content-Location",
- ["content-md5"]="Content-MD5",
- ["content-range"]="Content-Range",
- ["content-transfer-encoding"]="Content-Transfer-Encoding",
- ["content-type"]="Content-Type",
- ["cookie"]="Cookie",
- ["date"]="Date",
- ["diagnostic-code"]="Diagnostic-Code",
- ["dsn-gateway"]="DSN-Gateway",
- ["etag"]="ETag",
- ["expect"]="Expect",
- ["expires"]="Expires",
- ["final-log-id"]="Final-Log-ID",
- ["final-recipient"]="Final-Recipient",
- ["from"]="From",
- ["host"]="Host",
- ["if-match"]="If-Match",
- ["if-modified-since"]="If-Modified-Since",
- ["if-none-match"]="If-None-Match",
- ["if-range"]="If-Range",
- ["if-unmodified-since"]="If-Unmodified-Since",
- ["in-reply-to"]="In-Reply-To",
- ["keywords"]="Keywords",
- ["last-attempt-date"]="Last-Attempt-Date",
- ["last-modified"]="Last-Modified",
- ["location"]="Location",
- ["max-forwards"]="Max-Forwards",
- ["message-id"]="Message-ID",
- ["mime-version"]="MIME-Version",
- ["original-envelope-id"]="Original-Envelope-ID",
- ["original-recipient"]="Original-Recipient",
- ["pragma"]="Pragma",
- ["proxy-authenticate"]="Proxy-Authenticate",
- ["proxy-authorization"]="Proxy-Authorization",
- ["range"]="Range",
- ["received"]="Received",
- ["received-from-mta"]="Received-From-MTA",
- ["references"]="References",
- ["referer"]="Referer",
- ["remote-mta"]="Remote-MTA",
- ["reply-to"]="Reply-To",
- ["reporting-mta"]="Reporting-MTA",
- ["resent-bcc"]="Resent-Bcc",
- ["resent-cc"]="Resent-Cc",
- ["resent-date"]="Resent-Date",
- ["resent-from"]="Resent-From",
- ["resent-message-id"]="Resent-Message-ID",
- ["resent-reply-to"]="Resent-Reply-To",
- ["resent-sender"]="Resent-Sender",
- ["resent-to"]="Resent-To",
- ["retry-after"]="Retry-After",
- ["return-path"]="Return-Path",
- ["sender"]="Sender",
- ["server"]="Server",
- ["smtp-remote-recipient"]="SMTP-Remote-Recipient",
- ["status"]="Status",
- ["subject"]="Subject",
- ["te"]="TE",
- ["to"]="To",
- ["trailer"]="Trailer",
- ["transfer-encoding"]="Transfer-Encoding",
- ["upgrade"]="Upgrade",
- ["user-agent"]="User-Agent",
- ["vary"]="Vary",
- ["via"]="Via",
- ["warning"]="Warning",
- ["will-retry-until"]="Will-Retry-Until",
- ["www-authenticate"]="WWW-Authenticate",
- ["x-mailer"]="X-Mailer",
-}
-headers.canonic=setmetatable(canonic,{
- __index=function(t,k)
- socket.report("invalid header: %s",k)
- t[k]=k
- return k
- end
-})
-function headers.normalize(headers)
- if not headers then
- return {}
- end
- local normalized={}
- for k,v in next,headers do
- normalized[#normalized+1]=canonic[k]..": "..v
- end
- normalized[#normalized+1]=""
- normalized[#normalized+1]=""
- return concat(normalized,"\r\n")
-end
-function headers.lower(lowered,headers)
- if not lowered then
- return {}
- end
- if not headers then
- lowered,headers={},lowered
- end
- for k,v in next,headers do
- lowered[lower(k)]=v
- end
- return lowered
-end
-socket.headers=headers
-package.loaded["socket.headers"]=headers
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-tp"] = package.loaded["util-soc-imp-tp"] or true
-
--- original size: 3116, stripped down to: 2533
-
-
-local setmetatable,next,type,tonumber=setmetatable,next,type,tonumber
-local find,upper=string.find,string.upper
-local socket=socket or require("socket")
-local ltn12=ltn12 or require("ltn12")
-local skipsocket=socket.skip
-local sinksocket=socket.sink
-local tcpsocket=socket.tcp
-local ltn12pump=ltn12.pump
-local pumpall=ltn12pump.all
-local pumpstep=ltn12pump.step
-local tp={
- TIMEOUT=60,
-}
-socket.tp=tp
-local function get_reply(c)
- local line,err=c:receive()
- local reply=line
- if err then return
- nil,err
- end
- local code,sep=skipsocket(2,find(line,"^(%d%d%d)(.?)"))
- if not code then
- return nil,"invalid server reply"
- end
- if sep=="-" then
- local current
- repeat
- line,err=c:receive()
- if err then
- return nil,err
- end
- current,sep=skipsocket(2,find(line,"^(%d%d%d)(.?)"))
- reply=reply.."\n"..line
- until code==current and sep==" "
- end
- return code,reply
-end
-local methods={}
-local mt={ __index=methods }
-function methods.getpeername(self)
- return self.c:getpeername()
-end
-function methods.getsockname(self)
- return self.c:getpeername()
-end
-function methods.check(self,ok)
- local code,reply=get_reply(self.c)
- if not code then
- return nil,reply
- end
- local c=tonumber(code)
- local t=type(ok)
- if t=="function" then
- return ok(c,reply)
- elseif t=="table" then
- for i=1,#ok do
- if find(code,ok[i]) then
- return c,reply
- end
- end
- return nil,reply
- elseif find(code,ok) then
- return c,reply
- else
- return nil,reply
- end
-end
-function methods.command(self,cmd,arg)
- cmd=upper(cmd)
- if arg then
- cmd=cmd.." "..arg.."\r\n"
- else
- cmd=cmd.."\r\n"
- end
- return self.c:send(cmd)
-end
-function methods.sink(self,snk,pat)
- local chunk,err=self.c:receive(pat)
- return snk(chunk,err)
-end
-function methods.send(self,data)
- return self.c:send(data)
-end
-function methods.receive(self,pat)
- return self.c:receive(pat)
-end
-function methods.getfd(self)
- return self.c:getfd()
-end
-function methods.dirty(self)
- return self.c:dirty()
-end
-function methods.getcontrol(self)
- return self.c
-end
-function methods.source(self,source,step)
- local sink=sinksocket("keep-open",self.c)
- local ret,err=pumpall(source,sink,step or pumpstep)
- return ret,err
-end
-function methods.close(self)
- self.c:close()
- return 1
-end
-function tp.connect(host,port,timeout,create)
- local c,e=(create or tcpsocket)()
- if not c then
- return nil,e
- end
- c:settimeout(timeout or tp.TIMEOUT)
- local r,e=c:connect(host,port)
- if not r then
- c:close()
- return nil,e
- end
- return setmetatable({ c=c },mt)
-end
-package.loaded["socket.tp"]=tp
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-http"] = package.loaded["util-soc-imp-http"] or true
-
--- original size: 12624, stripped down to: 9598
-
-
-local tostring,tonumber,setmetatable,next,type=tostring,tonumber,setmetatable,next,type
-local find,lower,format,gsub,match=string.find,string.lower,string.format,string.gsub,string.match
-local concat=table.concat
-local socket=socket or require("socket")
-local url=socket.url or require("socket.url")
-local ltn12=ltn12 or require("ltn12")
-local mime=mime or require("mime")
-local headers=socket.headers or require("socket.headers")
-local normalizeheaders=headers.normalize
-local parseurl=url.parse
-local buildurl=url.build
-local absoluteurl=url.absolute
-local unescapeurl=url.unescape
-local skipsocket=socket.skip
-local sinksocket=socket.sink
-local sourcesocket=socket.source
-local trysocket=socket.try
-local tcpsocket=socket.tcp
-local newtrysocket=socket.newtry
-local protectsocket=socket.protect
-local emptysource=ltn12.source.empty
-local stringsource=ltn12.source.string
-local rewindsource=ltn12.source.rewind
-local pumpstep=ltn12.pump.step
-local pumpall=ltn12.pump.all
-local sinknull=ltn12.sink.null
-local sinktable=ltn12.sink.table
-local lowerheaders=headers.lower
-local mimeb64=mime.b64
-local http={
- TIMEOUT=60,
- USERAGENT=socket._VERSION,
-}
-socket.http=http
-local PORT=80
-local SCHEMES={
- http=true,
-}
-local function receiveheaders(sock,headers)
- if not headers then
- headers={}
- end
- local line,err=sock:receive("*l")
- if err then
- return nil,err
- end
- while line~="" do
- local name,value=skipsocket(2,find(line,"^(.-):%s*(.*)"))
- if not (name and value) then
- return nil,"malformed reponse headers"
- end
- name=lower(name)
- line,err=sock:receive("*l")
- if err then
- return nil,err
- end
- while find(line,"^%s") do
- value=value..line
- line=sock:receive("*l")
- if err then
- return nil,err
- end
- end
- local found=headers[name]
- if found then
- value=found..", "..value
- end
- headers[name]=value
- end
- return headers
-end
-socket.sourcet["http-chunked"]=function(sock,headers)
- return setmetatable (
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },{
- __call=function()
- local line,err=sock:receive("*l")
- if err then
- return nil,err
- end
- local size=tonumber(gsub(line,";.*",""),16)
- if not size then
- return nil,"invalid chunk size"
- end
- if size>0 then
- local chunk,err,part=sock:receive(size)
- if chunk then
- sock:receive("*a")
- end
- return chunk,err
- else
- headers,err=receiveheaders(sock,headers)
- if not headers then
- return nil,err
- end
- end
- end
- }
- )
-end
-socket.sinkt["http-chunked"]=function(sock)
- return setmetatable(
- {
- getfd=function() return sock:getfd() end,
- dirty=function() return sock:dirty() end,
- },
- {
- __call=function(self,chunk,err)
- if not chunk then
- chunk=""
- end
- return sock:send(format("%X\r\n%s\r\n",#chunk,chunk))
- end
- })
-end
-local methods={}
-local mt={ __index=methods }
-local function openhttp(host,port,create)
- local c=trysocket((create or tcpsocket)())
- local h=setmetatable({ c=c },mt)
- local try=newtrysocket(function() h:close() end)
- h.try=try
- try(c:settimeout(http.TIMEOUT))
- try(c:connect(host,port or PORT))
- return h
-end
-http.open=openhttp
-function methods.sendrequestline(self,method,uri)
- local requestline=format("%s %s HTTP/1.1\r\n",method or "GET",uri)
- return self.try(self.c:send(requestline))
-end
-function methods.sendheaders(self,headers)
- self.try(self.c:send(normalizeheaders(headers)))
- return 1
-end
-function methods.sendbody(self,headers,source,step)
- if not source then
- source=emptysource()
- end
- if not step then
- step=pumpstep
- end
- local mode="http-chunked"
- if headers["content-length"] then
- mode="keep-open"
- end
- return self.try(pumpall(source,sinksocket(mode,self.c),step))
-end
-function methods.receivestatusline(self)
- local try=self.try
- local status=try(self.c:receive(5))
- if status~="HTTP/" then
- return nil,status
- end
- status=try(self.c:receive("*l",status))
- local code=skipsocket(2,find(status,"HTTP/%d*%.%d* (%d%d%d)"))
- return try(tonumber(code),status)
-end
-function methods.receiveheaders(self)
- return self.try(receiveheaders(self.c))
-end
-function methods.receivebody(self,headers,sink,step)
- if not sink then
- sink=sinknull()
- end
- if not step then
- step=pumpstep
- end
- local length=tonumber(headers["content-length"])
- local encoding=headers["transfer-encoding"]
- local mode="default"
- if encoding and encoding~="identity" then
- mode="http-chunked"
- elseif length then
- mode="by-length"
- end
- return self.try(pumpall(sourcesocket(mode,self.c,length),sink,step))
-end
-function methods.receive09body(self,status,sink,step)
- local source=rewindsource(sourcesocket("until-closed",self.c))
- source(status)
- return self.try(pumpall(source,sink,step))
-end
-function methods.close(self)
- return self.c:close()
-end
-local function adjusturi(request)
- if not request.proxy and not http.PROXY then
- request={
- path=trysocket(request.path,"invalid path 'nil'"),
- params=request.params,
- query=request.query,
- fragment=request.fragment,
- }
- end
- return buildurl(request)
-end
-local function adjustheaders(request)
- local headers={
- ["user-agent"]=http.USERAGENT,
- ["host"]=gsub(request.authority,"^.-@",""),
- ["connection"]="close, TE",
- ["te"]="trailers"
- }
- local username=request.user
- local password=request.password
- if username and password then
- headers["authorization"]="Basic "..(mimeb64(username..":"..unescapeurl(password)))
- end
- local proxy=request.proxy or http.PROXY
- if proxy then
- proxy=parseurl(proxy)
- local username=proxy.user
- local password=proxy.password
- if username and password then
- headers["proxy-authorization"]="Basic "..(mimeb64(username..":"..password))
- end
- end
- local requestheaders=request.headers
- if requestheaders then
- headers=lowerheaders(headers,requestheaders)
- end
- return headers
-end
-local default={
- host="",
- port=PORT,
- path="/",
- scheme="http"
-}
-local function adjustrequest(originalrequest)
- local url=originalrequest.url
- local request=url and parseurl(url,default) or {}
- for k,v in next,originalrequest do
- request[k]=v
- end
- local host=request.host
- local port=request.port
- local uri=request.uri
- if not host or host=="" then
- trysocket(nil,"invalid host '"..tostring(host).."'")
- end
- if port=="" then
- request.port=PORT
- end
- if not uri or uri=="" then
- request.uri=adjusturi(request)
- end
- request.headers=adjustheaders(request)
- local proxy=request.proxy or http.PROXY
- if proxy then
- proxy=parseurl(proxy)
- request.host=proxy.host
- request.port=proxy.port or 3128
- end
- return request
-end
-local maxredericts=4
-local validredirects={ [301]=true,[302]=true,[303]=true,[307]=true }
-local validmethods={ [false]=true,GET=true,HEAD=true }
-local function shouldredirect(request,code,headers)
- local location=headers.location
- if not location then
- return false
- end
- location=gsub(location,"%s","")
- if location=="" then
- return false
- end
- local scheme=match(location,"^([%w][%w%+%-%.]*)%:")
- if scheme and not SCHEMES[scheme] then
- return false
- end
- local method=request.method
- local redirect=request.redirect
- local redirects=request.nredirects or 0
- return redirect and validredirects[code] and validmethods[method] and redirects<=maxredericts
-end
-local function shouldreceivebody(request,code)
- if request.method=="HEAD" then
- return nil
- end
- if code==204 or code==304 then
- return nil
- end
- if code>=100 and code<200 then
- return nil
- end
- return 1
-end
-local tredirect,trequest,srequest
-tredirect=function(request,location)
- local result,code,headers,status=trequest {
- url=absoluteurl(request.url,location),
- source=request.source,
- sink=request.sink,
- headers=request.headers,
- proxy=request.proxy,
- nredirects=(request.nredirects or 0)+1,
- create=request.create,
- }
- if not headers then
- headers={}
- end
- if not headers.location then
- headers.location=location
- end
- return result,code,headers,status
-end
-trequest=function(originalrequest)
- local request=adjustrequest(originalrequest)
- local connection=openhttp(request.host,request.port,request.create)
- local headers=request.headers
- connection:sendrequestline(request.method,request.uri)
- connection:sendheaders(headers)
- if request.source then
- connection:sendbody(headers,request.source,request.step)
- end
- local code,status=connection:receivestatusline()
- if not code then
- connection:receive09body(status,request.sink,request.step)
- return 1,200
- end
- while code==100 do
- headers=connection:receiveheaders()
- code,status=connection:receivestatusline()
- end
- headers=connection:receiveheaders()
- if shouldredirect(request,code,headers) and not request.source then
- connection:close()
- return tredirect(originalrequest,headers.location)
- end
- if shouldreceivebody(request,code) then
- connection:receivebody(headers,request.sink,request.step)
- end
- connection:close()
- return 1,code,headers,status
-end
-local function genericform(url,body)
- local buffer={}
- local request={
- url=url,
- sink=sinktable(buffer),
- target=buffer,
- }
- if body then
- request.source=stringsource(body)
- request.method="POST"
- request.headers={
- ["content-length"]=#body,
- ["content-type"]="application/x-www-form-urlencoded"
- }
- end
- return request
-end
-http.genericform=genericform
-srequest=function(url,body)
- local request=genericform(url,body)
- local _,code,headers,status=trequest(request)
- return concat(request.target),code,headers,status
-end
-http.request=protectsocket(function(request,body)
- if type(request)=="string" then
- return srequest(request,body)
- else
- return trequest(request)
- end
-end)
-package.loaded["socket.http"]=http
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-ftp"] = package.loaded["util-soc-imp-ftp"] or true
-
--- original size: 10357, stripped down to: 8548
-
-
-local setmetatable,type,next=setmetatable,type,next
-local find,format,gsub,match=string.find,string.format,string.gsub,string.match
-local concat=table.concat
-local mod=math.mod
-local socket=socket or require("socket")
-local url=socket.url or require("socket.url")
-local tp=socket.tp or require("socket.tp")
-local ltn12=ltn12 or require("ltn12")
-local tcpsocket=socket.tcp
-local trysocket=socket.try
-local skipsocket=socket.skip
-local sinksocket=socket.sink
-local selectsocket=socket.select
-local bindsocket=socket.bind
-local newtrysocket=socket.newtry
-local sourcesocket=socket.source
-local protectsocket=socket.protect
-local parseurl=url.parse
-local unescapeurl=url.unescape
-local pumpall=ltn12.pump.all
-local pumpstep=ltn12.pump.step
-local sourcestring=ltn12.source.string
-local sinktable=ltn12.sink.table
-local ftp={
- TIMEOUT=60,
- USER="ftp",
- PASSWORD="anonymous@anonymous.org",
-}
-socket.ftp=ftp
-local PORT=21
-local methods={}
-local mt={ __index=methods }
-function ftp.open(server,port,create)
- local tp=trysocket(tp.connect(server,port or PORT,ftp.TIMEOUT,create))
- local f=setmetatable({ tp=tp },metat)
- f.try=newtrysocket(function() f:close() end)
- return f
-end
-function methods.portconnect(self)
- local try=self.try
- local server=self.server
- try(server:settimeout(ftp.TIMEOUT))
- self.data=try(server:accept())
- try(self.data:settimeout(ftp.TIMEOUT))
-end
-function methods.pasvconnect(self)
- local try=self.try
- self.data=try(tcpsocket())
- self(self.data:settimeout(ftp.TIMEOUT))
- self(self.data:connect(self.pasvt.address,self.pasvt.port))
-end
-function methods.login(self,user,password)
- local try=self.try
- local tp=self.tp
- try(tp:command("user",user or ftp.USER))
- local code,reply=try(tp:check{"2..",331})
- if code==331 then
- try(tp:command("pass",password or ftp.PASSWORD))
- try(tp:check("2.."))
- end
- return 1
-end
-function methods.pasv(self)
- local try=self.try
- local tp=self.tp
- try(tp:command("pasv"))
- local code,reply=try(self.tp:check("2.."))
- local pattern="(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)"
- local a,b,c,d,p1,p2=skipsocket(2,find(reply,pattern))
- try(a and b and c and d and p1 and p2,reply)
- local address=format("%d.%d.%d.%d",a,b,c,d)
- local port=p1*256+p2
- local server=self.server
- self.pasvt={
- address=address,
- port=port,
- }
- if server then
- server:close()
- self.server=nil
- end
- return address,port
-end
-function methods.epsv(self)
- local try=self.try
- local tp=self.tp
- try(tp:command("epsv"))
- local code,reply=try(tp:check("229"))
- local pattern="%((.)(.-)%1(.-)%1(.-)%1%)"
- local d,prt,address,port=match(reply,pattern)
- try(port,"invalid epsv response")
- local address=tp:getpeername()
- local server=self.server
- self.pasvt={
- address=address,
- port=port,
- }
- if self.server then
- server:close()
- self.server=nil
- end
- return address,port
-end
-function methods.port(self,address,port)
- local try=self.try
- local tp=self.tp
- self.pasvt=nil
- if not address then
- address,port=try(tp:getsockname())
- self.server=try(bindsocket(address,0))
- address,port=try(self.server:getsockname())
- try(self.server:settimeout(ftp.TIMEOUT))
- end
- local pl=mod(port,256)
- local ph=(port-pl)/256
- local arg=gsub(format("%s,%d,%d",address,ph,pl),"%.",",")
- try(tp:command("port",arg))
- try(tp:check("2.."))
- return 1
-end
-function methods.eprt(self,family,address,port)
- local try=self.try
- local tp=self.tp
- self.pasvt=nil
- if not address then
- address,port=try(tp:getsockname())
- self.server=try(bindsocket(address,0))
- address,port=try(self.server:getsockname())
- try(self.server:settimeout(ftp.TIMEOUT))
- end
- local arg=format("|%s|%s|%d|",family,address,port)
- try(tp:command("eprt",arg))
- try(tp:check("2.."))
- return 1
-end
-function methods.send(self,sendt)
- local try=self.try
- local tp=self.tp
- try(self.pasvt or self.server,"need port or pasv first")
- if self.pasvt then
- self:pasvconnect()
- end
- local argument=sendt.argument or unescapeurl(gsub(sendt.path or "","^[/\\]",""))
- if argument=="" then
- argument=nil
- end
- local command=sendt.command or "stor"
- try(tp:command(command,argument))
- local code,reply=try(tp:check{"2..","1.."})
- if not self.pasvt then
- self:portconnect()
- end
- local step=sendt.step or pumpstep
- local readt={ tp }
- local checkstep=function(src,snk)
- local readyt=selectsocket(readt,nil,0)
- if readyt[tp] then
- code=try(tp:check("2.."))
- end
- return step(src,snk)
- end
- local sink=sinksocket("close-when-done",self.data)
- try(pumpall(sendt.source,sink,checkstep))
- if find(code,"1..") then
- try(tp:check("2.."))
- end
- self.data:close()
- local sent=skipsocket(1,self.data:getstats())
- self.data=nil
- return sent
-end
-function methods.receive(self,recvt)
- local try=self.try
- local tp=self.tp
- try(self.pasvt or self.server,"need port or pasv first")
- if self.pasvt then self:pasvconnect() end
- local argument=recvt.argument or unescapeurl(gsub(recvt.path or "","^[/\\]",""))
- if argument=="" then
- argument=nil
- end
- local command=recvt.command or "retr"
- try(tp:command(command,argument))
- local code,reply=try(tp:check{"1..","2.."})
- if code>=200 and code<=299 then
- recvt.sink(reply)
- return 1
- end
- if not self.pasvt then
- self:portconnect()
- end
- local source=sourcesocket("until-closed",self.data)
- local step=recvt.step or pumpstep
- try(pumpall(source,recvt.sink,step))
- if find(code,"1..") then
- try(tp:check("2.."))
- end
- self.data:close()
- self.data=nil
- return 1
-end
-function methods.cwd(self,dir)
- local try=self.try
- local tp=self.tp
- try(tp:command("cwd",dir))
- try(tp:check(250))
- return 1
-end
-function methods.type(self,typ)
- local try=self.try
- local tp=self.tp
- try(tp:command("type",typ))
- try(tp:check(200))
- return 1
-end
-function methods.greet(self)
- local try=self.try
- local tp=self.tp
- local code=try(tp:check{"1..","2.."})
- if find(code,"1..") then
- try(tp:check("2.."))
- end
- return 1
-end
-function methods.quit(self)
- local try=self.try
- try(self.tp:command("quit"))
- try(self.tp:check("2.."))
- return 1
-end
-function methods.close(self)
- local data=self.data
- if data then
- data:close()
- end
- local server=self.server
- if server then
- server:close()
- end
- local tp=self.tp
- if tp then
- tp:close()
- end
-end
-local function override(t)
- if t.url then
- local u=parseurl(t.url)
- for k,v in next,t do
- u[k]=v
- end
- return u
- else
- return t
- end
-end
-local function tput(putt)
- putt=override(putt)
- local host=putt.host
- trysocket(host,"missing hostname")
- local f=ftp.open(host,putt.port,putt.create)
- f:greet()
- f:login(putt.user,putt.password)
- local typ=putt.type
- if typ then
- f:type(typ)
- end
- f:epsv()
- local sent=f:send(putt)
- f:quit()
- f:close()
- return sent
-end
-local default={
- path="/",
- scheme="ftp",
-}
-local function genericform(u)
- local t=trysocket(parseurl(u,default))
- trysocket(t.scheme=="ftp","wrong scheme '"..t.scheme.."'")
- trysocket(t.host,"missing hostname")
- local pat="^type=(.)$"
- if t.params then
- local typ=skipsocket(2,find(t.params,pat))
- t.type=typ
- trysocket(typ=="a" or typ=="i","invalid type '"..typ.."'")
- end
- return t
-end
-ftp.genericform=genericform
-local function sput(u,body)
- local putt=genericform(u)
- putt.source=sourcestring(body)
- return tput(putt)
-end
-ftp.put=protectsocket(function(putt,body)
- if type(putt)=="string" then
- return sput(putt,body)
- else
- return tput(putt)
- end
-end)
-local function tget(gett)
- gett=override(gett)
- local host=gett.host
- trysocket(host,"missing hostname")
- local f=ftp.open(host,gett.port,gett.create)
- f:greet()
- f:login(gett.user,gett.password)
- if gett.type then
- f:type(gett.type)
- end
- f:epsv()
- f:receive(gett)
- f:quit()
- return f:close()
-end
-local function sget(u)
- local gett=genericform(u)
- local t={}
- gett.sink=sinktable(t)
- tget(gett)
- return concat(t)
-end
-ftp.command=protectsocket(function(cmdt)
- cmdt=override(cmdt)
- local command=cmdt.command
- local argument=cmdt.argument
- local check=cmdt.check
- local host=cmdt.host
- trysocket(host,"missing hostname")
- trysocket(command,"missing command")
- local f=ftp.open(host,cmdt.port,cmdt.create)
- local try=f.try
- local tp=f.tp
- f:greet()
- f:login(cmdt.user,cmdt.password)
- if type(command)=="table" then
- local argument=argument or {}
- for i=1,#command do
- local cmd=command[i]
- try(tp:command(cmd,argument[i]))
- if check and check[i] then
- try(tp:check(check[i]))
- end
- end
- else
- try(tp:command(command,argument))
- if check then
- try(tp:check(check))
- end
- end
- f:quit()
- return f:close()
-end)
-ftp.get=protectsocket(function(gett)
- if type(gett)=="string" then
- return sget(gett)
- else
- return tget(gett)
- end
-end)
-package.loaded["socket.ftp"]=ftp
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-soc-imp-smtp"] = package.loaded["util-soc-imp-smtp"] or true
-
--- original size: 7018, stripped down to: 5883
-
-
-local type,setmetatable,next=type,setmetatable,next
-local find,lower,format=string.find,string.lower,string.format
-local osdate,osgetenv=os.date,os.getenv
-local random=math.random
-local socket=socket or require("socket")
-local headers=socket.headers or require("socket.headers")
-local ltn12=ltn12 or require("ltn12")
-local tp=socket.tp or require("socket.tp")
-local mime=mime or require("mime")
-local mimeb64=mime.b64
-local mimestuff=mime.stuff
-local skipsocket=socket.skip
-local trysocket=socket.try
-local newtrysocket=socket.newtry
-local protectsocket=socket.protect
-local normalizeheaders=headers.normalize
-local lowerheaders=headers.lower
-local createcoroutine=coroutine.create
-local resumecoroutine=coroutine.resume
-local yieldcoroutine=coroutine.resume
-local smtp={
- TIMEOUT=60,
- SERVER="localhost",
- PORT=25,
- DOMAIN=osgetenv("SERVER_NAME") or "localhost",
- ZONE="-0000",
-}
-socket.smtp=smtp
-local methods={}
-local mt={ __index=methods }
-function methods.greet(self,domain)
- local try=self.try
- local tp=self.tp
- try(tp:check("2.."))
- try(tp:command("EHLO",domain or _M.DOMAIN))
- return skipsocket(1,try(tp:check("2..")))
-end
-function methods.mail(self,from)
- local try=self.try
- local tp=self.tp
- try(tp:command("MAIL","FROM:"..from))
- return try(tp:check("2.."))
-end
-function methods.rcpt(self,to)
- local try=self.try
- local tp=self.tp
- try(tp:command("RCPT","TO:"..to))
- return try(tp:check("2.."))
-end
-function methods.data(self,src,step)
- local try=self.try
- local tp=self.tp
- try(tp:command("DATA"))
- try(tp:check("3.."))
- try(tp:source(src,step))
- try(tp:send("\r\n.\r\n"))
- return try(tp:check("2.."))
-end
-function methods.quit(self)
- local try=self.try
- local tp=self.tp
- try(tp:command("QUIT"))
- return try(tp:check("2.."))
-end
-function methods.close(self)
- return self.tp:close()
-end
-function methods.login(self,user,password)
- local try=self.try
- local tp=self.tp
- try(tp:command("AUTH","LOGIN"))
- try(tp:check("3.."))
- try(tp:send(mimeb64(user).."\r\n"))
- try(tp:check("3.."))
- try(tp:send(mimeb64(password).."\r\n"))
- return try(tp:check("2.."))
-end
-function methods.plain(self,user,password)
- local try=self.try
- local tp=self.tp
- local auth="PLAIN "..mimeb64("\0"..user.."\0"..password)
- try(tp:command("AUTH",auth))
- return try(tp:check("2.."))
-end
-function methods.auth(self,user,password,ext)
- if not user or not password then
- return 1
- end
- local try=self.try
- if find(ext,"AUTH[^\n]+LOGIN") then
- return self:login(user,password)
- elseif find(ext,"AUTH[^\n]+PLAIN") then
- return self:plain(user,password)
- else
- try(nil,"authentication not supported")
- end
-end
-function methods.send(self,mail)
- self:mail(mail.from)
- local receipt=mail.rcpt
- if type(receipt)=="table" then
- for i=1,#receipt do
- self:rcpt(receipt[i])
- end
- elseif receipt then
- self:rcpt(receipt)
- end
- self:data(ltn12.source.chain(mail.source,mimestuff()),mail.step)
-end
-local function opensmtp(self,server,port,create)
- if not server or server=="" then
- server=smtp.SERVER
- end
- if not port or port=="" then
- port=smtp.PORT
- end
- local s={
- tp=trysocket(tp.connect(server,port,smtp.TIMEOUT,create)),
- try=newtrysocket(function()
- s:close()
- end),
- }
- setmetatable(s,mt)
- return s
-end
-smtp.open=opensmtp
-local nofboundaries=0
-local function newboundary()
- nofboundaries=nofboundaries+1
- return format('%s%05d==%05u',osdate('%d%m%Y%H%M%S'),random(0,99999),nofboundaries)
-end
-local send_message
-local function send_headers(headers)
- yieldcoroutine(normalizeheaders(headers))
-end
-local function send_multipart(message)
- local boundary=newboundary()
- local headers=lowerheaders(message.headers)
- local body=message.body
- local preamble=body.preamble
- local epilogue=body.epilogue
- local content=headers['content-type'] or 'multipart/mixed'
- headers['content-type']=content..'; boundary="'..boundary..'"'
- send_headers(headers)
- if preamble then
- yieldcoroutine(preamble)
- yieldcoroutine("\r\n")
- end
- for i=1,#body do
- yieldcoroutine("\r\n--"..boundary.."\r\n")
- send_message(body[i])
- end
- yieldcoroutine("\r\n--"..boundary.."--\r\n\r\n")
- if epilogue then
- yieldcoroutine(epilogue)
- yieldcoroutine("\r\n")
- end
-end
-local default_content_type='text/plain; charset="UTF-8"'
-local function send_source(message)
- local headers=lowerheaders(message.headers)
- if not headers['content-type'] then
- headers['content-type']=default_content_type
- end
- send_headers(headers)
- local getchunk=message.body
- while true do
- local chunk,err=getchunk()
- if err then
- yieldcoroutine(nil,err)
- elseif chunk then
- yieldcoroutine(chunk)
- else
- break
- end
- end
-end
-local function send_string(message)
- local headers=lowerheaders(message.headers)
- if not headers['content-type'] then
- headers['content-type']=default_content_type
- end
- send_headers(headers)
- yieldcoroutine(message.body)
-end
-function send_message(message)
- local body=message.body
- if type(body)=="table" then
- send_multipart(message)
- elseif type(body)=="function" then
- send_source(message)
- else
- send_string(message)
- end
-end
-local function adjust_headers(message)
- local headers=lowerheaders(message.headers)
- if not headers["date"] then
- headers["date"]=osdate("!%a, %d %b %Y %H:%M:%S ")..(message.zone or smtp.ZONE)
- end
- if not headers["x-mailer"] then
- headers["x-mailer"]=socket._VERSION
- end
- headers["mime-version"]="1.0"
- return headers
-end
-function smtp.message(message)
- message.headers=adjust_headers(message)
- local action=createcoroutine(function()
- send_message(message)
- end)
- return function()
- local ret,a,b=resumecoroutine(action)
- if ret then
- return a,b
- else
- return nil,a
- end
- end
-end
-smtp.send=protectsocket(function(mail)
- local snd=opensmtp(smtp,mail.server,mail.port,mail.create)
- local ext=snd:greet(mail.domain)
- snd:auth(mail.user,mail.password,ext)
- snd:send(mail)
- snd:quit()
- return snd:close()
-end)
-package.loaded["socket.smtp"]=smtp
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["trac-set"] = package.loaded["trac-set"] or true
-
--- original size: 13901, stripped down to: 9175
-
-if not modules then modules={} end modules ['trac-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"
-}
-local type,next,tostring,tonumber=type,next,tostring,tonumber
-local print=print
-local concat,sortedhash=table.concat,table.sortedhash
-local formatters,find,lower,gsub,topattern=string.formatters,string.find,string.lower,string.gsub,string.topattern
-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
-local setters=utilities.setters or {}
-utilities.setters=setters
-local data={}
-local trace_initialize=false
-local frozen=true
-local function initialize_setter(filename,name,values)
- local setter=data[name]
- if setter then
- local data=setter.data
- if data then
- for key,newvalue in sortedhash(values) do
- local newvalue=is_boolean(newvalue,newvalue,true)
- local functions=data[key]
- if functions then
- local oldvalue=functions.value
- if functions.frozen then
- if trace_initialize then
- setter.report("%s: %a is %s to %a",filename,key,"frozen",oldvalue)
- end
- elseif #functions>0 and not oldvalue then
- if trace_initialize then
- setter.report("%s: %a is %s to %a",filename,key,"set",newvalue)
- end
- for i=1,#functions do
- functions[i](newvalue)
- end
- functions.value=newvalue
- functions.frozen=functions.frozen or frozen
- else
- if trace_initialize then
- setter.report("%s: %a is %s as %a",filename,key,"kept",oldvalue)
- end
- end
- else
- functions={ default=newvalue,frozen=frozen }
- data[key]=functions
- if trace_initialize then
- setter.report("%s: %a is %s to %a",filename,key,"defaulted",newvalue)
- end
- end
- end
- return true
- end
- end
-end
-local function set(t,what,newvalue)
- local data=t.data
- if data and not data.frozen then
- local done=t.done
- if type(what)=="string" then
- what=settings_to_hash(what)
- end
- if type(what)~="table" then
- return
- end
- if not done then
- done={}
- t.done=done
- end
- for w,value in sortedhash(what) do
- if value=="" then
- value=newvalue
- elseif not value then
- value=false
- else
- value=is_boolean(value,value,true)
- end
- w=topattern(w,true,true)
- for name,functions in sortedhash(data) do
- if done[name] then
- elseif find(name,w) then
- done[name]=true
- for i=1,#functions do
- functions[i](value)
- end
- functions.value=value
- end
- end
- end
- end
-end
-local function reset(t)
- local data=t.data
- if data and not data.frozen then
- for name,functions in sortedthash(data) do
- for i=1,#functions do
- functions[i](false)
- end
- functions.value=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
-local function register_setter(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 %a",what)
- end
- end
- local default=functions.default
- for i=1,select("#",...) do
- local fnc=select(i,...)
- local typ=type(fnc)
- if typ=="string" then
- if trace_initialize then
- t.report("coupling %a to %a",what,fnc)
- end
- local s=fnc
- fnc=function(value) set(t,s,value) end
- elseif typ~="function" then
- fnc=nil
- end
- if fnc then
- functions[#functions+1]=fnc
- local value=functions.value or default
- if value~=nil then
- fnc(value)
- functions.value=value
- end
- end
- end
- return false
-end
-local function enable_setter(t,what)
- local e=t.enable
- t.enable,t.done=enable,{}
- set(t,what,true)
- enable(t,what)
- t.enable,t.done=e,{}
-end
-local function disable_setter(t,what)
- local e=t.disable
- t.disable,t.done=disable,{}
- disable(t,what)
- t.disable,t.done=e,{}
-end
-local function reset_setter(t)
- t.done={}
- reset(t)
-end
-local function list_setter(t)
- 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
-local function show_setter(t)
- local list=list_setter(t)
- t.report()
- for k=1,#list do
- local name=list[k]
- local functions=t.data[name]
- if functions then
- local value=functions.value
- local default=functions.default
- local modules=#functions
- if default==nil then
- default="unset"
- elseif type(default)=="table" then
- default=concat(default,"|")
- else
- default=tostring(default)
- end
- if value==nil then
- value="unset"
- elseif type(value)=="table" then
- value=concat(value,"|")
- else
- value=tostring(value)
- end
- t.report(name)
- t.report(" modules : %i",modules)
- t.report(" default : %s",default)
- t.report(" value : %s",value)
- t.report()
- end
- end
-end
-function setters.report(setter,fmt,...)
- if fmt then
- print(formatters["%-15s : %s"](setter.name,formatters[fmt](...)))
- else
- print("")
- end
-end
-local function setter_default(setter,name)
- local d=setter.data[name]
- return d and d.default
-end
-local function setter_value(setter,name)
- local d=setter.data[name]
- return d and (d.value or d.default)
-end
-local function new_setter(name)
- local setter
- setter={
- data=allocate(),
- name=name,
- report=function(...) setters.report (setter,...) end,
- enable=function(...) enable_setter (setter,...) end,
- disable=function(...) disable_setter (setter,...) end,
- reset=function(...) reset_setter (setter,...) end,
- register=function(...) register_setter(setter,...) end,
- list=function(...) return list_setter (setter,...) end,
- show=function(...) show_setter (setter,...) end,
- default=function(...) return setter_default (setter,...) end,
- value=function(...) return setter_value (setter,...) end,
- }
- data[name]=setter
- return setter
-end
-setters.enable=enable_setter
-setters.disable=disable_setter
-setters.register=register_setter
-setters.list=list_setter
-setters.show=show_setter
-setters.reset=reset_setter
-setters.new=new_setter
-setters.initialize=initialize_setter
-trackers=new_setter("trackers")
-directives=new_setter("directives")
-experiments=new_setter("experiments")
-local t_enable,t_disable=trackers .enable,trackers .disable
-local d_enable,d_disable=directives .enable,directives .disable
-local e_enable,e_disable=experiments.enable,experiments.disable
-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
- directives.report("enabling: % t",{...})
- end
- d_enable(...)
-end
-function directives.disable(...)
- if trace_directives then
- directives.report("disabling: % t",{...})
- end
- d_disable(...)
-end
-function experiments.enable(...)
- if trace_experiments then
- experiments.report("enabling: % t",{...})
- end
- e_enable(...)
-end
-function experiments.disable(...)
- if trace_experiments then
- experiments.report("disabling: % t",{...})
- end
- e_disable(...)
-end
-directives.register("system.nostatistics",function(v)
- if statistics then
- statistics.enable=not v
- else
- end
-end)
-directives.register("system.nolibraries",function(v)
- if libraries then
- libraries=nil
- else
- end
-end)
-if environment then
- local engineflags=environment.engineflags
- if engineflags then
- local list=engineflags["c:trackers"] or engineflags["trackers"]
- if type(list)=="string" then
- initialize_setter("commandline flags","trackers",settings_to_hash(list))
- end
- local list=engineflags["c:directives"] or engineflags["directives"]
- if type(list)=="string" then
- initialize_setter("commandline flags","directives",settings_to_hash(list))
- end
- end
-end
-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
-local data=table.setmetatableindex("table")
-updaters={
- register=function(what,f)
- local d=data[what]
- d[#d+1]=f
- end,
- apply=function(what,...)
- local d=data[what]
- for i=1,#d do
- d[i](...)
- end
- end,
-}
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["trac-log"] = package.loaded["trac-log"] or true
-
--- original size: 16017, stripped down to: 11045
-
-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"
-}
-local next,type,select,print=next,type,select,print
-local format,gmatch,find=string.format,string.gmatch,string.find
-local concat,insert,remove=table.concat,table.insert,table.remove
-local topattern=string.topattern
-local utfchar=utf.char
-local datetime=os.date
-local openfile=io.open
-local write_nl=print
-local write=io.write
-local setmetatableindex=table.setmetatableindex
-local formatters=string.formatters
-local settings_to_hash=utilities.parsers.settings_to_hash
-local sortedkeys=table.sortedkeys
-local variant="default"
-logs=logs or {}
-local logs=logs
-local moreinfo=[[
-More information about ConTeXt and the tools that come with it can be found at:
-]].."\n"..[[
-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
-]]
-formatters.add (
- formatters,"unichr",
- [["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
-)
-formatters.add (
- formatters,"chruni",
- [[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
-)
-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,setlogfile,settimedlog,setprocessor,setformatters,newline
-local function ansisupported(specification)
- if specification~="ansi" and specification~="ansilog" then
- return false
- elseif os and os.enableansi then
- return os.enableansi()
- else
- return false
- end
-end
-do
- local report_yes,subreport_yes,status_yes
- local report_nop,subreport_nop,status_nop
- local variants={
- default={
- formats={
- report_yes=formatters["%-15s | %s"],
- report_nop=formatters["%-15s |"],
- subreport_yes=formatters["%-15s | %s | %s"],
- subreport_nop=formatters["%-15s | %s |"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- },
- ansi={
- formats={
- report_yes=formatters["%-15s | %s"],
- report_nop=formatters["%-15s |"],
- subreport_yes=formatters["%-15s | %s | %s"],
- subreport_nop=formatters["%-15s | %s |"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- },
- }
- logs.flush=ignore
- writer=function(s)
- write_nl(s)
- end
- newline=function()
- write_nl("\n")
- end
- report=function(a,b,c,...)
- if c then
- write_nl(report_yes(a,formatters[b](c,...)))
- elseif b then
- write_nl(report_yes(a,b))
- elseif a then
- write_nl(report_nop(a))
- else
- write_nl("")
- end
- end
- subreport=function(a,sub,b,c,...)
- if c then
- write_nl(subreport_yes(a,sub,formatters[b](c,...)))
- elseif b then
- write_nl(subreport_yes(a,sub,b))
- elseif a then
- write_nl(subreport_nop(a,sub))
- else
- write_nl("")
- end
- end
- status=function(a,b,c,...)
- if c then
- write_nl(status_yes(a,formatters[b](c,...)))
- elseif b then
- write_nl(status_yes(a,b))
- elseif a then
- write_nl(status_nop(a))
- else
- write_nl("\n")
- end
- end
- direct=ignore
- subdirect=ignore
- settarget=ignore
- pushtarget=ignore
- poptarget=ignore
- setformats=ignore
- settranslations=ignore
- setprocessor=function(f)
- local writeline=write_nl
- write_nl=function(s)
- writeline(f(s))
- end
- end
- setformatters=function(specification)
- local f=nil
- local d=variants.default
- if specification then
- if type(specification)=="table" then
- f=specification.formats or specification
- else
- if not ansisupported(specification) then
- specification="default"
- end
- local v=variants[specification]
- if v then
- f=v.formats
- end
- end
- end
- if f then
- d=d.formats
- else
- f=d.formats
- d=f
- end
- setmetatableindex(f,d)
- report_yes=f.report_yes
- report_nop=f.report_nop
- subreport_yes=f.subreport_yes
- subreport_nop=f.subreport_nop
- status_yes=f.status_yes
- status_nop=f.status_nop
- end
- setformatters(variant)
- setlogfile=function(name,keepopen)
- if name and name~="" then
- local localtime=os.localtime
- local writeline=write_nl
- if keepopen then
- local f=io.open(name,"ab")
- write_nl=function(s)
- writeline(s)
- f:write(localtime()," | ",s,"\n")
- end
- else
- write_nl=function(s)
- writeline(s)
- local f=io.open(name,"ab")
- f:write(localtime()," | ",s,"\n")
- f:close()
- end
- end
- end
- setlogfile=ignore
- end
- settimedlog=function()
- local localtime=os.localtime
- local writeline=write_nl
- write_nl=function(s)
- writeline(localtime().." | "..s)
- end
- settimedlog=ignore
- end
-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.setlogfile=setlogfile
-logs.settimedlog=settimedlog
-logs.setprocessor=setprocessor
-logs.setformatters=setformatters
-logs.direct=direct
-logs.subdirect=subdirect
-logs.writer=writer
-logs.newline=newline
-local data={}
-local states=nil
-local force=false
-function logs.reporter(category,subcategory)
- local logger=data[category]
- if not logger then
- local state=states==true
- if not state and 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 force or not logger.state then
- subreport(category,subcategory,...)
- end
- end
- logger.reporters[subcategory]=reporter
- else
- local tag=category
- reporter=function(...)
- if force or not logger.state then
- report(category,...)
- end
- end
- logger.reporters.default=reporter
- end
- end
- return reporter
-end
-logs.new=logs.reporter
-local ctxreport=logs.writer
-function logs.setmessenger(m)
- ctxreport=m
-end
-function logs.messenger(category,subcategory)
- if subcategory then
- return function(...)
- ctxreport(subdirect(category,subcategory,...))
- end
- else
- return function(...)
- ctxreport(direct(category,...))
- end
- end
-end
-local function setblocked(category,value)
- if category==true or category=="all" then
- category,value="*",true
- elseif category==false then
- category,value="*",false
- elseif value==nil then
- value=true
- end
- if category=="*" then
- states=value
- for k,v in next,data do
- v.state=value
- end
- else
- alllocked=false
- states=settings_to_hash(category,type(states)=="table" and states or nil)
- for c in next,states do
- local v=data[c]
- if v then
- v.state=value
- else
- c=topattern(c,true,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 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(sortedkeys(reporters),", ")
- if state==true then
- state="disabled"
- elseif state==false then
- state="enabled"
- else
- state="unknown"
- end
- report("logging","category %a, subcategories %a, state %a",category,subcategories,state)
- end
- report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max)
-end
-local delayed_reporters={}
-setmetatableindex(delayed_reporters,function(t,k)
- local v=logs.reporter(k.name)
- t[k]=v
- return v
-end)
-function utilities.setters.report(setter,...)
- delayed_reporters[setter](...)
-end
-directives.register("logs.blocked",function(v)
- setblocked(v,true)
-end)
-directives.register("logs.target",function(v)
- settarget(v)
-end)
-local nesting=0
-local verbose=false
-local hasscheme=url.hasscheme
-local simple=logs.reporter("comment")
-logs.simple=simple
-logs.simpleline=simple
-logs.setprogram=ignore
-logs.extendbanner=ignore
-logs.reportlines=ignore
-logs.reportbanner=ignore
-logs.reportline=ignore
-logs.simplelines=ignore
-logs.help=ignore
-local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match
-local p_newline=lpeg.patterns.newline
-local linewise=(
- Carg(1)*C((1-p_newline)^1)/function(t,s) t.report(s) end+Carg(1)*p_newline^2/function(t) t.report() end+p_newline
-)^1
-local function reportlines(t,str)
- if str then
- lpegmatch(linewise,str,1,t)
- end
-end
-local function reportbanner(t)
- local banner=t.banner
- if banner then
- t.report(banner)
- t.report()
- end
-end
-local function reportversion(t)
- local banner=t.banner
- if banner then
- t.report(banner)
- end
-end
-local function reporthelp(t,...)
- local helpinfo=t.helpinfo
- if type(helpinfo)=="string" then
- reportlines(t,helpinfo)
- elseif type(helpinfo)=="table" then
- for i=1,select("#",...) do
- reportlines(t,t.helpinfo[select(i,...)])
- if i<n then
- t.report()
- end
- end
- end
-end
-local function reportinfo(t)
- t.report()
- reportlines(t,t.moreinfo)
-end
-local function reportexport(t,method)
- report(t.helpinfo)
-end
-local reporters={
- lines=reportlines,
- banner=reportbanner,
- version=reportversion,
- help=reporthelp,
- info=reportinfo,
- export=reportexport,
-}
-local exporters={
-}
-logs.reporters=reporters
-logs.exporters=exporters
-function logs.application(t)
- local arguments=environment and environment.arguments
- if arguments then
- local ansi=arguments.ansi or arguments.ansilog
- if ansi then
- logs.setformatters(arguments.ansi and "ansi" or "ansilog")
- end
- end
- t.name=t.name or "unknown"
- t.banner=t.banner
- t.moreinfo=moreinfo
- t.report=logs.reporter(t.name)
- t.help=function(...)
- reporters.banner(t)
- reporters.help(t,...)
- reporters.info(t)
- end
- t.export=function(...)
- reporters.export(t,...)
- end
- t.identify=function()
- reporters.banner(t)
- end
- t.version=function()
- reporters.version(t)
- end
- return t
-end
-local f_syslog=formatters["%s %s => %s => %s => %s\r"]
-function logs.system(whereto,process,jobname,category,fmt,arg,...)
- local message=f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg==nil and fmt or format(fmt,arg,...))
- for i=1,10 do
- local f=openfile(whereto,"a")
- if f then
- f:write(message)
- f:close()
- break
- else
- sleep(0.1)
- end
- end
-end
-local report_system=logs.reporter("system","logs")
-if utilities then
- utilities.report=report_system
-end
-if package.helpers.report then
- package.helpers.report=logs.reporter("package loader")
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
-
--- original size: 9740, stripped down to: 7296
-
-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 type,tonumber,select=type,tonumber,select
-local format,lower,find=string.format,string.lower,string.find
-local concat=table.concat
-local clock=os.gettimeofday or os.clock
-local setmetatableindex=table.setmetatableindex
-local serialize=table.serialize
-local formatters=string.formatters
-statistics=statistics or {}
-local statistics=statistics
-statistics.enable=true
-statistics.threshold=0.01
-local statusinfo,n,registered,timers={},0,{},{}
-setmetatableindex(timers,function(t,k)
- local v={ timing=0,loadtime=0,offset=0 }
- t[k]=v
- return v
-end)
-local function hastiming(instance)
- return instance and timers[instance]
-end
-local function resettiming(instance)
- timers[instance or "notimer"]={ timing=0,loadtime=0,offset=0 }
-end
-local ticks=clock
-local seconds=function(n) return n or 0 end
-if os.type~="windows" then
-elseif lua.getpreciseticks then
- ticks=lua.getpreciseticks
- seconds=lua.getpreciseseconds
-elseif FFISUPPORTED then
- local okay,kernel=pcall(ffi.load,"kernel32")
- if kernel then
- local tonumber=ffi.number or tonumber
- ffi.cdef[[
- int QueryPerformanceFrequency(int64_t *lpFrequency);
- int QueryPerformanceCounter(int64_t *lpPerformanceCount);
- ]]
- local target=ffi.new("__int64[1]")
- ticks=function()
- if kernel.QueryPerformanceCounter(target)==1 then
- return tonumber(target[0])
- else
- return 0
- end
- end
- local target=ffi.new("__int64[1]")
- seconds=function(ticks)
- if kernel.QueryPerformanceFrequency(target)==1 then
- return ticks/tonumber(target[0])
- else
- return 0
- end
- end
- end
-else
-end
-local function starttiming(instance,reset)
- local timer=timers[instance or "notimer"]
- local it=timer.timing
- if reset then
- it=0
- timer.loadtime=0
- end
- if it==0 then
- timer.starttime=ticks()
- if not timer.loadtime then
- timer.loadtime=0
- end
- end
- timer.timing=it+1
-end
-local function stoptiming(instance)
- 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 and starttime>0 then
- local stoptime=ticks()
- local loadtime=stoptime-starttime
- timer.stoptime=stoptime
- timer.loadtime=timer.loadtime+loadtime
- timer.timing=0
- timer.starttime=0
- end
- end
-end
-local function benchmarktimer(instance)
- 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 and starttime>0 then
- timer.offset=ticks()-starttime
- else
- timer.offset=0
- end
- end
-end
-local function elapsed(instance)
- if type(instance)=="number" then
- return instance
- else
- local timer=timers[instance or "notimer"]
- return timer and seconds(timer.loadtime-2*(timer.offset or 0)) or 0
- end
-end
-local function currenttime(instance)
- if type(instance)=="number" then
- return instance
- else
- local timer=timers[instance or "notimer"]
- local it=timer.timing
- if it>1 then
- else
- local starttime=timer.starttime
- if starttime and starttime>0 then
- return seconds(timer.loadtime+ticks()-starttime-2*(timer.offset or 0))
- end
- end
- return 0
- end
-end
-local function elapsedtime(instance)
- return format("%0.3f",elapsed(instance))
-end
-local function elapsedindeed(instance)
- return elapsed(instance)>statistics.threshold
-end
-local function elapsedseconds(instance,rest)
- if elapsedindeed(instance) then
- return format("%0.3f seconds %s",elapsed(instance),rest or "")
- end
-end
-statistics.hastiming=hastiming
-statistics.resettiming=resettiming
-statistics.starttiming=starttiming
-statistics.stoptiming=stoptiming
-statistics.currenttime=currenttime
-statistics.elapsed=elapsed
-statistics.elapsedtime=elapsedtime
-statistics.elapsedindeed=elapsedindeed
-statistics.elapsedseconds=elapsedseconds
-statistics.benchmarktimer=benchmarktimer
-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
-local report=logs.reporter("mkiv lua stats")
-function statistics.show()
- if statistics.enable then
- local register=statistics.register
- register("used platform",function()
- return format("%s, type: %s, binary subtree: %s",
- os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
- end)
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- register("used hash slots",function()
- return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
- end)
- register("callbacks",statistics.callbacks)
- if JITSUPPORTED then
- local jitstatus=jit.status
- if jitstatus then
- local jitstatus={ jitstatus() }
- if jitstatus[1] then
- register("luajit options",concat(jitstatus," ",2))
- end
- end
- end
- register("lua properties",function()
- local hash=2^status.luatex_hashchars
- local mask=load([[τεχ = 1]]) and "utf" or "ascii"
- return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
- end)
- register("runtime",statistics.runtime)
- logs.newline()
- for i=1,#statusinfo do
- local s=statusinfo[i]
- local r=s[2]()
- if r then
- report("%s: %s",s[1],r)
- end
- end
- statistics.enable=false
- end
-end
-function statistics.memused()
- local round=math.round or math.floor
- return format("%s MB, ctx: %s MB, max: %s MB",
- round(collectgarbage("count")/1000),
- round(status.luastate_bytes/1000000),
- status.luastate_bytes_max and round(status.luastate_bytes_max/1000000) or "unknown"
- )
-end
-starttiming(statistics)
-function statistics.formatruntime(runtime)
- return format("%s seconds",runtime)
-end
-function statistics.runtime()
- stoptiming(statistics)
- local runtime=lua.getruntime and lua.getruntime() or elapsedtime(statistics)
- return statistics.formatruntime(runtime)
-end
-local report=logs.reporter("system")
-function statistics.timed(action,all)
- starttiming("run")
- action()
- stoptiming("run")
- local runtime=tonumber(elapsedtime("run"))
- if all then
- local alltime=tonumber(lua.getruntime and lua.getruntime() or elapsedtime(statistics))
- if alltime and alltime>0 then
- report("total runtime: %0.3f seconds of %0.3f seconds",runtime,alltime)
- return
- end
- end
- report("total runtime: %0.3f seconds",runtime)
-end
-function statistics.tracefunction(base,tag,...)
- for i=1,select("#",...) do
- local name=select(i,...)
- local stat={}
- local func=base[name]
- setmetatableindex(stat,function(t,k) t[k]=0 return 0 end)
- base[name]=function(n,k,v) stat[k]=stat[k]+1 return func(n,k,v) end
- statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
- end
-end
-function status.getreadstate()
- return {
- filename=status.filename or "?",
- linenumber=status.linenumber or 0,
- iocode=status.inputid or 0,
- }
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["trac-pro"] = package.loaded["trac-pro"] or true
-
--- original size: 5841, stripped down to: 3352
-
-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,next=getmetatable,setmetatable,rawset,type,next
-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 %a in protected namespace %a: %s",k,name)
- debugger.showtraceback(report_system)
- else
- report_system("reference to %a in protected namespace %a",k,name)
- end
-end
-local function report_newindex(k,name)
- if trace_namespaces then
- report_system("assignment to %a in protected namespace %a: %s",k,name)
- debugger.showtraceback(report_system)
- else
- report_system("assignment to %a in protected namespace %a",k,name)
- end
-end
-local function register(name)
- local data=name=="global" and _G or _G[name]
- if not data then
- return
- 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)
- 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
-namespaces.private=private
-namespaces.protect=protect
-namespaces.unprotect=unprotect
-namespaces.protectall=protectall
-namespaces.unprotectall=unprotectall
-namespaces.private("namespaces") registered={} register("global")
-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)
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-lua"] = package.loaded["util-lua"] or true
-
--- original size: 7149, stripped down to: 4997
-
-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",
- comment="the strip code is written by Peter Cawley",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local rep,sub,byte,dump,format=string.rep,string.sub,string.byte,string.dump,string.format
-local load,loadfile,type,collectgarbage=load,loadfile,type,collectgarbage
-utilities=utilities or {}
-utilities.lua=utilities.lua or {}
-local luautilities=utilities.lua
-local report_lua=logs.reporter("system","lua")
-local report_mem=logs.reporter("system","lua memory")
-local tracestripping=false
-local tracememory=false
-luautilities.stripcode=true
-luautilities.alwaysstripcode=false
-luautilities.nofstrippedchunks=0
-luautilities.nofstrippedbytes=0
-local strippedchunks={}
-luautilities.strippedchunks=strippedchunks
-if not LUATEXENGINE then
- LUATEXENGINE=status.luatex_engine and string.lower(status.luatex_engine)
- JITSUPPORTED=LUATEXENGINE=="luajittex" or jit
- CONTEXTLMTXMODE=CONTEXTLMTXMODE or (LUATEXENGINE=="luametatex" and 1) or 0
-end
-luautilities.suffixes={
- tma="tma",
- tmc=(CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 and "tmd") or (jit and "tmb") or "tmc",
- lua="lua",
- luc=(CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 and "lud") or (jit and "lub") or "luc",
- lui="lui",
- luv="luv",
- luj="luj",
- tua="tua",
- tuc=(CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 and "tud") or (jit and "tub") or "tuc",
-}
-local function register(name)
- if tracestripping then
- report_lua("stripped bytecode from %a",name or "unknown")
- end
- strippedchunks[#strippedchunks+1]=name
- luautilities.nofstrippedchunks=luautilities.nofstrippedchunks+1
-end
-local function stupidcompile(luafile,lucfile,strip)
- local code=io.loaddata(luafile)
- if code and code~="" then
- code=load(code)
- if code then
- code=dump(code,strip and luautilities.stripcode or luautilities.alwaysstripcode)
- if code and code~="" then
- register(name)
- io.savedata(lucfile,code)
- return true,0
- end
- else
- report_lua("fatal error %a in file %a",1,luafile)
- end
- else
- report_lua("fatal error %a in file %a",2,luafile)
- end
- return false,0
-end
-function luautilities.loadedluacode(fullname,forcestrip,name,macros)
- name=name or fullname
- if macros then
- macros=lua.macros
- end
- local code,message
- if macros then
- code,message=macros.loaded(fullname,true,false)
- else
- code,message=loadfile(fullname)
- end
- if code then
- code()
- else
- report_lua("loading of file %a failed:\n\t%s",fullname,message or "no message")
- code,message=loadfile(fullname)
- end
- if forcestrip and luautilities.stripcode then
- if type(forcestrip)=="function" then
- forcestrip=forcestrip(fullname)
- end
- if forcestrip or luautilities.alwaysstripcode then
- register(name)
- return load(dump(code,true)),0
- else
- return code,0
- end
- elseif luautilities.alwaysstripcode then
- register(name)
- return load(dump(code,true)),0
- else
- return code,0
- end
-end
-function luautilities.strippedloadstring(code,name,forcestrip)
- local code,message=load(code)
- if not code then
- report_lua("loading of file %a failed:\n\t%s",name,message or "no message")
- end
- if forcestrip and luautilities.stripcode or luautilities.alwaysstripcode then
- register(name)
- return load(dump(code,true)),0
- else
- return code,0
- end
-end
-function luautilities.loadstring(code,name)
- local code,message=load(code)
- if not code then
- report_lua("loading of file %a failed:\n\t%s",name,message or "no message")
- end
- return code,0
-end
-function luautilities.compile(luafile,lucfile,cleanup,strip,fallback)
- report_lua("compiling %a into %a",luafile,lucfile)
- os.remove(lucfile)
- local done=stupidcompile(luafile,lucfile,strip~=false)
- if done then
- report_lua("dumping %a into %a stripped",luafile,lucfile)
- if cleanup==true and lfs.isfile(lucfile) and lfs.isfile(luafile) then
- report_lua("removing %a",luafile)
- os.remove(luafile)
- end
- end
- return done
-end
-function luautilities.loadstripped(...)
- local l=load(...)
- if l then
- return load(dump(l,true))
- end
-end
-local finalizers={}
-setmetatable(finalizers,{
- __gc=function(t)
- for i=1,#t do
- pcall(t[i])
- end
- end
-} )
-function luautilities.registerfinalizer(f)
- finalizers[#finalizers+1]=f
-end
-function luautilities.checkmemory(previous,threshold,trace)
- local current=collectgarbage("count")
- if previous then
- local checked=(threshold or 64)*1024
- local delta=current-previous
- if current-previous>checked then
- collectgarbage("collect")
- local afterwards=collectgarbage("count")
- if trace or tracememory then
- report_mem("previous %r MB, current %r MB, delta %r MB, threshold %r MB, afterwards %r MB",
- previous/1024,current/1024,delta/1024,threshold,afterwards)
- end
- return afterwards
- elseif trace or tracememory then
- report_mem("previous %r MB, current %r MB, delta %r MB, threshold %r MB",
- previous/1024,current/1024,delta/1024,threshold)
- end
- end
- return current
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-deb"] = package.loaded["util-deb"] or true
-
--- original size: 10136, stripped down to: 6832
-
-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"
-}
-local type,next,tostring,tonumber=type,next,tostring,tonumber
-local format,find,sub,gsub=string.format,string.find,string.sub,string.gsub
-local insert,remove,sort=table.insert,table.remove,table.sort
-local setmetatableindex=table.setmetatableindex
-utilities=utilities or {}
-local debugger=utilities.debugger or {}
-utilities.debugger=debugger
-local report=logs.reporter("debugger")
-local ticks=os.gettimeofday or os.clock
-local seconds=function(n) return n or 0 end
-local overhead=0
-local dummycalls=10*1000
-local nesting=0
-local names={}
-local initialize=false
-if lua.getpreciseticks then
- initialize=function()
- ticks=lua.getpreciseticks
- seconds=lua.getpreciseseconds
- initialize=false
- end
-elseif not (FFISUPPORTED and ffi) then
-elseif os.type=="windows" then
- initialize=function()
- local kernel=ffilib("kernel32","system")
- if kernel then
- local tonumber=ffi.number or tonumber
- ffi.cdef[[
- int QueryPerformanceFrequency(int64_t *lpFrequency);
- int QueryPerformanceCounter(int64_t *lpPerformanceCount);
- ]]
- local target=ffi.new("__int64[1]")
- ticks=function()
- if kernel.QueryPerformanceCounter(target)==1 then
- return tonumber(target[0])
- else
- return 0
- end
- end
- local target=ffi.new("__int64[1]")
- seconds=function(ticks)
- if kernel.QueryPerformanceFrequency(target)==1 then
- return ticks/tonumber(target[0])
- else
- return 0
- end
- end
- end
- initialize=false
- end
-elseif os.type=="unix" then
- initialize=function()
- local C=ffi.C
- local tonumber=ffi.number or tonumber
- ffi.cdef [[
- /* what a mess */
- typedef int clk_id_t;
- typedef enum { CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID } clk_id;
- typedef struct timespec { long sec; long nsec; } ctx_timespec;
- int clock_gettime(clk_id_t timerid, struct timespec *t);
- ]]
- local target=ffi.new("ctx_timespec[?]",1)
- local clock=C.CLOCK_PROCESS_CPUTIME_ID
- ticks=function ()
- C.clock_gettime(clock,target)
- return tonumber(target[0].sec*1000000000+target[0].nsec)
- end
- seconds=function(ticks)
- return ticks/1000000000
- end
- initialize=false
- end
-end
-setmetatableindex(names,function(t,name)
- local v=setmetatableindex(function(t,source)
- local v=setmetatableindex(function(t,line)
- local v={ total=0,count=0,nesting=0 }
- t[line]=v
- return v
- end)
- t[source]=v
- return v
- end)
- t[name]=v
- return v
-end)
-local getinfo=nil
-local sethook=nil
-local function hook(where)
- local f=getinfo(2,"nSl")
- if f then
- local source=f.short_src
- if not source then
- return
- end
- local line=f.linedefined or 0
- local name=f.name
- if not name then
- local what=f.what
- if what=="C" then
- name="<anonymous>"
- else
- name=f.namewhat or what or "<unknown>"
- end
- end
- local data=names[name][source][line]
- if where=="call" then
- local nesting=data.nesting
- if nesting==0 then
- data.count=data.count+1
- insert(data,ticks())
- data.nesting=1
- else
- data.nesting=nesting+1
- end
- elseif where=="return" then
- local nesting=data.nesting
- if nesting==1 then
- local t=remove(data)
- if t then
- data.total=data.total+ticks()-t
- end
- data.nesting=0
- else
- data.nesting=nesting-1
- end
- end
- end
-end
-function debugger.showstats(printer,threshold)
- local printer=printer or report
- local calls=0
- local functions=0
- local dataset={}
- local length=0
- local realtime=0
- local totaltime=0
- local threshold=threshold or 0
- for name,sources in next,names do
- for source,lines in next,sources do
- for line,data in next,lines do
- local count=data.count
- if count>threshold then
- if #name>length then
- length=#name
- end
- local total=data.total
- local real=total
- if real>0 then
- real=total-(count*overhead/dummycalls)
- if real<0 then
- real=0
- end
- realtime=realtime+real
- end
- totaltime=totaltime+total
- if line<0 then
- line=0
- end
- dataset[#dataset+1]={ real,total,count,name,source,line }
- end
- end
- end
- end
- sort(dataset,function(a,b)
- if a[1]==b[1] then
- if a[2]==b[2] then
- if a[3]==b[3] then
- if a[4]==b[4] then
- if a[5]==b[5] then
- return a[6]<b[6]
- else
- return a[5]<b[5]
- end
- else
- return a[4]<b[4]
- end
- else
- return b[3]<a[3]
- end
- else
- return b[2]<a[2]
- end
- else
- return b[1]<a[1]
- end
- end)
- if length>50 then
- length=50
- end
- local fmt=string.formatters["%4.9k s %3.3k %% %4.9k s %3.3k %% %8i # %-"..length.."s %4i %s"]
- for i=1,#dataset do
- local data=dataset[i]
- local real=data[1]
- local total=data[2]
- local count=data[3]
- local name=data[4]
- local source=data[5]
- local line=data[6]
- calls=calls+count
- functions=functions+1
- name=gsub(name,"%s+"," ")
- if #name>length then
- name=sub(name,1,length)
- end
- printer(fmt(seconds(total),100*total/totaltime,seconds(real),100*real/realtime,count,name,line,source))
- end
- printer("")
- printer(format("functions : %i",functions))
- printer(format("calls : %i",calls))
- printer(format("overhead : %f",seconds(overhead/1000)))
-end
-local function getdebug()
- if sethook and getinfo then
- return
- end
- if not debug then
- local okay
- okay,debug=pcall(require,"debug")
- end
- if type(debug)~="table" then
- return
- end
- getinfo=debug.getinfo
- sethook=debug.sethook
- if type(getinfo)~="function" then
- getinfo=nil
- end
- if type(sethook)~="function" then
- sethook=nil
- end
-end
-function debugger.savestats(filename,threshold)
- local f=io.open(filename,'w')
- if f then
- debugger.showstats(function(str) f:write(str,"\n") end,threshold)
- f:close()
- end
-end
-function debugger.enable()
- getdebug()
- if sethook and getinfo and nesting==0 then
- running=true
- if initialize then
- initialize()
- end
- sethook(hook,"cr")
- local function dummy() end
- local t=ticks()
- for i=1,dummycalls do
- dummy()
- end
- overhead=ticks()-t
- end
- if nesting>0 then
- nesting=nesting+1
- end
-end
-function debugger.disable()
- if nesting>0 then
- nesting=nesting-1
- end
- if sethook and getinfo and nesting==0 then
- sethook()
- end
-end
-local function showtraceback(rep)
- getdebug()
- if getinfo then
- local level=2
- local reporter=rep or report
- while true do
- local info=getinfo(level,"Sl")
- if not info then
- break
- elseif info.what=="C" then
- reporter("%2i : %s",level-1,"C function")
- else
- reporter("%2i : %s : %s",level-1,info.short_src,info.currentline)
- end
- level=level+1
- end
- end
-end
-debugger.showtraceback=showtraceback
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-tpl"] = package.loaded["util-tpl"] or true
-
--- original size: 7722, stripped down to: 4212
-
-if not modules then modules={} end modules ['util-tpl']={
- 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.templates=utilities.templates or {}
-local templates=utilities.templates
-local trace_template=false trackers.register("templates.trace",function(v) trace_template=v end)
-local report_template=logs.reporter("template")
-local tostring,next=tostring,next
-local format,sub,byte=string.format,string.sub,string.byte
-local P,C,R,Cs,Cc,Carg,lpegmatch,lpegpatterns=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.match,lpeg.patterns
-local formatters=string.formatters
-local replacer
-local function replacekey(k,t,how,recursive)
- local v=t[k]
- if not v then
- if trace_template then
- report_template("unknown key %a",k)
- end
- return ""
- else
- v=tostring(v)
- if trace_template then
- report_template("setting key %a to value %a",k,v)
- end
- if recursive then
- return lpegmatch(replacer,v,1,t,how,recursive)
- else
- return v
- end
- end
-end
-local sqlescape=lpeg.replacer {
- { "'","''" },
- { "\\","\\\\" },
- { "\r\n","\\n" },
- { "\r","\\n" },
-}
-local sqlquoted=Cs(Cc("'")*sqlescape*Cc("'"))
-lpegpatterns.sqlescape=sqlescape
-lpegpatterns.sqlquoted=sqlquoted
-local luaescape=lpegpatterns.luaescape
-local escapers={
- lua=function(s)
- return lpegmatch(luaescape,s)
- end,
- sql=function(s)
- return lpegmatch(sqlescape,s)
- end,
-}
-local quotedescapers={
- lua=function(s)
- return format("%q",s)
- end,
- sql=function(s)
- return lpegmatch(sqlquoted,s)
- end,
-}
-local luaescaper=escapers.lua
-local quotedluaescaper=quotedescapers.lua
-local function replacekeyunquoted(s,t,how,recurse)
- if how==false then
- return replacekey(s,t,how,recurse)
- else
- local escaper=how and escapers[how] or luaescaper
- return escaper(replacekey(s,t,how,recurse))
- end
-end
-local function replacekeyquoted(s,t,how,recurse)
- if how==false then
- return replacekey(s,t,how,recurse)
- else
- local escaper=how and quotedescapers[how] or quotedluaescaper
- return escaper(replacekey(s,t,how,recurse))
- end
-end
-local function replaceoptional(l,m,r,t,how,recurse)
- local v=t[l]
- return v and v~="" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
-end
-local function replaceformatted(l,m,r,t,how,recurse)
- local v=t[r]
- return v and formatters[l](v)
-end
-local single=P("%")
-local double=P("%%")
-local lquoted=P("%[")
-local rquoted=P("]%")
-local lquotedq=P("%(")
-local rquotedq=P(")%")
-local escape=double/'%%'
-local nosingle=single/''
-local nodouble=double/''
-local nolquoted=lquoted/''
-local norquoted=rquoted/''
-local nolquotedq=lquotedq/''
-local norquotedq=rquotedq/''
-local nolformatted=P(":")/"%%"
-local norformatted=P(":")/""
-local noloptional=P("%?")/''
-local noroptional=P("?%")/''
-local nomoptional=P(":")/''
-local args=Carg(1)*Carg(2)*Carg(3)
-local key=nosingle*((C((1-nosingle)^1)*args)/replacekey)*nosingle
-local quoted=nolquotedq*((C((1-norquotedq)^1)*args)/replacekeyquoted)*norquotedq
-local unquoted=nolquoted*((C((1-norquoted)^1)*args)/replacekeyunquoted)*norquoted
-local optional=noloptional*((C((1-nomoptional)^1)*nomoptional*C((1-noroptional)^1)*args)/replaceoptional)*noroptional
-local formatted=nosingle*((Cs(nolformatted*(1-norformatted )^1)*norformatted*C((1-nosingle)^1)*args)/replaceformatted)*nosingle
-local any=P(1)
- replacer=Cs((unquoted+quoted+formatted+escape+optional+key+any)^0)
-local function replace(str,mapping,how,recurse)
- if mapping and str then
- return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
- else
- return str
- end
-end
-templates.replace=replace
-function templates.replacer(str,how,recurse)
- return function(mapping)
- return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
- end
-end
-function templates.load(filename,mapping,how,recurse)
- local data=io.loaddata(filename) or ""
- if mapping and next(mapping) then
- return replace(data,mapping,how,recurse)
- else
- return data
- end
-end
-function templates.resolve(t,mapping,how,recurse)
- if not mapping then
- mapping=t
- end
- for k,v in next,t do
- t[k]=replace(v,mapping,how,recurse)
- end
- return t
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
-
--- original size: 21084, stripped down to: 13214
-
-if not modules then modules={} end modules ['util-sbx']={
- 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 sandbox then require("l-sandbox") end
-local next,type=next,type
-local replace=utilities.templates.replace
-local collapsepath=file.collapsepath
-local expandname=dir.expandname
-local sortedhash=table.sortedhash
-local lpegmatch=lpeg.match
-local platform=os.type
-local P,S,C=lpeg.P,lpeg.S,lpeg.C
-local gsub=string.gsub
-local lower=string.lower
-local find=string.find
-local concat=string.concat
-local unquoted=string.unquoted
-local optionalquoted=string.optionalquoted
-local basename=file.basename
-local nameonly=file.nameonly
-local sandbox=sandbox
-local validroots={}
-local validrunners={}
-local validbinaries=true
-local validlibraries=true
-local validators={}
-local finalized=nil
-local trace=false
-local p_validroot=nil
-local p_split=lpeg.firstofsplit(" ")
-local report=logs.reporter("sandbox")
-trackers.register("sandbox",function(v) trace=v end)
-sandbox.setreporter(report)
-sandbox.finalizer {
- category="files",
- action=function()
- finalized=true
- end
-}
-local function registerroot(root,what)
- if finalized then
- report("roots are already finalized")
- else
- if type(root)=="table" then
- root,what=root[1],root[2]
- end
- if type(root)=="string" and root~="" then
- root=collapsepath(expandname(root))
- if what=="r" or what=="ro" or what=="readable" then
- what="read"
- elseif what=="w" or what=="wo" or what=="writable" then
- what="write"
- end
- validroots[root]=what=="write" or false
- end
- end
-end
-sandbox.finalizer {
- category="files",
- action=function()
- if p_validroot then
- report("roots are already initialized")
- else
- sandbox.registerroot(".","write")
- for name in sortedhash(validroots) do
- if p_validroot then
- p_validroot=P(name)+p_validroot
- else
- p_validroot=P(name)
- end
- end
- p_validroot=p_validroot/validroots
- end
- end
-}
-local function registerbinary(name)
- if finalized then
- report("binaries are already finalized")
- elseif type(name)=="string" and name~="" then
- if not validbinaries then
- return
- end
- if validbinaries==true then
- validbinaries={ [name]=true }
- else
- validbinaries[name]=true
- end
- elseif name==true then
- validbinaries={}
- end
-end
-local function registerlibrary(name)
- if finalized then
- report("libraries are already finalized")
- elseif type(name)=="string" and name~="" then
- if not validlibraries then
- return
- end
- if validlibraries==true then
- validlibraries={ [nameonly(name)]=true }
- else
- validlibraries[nameonly(name)]=true
- end
- elseif name==true then
- validlibraries={}
- end
-end
-local p_write=S("wa") p_write=(1-p_write)^0*p_write
-local p_path=S("\\/~$%:") p_path=(1-p_path )^0*p_path
-local function normalized(name)
- if platform=="windows" then
- name=gsub(name,"/","\\")
- end
- return name
-end
-function sandbox.possiblepath(name)
- return lpegmatch(p_path,name) and true or false
-end
-local filenamelogger=false
-function sandbox.setfilenamelogger(l)
- filenamelogger=type(l)=="function" and l or false
-end
-local function validfilename(name,what)
- if p_validroot and type(name)=="string" and lpegmatch(p_path,name) then
- local asked=collapsepath(expandname(name))
- local okay=lpegmatch(p_validroot,asked)
- if okay==true then
- if filenamelogger then
- filenamelogger(name,"w",asked,true)
- end
- return name
- elseif okay==false then
- if not what then
- if filenamelogger then
- filenamelogger(name,"r",asked,true)
- end
- return name
- elseif lpegmatch(p_write,what) then
- if filenamelogger then
- filenamelogger(name,"w",asked,false)
- end
- return
- else
- if filenamelogger then
- filenamelogger(name,"r",asked,true)
- end
- return name
- end
- elseif filenamelogger then
- filenamelogger(name,"*",name,false)
- end
- else
- return name
- end
-end
-local function readable(name,finalized)
- return validfilename(name,"r")
-end
-local function normalizedreadable(name,finalized)
- local valid=validfilename(name,"r")
- if valid then
- return normalized(valid)
- end
-end
-local function writeable(name,finalized)
- return validfilename(name,"w")
-end
-local function normalizedwriteable(name,finalized)
- local valid=validfilename(name,"w")
- if valid then
- return normalized(valid)
- end
-end
-validators.readable=readable
-validators.writeable=normalizedwriteable
-validators.normalizedreadable=normalizedreadable
-validators.normalizedwriteable=writeable
-validators.filename=readable
-table.setmetatableindex(validators,function(t,k)
- if k then
- t[k]=readable
- end
- return readable
-end)
-function validators.string(s,finalized)
- if finalized and suspicious(s) then
- return ""
- else
- return s
- end
-end
-function validators.cache(s)
- if finalized then
- return basename(s)
- else
- return s
- end
-end
-function validators.url(s)
- if finalized and find("^file:") then
- return ""
- else
- return s
- end
-end
-local function filehandlerone(action,one,...)
- local checkedone=validfilename(one)
- if checkedone then
- return action(one,...)
- else
- end
-end
-local function filehandlertwo(action,one,two,...)
- local checkedone=validfilename(one)
- if checkedone then
- local checkedtwo=validfilename(two)
- if checkedtwo then
- return action(one,two,...)
- else
- end
- else
- end
-end
-local function iohandler(action,one,...)
- if type(one)=="string" then
- local checkedone=validfilename(one)
- if checkedone then
- return action(one,...)
- end
- elseif one then
- return action(one,...)
- else
- return action()
- end
-end
-local osexecute=sandbox.original(os.execute)
-local iopopen=sandbox.original(io.popen)
-local reported={}
-local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict)
- if validbinaries~=false and (validbinaries==true or validbinaries[program]) then
- local binpath=nil
- if variables then
- for variable,value in next,variables do
- local chktype=checkers[variable]
- if chktype=="verbose" then
- else
- local checker=validators[chktype]
- if checker then
- value=checker(unquoted(value),strict)
- if value then
- variables[variable]=optionalquoted(value)
- else
- report("variable %a with value %a fails the check",variable,value)
- return
- end
- else
- report("variable %a has no checker",variable)
- return
- end
- end
- end
- for variable,default in next,defaults do
- local value=variables[variable]
- if not value or value=="" then
- local chktype=checkers[variable]
- if chktype=="verbose" then
- else
- local checker=validators[chktype]
- if checker then
- default=checker(unquoted(default),strict)
- if default then
- variables[variable]=optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
- end
- end
- end
- end
- end
- binpath=variables.binarypath
- end
- if type(binpath)=="string" and binpath~="" then
- program=binpath.."/"..program
- end
- local command=program.." "..replace(template,variables)
- if reporter then
- reporter("executing runner %a: %s",name,command)
- elseif trace then
- report("executing runner %a: %s",name,command)
- end
- return command
- elseif not reported[name] then
- report("executing program %a of runner %a is not permitted",program,name)
- reported[name]=true
- end
-end
-local runners={
- resultof=function(...)
- local command=validcommand(...)
- if command then
- if trace then
- report("resultof: %s",command)
- end
- local handle=iopopen(command,"r")
- if handle then
- local result=handle:read("*all") or ""
- handle:close()
- return result
- end
- end
- end,
- execute=function(...)
- local command=validcommand(...)
- if command then
- if trace then
- report("execute: %s",command)
- end
- local okay=osexecute(command)
- return okay
- end
- end,
- pipeto=function(...)
- local command=validcommand(...)
- if command then
- if trace then
- report("pipeto: %s",command)
- end
- return iopopen(command,"w")
- end
- end,
-}
-function sandbox.registerrunner(specification)
- if type(specification)=="string" then
- local wrapped=validrunners[specification]
- inspect(table.sortedkeys(validrunners))
- if wrapped then
- return wrapped
- else
- report("unknown predefined runner %a",specification)
- return
- end
- end
- if type(specification)~="table" then
- report("specification should be a table (or string)")
- return
- end
- local name=specification.name
- if type(name)~="string" then
- report("invalid name, string expected",name)
- return
- end
- if validrunners[name] then
- report("invalid name, runner %a already defined",name)
- return
- end
- local program=specification.program
- if type(program)=="string" then
- elseif type(program)=="table" then
- program=program[platform] or program.default or program.unix
- end
- if type(program)~="string" or program=="" then
- report("invalid runner %a specified for platform %a",name,platform)
- return
- end
- local template=specification.template
- if not template then
- report("missing template for runner %a",name)
- return
- end
- local method=specification.method or "execute"
- local checkers=specification.checkers or {}
- local defaults=specification.defaults or {}
- local runner=runners[method]
- if runner then
- local finalized=finalized
- local wrapped=function(variables)
- return runner(name,program,template,checkers,defaults,variables,specification.reporter,finalized)
- end
- validrunners[name]=wrapped
- return wrapped
- else
- validrunners[name]=nil
- report("invalid method for runner %a",name)
- end
-end
-function sandbox.getrunner(name)
- return name and validrunners[name]
-end
-local function suspicious(str)
- return (find(str,"[/\\]") or find(command,"..",1,true)) and true or false
-end
-local function binaryrunner(action,command,...)
- if validbinaries==false then
- report("no binaries permitted, ignoring command: %s",command)
- return
- end
- if type(command)~="string" then
- report("command should be a string")
- return
- end
- local program=lpegmatch(p_split,command)
- if not program or program=="" then
- report("unable to filter binary from command: %s",command)
- return
- end
- if validbinaries==true then
- elseif not validbinaries[program] then
- report("binary not permitted, ignoring command: %s",command)
- return
- elseif suspicious(command) then
- report("/ \\ or .. found, ignoring command (use sandbox.registerrunner): %s",command)
- return
- end
- return action(command,...)
-end
-local function dummyrunner(action,command,...)
- if type(command)=="table" then
- command=concat(command," ",command[0] and 0 or 1)
- end
- report("ignoring command: %s",command)
-end
-sandbox.filehandlerone=filehandlerone
-sandbox.filehandlertwo=filehandlertwo
-sandbox.iohandler=iohandler
-function sandbox.disablerunners()
- validbinaries=false
-end
-function sandbox.disablelibraries()
- validlibraries=false
-end
-if FFISUPPORTED and ffi then
- function sandbox.disablelibraries()
- validlibraries=false
- for k,v in next,ffi do
- if k~="gc" then
- ffi[k]=nil
- end
- end
- end
- local fiiload=ffi.load
- if fiiload then
- local reported={}
- function ffi.load(name,...)
- if validlibraries==false then
- elseif validlibraries==true then
- return fiiload(name,...)
- elseif validlibraries[nameonly(name)] then
- return fiiload(name,...)
- else
- end
- if not reported[name] then
- report("using library %a is not permitted",name)
- reported[name]=true
- end
- return nil
- end
- end
-end
-local overload=sandbox.overload
-local register=sandbox.register
- overload(loadfile,filehandlerone,"loadfile")
-if io then
- overload(io.open,filehandlerone,"io.open")
- overload(io.popen,binaryrunner,"io.popen")
- overload(io.input,iohandler,"io.input")
- overload(io.output,iohandler,"io.output")
- overload(io.lines,filehandlerone,"io.lines")
-end
-if os then
- overload(os.execute,binaryrunner,"os.execute")
- overload(os.spawn,dummyrunner,"os.spawn")
- overload(os.exec,dummyrunner,"os.exec")
- overload(os.resultof,binaryrunner,"os.resultof")
- overload(os.pipeto,binaryrunner,"os.pipeto")
- overload(os.rename,filehandlertwo,"os.rename")
- overload(os.remove,filehandlerone,"os.remove")
-end
-if lfs then
- overload(lfs.chdir,filehandlerone,"lfs.chdir")
- overload(lfs.mkdir,filehandlerone,"lfs.mkdir")
- overload(lfs.rmdir,filehandlerone,"lfs.rmdir")
- overload(lfs.isfile,filehandlerone,"lfs.isfile")
- overload(lfs.isdir,filehandlerone,"lfs.isdir")
- overload(lfs.attributes,filehandlerone,"lfs.attributes")
- overload(lfs.dir,filehandlerone,"lfs.dir")
- overload(lfs.lock_dir,filehandlerone,"lfs.lock_dir")
- overload(lfs.touch,filehandlerone,"lfs.touch")
- overload(lfs.link,filehandlertwo,"lfs.link")
- overload(lfs.setmode,filehandlerone,"lfs.setmode")
- overload(lfs.readlink,filehandlerone,"lfs.readlink")
- overload(lfs.shortname,filehandlerone,"lfs.shortname")
- overload(lfs.symlinkattributes,filehandlerone,"lfs.symlinkattributes")
-end
-if zip then
- zip.open=register(zip.open,filehandlerone,"zip.open")
-end
-sandbox.registerroot=registerroot
-sandbox.registerbinary=registerbinary
-sandbox.registerlibrary=registerlibrary
-sandbox.validfilename=validfilename
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-mrg"] = package.loaded["util-mrg"] or true
-
--- original size: 7819, stripped down to: 5881
-
-if not modules then modules={} end modules ['util-mrg']={
- 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,format=string.gsub,string.format
-local concat=table.concat
-local type,next=type,next
-local P,R,S,V,Ct,C,Cs,Cc,Cp,Cmt,Cb,Cg=lpeg.P,lpeg.R,lpeg.S,lpeg.V,lpeg.Ct,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Cp,lpeg.Cmt,lpeg.Cb,lpeg.Cg
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
-utilities=utilities or {}
-local merger=utilities.merger or {}
-utilities.merger=merger
-merger.strip_comment=true
-local report=logs.reporter("system","merge")
-utilities.report=report
-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 m_pattern="%c+".."%-%-%s+"..m_begin_merge.."%c+(.-)%c+".."%-%-%s+"..m_end_merge.."%c+"
-local m_format="\n\n-- "..m_begin_merge.."\n%s\n".."-- "..m_end_merge.."\n\n"
-local m_faked="-- ".."created merged file".."\n\n".."-- "..m_begin_merge.."\n\n".."-- "..m_end_merge.."\n\n"
-local m_report=[[
--- used libraries : %s
--- skipped libraries : %s
--- original bytes : %s
--- stripped bytes : %s
-]]
-local m_preloaded=[[package.loaded[%q] = package.loaded[%q] or true]]
-local function self_fake()
- return m_faked
-end
-local function self_nothing()
- return ""
-end
-local function self_load(name)
- local data=io.loaddata(name) or ""
- if data=="" then
- report("unknown file %a",name)
- else
- report("inserting file %a",name)
- end
- return data or ""
-end
-local space=patterns.space
-local eol=patterns.newline
-local equals=P("=")^0
-local open=P("[")*Cg(equals,"init")*P("[")*P("\n")^-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*(1-closeeq)^0*close
-local quoted=patterns.quoted
-local digit=patterns.digit
-local emptyline=space^0*eol
-local operator1=P("<=")+P(">=")+P("~=")+P("..")+S("/^<>=*+%%")
-local operator2=S("*+/")
-local operator3=S("-")
-local operator4=P("..")
-local separator=S(",;")
-local ignore=(P("]")*space^1*P("=")*space^1*P("]"))/"]=["+(P("=")*space^1*P("{"))/"={"+(P("(")*space^1)/"("+(P("{")*(space+eol)^1*P("}"))/"{}"
-local strings=quoted
-local longcmt=(emptyline^0*P("--")*longstring*emptyline^0)/""
-local longstr=longstring
-local comment=emptyline^0*P("--")*P("-")^0*(1-eol)^0*emptyline^1/"\n"
-local optionalspaces=space^0/""
-local mandatespaces=space^1/""
-local optionalspacing=(eol+space)^0/""
-local mandatespacing=(eol+space)^1/""
-local pack=digit*space^1*operator4*optionalspacing+optionalspacing*operator1*optionalspacing+optionalspacing*operator2*optionalspaces+mandatespacing*operator3*mandatespaces+optionalspaces*separator*optionalspaces
-local lines=emptyline^2/"\n"
-local spaces=(space*space)/" "
-local spaces=(space*space*space*space)/" "
-local compact=Cs ((
- ignore+strings+longcmt+longstr+comment+pack+lines+spaces+1
-)^1 )
-local strip=Cs((emptyline^2/"\n"+1)^0)
-local stripreturn=Cs((1-P("return")*space^1*P(1-space-eol)^1*(space+eol)^0*P(-1))^1)
-function merger.compact(data)
- return lpegmatch(strip,lpegmatch(compact,data))
-end
-local function self_compact(data)
- local delta=0
- if merger.strip_comment then
- local before=#data
- data=lpegmatch(compact,data)
- data=lpegmatch(strip,data)
- local after=#data
- delta=before-after
- report("original size %s, compacted to %s, stripped %s",before,after,delta)
- data=format("-- original size: %s, stripped down to: %s\n\n%s",before,after,data)
- end
- return lpegmatch(stripreturn,data) or data,delta
-end
-local function self_save(name,data)
- if data~="" then
- io.savedata(name,data)
- report("saving %s with size %s",name,#data)
- 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 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],"\\","/")
- report("checking library path %a",pth)
- local name=pth.."/"..lib
- if lfs.isfile(name) then
- foundpath=pth
- end
- end
- if foundpath then break end
- end
- if foundpath then
- report("using library path %a",foundpath)
- local right,wrong,original,stripped={},{},0,0
- for i=1,#libs do
- local lib=libs[i]
- local fullname=foundpath.."/"..lib
- if lfs.isfile(fullname) then
- report("using library %a",fullname)
- local preloaded=file.nameonly(lib)
- local data=io.loaddata(fullname,true)
- original=original+#data
- local data,delta=self_compact(data)
- right[#right+1]=lib
- result[#result+1]=m_begin_closure
- result[#result+1]=format(m_preloaded,preloaded,preloaded)
- result[#result+1]=data
- result[#result+1]=m_end_closure
- stripped=stripped+delta
- else
- report("skipping library %a",fullname)
- wrong[#wrong+1]=lib
- end
- end
- right=#right>0 and concat(right," ") or "-"
- wrong=#wrong>0 and concat(wrong," ") or "-"
- report("used libraries: %a",right)
- report("skipped libraries: %a",wrong)
- report("original bytes: %a",original)
- report("stripped bytes: %a",stripped)
- result[#result+1]=format(m_report,right,wrong,original,stripped)
- else
- report("no valid library path found")
- end
- return concat(result,"\n\n")
-end
-function merger.selfcreate(libs,list,target)
- if target then
- self_save(target,self_swap(self_fake(),self_libs(libs,list)))
- end
-end
-function merger.selfmerge(name,libs,list,target)
- self_save(target or name,self_swap(self_load(name),self_libs(libs,list)))
-end
-function merger.selfclean(name)
- self_save(name,self_swap(self_load(name),self_nothing()))
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-env"] = package.loaded["util-env"] or true
-
--- original size: 9738, stripped down to: 5531
-
-if not modules then modules={} end modules ['util-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 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,optionalquoted=string.unquoted,string.quoted,string.optionalquoted
-local concat,insert,remove=table.concat,table.insert,table.remove
-environment=environment or {}
-local environment=environment
-local setlocale=os.setlocale
-setlocale(nil,nil)
-local report=logs.reporter("system")
-function os.setlocale(a,b)
- if a or b then
- if report then
- report()
- report("You're messing with os.locale in a supposedly locale neutral enviroment. From")
- report("now on are on your own and without support. Crashes or unexpected side effects")
- report("can happen but don't bother the luatex and context developer team with it.")
- report()
- report=nil
- end
- setlocale(a,b)
- end
-end
-local validengines=allocate {
- ["luatex"]=true,
- ["luajittex"]=true,
-}
-local basicengines=allocate {
- ["luatex"]="luatex",
- ["texlua"]="luatex",
- ["texluac"]="luatex",
- ["luajittex"]="luajittex",
- ["texluajit"]="luajittex",
-}
-local luaengines=allocate {
- ["lua"]=true,
- ["luajit"]=true,
-}
-environment.validengines=validengines
-environment.basicengines=basicengines
-if not arg then
- environment.used_as_library=true
-elseif luaengines[file.removesuffix(arg[-1])] then
-elseif validengines[file.removesuffix(arg[0])] then
- if arg[1]=="--luaonly" then
- arg[-1]=arg[0]
- arg[ 0]=arg[2]
- for k=3,#arg do
- arg[k-2]=arg[k]
- end
- remove(arg)
- remove(arg)
- else
- end
- local originalzero=file.basename(arg[0])
- local specialmapping={ luatools=="base" }
- if originalzero~="mtxrun" and originalzero~="mtxrun.lua" then
- arg[0]=specialmapping[originalzero] or originalzero
- insert(arg,0,"--script")
- insert(arg,0,"mtxrun")
- end
-end
-environment.arguments=allocate()
-environment.files=allocate()
-environment.sortedflags=nil
-function environment.initializearguments(arg)
- local arguments={}
- local files={}
- environment.arguments=arguments
- environment.files=files
- environment.sortedflags=nil
- for index=1,#arg do
- local argument=arg[index]
- if index>0 then
- local flag,value=match(argument,"^%-+(.-)=(.-)$")
- if flag then
- flag=gsub(flag,"^c:","")
- arguments[flag]=unquoted(value or "")
- else
- flag=match(argument,"^%-+(.+)")
- if flag then
- flag=gsub(flag,"^c:","")
- arguments[flag]=true
- else
- files[#files+1]=argument
- end
- end
- end
- end
- if not environment.ownname then
- if os.selfpath and os.selfname then
- environment.ownname=file.addsuffix(file.join(os.selfpath,os.selfname),"lua")
- end
- end
- environment.ownname=file.reslash(environment.ownname or arg[0] or 'unknown.lua')
-end
-function environment.setargument(name,value)
- environment.arguments[name]=value
-end
-function environment.getargument(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
- 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=environment.getargument
-function environment.splitarguments(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
- return before,after
-end
-function environment.reconstructcommandline(arg,noquote)
- local resolveprefix=resolvers.resolve
- arg=arg or environment.originalarguments
- if noquote and #arg==1 then
- return unquoted(resolveprefix and resolveprefix(arg[1]) or arg[1])
- elseif #arg>0 then
- local result={}
- for i=1,#arg do
- result[i]=optionalquoted(resolveprefix and resolveprefix(arg[i]) or resolveprefix)
- end
- return concat(result," ")
- else
- return ""
- end
-end
-function environment.relativepath(path,root)
- if not path then
- path=""
- end
- if not file.is_rootbased_path(path) then
- if not root then
- root=file.pathpart(environment.ownscript or environment.ownname or ".")
- end
- if root=="" then
- root="."
- end
- path=root.."/"..path
- end
- return file.collapsepath(path,true)
-end
-if arg then
- local newarg,instring={},false
- for index=1,#arg do
- local argument=arg[index]
- if find(argument,"^\"") then
- if find(argument,"\"$") then
- newarg[#newarg+1]=gsub(argument,"^\"(.-)\"$","%1")
- instring=false
- else
- newarg[#newarg+1]=gsub(argument,"^\"","")
- instring=true
- end
- elseif find(argument,"\"$") then
- if instring then
- newarg[#newarg]=newarg[#newarg].." "..gsub(argument,"\"$","")
- instring=false
- else
- newarg[#newarg+1]=argument
- end
- 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.initializearguments(newarg)
- environment.originalarguments=mark(newarg)
- environment.rawarguments=mark(arg)
- arg={}
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["luat-env"] = package.loaded["luat-env"] or true
-
--- original size: 6267, stripped down to: 4115
-
- 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"
-}
-local rawset,loadfile=rawset,loadfile
-local gsub=string.gsub
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_lua=logs.reporter("resolvers","lua")
-local luautilities=utilities.lua
-local luasuffixes=luautilities.suffixes
-local texgettoks=tex and tex.gettoks
-environment=environment or {}
-local environment=environment
-local mt={
- __index=function(_,k)
- if k=="version" then
- local version=texgettoks and texgettoks("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.texfile(filename)
- return resolvers.findfile(filename,'tex')
-end
-function environment.luafile(filename)
- if CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 and file.suffix(filename)=="lua" then
- local resolved=resolvers.findfile(file.replacesuffix(filename,"lmt")) or ""
- if resolved~="" then
- return resolved
- end
- end
- 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
-local stripindeed=false directives.register("system.compile.strip",function(v) stripindeed=v end)
-local function strippable(filename)
- if stripindeed then
- local modu=modules[file.nameonly(filename)]
- return modu and modu.dataonly
- else
- return false
- end
-end
-function environment.luafilechunk(filename,silent,macros)
- filename=file.replacesuffix(filename,"lua")
- local fullname=environment.luafile(filename)
- if fullname and fullname~="" then
- local data=luautilities.loadedluacode(fullname,strippable,filename,macros)
- if not silent then
- report_lua("loading file %a %s",fullname,not data and "failed" or "succeeded")
- end
- return data
- else
- if not silent then
- report_lua("unknown file %a",filename)
- end
- return nil
- end
-end
-function environment.loadluafile(filename,version)
- local lucname,luaname,chunk
- local basename=file.removesuffix(filename)
- if basename==filename then
- luaname=file.addsuffix(basename,luasuffixes.lua)
- lucname=file.addsuffix(basename,luasuffixes.luc)
- else
- luaname=filename
- lucname=nil
- end
- local fullname=(lucname and environment.luafile(lucname)) or ""
- if fullname~="" then
- if trace_locating then
- report_lua("loading %a",fullname)
- end
- chunk=loadfile(fullname)
- end
- if chunk then
- chunk()
- if version then
- local v=version
- if modules and modules[filename] then
- v=modules[filename].version
- elseif versions and versions[filename] then
- v=versions[filename]
- end
- if v==version then
- return true
- else
- if trace_locating then
- report_lua("version mismatch for %a, lua version %a, luc version %a",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 %a",fullname)
- end
- chunk=loadfile(fullname)
- if not chunk then
- if trace_locating then
- report_lua("unknown file %a",filename)
- end
- else
- chunk()
- return true
- end
- end
- return false
-end
-environment.filenames=setmetatable({},{
- __index=function(t,k)
- local v=environment.files[k]
- if v then
- return (gsub(v,"%.+$",""))
- end
- end,
- __newindex=function(t,k)
- end,
- __len=function(t)
- return #environment.files
- end,
-} )
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["util-zip"] = package.loaded["util-zip"] or true
-
--- original size: 19496, stripped down to: 10858
-
-if not modules then modules={} end modules ['util-zip']={
- version=1.001,
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local type,tostring,tonumber=type,tostring,tonumber
-local sort=table.sort
-local find,format,sub,gsub=string.find,string.format,string.sub,string.gsub
-local osdate,ostime,osclock=os.date,os.time,os.clock
-local ioopen=io.open
-local loaddata,savedata=io.loaddata,io.savedata
-local filejoin,isdir,dirname,mkdirs=file.join,lfs.isdir,file.dirname,dir.mkdirs
-local files=utilities.files
-local openfile=files.open
-local closefile=files.close
-local readstring=files.readstring
-local readcardinal2=files.readcardinal2le
-local readcardinal4=files.readcardinal4le
-local setposition=files.setposition
-local getposition=files.getposition
-local band=bit32.band
-local rshift=bit32.rshift
-local lshift=bit32.lshift
-local decompress,expandsize,calculatecrc
- local zlibdecompress=zlib.decompress
- local zlibexpandsize=zlib.expandsize
- local zlibchecksum=zlib.crc32
- decompress=function(source)
- return zlibdecompress(source,-15)
- end
- expandsize=zlibexpandsize and function(source,targetsize)
- return zlibexpandsize(source,targetsize,-15)
- end or decompress
- calculatecrc=function(buffer,initial)
- return zlibchecksum(initial or 0,buffer)
- end
-local zipfiles={}
-utilities.zipfiles=zipfiles
-local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do
- function openzipfile(name)
- return {
- name=name,
- handle=openfile(name,0),
- }
- end
- local function collect(z)
- if not z.list then
- local list={}
- local hash={}
- local position=0
- local index=0
- local handle=z.handle
- while true do
- setposition(handle,position)
- local signature=readstring(handle,4)
- if signature=="PK\3\4" then
- local version=readcardinal2(handle)
- local flag=readcardinal2(handle)
- local method=readcardinal2(handle)
- local filetime=readcardinal2(handle)
- local filedate=readcardinal2(handle)
- local crc32=readcardinal4(handle)
- local compressed=readcardinal4(handle)
- local uncompressed=readcardinal4(handle)
- local namelength=readcardinal2(handle)
- local extralength=readcardinal2(handle)
- local filename=readstring(handle,namelength)
- local descriptor=band(flag,8)~=0
- local encrypted=band(flag,1)~=0
- local acceptable=method==0 or method==8
- local skipped=0
- local size=0
- if encrypted then
- size=readcardinal2(handle)
- skipbytes(size)
- skipped=skipped+size+2
- skipbytes(8)
- skipped=skipped+8
- size=readcardinal2(handle)
- skipbytes(size)
- skipped=skipped+size+2
- size=readcardinal4(handle)
- skipbytes(size)
- skipped=skipped+size+4
- size=readcardinal2(handle)
- skipbytes(size)
- skipped=skipped+size+2
- end
- position=position+30+namelength+extralength+skipped
- if descriptor then
- setposition(handle,position+compressed)
- crc32=readcardinal4(handle)
- compressed=readcardinal4(handle)
- uncompressed=readcardinal4(handle)
- end
- if acceptable then
- index=index+1
- local data={
- filename=filename,
- index=index,
- position=position,
- method=method,
- compressed=compressed,
- uncompressed=uncompressed,
- crc32=crc32,
- encrypted=encrypted,
- }
- hash[filename]=data
- list[index]=data
- else
- end
- position=position+compressed
- else
- break
- end
- z.list=list
- z.hash=hash
- end
- end
- end
- function getziplist(z)
- local list=z.list
- if not list then
- collect(z)
- end
- return z.list
- end
- function getziphash(z)
- local hash=z.hash
- if not hash then
- collect(z)
- end
- return z.hash
- end
- function foundzipfile(z,name)
- return getziphash(z)[name]
- end
- function closezipfile(z)
- local f=z.handle
- if f then
- closefile(f)
- z.handle=nil
- end
- end
- function unzipfile(z,filename,check)
- local hash=z.hash
- if not hash then
- hash=zipfiles.hash(z)
- end
- local data=hash[filename]
- if not data then
- end
- if data then
- local handle=z.handle
- local position=data.position
- local compressed=data.compressed
- if compressed>0 then
- setposition(handle,position)
- local result=readstring(handle,compressed)
- if data.method==8 then
- if expandsize then
- result=expandsize(result,data.uncompressed)
- else
- result=decompress(result)
- end
- end
- if check and data.crc32~=calculatecrc(result) then
- print("checksum mismatch")
- return ""
- end
- return result
- else
- return ""
- end
- end
- end
- zipfiles.open=openzipfile
- zipfiles.close=closezipfile
- zipfiles.unzip=unzipfile
- zipfiles.hash=getziphash
- zipfiles.list=getziplist
- zipfiles.found=foundzipfile
-end
-if xzip then
- local writecardinal1=files.writebyte
- local writecardinal2=files.writecardinal2le
- local writecardinal4=files.writecardinal4le
- local logwriter=logs.writer
- local globpattern=dir.globpattern
- local compress=xzip.compress
- local checksum=xzip.crc32
- local function fromdostime(dostime,dosdate)
- return ostime {
- year=rshift(dosdate,9)+1980,
- month=band(rshift(dosdate,5),0x0F),
- day=band((dosdate ),0x1F),
- hour=band(rshift(dostime,11) ),
- min=band(rshift(dostime,5),0x3F),
- sec=band((dostime ),0x1F),
- }
- end
- local function todostime(time)
- local t=osdate("*t",time)
- return
- lshift(t.year-1980,9)+lshift(t.month,5)+t.day,
- lshift(t.hour,11)+lshift(t.min,5)+rshift(t.sec,1)
- end
- local function openzip(filename,level,comment,verbose)
- local f=ioopen(filename,"wb")
- if f then
- return {
- filename=filename,
- handle=f,
- list={},
- level=tonumber(level) or 3,
- comment=tostring(comment),
- verbose=verbose,
- uncompressed=0,
- compressed=0,
- }
- end
- end
- local function writezip(z,name,data,level,time)
- local f=z.handle
- local list=z.list
- local level=tonumber(level) or z.level or 3
- local method=8
- local zipped=compress(data,level)
- local checksum=checksum(data)
- local verbose=z.verbose
- if not zipped then
- method=0
- zipped=data
- end
- local start=f:seek()
- local compressed=#zipped
- local uncompressed=#data
- z.compressed=z.compressed+compressed
- z.uncompressed=z.uncompressed+uncompressed
- if verbose then
- local pct=100*compressed/uncompressed
- if pct>=100 then
- logwriter(format("%10i %s",uncompressed,name))
- else
- logwriter(format("%10i %02.1f %s",uncompressed,pct,name))
- end
- end
- f:write("\x50\x4b\x03\x04")
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,method)
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal4(f,checksum)
- writecardinal4(f,compressed)
- writecardinal4(f,uncompressed)
- writecardinal2(f,#name)
- writecardinal2(f,0)
- f:write(name)
- f:write(zipped)
- list[#list+1]={ #zipped,#data,name,checksum,start,time or 0 }
- end
- local function closezip(z)
- local f=z.handle
- local list=z.list
- local comment=z.comment
- local verbose=z.verbose
- local count=#list
- local start=f:seek()
- for i=1,count do
- local l=list[i]
- local compressed=l[1]
- local uncompressed=l[2]
- local name=l[3]
- local checksum=l[4]
- local start=l[5]
- local time=l[6]
- local date,time=todostime(time)
- f:write('\x50\x4b\x01\x02')
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,8)
- writecardinal2(f,time)
- writecardinal2(f,date)
- writecardinal4(f,checksum)
- writecardinal4(f,compressed)
- writecardinal4(f,uncompressed)
- writecardinal2(f,#name)
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal4(f,0)
- writecardinal4(f,start)
- f:write(name)
- end
- local stop=f:seek()
- local size=stop-start
- f:write('\x50\x4b\x05\x06')
- writecardinal2(f,0)
- writecardinal2(f,0)
- writecardinal2(f,count)
- writecardinal2(f,count)
- writecardinal4(f,size)
- writecardinal4(f,start)
- if type(comment)=="string" and comment~="" then
- writecardinal2(f,#comment)
- f:write(comment)
- else
- writecardinal2(f,0)
- end
- if verbose then
- local compressed=z.compressed
- local uncompressed=z.uncompressed
- local filename=z.filename
- local pct=100*compressed/uncompressed
- logwriter("")
- if pct>=100 then
- logwriter(format("%10i %s",uncompressed,filename))
- else
- logwriter(format("%10i %02.1f %s",uncompressed,pct,filename))
- end
- end
- f:close()
- end
- local function zipdir(zipname,path,level,verbose)
- if type(zipname)=="table" then
- verbose=zipname.verbose
- level=zipname.level
- path=zipname.path
- zipname=zipname.zipname
- end
- if not zipname or zipname=="" then
- return
- end
- if not path or path=="" then
- path="."
- end
- if not isdir(path) then
- return
- end
- path=gsub(path,"\\+","/")
- path=gsub(path,"/+","/")
- local list={}
- local count=0
- globpattern(path,"",true,function(name,size,time)
- count=count+1
- list[count]={ name,time }
- end)
- sort(list,function(a,b)
- return a[1]<b[1]
- end)
- local zipf=openzip(zipname,level,comment,verbose)
- if zipf then
- local p=#path+2
- for i=1,count do
- local li=list[i]
- local name=li[1]
- local time=li[2]
- local data=loaddata(name)
- local name=sub(name,p,#name)
- writezip(zipf,name,data,level,time,verbose)
- end
- closezip(zipf)
- end
- end
- local function unzipdir(zipname,path,verbose)
- if type(zipname)=="table" then
- verbose=zipname.verbose
- path=zipname.path
- zipname=zipname.zipname
- end
- if not zipname or zipname=="" then
- return
- end
- if not path or path=="" then
- path="."
- end
- local z=openzipfile(zipname)
- if z then
- local list=getziplist(z)
- if list then
- local total=0
- local count=#list
- local step=number.idiv(count,10)
- local done=0
- local steps=verbose=="steps"
- local time=steps and osclock()
- for i=1,count do
- local l=list[i]
- local n=l.filename
- local d=unzipfile(z,n)
- if d then
- local p=filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total=total+#d
- done=done+1
- if done>=step then
- done=0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
- end
- elseif verbose then
- logwriter(n)
- end
- savedata(p,d)
- end
- else
- logwriter(format("problem with file %s",n))
- end
- end
- if steps then
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
- end
- closezipfile(z)
- return true
- else
- closezipfile(z)
- end
- end
- end
- zipfiles.zipdir=zipdir
- zipfiles.unzipdir=unzipdir
-end
-zipfiles.gunzipfile=gzip.load
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
-
--- original size: 61808, stripped down to: 36227
-
-if not modules then modules={} end modules ['lxml-tab']={
- version=1.001,
- comment="this module is the basis for the lxml-* ones",
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-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(string.format(...)) end
-if lpeg.setmaxstack then lpeg.setmaxstack(1000) end
-xml=xml or {}
-local xml=xml
-local concat,remove,insert=table.concat,table.remove,table.insert
-local type,next,setmetatable,getmetatable,tonumber,rawset,select=type,next,setmetatable,getmetatable,tonumber,rawset,select
-local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub
-local sort=table.sort
-local utfchar=utf.char
-local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
-local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs
-local formatters=string.formatters
-do
-xml.xmlns=xml.xmlns or {}
-local check=P(false)
-local parse=check
-function xml.registerns(namespace,pattern)
- check=check+C(P(lower(pattern)))/namespace
- parse=P { P(check)+1*V(1) }
-end
-function xml.checkns(namespace,url)
- local ns=lpegmatch(parse,lower(url))
- if ns and namespace~=ns then
- xml.xmlns[namespace]=ns
- end
-end
-function xml.resolvens(url)
- return lpegmatch(parse,lower(url)) or ""
-end
-end
-local nsremap,resolvens=xml.xmlns,xml.resolvens
-local stack,level,top,at,xmlnms,errorstr
-local entities,parameters
-local strip,utfize,resolve,cleanup,resolve_predefined,unify_predefined
-local dcache,hcache,acache
-local mt,dt,nt
-local currentfilename,currentline,linenumbers
-local grammar_parsed_text_one
-local grammar_parsed_text_two
-local grammar_unparsed_text
-local handle_hex_entity
-local handle_dec_entity
-local handle_any_entity_dtd
-local handle_any_entity_text
-local function preparexmlstate(settings)
- if settings then
- linenumbers=settings.linenumbers
- stack={}
- level=0
- top={}
- at={}
- mt={}
- dt={}
- nt=0
- xmlns={}
- errorstr=nil
- strip=settings.strip_cm_and_dt
- utfize=settings.utfize_entities
- resolve=settings.resolve_entities
- resolve_predefined=settings.resolve_predefined_entities
- unify_predefined=settings.unify_predefined_entities
- cleanup=settings.text_cleanup
- entities=settings.entities or {}
- currentfilename=settings.currentresource
- currentline=1
- parameters={}
- reported_at_errors={}
- dcache={}
- hcache={}
- acache={}
- if utfize==nil then
- settings.utfize_entities=true
- utfize=true
- end
- if resolve_predefined==nil then
- settings.resolve_predefined_entities=true
- resolve_predefined=true
- end
- else
- linenumbers=false
- stack=nil
- level=nil
- top=nil
- at=nil
- mt=nil
- dt=nil
- nt=nil
- xmlns=nil
- errorstr=nil
- strip=nil
- utfize=nil
- resolve=nil
- resolve_predefined=nil
- unify_predefined=nil
- cleanup=nil
- entities=nil
- parameters=nil
- reported_at_errors=nil
- dcache=nil
- hcache=nil
- acache=nil
- currentfilename=nil
- currentline=1
- end
-end
-local function initialize_mt(root)
- mt={ __index=root }
-end
-function xml.setproperty(root,k,v)
- getmetatable(root).__index[k]=v
-end
-function xml.checkerror(top,toclose)
- return ""
-end
-local checkns=xml.checkns
-local function add_attribute(namespace,tag,value)
- if cleanup and value~="" then
- value=cleanup(value)
- end
- if tag=="xmlns" then
- xmlns[#xmlns+1]=resolvens(value)
- at[tag]=value
- elseif namespace=="" then
- at[tag]=value
- elseif namespace=="xmlns" then
- checkns(tag,value)
- at["xmlns:"..tag]=value
- else
- at[namespace..":"..tag]=value
- end
-end
-local function add_empty(spacing,namespace,tag)
- if spacing~="" then
- nt=nt+1
- dt[nt]=spacing
- end
- local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace
- top=stack[level]
- dt=top.dt
- nt=#dt+1
- local t=linenumbers and {
- ns=namespace or "",
- rn=resolved,
- tg=tag,
- at=at,
- dt={},
- ni=nt,
- cf=currentfilename,
- cl=currentline,
- __p__=top,
- } or {
- ns=namespace or "",
- rn=resolved,
- tg=tag,
- at=at,
- dt={},
- ni=nt,
- __p__=top,
- }
- dt[nt]=t
- setmetatable(t,mt)
- if at.xmlns then
- remove(xmlns)
- end
- at={}
-end
-local function add_begin(spacing,namespace,tag)
- if spacing~="" then
- nt=nt+1
- dt[nt]=spacing
- end
- local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace
- dt={}
- top=linenumbers and {
- ns=namespace or "",
- rn=resolved,
- tg=tag,
- at=at,
- dt=dt,
- ni=nil,
- cf=currentfilename,
- cl=currentline,
- __p__=stack[level],
- } or {
- ns=namespace or "",
- rn=resolved,
- tg=tag,
- at=at,
- dt=dt,
- ni=nil,
- __p__=stack[level],
- }
- setmetatable(top,mt)
- nt=0
- level=level+1
- stack[level]=top
- at={}
-end
-local function add_end(spacing,namespace,tag)
- if spacing~="" then
- nt=nt+1
- dt[nt]=spacing
- end
- local toclose=stack[level]
- level=level-1
- top=stack[level]
- if level<1 then
- errorstr=formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "")
- report_xml(errorstr)
- elseif toclose.tg~=tag then
- errorstr=formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "")
- report_xml(errorstr)
- end
- dt=top.dt
- nt=#dt+1
- dt[nt]=toclose
- toclose.ni=nt
- if toclose.at.xmlns then
- remove(xmlns)
- end
-end
-local function add_text(text)
- if text=="" then
- return
- end
- if cleanup then
- if nt>0 then
- local s=dt[nt]
- if type(s)=="string" then
- dt[nt]=s..cleanup(text)
- else
- nt=nt+1
- dt[nt]=cleanup(text)
- end
- else
- nt=1
- dt[1]=cleanup(text)
- end
- else
- if nt>0 then
- local s=dt[nt]
- if type(s)=="string" then
- dt[nt]=s..text
- else
- nt=nt+1
- dt[nt]=text
- end
- else
- nt=1
- dt[1]=text
- end
- end
-end
-local function add_special(what,spacing,text)
- if spacing~="" then
- nt=nt+1
- dt[nt]=spacing
- end
- if strip and (what=="@cm@" or what=="@dt@") then
- else
- nt=nt+1
- dt[nt]=linenumbers and {
- special=true,
- ns="",
- tg=what,
- ni=nil,
- dt={ text },
- cf=currentfilename,
- cl=currentline,
- } or {
- special=true,
- ns="",
- tg=what,
- ni=nil,
- dt={ text },
- }
- end
-end
-local function set_message(txt)
- errorstr="garbage at the end of the file: "..gsub(txt,"([ \n\r\t]*)","")
-end
-local function attribute_value_error(str)
- if not reported_at_errors[str] then
- report_xml("invalid attribute value %a",str)
- reported_at_errors[str]=true
- at._error_=str
- end
- return str
-end
-local function attribute_specification_error(str)
- if not reported_at_errors[str] then
- report_xml("invalid attribute specification %a",str)
- reported_at_errors[str]=true
- at._error_=str
- end
- return str
-end
-do
- local badentity="&"
- xml.placeholders={
- unknown_dec_entity=function(str) return str=="" and badentity or formatters["&%s;"](str) end,
- unknown_hex_entity=function(str) return formatters["&#x%s;"](str) end,
- unknown_any_entity=function(str) return formatters["&#x%s;"](str) end,
- }
- local function fromhex(s)
- local n=tonumber(s,16)
- if n then
- return utfchar(n)
- else
- return formatters["h:%s"](s),true
- end
- end
- local function fromdec(s)
- local n=tonumber(s)
- if n then
- return utfchar(n)
- else
- return formatters["d:%s"](s),true
- end
- end
- local p_rest=(1-P(";"))^0
- local p_many=P(1)^0
- local parsedentity=P("&#")*(P("x")*(p_rest/fromhex)+(p_rest/fromdec))*P(";")*P(-1)+P ("#")*(P("x")*(p_many/fromhex)+(p_many/fromdec))
- xml.parsedentitylpeg=parsedentity
- local predefined_unified={
- [38]="&amp;",
- [42]="&quot;",
- [47]="&apos;",
- [74]="&lt;",
- [76]="&gt;",
- }
- local predefined_simplified={
- [38]="&",amp="&",
- [42]='"',quot='"',
- [47]="'",apos="'",
- [74]="<",lt="<",
- [76]=">",gt=">",
- }
- local nofprivates=0xF0000
- local privates_u={
- [ [[&]] ]="&amp;",
- [ [["]] ]="&quot;",
- [ [[']] ]="&apos;",
- [ [[<]] ]="&lt;",
- [ [[>]] ]="&gt;",
- }
- local privates_p={
- }
- local privates_s={
- [ [["]] ]="&U+22;",
- [ [[#]] ]="&U+23;",
- [ [[$]] ]="&U+24;",
- [ [[%]] ]="&U+25;",
- [ [[&]] ]="&U+26;",
- [ [[']] ]="&U+27;",
- [ [[<]] ]="&U+3C;",
- [ [[>]] ]="&U+3E;",
- [ [[\]] ]="&U+5C;",
- [ [[{]] ]="&U+7B;",
- [ [[|]] ]="&U+7C;",
- [ [[}]] ]="&U+7D;",
- [ [[~]] ]="&U+7E;",
- }
- local privates_x={
- [ [["]] ]="&U+22;",
- [ [[#]] ]="&U+23;",
- [ [[$]] ]="&U+24;",
- [ [[%]] ]="&U+25;",
- [ [[']] ]="&U+27;",
- [ [[\]] ]="&U+5C;",
- [ [[{]] ]="&U+7B;",
- [ [[|]] ]="&U+7C;",
- [ [[}]] ]="&U+7D;",
- [ [[~]] ]="&U+7E;",
- }
- local privates_n={
- }
- local escaped=utf.remapper(privates_u,"dynamic")
- local unprivatized=utf.remapper(privates_p,"dynamic")
- local unspecialized=utf.remapper(privates_s,"dynamic")
- local despecialized=utf.remapper(privates_x,"dynamic")
- xml.unprivatized=unprivatized
- xml.unspecialized=unspecialized
- xml.despecialized=despecialized
- xml.escaped=escaped
- local function unescaped(s)
- local p=privates_n[s]
- if not p then
- nofprivates=nofprivates+1
- p=utfchar(nofprivates)
- privates_n[s]=p
- s="&"..s..";"
- privates_u[p]=s
- privates_p[p]=s
- privates_s[p]=s
- end
- return p
- end
- xml.privatetoken=unescaped
- xml.privatecodes=privates_n
- xml.specialcodes=privates_s
- function xml.addspecialcode(key,value)
- privates_s[key]=value or "&"..s..";"
- end
- handle_hex_entity=function(str)
- local h=hcache[str]
- if not h then
- local n=tonumber(str,16)
- h=unify_predefined and predefined_unified[n]
- if h then
- if trace_entities then
- report_xml("utfize, converting hex entity &#x%s; into %a",str,h)
- end
- elseif utfize then
- h=(n and utfchar(n)) or xml.unknown_hex_entity(str) or ""
- if not n then
- report_xml("utfize, ignoring hex entity &#x%s;",str)
- elseif trace_entities then
- report_xml("utfize, converting hex entity &#x%s; into %a",str,h)
- end
- else
- if trace_entities then
- report_xml("found entity &#x%s;",str)
- end
- h="&#x"..str..";"
- end
- hcache[str]=h
- end
- return h
- end
- handle_dec_entity=function(str)
- local d=dcache[str]
- if not d then
- local n=tonumber(str)
- d=unify_predefined and predefined_unified[n]
- if d then
- if trace_entities then
- report_xml("utfize, converting dec entity &#%s; into %a",str,d)
- end
- elseif utfize then
- d=(n and utfchar(n)) or placeholders.unknown_dec_entity(str) or ""
- if not n then
- report_xml("utfize, ignoring dec entity &#%s;",str)
- elseif trace_entities then
- report_xml("utfize, converting dec entity &#%s; into %a",str,d)
- end
- else
- if trace_entities then
- report_xml("found entity &#%s;",str)
- end
- d="&#"..str..";"
- end
- dcache[str]=d
- end
- return d
- end
- handle_any_entity_dtd=function(str)
- if resolve then
- local a=resolve_predefined and predefined_simplified[str]
- if a then
- if trace_entities then
- report_xml("resolving entity &%s; to predefined %a",str,a)
- end
- else
- if type(resolve)=="function" then
- a=resolve(str,entities) or entities[str]
- else
- a=entities[str]
- end
- if a then
- if type(a)=="function" then
- if trace_entities then
- report_xml("expanding entity &%s; to function call",str)
- end
- a=a(str) or ""
- end
- a=lpegmatch(parsedentity,a) or a
- if trace_entities then
- report_xml("resolving entity &%s; to internal %a",str,a)
- end
- else
- 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
- report_xml("resolving entity &%s; to external %s",str,a)
- end
- else
- if trace_entities then
- report_xml("keeping entity &%s;",str)
- end
- if str=="" then
- a=badentity
- else
- a="&"..str..";"
- end
- end
- end
- end
- return a
- else
- local a=acache[str]
- if not a then
- a=resolve_predefined and predefined_simplified[str]
- if a then
- acache[str]=a
- if trace_entities then
- report_xml("entity &%s; becomes %a",str,a)
- end
- elseif str=="" then
- if trace_entities then
- report_xml("invalid entity &%s;",str)
- end
- a=badentity
- acache[str]=a
- else
- if trace_entities then
- report_xml("entity &%s; is made private",str)
- end
- a=unescaped(str)
- acache[str]=a
- end
- end
- return a
- end
- end
- handle_any_entity_text=function(str)
- if resolve then
- local a=resolve_predefined and predefined_simplified[str]
- if a then
- if trace_entities then
- report_xml("resolving entity &%s; to predefined %a",str,a)
- end
- else
- if type(resolve)=="function" then
- a=resolve(str,entities) or entities[str]
- else
- a=entities[str]
- end
- if a then
- if type(a)=="function" then
- if trace_entities then
- report_xml("expanding entity &%s; to function call",str)
- end
- a=a(str) or ""
- end
- a=lpegmatch(grammar_parsed_text_two,a) or a
- if type(a)=="number" then
- return ""
- else
- a=lpegmatch(parsedentity,a) or a
- if trace_entities then
- report_xml("resolving entity &%s; to internal %a",str,a)
- end
- end
- if trace_entities then
- report_xml("resolving entity &%s; to internal %a",str,a)
- end
- else
- 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
- report_xml("resolving entity &%s; to external %s",str,a)
- end
- else
- if trace_entities then
- report_xml("keeping entity &%s;",str)
- end
- if str=="" then
- a=badentity
- else
- a="&"..str..";"
- end
- end
- end
- end
- return a
- else
- local a=acache[str]
- if not a then
- a=resolve_predefined and predefined_simplified[str]
- if a then
- acache[str]=a
- if trace_entities then
- report_xml("entity &%s; becomes %a",str,a)
- end
- elseif str=="" then
- if trace_entities then
- report_xml("invalid entity &%s;",str)
- end
- a=badentity
- acache[str]=a
- else
- if trace_entities then
- report_xml("entity &%s; is made private",str)
- end
- a=unescaped(str)
- acache[str]=a
- end
- end
- return a
- end
- end
- local p_rest=(1-P(";"))^1
- local spec={
- [0x23]="\\Ux{23}",
- [0x24]="\\Ux{24}",
- [0x25]="\\Ux{25}",
- [0x5C]="\\Ux{5C}",
- [0x7B]="\\Ux{7B}",
- [0x7C]="\\Ux{7C}",
- [0x7D]="\\Ux{7D}",
- [0x7E]="\\Ux{7E}",
- }
- local hash=table.setmetatableindex(spec,function(t,k)
- local v=utfchar(k)
- t[k]=v
- return v
- end)
- local function fromuni(s)
- local n=tonumber(s,16)
- if n then
- return hash[n]
- else
- return formatters["u:%s"](s),true
- end
- end
- local function fromhex(s)
- local n=tonumber(s,16)
- if n then
- return hash[n]
- else
- return formatters["h:%s"](s),true
- end
- end
- local function fromdec(s)
- local n=tonumber(s)
- if n then
- return hash[n]
- else
- return formatters["d:%s"](s),true
- end
- end
- local reparsedentity=P("U+")*(p_rest/fromuni)+P("#")*(
- P("x")*(p_rest/fromhex)+p_rest/fromdec
- )
- local hash=table.setmetatableindex(function(t,k)
- local v=utfchar(k)
- t[k]=v
- return v
- end)
- local function fromuni(s)
- local n=tonumber(s,16)
- if n then
- return hash[n]
- else
- return formatters["u:%s"](s),true
- end
- end
- local function fromhex(s)
- local n=tonumber(s,16)
- if n then
- return hash[n]
- else
- return formatters["h:%s"](s),true
- end
- end
- local function fromdec(s)
- local n=tonumber(s)
- if n then
- return hash[n]
- else
- return formatters["d:%s"](s),true
- end
- end
- local unescapedentity=P("U+")*(p_rest/fromuni)+P("#")*(
- P("x")*(p_rest/fromhex)+p_rest/fromdec
- )
- xml.reparsedentitylpeg=reparsedentity
- xml.unescapedentitylpeg=unescapedentity
-end
-local escaped=xml.escaped
-local unescaped=xml.unescaped
-local placeholders=xml.placeholders
-local function handle_end_entity(str)
- report_xml("error in entity, %a found without ending %a",str,";")
- return str
-end
-local function handle_crap_error(chr)
- report_xml("error in parsing, unexpected %a found ",chr)
- add_text(chr)
- return chr
-end
-local function handlenewline()
- currentline=currentline+1
-end
-local spacetab=S(' \t')
-local space=S(' \r\n\t')
-local newline=lpegpatterns.newline/handlenewline
-local anything=P(1)
-local open=P('<')
-local close=P('>')
-local squote=S("'")
-local dquote=S('"')
-local equal=P('=')
-local slash=P('/')
-local colon=P(':')
-local semicolon=P(';')
-local ampersand=P('&')
-local valid_0=R("\128\255")
-local valid_1=R('az','AZ')+S('_')+valid_0
-local valid_2=valid_1+R('09')+S('-.')
-local valid=valid_1*valid_2^0
-local name_yes=C(valid^1)*colon*C(valid^1)
-local name_nop=C(P(true))*C(valid^1)
-local name=name_yes+name_nop
-local utfbom=lpegpatterns.utfbom
-local spacing=C(space^0)
-local space_nl=spacetab+newline
-local spacing_nl=Cs((space_nl)^0)
-local anything_nl=newline+P(1)
-local function weirdentity(k,v)
- if trace_entities then
- report_xml("registering %s entity %a as %a","weird",k,v)
- end
- parameters[k]=v
-end
-local function normalentity(k,v)
- if trace_entities then
- report_xml("registering %s entity %a as %a","normal",k,v)
- end
- entities[k]=v
-end
-local function systementity(k,v,n)
- if trace_entities then
- report_xml("registering %s entity %a as %a","system",k,v)
- end
- entities[k]=v
-end
-local function publicentity(k,v,n)
- if trace_entities then
- report_xml("registering %s entity %a as %a","public",k,v)
- end
- entities[k]=v
-end
-local function entityfile(pattern,k,v,n)
- if n then
- local okay,data
- local loadbinfile=resolvers and resolvers.loadbinfile
- if loadbinfile then
- okay,data=loadbinfile(n)
- else
- data=io.loaddata(n)
- okay=data and data~=""
- end
- if okay then
- if trace_entities then
- report_xml("loading public entities %a as %a from %a",k,v,n)
- end
- lpegmatch(pattern,data)
- return
- end
- end
- report_xml("ignoring public entities %a as %a from %a",k,v,n)
-end
-local function install(spacenewline,spacing,anything)
- local anyentitycontent=(1-open-semicolon-space-close-ampersand)^0
- local hexentitycontent=R("AF","af","09")^1
- local decentitycontent=R("09")^1
- local parsedentity=P("#")/""*(
- P("x")/""*(hexentitycontent/handle_hex_entity)+(decentitycontent/handle_dec_entity)
- )+(anyentitycontent/handle_any_entity_dtd)
- local parsedentity_text=P("#")/""*(
- P("x")/""*(hexentitycontent/handle_hex_entity)+(decentitycontent/handle_dec_entity)
- )+(anyentitycontent/handle_any_entity_text)
- local entity=(ampersand/"")*parsedentity*(semicolon/"")+ampersand*(anyentitycontent/handle_end_entity)
- local entity_text=(ampersand/"")*parsedentity_text*(semicolon/"")+ampersand*(anyentitycontent/handle_end_entity)
- local text_unparsed=Cs((anything-open)^1)
- local text_parsed=(Cs((anything-open-ampersand)^1)/add_text+Cs(entity_text)/add_text)^1
- local somespace=(spacenewline)^1
- local optionalspace=(spacenewline)^0
- local value=(squote*Cs((entity+(anything-squote))^0)*squote)+(dquote*Cs((entity+(anything-dquote))^0)*dquote)
- local endofattributes=slash*close+close
- local whatever=space*name*optionalspace*equal
- local wrongvalue=Cs(P(entity+(1-space-endofattributes))^1)/attribute_value_error
- local attributevalue=value+wrongvalue
- local attribute=(somespace*name*optionalspace*equal*optionalspace*attributevalue)/add_attribute
- local attributes=(attribute+somespace^-1*(((anything-endofattributes)^1)/attribute_specification_error))^0
- local parsedtext=text_parsed
- local unparsedtext=text_unparsed/add_text
- local balanced=P { "["*((anything-S"[]")+V(1))^0*"]" }
- local emptyelement=(spacing*open*name*attributes*optionalspace*slash*close)/add_empty
- local beginelement=(spacing*open*name*attributes*optionalspace*close)/add_begin
- local endelement=(spacing*open*slash*name*optionalspace*close)/add_end
- local begincomment=open*P("!--")
- local endcomment=P("--")*close
- local begininstruction=open*P("?")
- local endinstruction=P("?")*close
- local begincdata=open*P("![CDATA[")
- local endcdata=P("]]")*close
- local someinstruction=C((anything-endinstruction)^0)
- local somecomment=C((anything-endcomment )^0)
- local somecdata=C((anything-endcdata )^0)
- local begindoctype=open*P("!DOCTYPE")
- local enddoctype=close
- local beginset=P("[")
- local endset=P("]")
- local wrdtypename=C((anything-somespace-P(";"))^1)
- local doctypename=C((anything-somespace-close)^0)
- local elementdoctype=optionalspace*P("<!ELEMENT")*(anything-close)^0*close
- local basiccomment=begincomment*((anything-endcomment)^0)*endcomment
- local weirdentitytype=P("%")*(somespace*doctypename*somespace*value)/weirdentity
- local normalentitytype=(doctypename*somespace*value)/normalentity
- local publicentitytype=(doctypename*somespace*P("PUBLIC")*somespace*value)/publicentity
- local systementitytype=(doctypename*somespace*P("SYSTEM")*somespace*value*somespace*P("NDATA")*somespace*doctypename)/systementity
- local entitydoctype=optionalspace*P("<!ENTITY")*somespace*(systementitytype+publicentitytype+normalentitytype+weirdentitytype)*optionalspace*close
- local publicentityfile=(doctypename*somespace*P("PUBLIC")*somespace*value*(somespace*value)^0)/function(...)
- entityfile(entitydoctype,...)
- end
- local function weirdresolve(s)
- lpegmatch(entitydoctype,parameters[s])
- end
- local function normalresolve(s)
- lpegmatch(entitydoctype,entities[s])
- end
- local entityresolve=P("%")*(wrdtypename/weirdresolve )*P(";")+P("&")*(wrdtypename/normalresolve)*P(";")
- entitydoctype=entitydoctype+entityresolve
- local doctypeset=beginset*optionalspace*P(elementdoctype+entitydoctype+entityresolve+basiccomment+space)^0*optionalspace*endset
- local definitiondoctype=doctypename*somespace*doctypeset
- local publicdoctype=doctypename*somespace*P("PUBLIC")*somespace*value*somespace*value*somespace*doctypeset
- local systemdoctype=doctypename*somespace*P("SYSTEM")*somespace*value*somespace*doctypeset
- local simpledoctype=(anything-close)^1
- local somedoctype=C((somespace*(
-publicentityfile+publicdoctype+systemdoctype+definitiondoctype+simpledoctype)*optionalspace)^0)
- local instruction=(spacing*begininstruction*someinstruction*endinstruction)/function(...) add_special("@pi@",...) end
- local comment=(spacing*begincomment*somecomment*endcomment )/function(...) add_special("@cm@",...) end
- local cdata=(spacing*begincdata*somecdata*endcdata )/function(...) add_special("@cd@",...) end
- local doctype=(spacing*begindoctype*somedoctype*enddoctype )/function(...) add_special("@dt@",...) end
- local crap_parsed=anything-beginelement-endelement-emptyelement-begininstruction-begincomment-begincdata-ampersand
- local crap_unparsed=anything-beginelement-endelement-emptyelement-begininstruction-begincomment-begincdata
- local parsedcrap=Cs((crap_parsed^1+entity_text)^1)/handle_crap_error
- local parsedcrap=Cs((crap_parsed^1+entity_text)^1)/handle_crap_error
- local unparsedcrap=Cs((crap_unparsed )^1)/handle_crap_error
- local trailer=space^0*(text_unparsed/set_message)^0
- local grammar_parsed_text_one=P { "preamble",
- preamble=utfbom^0*instruction^0*(doctype+comment+instruction)^0,
- }
- local grammar_parsed_text_two=P { "followup",
- followup=V("parent")*trailer,
- parent=beginelement*V("children")^0*endelement,
- children=parsedtext+V("parent")+emptyelement+comment+cdata+instruction+parsedcrap,
- }
- local grammar_unparsed_text=P { "preamble",
- preamble=utfbom^0*instruction^0*(doctype+comment+instruction)^0*V("parent")*trailer,
- parent=beginelement*V("children")^0*endelement,
- children=unparsedtext+V("parent")+emptyelement+comment+cdata+instruction+unparsedcrap,
- }
- return grammar_parsed_text_one,grammar_parsed_text_two,grammar_unparsed_text
-end
-local
- grammar_parsed_text_one_nop,
- grammar_parsed_text_two_nop,
- grammar_unparsed_text_nop=install(space,spacing,anything)
-local
- grammar_parsed_text_one_yes,
- grammar_parsed_text_two_yes,
- grammar_unparsed_text_yes=install(space_nl,spacing_nl,anything_nl)
-local function _xmlconvert_(data,settings,detail)
- settings=settings or {}
- preparexmlstate(settings)
- if settings.linenumbers then
- grammar_parsed_text_one=grammar_parsed_text_one_yes
- grammar_parsed_text_two=grammar_parsed_text_two_yes
- grammar_unparsed_text=grammar_unparsed_text_yes
- else
- grammar_parsed_text_one=grammar_parsed_text_one_nop
- grammar_parsed_text_two=grammar_parsed_text_two_nop
- grammar_unparsed_text=grammar_unparsed_text_nop
- end
- local preprocessor=settings.preprocessor
- if data and data~="" and type(preprocessor)=="function" then
- data=preprocessor(data,settings) or data
- end
- if settings.parent_root then
- mt=getmetatable(settings.parent_root)
- else
- initialize_mt(top)
- end
- level=level+1
- stack[level]=top
- top.dt={}
- dt=top.dt
- nt=0
- if not data or data=="" then
- errorstr="empty xml file"
- elseif data==true then
- errorstr=detail or "problematic xml file"
- elseif utfize or resolve then
- local m=lpegmatch(grammar_parsed_text_one,data)
- if m then
- m=lpegmatch(grammar_parsed_text_two,data,m)
- end
- if m then
- else
- errorstr="invalid xml file - parsed text"
- end
- elseif type(data)=="string" then
- if lpegmatch(grammar_unparsed_text,data) then
- errorstr=""
- else
- errorstr="invalid xml file - unparsed text"
- end
- 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(result,mt)
- setmetatable(result.dt[1],mt)
- setmetatable(stack,mt)
- local errorhandler=settings.error_handler
- if errorhandler==false then
- else
- errorhandler=errorhandler or xml.errorhandler
- if errorhandler then
- local currentresource=settings.currentresource
- if currentresource and currentresource~="" then
- xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource)
- else
- xml.errorhandler(formatters["load error: %s"](errorstr))
- end
- end
- end
- else
- result=stack[1]
- end
- if not settings.no_root then
- result={ special=true,ns="",tg='@rt@',dt=result.dt,at={},entities=entities,settings=settings }
- setmetatable(result,mt)
- local rdt=result.dt
- for k=1,#rdt do
- local v=rdt[k]
- if type(v)=="table" and not v.special then
- result.ri=k
- v.__p__=result
- break
- end
- end
- end
- if errorstr and errorstr~="" then
- result.error=true
- else
- errorstr=nil
- end
- result.statistics={
- errormessage=errorstr,
- entities={
- decimals=dcache,
- hexadecimals=hcache,
- names=acache,
- intermediates=parameters,
- }
- }
- preparexmlstate()
- return result
-end
-local function xmlconvert(data,settings)
- local ok,result=pcall(function() return _xmlconvert_(data,settings) end)
- if ok then
- return result
- elseif type(result)=="string" then
- return _xmlconvert_(true,settings,result)
- else
- return _xmlconvert_(true,settings)
- end
-end
-xml.convert=xmlconvert
-function xml.inheritedconvert(data,xmldata,cleanup)
- local settings=xmldata.settings
- if settings then
- settings.parent_root=xmldata
- end
- local xc=xmlconvert(data,settings)
- if cleanup then
- local x=xc.dt
- if x then
- x=x[1]
- if x and x.tg=="@pi@" then
- local dt=x.dt
- local pi=dt and dt[1]
- if type(pi)=="string" and find(pi,"^xml") then
- remove(dt,1)
- end
- end
- end
- end
- return xc
-end
-function xml.is_valid(root)
- return root and root.dt and root.dt[1] and type(root.dt[1])=="table" and not root.dt[1].er
-end
-function xml.package(tag,attributes,data)
- local ns,tg=match(tag,"^(.-):?([^:]+)$")
- local t={ ns=ns,tg=tg,dt=data or "",at=attributes or {} }
- setmetatable(t,mt)
- return t
-end
-function xml.is_valid(root)
- return root and not root.error
-end
-xml.errorhandler=report_xml
-function xml.load(filename,settings)
- local data=""
- if type(filename)=="string" then
- local f=io.open(filename,'r')
- if f then
- data=f:read("*all")
- f:close()
- end
- elseif filename then
- data=filename:read("*all")
- end
- if settings then
- settings.currentresource=filename
- local result=xmlconvert(data,settings)
- settings.currentresource=nil
- return result
- else
- return xmlconvert(data,{ currentresource=filename })
- end
-end
-local no_root={ no_root=true }
-function xml.toxml(data)
- if type(data)=="string" then
- local root={ xmlconvert(data,no_root) }
- return (#root>1 and root) or root[1]
- else
- return data
- end
-end
-local function copy(old,p)
- if old then
- local new={}
- for k,v in next,old do
- local t=type(v)=="table"
- if k=="at" then
- local t={}
- for k,v in next,v do
- t[k]=v
- end
- new[k]=t
- elseif k=="dt" then
- v.__p__=nil
- local t={}
- for i=1,#v do
- local vi=v[i]
- if type(vi)=="table" then
- t[i]=copy(vi,new)
- else
- t[i]=vi
- end
- end
- new[k]=t
- t.__p__=p
- else
- new[k]=v
- end
- end
- local mt=getmetatable(old)
- if mt then
- setmetatable(new,mt)
- end
- return new
- else
- return {}
- end
-end
-xml.copy=copy
-function xml.checkbom(root)
- if root.ri then
- local dt=root.dt
- for k=1,#dt do
- local v=dt[k]
- if type(v)=="table" and v.special and v.tg=="@pi@" and find(v.dt[1],"xml.*version=") then
- return
- end
- end
- insert(dt,1,{ special=true,ns="",tg="@pi@",dt={ "xml version='1.0' standalone='yes'" } } )
- insert(dt,2,"\n" )
- end
-end
-local f_attribute=formatters['%s=%q']
-local function verbose_element(e,handlers,escape)
- local handle=handlers.handle
- local serialize=handlers.serialize
- local ens,etg,eat,edt,ern=e.ns,e.tg,e.at,e.dt,e.rn
- local ats=eat and next(eat) and {}
- if ats then
- local n=0
- for k in next,eat do
- n=n+1
- ats[n]=k
- end
- if n==1 then
- local k=ats[1]
- ats=f_attribute(k,escaped(eat[k]))
- else
- sort(ats)
- for i=1,n do
- local k=ats[i]
- ats[i]=f_attribute(k,escaped(eat[k]))
- end
- ats=concat(ats," ")
- end
- end
- if ern and trace_entities and ern~=ens then
- ens=ern
- end
- local n=edt and #edt
- if ens~="" then
- if n and n>0 then
- if ats then
- handle("<",ens,":",etg," ",ats,">")
- else
- handle("<",ens,":",etg,">")
- end
- for i=1,n do
- local e=edt[i]
- if type(e)=="string" then
- handle(escaped(e))
- else
- serialize(e,handlers)
- end
- end
- handle("</",ens,":",etg,">")
- else
- if ats then
- handle("<",ens,":",etg," ",ats,"/>")
- else
- handle("<",ens,":",etg,"/>")
- end
- end
- else
- if n and n>0 then
- if ats then
- handle("<",etg," ",ats,">")
- else
- handle("<",etg,">")
- end
- for i=1,n do
- local e=edt[i]
- if type(e)=="string" then
- handle(escaped(e))
- else
- serialize(e,handlers)
- end
- end
- handle("</",etg,">")
- else
- if ats then
- handle("<",etg," ",ats,"/>")
- else
- handle("<",etg,"/>")
- end
- end
- end
-end
-local function verbose_pi(e,handlers)
- handlers.handle("<?",e.dt[1],"?>")
-end
-local function verbose_comment(e,handlers)
- handlers.handle("<!--",e.dt[1],"-->")
-end
-local function verbose_cdata(e,handlers)
- handlers.handle("<![CDATA[",e.dt[1],"]]>")
-end
-local function verbose_doctype(e,handlers)
- handlers.handle("<!DOCTYPE",e.dt[1],">")
-end
-local function verbose_root(e,handlers)
- handlers.serialize(e.dt,handlers)
-end
-local function verbose_text(e,handlers)
- handlers.handle(escaped(e))
-end
-local function verbose_document(e,handlers)
- local serialize=handlers.serialize
- local functions=handlers.functions
- for i=1,#e do
- local ei=e[i]
- if type(ei)=="string" then
- functions["@tx@"](ei,handlers)
- else
- serialize(ei,handlers)
- end
- end
-end
-local function serialize(e,handlers,...)
- if e then
- local initialize=handlers.initialize
- local finalize=handlers.finalize
- local functions=handlers.functions
- if initialize then
- local state=initialize(...)
- if not state==true then
- return state
- end
- end
- local etg=e.tg
- if etg then
- (functions[etg] or functions["@el@"])(e,handlers)
- else
- functions["@dc@"](e,handlers)
- end
- if finalize then
- return finalize()
- end
- end
-end
-local function xserialize(e,handlers)
- if e then
- local functions=handlers.functions
- local etg=e.tg
- if etg then
- (functions[etg] or functions["@el@"])(e,handlers)
- else
- functions["@dc@"](e,handlers)
- end
- end
-end
-local handlers={}
-local function newhandlers(settings)
- local t=table.copy(handlers[settings and settings.parent or "verbose"] or {})
- if settings then
- for k,v in next,settings do
- if type(v)=="table" then
- local tk=t[k] if not tk then tk={} t[k]=tk end
- for kk,vv in next,v do
- tk[kk]=vv
- end
- else
- t[k]=v
- end
- end
- if settings.name then
- handlers[settings.name]=t
- end
- end
- utilities.storage.mark(t)
- return t
-end
-local nofunction=function() end
-function xml.sethandlersfunction(handler,name,fnc)
- handler.functions[name]=fnc or nofunction
-end
-function xml.gethandlersfunction(handler,name)
- return handler.functions[name]
-end
-function xml.gethandlers(name)
- return handlers[name]
-end
-newhandlers {
- name="verbose",
- initialize=false,
- finalize=false,
- serialize=xserialize,
- handle=print,
- functions={
- ["@dc@"]=verbose_document,
- ["@dt@"]=verbose_doctype,
- ["@rt@"]=verbose_root,
- ["@el@"]=verbose_element,
- ["@pi@"]=verbose_pi,
- ["@cm@"]=verbose_comment,
- ["@cd@"]=verbose_cdata,
- ["@tx@"]=verbose_text,
- }
-}
-local result
-local xmlfilehandler=newhandlers {
- name="file",
- initialize=function(name)
- result=io.open(name,"wb")
- return result
- end,
- finalize=function()
- result:close()
- return true
- end,
- handle=function(...)
- result:write(...)
- end,
-}
-function xml.save(root,name)
- serialize(root,xmlfilehandler,name)
-end
-local result,r,threshold={},0,512
-local xmlstringhandler=newhandlers {
- name="string",
- initialize=function()
- r=0
- return result
- end,
- finalize=function()
- local done=concat(result,"",1,r)
- r=0
- if r>threshold then
- result={}
- end
- return done
- end,
- handle=function(...)
- for i=1,select("#",...) do
- r=r+1
- result[r]=select(i,...)
- end
- end,
-}
-local function xmltostring(root)
- if not root then
- return ""
- elseif type(root)=="string" then
- return root
- else
- return serialize(root,xmlstringhandler) or ""
- end
-end
-local function __tostring(root)
- return (root and xmltostring(root)) or ""
-end
-initialize_mt=function(root)
- mt={ __tostring=__tostring,__index=root }
-end
-xml.defaulthandlers=handlers
-xml.newhandlers=newhandlers
-xml.serialize=serialize
-xml.tostring=xmltostring
-local function xmlstring(e,handle)
- if not handle or (e.special and e.tg~="@rt@") then
- elseif e.tg then
- local edt=e.dt
- if edt then
- for i=1,#edt do
- xmlstring(edt[i],handle)
- end
- end
- else
- handle(e)
- end
-end
-xml.string=xmlstring
-function xml.settings(e)
- while e do
- local s=e.settings
- if s then
- return s
- else
- e=e.__p__
- end
- end
- return nil
-end
-function xml.root(e)
- local r=e
- while e do
- e=e.__p__
- if e then
- r=e
- end
- end
- return r
-end
-function xml.parent(root)
- return root.__p__
-end
-function xml.body(root)
- return root.ri and root.dt[root.ri] or root
-end
-function xml.name(root)
- if not root then
- return ""
- end
- local ns=root.ns
- local tg=root.tg
- if ns=="" then
- return tg
- else
- return ns..":"..tg
- end
-end
-function xml.erase(dt,k)
- if dt then
- if k then
- dt[k]=""
- else for k=1,#dt do
- dt[1]={ "" }
- end end
- end
-end
-function xml.assign(dt,k,root)
- if dt and k then
- dt[k]=type(root)=="table" and xml.body(root) or root
- return dt[k]
- else
- return xml.body(root)
- end
-end
-function xml.tocdata(e,wrapper)
- local whatever=type(e)=="table" and xmltostring(e.dt) or e or ""
- if wrapper then
- whatever=formatters["<%s>%s</%s>"](wrapper,whatever,wrapper)
- end
- local t={ special=true,ns="",tg="@cd@",at={},rn="",dt={ whatever },__p__=e }
- setmetatable(t,getmetatable(e))
- e.dt={ t }
-end
-function xml.makestandalone(root)
- if root.ri then
- local dt=root.dt
- for k=1,#dt do
- local v=dt[k]
- if type(v)=="table" and v.special and v.tg=="@pi@" then
- local txt=v.dt[1]
- if find(txt,"xml.*version=") then
- v.dt[1]=txt.." standalone='yes'"
- break
- end
- end
- end
- end
- return root
-end
-function xml.kind(e)
- local dt=e and e.dt
- if dt then
- local n=#dt
- if n==1 then
- local d=dt[1]
- if d.special then
- local tg=d.tg
- if tg=="@cd@" then
- return "cdata"
- elseif tg=="@cm" then
- return "comment"
- elseif tg=="@pi@" then
- return "instruction"
- elseif tg=="@dt@" then
- return "declaration"
- end
- elseif type(d)=="string" then
- return "text"
- end
- return "element"
- elseif n>0 then
- return "mixed"
- end
- end
- return "empty"
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
-
--- original size: 54667, stripped down to: 31258
-
-if not modules then modules={} end modules ['lxml-lpt']={
- version=1.001,
- comment="this module is the basis for the lxml-* ones",
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local concat,remove,insert=table.concat,table.remove,table.insert
-local type,next,tonumber,tostring,setmetatable,load,select=type,next,tonumber,tostring,setmetatable,load,select
-local format,upper,lower,gmatch,gsub,find,rep=string.format,string.upper,string.lower,string.gmatch,string.gsub,string.find,string.rep
-local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
-local setmetatableindex=table.setmetatableindex
-local formatters=string.formatters
-local trace_lpath=false
-local trace_lparse=false
-local trace_lprofile=false
-local report_lpath=logs.reporter("xml","lpath")
-if trackers then
- trackers.register("xml.path",function(v)
- trace_lpath=v
- end)
- trackers.register("xml.parse",function(v)
- trace_lparse=v
- end)
- trackers.register("xml.profile",function(v)
- trace_lpath=v
- trace_lparse=v
- trace_lprofile=v
- end)
-end
-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 {}
-local functions=xml.functions
-xml.expressions=xml.expressions or {}
-local expressions=xml.expressions
-xml.finalizers=xml.finalizers or {}
-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 {}
-local function fallback (t,name)
- local fn=finalizers[name]
- if fn then
- t[name]=fn
- else
- report_lpath("unknown sub finalizer %a",name)
- fn=function() end
- end
- return fn
-end
-setmetatableindex(finalizers.xml,fallback)
-setmetatableindex(finalizers.tex,fallback)
-xml.defaultprotocol="xml"
-local apply_axis={}
-apply_axis['root']=function(list)
- local collected={}
- for l=1,#list do
- local ll=list[l]
- local rt=ll
- while ll do
- ll=ll.__p__
- if ll then
- rt=ll
- end
- end
- collected[l]=rt
- end
- return collected
-end
-apply_axis['self']=function(list)
- return list
-end
-apply_axis['child']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local ll=list[l]
- local dt=ll.dt
- if dt then
- local n=#dt
- if n==0 then
- ll.en=0
- elseif n==1 then
- local dk=dt[1]
- if dk.tg then
- c=c+1
- collected[c]=dk
- dk.ni=1
- dk.ei=1
- ll.en=1
- end
- else
- local en=0
- for k=1,#dt do
- local dk=dt[k]
- if dk.tg then
- c=c+1
- en=en+1
- collected[c]=dk
- dk.ni=k
- dk.ei=en
- end
- end
- ll.en=en
- end
- end
- end
- return collected
-end
-local function collect(list,collected,c)
- local dt=list.dt
- if dt then
- local n=#dt
- if n==0 then
- list.en=0
- elseif n==1 then
- local dk=dt[1]
- if dk.tg then
- c=c+1
- collected[c]=dk
- dk.ni=1
- dk.ei=1
- c=collect(dk,collected,c)
- list.en=1
- else
- list.en=0
- end
- else
- local en=0
- for k=1,n do
- local dk=dt[k]
- if dk.tg then
- c=c+1
- en=en+1
- collected[c]=dk
- dk.ni=k
- dk.ei=en
- c=collect(dk,collected,c)
- end
- end
- list.en=en
- end
- end
- return c
-end
-apply_axis['descendant']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- c=collect(list[l],collected,c)
- end
- return collected
-end
-local function collect(list,collected,c)
- local dt=list.dt
- if dt then
- local n=#dt
- if n==0 then
- list.en=0
- elseif n==1 then
- local dk=dt[1]
- if dk.tg then
- c=c+1
- collected[c]=dk
- dk.ni=1
- dk.ei=1
- c=collect(dk,collected,c)
- list.en=1
- end
- else
- local en=0
- for k=1,#dt do
- local dk=dt[k]
- if dk.tg then
- c=c+1
- en=en+1
- collected[c]=dk
- dk.ni=k
- dk.ei=en
- c=collect(dk,collected,c)
- end
- end
- list.en=en
- end
- end
- return c
-end
-apply_axis['descendant-or-self']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local ll=list[l]
- if ll.special~=true then
- c=c+1
- collected[c]=ll
- end
- c=collect(ll,collected,c)
- end
- return collected
-end
-apply_axis['ancestor']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local ll=list[l]
- while ll do
- ll=ll.__p__
- if ll then
- c=c+1
- collected[c]=ll
- end
- end
- end
- return collected
-end
-apply_axis['ancestor-or-self']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local ll=list[l]
- c=c+1
- collected[c]=ll
- while ll do
- ll=ll.__p__
- if ll then
- c=c+1
- collected[c]=ll
- end
- end
- end
- return collected
-end
-apply_axis['parent']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local pl=list[l].__p__
- if pl then
- c=c+1
- collected[c]=pl
- end
- end
- return collected
-end
-apply_axis['attribute']=function(list)
- return {}
-end
-apply_axis['namespace']=function(list)
- return {}
-end
-apply_axis['following']=function(list)
- return {}
-end
-apply_axis['preceding']=function(list)
- return {}
-end
-apply_axis['following-sibling']=function(list)
- local collected={}
- local c=0
- 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
- c=c+1
- collected[c]=di
- end
- end
- end
- return collected
-end
-apply_axis['preceding-sibling']=function(list)
- local collected={}
- local c=0
- for l=1,#list do
- local ll=list[l]
- local p=ll.__p__
- local d=p.dt
- for i=1,ll.ni-1 do
- local di=d[i]
- if type(di)=="table" then
- c=c+1
- collected[c]=di
- end
- end
- end
- return collected
-end
-apply_axis['reverse-sibling']=function(list)
- local collected={}
- local c=0
- 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
- c=c+1
- collected[c]=di
- end
- end
- end
- return collected
-end
-apply_axis['auto-descendant-or-self']=apply_axis['descendant-or-self']
-apply_axis['auto-descendant']=apply_axis['descendant']
-apply_axis['auto-child']=apply_axis['child']
-apply_axis['auto-self']=apply_axis['self']
-apply_axis['initial-child']=apply_axis['child']
-local function apply_nodes(list,directive,nodes)
- local maxn=#nodes
- if maxn==3 then
- local nns=nodes[2]
- local ntg=nodes[3]
- if not nns and not ntg then
- if directive then
- return list
- else
- return {}
- end
- else
- local collected={}
- local c=0
- local m=0
- local p=nil
- if not nns then
- for l=1,#list do
- local ll=list[l]
- local ltg=ll.tg
- if ltg then
- if directive then
- if ntg==ltg then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- elseif ntg~=ltg then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- end
- end
- elseif not ntg then
- for l=1,#list do
- local ll=list[l]
- local lns=ll.rn or ll.ns
- if lns then
- if directive then
- if lns==nns then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- elseif lns~=nns then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- end
- end
- else
- for l=1,#list do
- local ll=list[l]
- local ltg=ll.tg
- if ltg then
- local lns=ll.rn or ll.ns
- local ok=ltg==ntg and lns==nns
- if directive then
- if ok then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- elseif not ok then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- end
- end
- end
- return collected
- end
- else
- local collected={}
- local c=0
- local m=0
- local p=nil
- for l=1,#list do
- local ll=list[l]
- local ltg=ll.tg
- if ltg then
- local lns=ll.rn or ll.ns
- local ok=false
- for n=1,maxn,3 do
- local nns=nodes[n+1]
- local ntg=nodes[n+2]
- ok=(not ntg or ltg==ntg) and (not nns or lns==nns)
- if ok then
- break
- end
- end
- if directive then
- if ok then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- elseif not ok then
- local llp=ll.__p__;if llp~=p then p=llp;m=1 else m=m+1 end
- c=c+1
- collected[c]=ll
- ll.mi=m
- end
- end
- end
- return collected
- end
-end
-local quit_expression=false
-local function apply_expression(list,expression,order)
- local collected={}
- local c=0
- quit_expression=false
- for l=1,#list do
- local ll=list[l]
- if expression(list,ll,l,order) then
- c=c+1
- collected[c]=ll
- end
- if quit_expression then
- break
- end
- end
- return collected
-end
-local function apply_selector(list,specification)
- if xml.applyselector then
- apply_selector=xml.applyselector
- return apply_selector(list,specification)
- else
- return list
- end
-end
-local P,V,C,Cs,Cc,Ct,R,S,Cg,Cb=lpeg.P,lpeg.V,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.R,lpeg.S,lpeg.Cg,lpeg.Cb
-local spaces=S(" \n\r\t\f")^0
-local lp_space=S(" \n\r\t\f")
-local lp_any=P(1)
-local lp_noequal=P("!=")/"~="+P("<=")+P(">=")+P("==")
-local lp_doequal=P("=")/"=="
-local lp_or=P("|")/" or "
-local lp_and=P("&")/" and "
-local builtin={
- text="(ll.dt[1] or '')",
- content="ll.dt",
- name="((ll.ns~='' and ll.ns..':'..ll.tg) or ll.tg)",
- tag="ll.tg",
- position="l",
- firstindex="1",
- firstelement="1",
- first="1",
- lastindex="(#ll.__p__.dt or 1)",
- lastelement="(ll.__p__.en or 1)",
- last="#list",
- list="list",
- self="ll",
- rootposition="order",
- order="order",
- element="(ll.ei or 1)",
- index="(ll.ni or 1)",
- match="(ll.mi or 1)",
- namespace="ll.ns",
- ns="ll.ns",
-}
-local lp_builtin=lpeg.utfchartabletopattern(builtin)/builtin*((spaces*P("(")*spaces*P(")"))/"")
-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)/"l==%0"
-local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0+1==l))"
-local lp_fastpos=lp_fastpos_n+lp_fastpos_p
-local lp_reserved=C("and")+C("or")+C("not")+C("div")+C("mod")+C("true")+C("false")
-local lp_lua_function=Cs((R("az","AZ","__")^1*(P(".")*R("az","AZ","__")^1)^1)*("("))/"%0"
-local lp_function=C(R("az","AZ","__")^1)*P("(")/function(t)
- if expressions[t] then
- return "expr."..t.."("
- else
- return "expr.error("
- end
-end
-local lparent=P("(")
-local rparent=P(")")
-local noparent=1-(lparent+rparent)
-local nested=P{lparent*(noparent+V(1))^0*rparent}
-local value=P(lparent*C((noparent+nested)^0)*rparent)
-local lp_child=Cc("expr.child(ll,'")*R("az","AZ")*R("az","AZ","--","__")^0*Cc("')")
-local lp_number=S("+-")*R("09")^1
-local lp_string=Cc("'")*R("az","AZ","--","__")^1*Cc("'")
-local lp_content=(P("'")*(1-P("'"))^0*P("'")+P('"')*(1-P('"'))^0*P('"'))
-local cleaner
-local lp_special=(C(P("name")+P("text")+P("tag")+P("count")+P("child")))*value/function(t,s)
- if expressions[t] then
- s=s and s~="" and lpegmatch(cleaner,s)
- if s and s~="" then
- return "expr."..t.."(ll,"..s..")"
- else
- return "expr."..t.."(ll)"
- end
- else
- return "expr.error("..t..")"
- end
-end
-local content=lp_builtin+lp_attribute+lp_special+lp_noequal+lp_doequal+lp_or+lp_and+lp_reserved+lp_lua_function+lp_function+lp_content+
- lp_child+lp_any
-local converter=Cs (
- lp_fastpos+(P { lparent*(V(1))^0*rparent+content } )^0
-)
-cleaner=Cs ((
- lp_reserved+lp_number+lp_string+1 )^1 )
-local template_e=[[
- local expr = xml.expressions
- return function(list,ll,l,order)
- return %s
- end
-]]
-local template_f_y=[[
- local finalizer = xml.finalizers['%s']['%s']
- return function(collection)
- return finalizer(collection,%s)
- end
-]]
-local template_f_n=[[
- return xml.finalizers['%s']['%s']
-]]
-local register_last_match={ kind="axis",axis="last-match" }
-local register_self={ kind="axis",axis="self" }
-local register_parent={ kind="axis",axis="parent" }
-local register_descendant={ kind="axis",axis="descendant" }
-local register_child={ kind="axis",axis="child" }
-local register_descendant_or_self={ kind="axis",axis="descendant-or-self" }
-local register_root={ kind="axis",axis="root" }
-local register_ancestor={ kind="axis",axis="ancestor" }
-local register_ancestor_or_self={ kind="axis",axis="ancestor-or-self" }
-local register_attribute={ kind="axis",axis="attribute" }
-local register_namespace={ kind="axis",axis="namespace" }
-local register_following={ kind="axis",axis="following" }
-local register_following_sibling={ kind="axis",axis="following-sibling" }
-local register_preceding={ kind="axis",axis="preceding" }
-local register_preceding_sibling={ kind="axis",axis="preceding-sibling" }
-local register_reverse_sibling={ kind="axis",axis="reverse-sibling" }
-local register_auto_descendant_or_self={ kind="axis",axis="auto-descendant-or-self" }
-local register_auto_descendant={ kind="axis",axis="auto-descendant" }
-local register_auto_self={ kind="axis",axis="auto-self" }
-local register_auto_child={ kind="axis",axis="auto-child" }
-local register_initial_child={ kind="axis",axis="initial-child" }
-local register_all_nodes={ kind="nodes",nodetest=true,nodes={ true,false,false } }
-local skip={}
-local function errorrunner_e(str,cnv)
- if not skip[str] then
- report_lpath("error in expression: %s => %s",str,cnv)
- skip[str]=cnv or str
- end
- return false
-end
-local function errorrunner_f(str,arg)
- report_lpath("error in finalizer: %s(%s)",str,arg or "")
- return false
-end
-local function register_nodes(nodetest,nodes)
- return { kind="nodes",nodetest=nodetest,nodes=nodes }
-end
-local function register_selector(specification)
- return { kind="selector",specification=specification }
-end
-local function register_expression(expression)
- local converted=lpegmatch(converter,expression)
- local wrapped=format(template_e,converted)
- local runner=load(wrapped)
- runner=(runner and runner()) or function() errorrunner_e(expression,converted) end
- return { kind="expression",expression=expression,converted=converted,evaluator=runner }
-end
-local function register_finalizer(protocol,name,arguments)
- local runner
- if arguments and arguments~="" then
- runner=load(format(template_f_y,protocol or xml.defaultprotocol,name,arguments))
- else
- runner=load(format(template_f_n,protocol or xml.defaultprotocol,name))
- end
- runner=(runner and runner()) or function() errorrunner_f(name,arguments) end
- return { kind="finalizer",name=name,arguments=arguments,finalizer=runner }
-end
-local expression=P { "ex",
- ex="["*C((V("sq")+V("dq")+(1-S("[]"))+V("ex"))^0)*"]",
- sq="'"*(1-S("'"))^0*"'",
- dq='"'*(1-S('"'))^0*'"',
-}
-local arguments=P { "ar",
- ar="("*Cs((V("sq")+V("dq")+V("nq")+P(1-P(")")))^0)*")",
- nq=((1-S("),'\""))^1)/function(s) return format("%q",s) end,
- sq=P("'")*(1-P("'"))^0*P("'"),
- dq=P('"')*(1-P('"'))^0*P('"'),
-}
-local function register_error(str)
- return { kind="error",error=format("unparsed: %s",str) }
-end
-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 no_nextcolon=P(-1)+#(1-P(":"))
-local no_nextlparent=P(-1)+#(1-P("("))
-local pathparser=Ct { "patterns",
- patterns=spaces*V("protocol")*spaces*(
- (V("special")*spaces*P(-1) )+(V("initial")*spaces*V("step")*spaces*(P("/")*spaces*V("step")*spaces)^0 )
- ),
- protocol=Cg(V("letters"),"protocol")*P("://")+Cg(Cc(nil),"protocol"),
- step=((V("shortcuts")+V("selector")+P("/")+V("axis"))*spaces*V("nodes")^0+V("error"))*spaces*V("expressions")^0*spaces*V("finalizer")^0,
- axis=V("last_match")+V("descendant")+V("child")+V("parent")+V("self")+V("root")+V("ancestor")+V("descendant_or_self")+V("following_sibling")+V("following")+V("reverse_sibling")+V("preceding_sibling")+V("preceding")+V("ancestor_or_self")+#(1-P(-1))*Cc(register_auto_child),
- special=special_1+special_2+special_3,
- initial=(P("/")*spaces*Cc(register_initial_child))^-1,
- error=(P(1)^1)/register_error,
- shortcuts_a=V("s_descendant_or_self")+V("s_descendant")+V("s_child")+V("s_parent")+V("s_self")+V("s_root")+V("s_ancestor")+V("s_lastmatch"),
- shortcuts=V("shortcuts_a")*(spaces*"/"*spaces*V("shortcuts_a"))^0,
- s_descendant_or_self=(P("***/")+P("/"))*Cc(register_descendant_or_self),
- s_descendant=P("**")*Cc(register_descendant),
- s_child=P("*")*no_nextcolon*Cc(register_child),
- s_parent=P("..")*Cc(register_parent),
- s_self=P("." )*Cc(register_self),
- s_root=P("^^")*Cc(register_root),
- s_ancestor=P("^")*Cc(register_ancestor),
- s_lastmatch=P("=")*Cc(register_last_match),
- descendant=P("descendant::")*Cc(register_descendant),
- child=P("child::")*Cc(register_child),
- parent=P("parent::")*Cc(register_parent),
- self=P("self::")*Cc(register_self),
- root=P('root::')*Cc(register_root),
- ancestor=P('ancestor::')*Cc(register_ancestor),
- descendant_or_self=P('descendant-or-self::')*Cc(register_descendant_or_self),
- ancestor_or_self=P('ancestor-or-self::')*Cc(register_ancestor_or_self),
- following=P('following::')*Cc(register_following),
- following_sibling=P('following-sibling::')*Cc(register_following_sibling),
- preceding=P('preceding::')*Cc(register_preceding),
- preceding_sibling=P('preceding-sibling::')*Cc(register_preceding_sibling),
- reverse_sibling=P('reverse-sibling::')*Cc(register_reverse_sibling),
- last_match=P('last-match::')*Cc(register_last_match),
- selector=P("{")*C((1-P("}"))^1)*P("}")/register_selector,
- nodes=(V("nodefunction")*spaces*P("(")*V("nodeset")*P(")")+V("nodetest")*V("nodeset"))/register_nodes,
- expressions=expression/register_expression,
- letters=R("az")^1,
- name=(1-S("/[]()|:*!"))^1,
- negate=P("!")*Cc(false),
- nodefunction=V("negate")+P("not")*Cc(false)+Cc(true),
- nodetest=V("negate")+Cc(true),
- nodename=(V("negate")+Cc(true))*spaces*((V("wildnodename")*P(":")*V("wildnodename"))+(Cc(false)*V("wildnodename"))),
- wildnodename=(C(V("name"))+P("*")*Cc(false))*no_nextlparent,
- nodeset=spaces*Ct(V("nodename")*(spaces*P("|")*spaces*V("nodename"))^0)*spaces,
- finalizer=(Cb("protocol")*P("/")^-1*C(V("name"))*arguments*P(-1))/register_finalizer,
-}
-xmlpatterns.pathparser=pathparser
-local cache={}
-local function nodesettostring(set,nodetest)
- local t={}
- for i=1,#set,3 do
- local directive,ns,tg=set[i],set[i+1],set[i+2]
- 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)
- end
- if nodetest==false then
- return format("not(%s)",concat(t,"|"))
- else
- return concat(t,"|")
- end
-end
-local function tagstostring(list)
- if #list==0 then
- return "no elements"
- else
- local t={}
- for i=1,#list do
- local li=list[i]
- local ns=li.ns
- local tg=li.tg
- if not ns or ns=="" then ns="*" end
- if not tg or tg=="" then tg="*" end
- t[i]=(tg=="@rt@" and "[root]") or format("%s:%s",ns,tg)
- end
- return concat(t," ")
- end
-end
-xml.nodesettostring=nodesettostring
-local lpath
-local function lshow(parsed)
- if type(parsed)=="string" then
- parsed=lpath(parsed)
- end
- report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,
- table.serialize(parsed,false))
-end
-xml.lshow=lshow
-local function add_comment(p,str)
- local pc=p.comment
- if not pc then
- p.comment={ str }
- else
- pc[#pc+1]=str
- end
-end
-lpath=function (pattern)
- lpathcalls=lpathcalls+1
- if type(pattern)=="table" then
- return pattern
- else
- local parsed=cache[pattern]
- if parsed then
- lpathcached=lpathcached+1
- else
- 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" }
- report_lpath("parsing error in pattern: %s",pattern)
- lshow(parsed)
- else
- local pi=parsed[1]
- if pi.axis=="auto-child" then
- if false then
- add_comment(parsed,"auto-child replaced by auto-descendant-or-self")
- parsed[1]=register_auto_descendant_or_self
- else
- add_comment(parsed,"auto-child replaced by auto-descendant")
- parsed[1]=register_auto_descendant
- end
- elseif pi.axis=="initial-child" and np>1 and parsed[2].axis then
- add_comment(parsed,"initial-child removed")
- remove(parsed,1)
- end
- local np=#parsed
- if np>1 then
- local pnp=parsed[np]
- if pnp.kind=="nodes" and pnp.nodetest==true then
- local nodes=pnp.nodes
- if nodes[1]==true and nodes[2]==false and nodes[3]==false then
- add_comment(parsed,"redundant final wildcard filter removed")
- remove(parsed,np)
- end
- end
- end
- end
- else
- parsed={ pattern=pattern }
- end
- cache[pattern]=parsed
- if trace_lparse and not trace_lprofile then
- lshow(parsed)
- end
- end
- return parsed
- end
-end
-xml.lpath=lpath
-do
- local profiled={}
- xml.profiled=profiled
- local lastmatch=nil
- local keepmatch=nil
- if directives then
- directives.register("xml.path.keeplastmatch",function(v)
- keepmatch=v
- lastmatch=nil
- end)
- end
- apply_axis["last-match"]=function()
- return lastmatch or {}
- end
- local function profiled_apply(list,parsed,nofparsed,order)
- local p=profiled[parsed.pattern]
- if p then
- p.tested=p.tested+1
- else
- p={ tested=1,matched=0,finalized=0 }
- profiled[parsed.pattern]=p
- end
- 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)
- elseif kind=="nodes" then
- collected=apply_nodes(collected,pi.nodetest,pi.nodes)
- elseif kind=="expression" then
- collected=apply_expression(collected,pi.evaluator,order)
- elseif kind=="selector" then
- collected=apply_selector(collected,pi.specification)
- elseif kind=="finalizer" then
- collected=pi.finalizer(collected)
- p.matched=p.matched+1
- p.finalized=p.finalized+1
- 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)
- p.finalized=p.finalized+1
- return collected
- end
- return nil
- end
- end
- if collected then
- p.matched=p.matched+1
- end
- return collected
- end
- local function traced_apply(list,parsed,nofparsed,order)
- if trace_lparse then
- lshow(parsed)
- end
- 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)
- report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis)
- elseif kind=="nodes" then
- collected=apply_nodes(collected,pi.nodetest,pi.nodes)
- 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)
- report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted)
- elseif kind=="selector" then
- collected=apply_selector(collected,pi.specification)
- report_lpath("% 10i : se : %s ",(collected and #collected) or 0,pi.specification)
- elseif kind=="finalizer" then
- collected=pi.finalizer(collected)
- 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)
- 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
- end
- end
- return collected
- end
- local function normal_apply(list,parsed,nofparsed,order)
- local collected=list
- for i=1,nofparsed do
- local pi=parsed[i]
- local kind=pi.kind
- if kind=="axis" then
- local axis=pi.axis
- if axis~="self" then
- collected=apply_axis[axis](collected)
- end
- elseif kind=="nodes" then
- collected=apply_nodes(collected,pi.nodetest,pi.nodes)
- elseif kind=="expression" then
- collected=apply_expression(collected,pi.evaluator,order)
- elseif kind=="selector" then
- collected=apply_selector(collected,pi.specification)
- elseif kind=="finalizer" then
- return pi.finalizer(collected)
- end
- if not collected or #collected==0 then
- local pf=i<nofparsed and parsed[nofparsed].finalizer
- if pf then
- return pf(collected)
- end
- return nil
- end
- end
- return collected
- end
- local apply=normal_apply
- if trackers then
- trackers.register("xml.path,xml.parse,xml.profile",function()
- if trace_lprofile then
- apply=profiled_apply
- elseif trace_lpath then
- apply=traced_apply
- else
- apply=normal_apply
- end
- end)
- end
- function xml.applylpath(list,pattern)
- if not list then
- lastmatch=nil
- return
- end
- 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
- lastmatch=nil
- return
- end
- local nofparsed=#parsed
- if nofparsed==0 then
- lastmatch=nil
- return
- end
- local collected=apply({ list },parsed,nofparsed,list.mi)
- lastmatch=keepmatch and collected or nil
- return collected
- end
- function xml.lastmatch()
- return lastmatch
- end
- local stack={}
- function xml.pushmatch()
- insert(stack,lastmatch)
- end
- function xml.popmatch()
- lastmatch=remove(stack)
- end
-end
-local applylpath=xml.applylpath
-function xml.filter(root,pattern)
- return applylpath(root,pattern)
-end
-expressions.child=function(e,pattern)
- return applylpath(e,pattern)
-end
-expressions.count=function(e,pattern)
- local collected=applylpath(e,pattern)
- return pattern and (collected and #collected) or 0
-end
-expressions.attribute=function(e,name,value)
- if type(e)=="table" and name then
- local a=e.at
- if a then
- local v=a[name]
- if value then
- return v==value
- else
- return v
- end
- end
- end
- return nil
-end
-expressions.oneof=function(s,...)
- for i=1,select("#",...) do
- if s==select(i,...) then
- return true
- end
- end
- return false
-end
-expressions.error=function(str)
- xml.errorhandler(format("unknown function in lpath expression: %s",tostring(str or "?")))
- return false
-end
-expressions.undefined=function(s)
- return s==nil
-end
-expressions.quit=function(s)
- if s or s==nil then
- quit_expression=true
- end
- return true
-end
-expressions.print=function(...)
- print(...)
- return true
-end
-expressions.find=find
-expressions.upper=upper
-expressions.lower=lower
-expressions.number=tonumber
-expressions.boolean=toboolean
-function expressions.contains(str,pattern)
- local t=type(str)
- if t=="string" then
- if find(str,pattern) then
- return true
- end
- elseif t=="table" then
- for i=1,#str do
- local d=str[i]
- if type(d)=="string" and find(d,pattern) then
- return true
- end
- end
- end
- return false
-end
-function expressions.idstring(str)
- return type(str)=="string" and gsub(str,"^#","") or ""
-end
-local function traverse(root,pattern,handle)
- local collected=applylpath(root,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- local r=e.__p__
- handle(r,r.dt,e.ni)
- end
- end
-end
-local function selection(root,pattern,handle)
- local collected=applylpath(root,pattern)
- if collected then
- if handle then
- for c=1,#collected do
- handle(collected[c])
- end
- else
- return collected
- end
- end
-end
-xml.traverse=traverse
-xml.selection=selection
-local function dofunction(collected,fnc,...)
- if collected then
- local f=functions[fnc]
- if f then
- for c=1,#collected do
- f(collected[c],...)
- end
- else
- report_lpath("unknown function %a",fnc)
- end
- end
-end
-finalizers.xml["function"]=dofunction
-finalizers.tex["function"]=dofunction
-expressions.text=function(e,n)
- local rdt=e.__p__.dt
- return rdt and rdt[n] or ""
-end
-expressions.name=function(e,n)
- local found=false
- n=tonumber(n) or 0
- if n==0 then
- found=type(e)=="table" and e
- elseif n<0 then
- local d=e.__p__.dt
- local k=e.ni
- for i=k-1,1,-1 do
- local di=d[i]
- if type(di)=="table" then
- if n==-1 then
- found=di
- break
- else
- n=n+1
- end
- end
- end
- else
- local d=e.__p__.dt
- local k=e.ni
- for i=k+1,#d,1 do
- local di=d[i]
- if type(di)=="table" then
- if n==1 then
- found=di
- break
- else
- n=n-1
- end
- end
- end
- end
- if found then
- local ns=found.rn or found.ns or ""
- local tg=found.tg
- if ns~="" then
- return ns..":"..tg
- else
- return tg
- end
- else
- return ""
- end
-end
-expressions.tag=function(e,n)
- if not e then
- return ""
- else
- local found=false
- n=tonumber(n) or 0
- if n==0 then
- found=(type(e)=="table") and e
- elseif n<0 then
- local d=e.__p__.dt
- local k=e.ni
- for i=k-1,1,-1 do
- local di=d[i]
- if type(di)=="table" then
- if n==-1 then
- found=di
- break
- else
- n=n+1
- end
- end
- end
- else
- local d=e.__p__.dt
- local k=e.ni
- for i=k+1,#d,1 do
- local di=d[i]
- if type(di)=="table" then
- if n==1 then
- found=di
- break
- else
- n=n-1
- end
- end
- end
- end
- return (found and found.tg) or ""
- end
-end
-local dummy=function() end
-function xml.elements(root,pattern,reverse)
- local collected=applylpath(root,pattern)
- if not collected then
- return dummy
- end
- local n=#collected
- if n==0 then
- return dummy
- end
- if reverse then
- local c=n+1
- return function()
- if c>1 then
- c=c-1
- local e=collected[c]
- local r=e.__p__
- return r,r.dt,e.ni
- end
- end
- else
- local c=0
- return function()
- if c<n then
- c=c+1
- local e=collected[c]
- local r=e.__p__
- return r,r.dt,e.ni
- end
- end
- end
-end
-function xml.collected(root,pattern,reverse)
- local collected=applylpath(root,pattern)
- if not collected then
- return dummy
- end
- local n=#collected
- if n==0 then
- return dummy
- end
- if reverse then
- local c=n+1
- return function()
- if c>1 then
- c=c-1
- return collected[c]
- end
- end
- else
- local c=0
- return function()
- if c<n then
- c=c+1
- return collected[c]
- end
- end
- end
-end
-function xml.inspect(collection,pattern)
- pattern=pattern or "."
- for e in xml.collected(collection,pattern or ".") do
- report_lpath("pattern: %s\n\n%s\n",pattern,xml.tostring(e))
- end
-end
-local function split(e)
- local dt=e.dt
- if dt then
- for i=1,#dt do
- local dti=dt[i]
- if type(dti)=="string" then
- dti=gsub(dti,"^[\n\r]*(.-)[\n\r]*","%1")
- dti=gsub(dti,"[\n\r]+","\n\n")
- dt[i]=dti
- else
- split(dti)
- end
- end
- end
- return e
-end
-function xml.finalizers.paragraphs(c)
- for i=1,#c do
- split(c[i])
- end
- return c
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
-
--- original size: 3574, stripped down to: 1808
-
-if not modules then modules={} end modules ['lxml-mis']={
- version=1.001,
- comment="this module is the basis for the lxml-* ones",
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local xml,lpeg,string=xml,lpeg,string
-local type=type
-local concat=table.concat
-local format,gsub,match=string.format,string.gsub,string.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
-local function xmlgsub(t,old,new)
- local dt=t.dt
- if dt then
- for k=1,#dt do
- local v=dt[k]
- if type(v)=="string" then
- dt[k]=gsub(v,old,new)
- else
- xmlgsub(v,old,new)
- end
- end
- end
-end
-function xml.stripleadingspaces(dk,d,k)
- if d and k then
- local dkm=d[k-1]
- if dkm and type(dkm)=="string" then
- local s=match(dkm,"\n(%s+)")
- xmlgsub(dk,"\n"..rep(" ",#s),"\n")
- end
- end
-end
-local normal=(1-S("<&>"))^0
-local special=P("<")/"&lt;"+P(">")/"&gt;"+P("&")/"&amp;"
-local escaped=Cs(normal*(special*normal)^0)
-local normal=(1-S"&")^0
-local special=P("&lt;")/"<"+P("&gt;")/">"+P("&amp;")/"&"
-local unescaped=Cs(normal*(special*normal)^0)
-local cleansed=Cs(((P("<")*(1-P(">"))^0*P(">"))/""+1)^0)
-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
-function xml.cleansed (str) return lpegmatch(cleansed,str) end
-function xml.fillin(root,pattern,str,check)
- local e=xml.first(root,pattern)
- if e then
- local n=#e.dt
- if not check or n==0 or (n==1 and e.dt[1]=="") then
- e.dt={ str }
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
-
--- original size: 33708, stripped down to: 20953
-
-if not modules then modules={} end modules ['lxml-aux']={
- version=1.001,
- comment="this module is the basis for the lxml-* ones",
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local trace_manipulations=false trackers.register("lxml.manipulations",function(v) trace_manipulations=v end)
-local trace_inclusions=false trackers.register("lxml.inclusions",function(v) trace_inclusions=v end)
-local report_xml=logs.reporter("xml")
-local xml=xml
-local xmlcopy,xmlname=xml.copy,xml.name
-local xmlinheritedconvert=xml.inheritedconvert
-local xmlapplylpath=xml.applylpath
-local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable
-local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat
-local gmatch,gsub,format,find,strip,match=string.gmatch,string.gsub,string.format,string.find,string.strip,string.match
-local utfbyte=utf.byte
-local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
-local striplinepatterns=utilities.strings.striplinepatterns
-local function report(what,pattern,c,e)
- report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern)
-end
-local function withelements(e,handle,depth)
- if e and handle then
- local edt=e.dt
- if edt then
- depth=depth or 0
- for i=1,#edt do
- local e=edt[i]
- if type(e)=="table" then
- handle(e,depth)
- withelements(e,handle,depth+1)
- end
- end
- end
- end
-end
-xml.withelements=withelements
-function xml.withelement(e,n,handle)
- if e and n~=0 and handle then
- local edt=e.dt
- if edt then
- if n>0 then
- for i=1,#edt do
- local ei=edt[i]
- if type(ei)=="table" then
- if n==1 then
- handle(ei)
- return
- else
- n=n-1
- end
- end
- end
- elseif n<0 then
- for i=#edt,1,-1 do
- local ei=edt[i]
- if type(ei)=="table" then
- if n==-1 then
- handle(ei)
- return
- else
- n=n+1
- end
- end
- end
- end
- end
- end
-end
-function xml.each(root,pattern,handle,reverse)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- if handle then
- if reverse then
- for c=#collected,1,-1 do
- handle(collected[c])
- end
- else
- for c=1,#collected do
- handle(collected[c])
- end
- end
- end
- return collected
- end
-end
-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)
- end
- end
- return collected
-end
-function xml.collect(root,pattern)
- return xmlapplylpath(root,pattern)
-end
-function xml.collecttexts(root,pattern,flatten)
- local collected=xmlapplylpath(root,pattern)
- if collected and flatten then
- local xmltostring=xml.tostring
- for c=1,#collected do
- collected[c]=xmltostring(collected[c].dt)
- end
- end
- return collected or {}
-end
-function xml.collect_tags(root,pattern,nonamespace)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- local t={}
- local n=0
- for c=1,#collected do
- local e=collected[c]
- local ns=e.ns
- local tg=e.tg
- n=n+1
- if nonamespace then
- t[n]=tg
- elseif ns=="" then
- t[n]=tg
- else
- t[n]=ns..":"..tg
- end
- end
- return t
- end
-end
-local no_root={ no_root=true }
-local function redo_ni(d)
- for k=1,#d do
- local dk=d[k]
- if type(dk)=="table" then
- dk.ni=k
- end
- end
-end
-xml.reindex=redo_ni
-local function xmltoelement(whatever,root)
- if not whatever then
- return nil
- end
- local element
- if type(whatever)=="string" then
- element=xmlinheritedconvert(whatever,root,true)
- else
- element=whatever
- end
- if element.error then
- return whatever
- end
- if element then
- end
- return element
-end
-xml.toelement=xmltoelement
-local function copiedelement(element,newparent)
- if type(element)~="string" then
- element=xmlcopy(element).dt
- if newparent and type(element)=="table" then
- for i=1,#element do
- local e=element[i]
- if type(e)=="table" then
- e.__p__=newparent
- end
- end
- end
- end
- return element
-end
-function xml.delete(root,pattern)
- if not pattern or pattern=="" then
- local p=root.__p__
- if p then
- if trace_manipulations then
- report('deleting',"--",c,root)
- end
- local d=p.dt
- remove(d,root.ni)
- redo_ni(d)
- end
- else
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- local p=e.__p__
- if p then
- if trace_manipulations then
- report('deleting',pattern,c,e)
- end
- local d=p.dt
- local ni=e.ni
- if ni<=#d then
- if false then
- p.dt[ni]=""
- else
- remove(d,ni)
- redo_ni(d)
- end
- else
- end
- end
- end
- end
- end
-end
-function xml.wipe(root,pattern)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- local p=e.__p__
- if p then
- local d=p.dt
- local ni=e.ni
- if ni<=#d then
- local dt=e.dt
- if #dt==1 then
- local d1=dt[1]
- if type(d1)=="string" and match(d1,"^%s*$") then
- if trace_manipulations then
- report('wiping',pattern,c,e)
- end
- remove(d,ni)
- redo_ni(d)
- end
- end
- end
- end
- end
- end
-end
-function xml.replace(root,pattern,whatever)
- local element=root and xmltoelement(whatever,root)
- local collected=element and xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- local p=e.__p__
- if p then
- if trace_manipulations then
- report('replacing',pattern,c,e)
- end
- local d=p.dt
- local n=e.ni
- local t=copiedelement(element,p)
- if type(t)=="table" then
- d[n]=t[1]
- for i=2,#t do
- n=n+1
- insert(d,n,t[i])
- end
- else
- d[n]=t
- end
- redo_ni(d)
- 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 xmlapplylpath(root,pattern)
- local function inject_e(e)
- local r=e.__p__
- local d=r.dt
- local k=e.ni
- local rri=r.ri
- local edt=(rri and d[rri].dt) or (d and d[k] and d[k].dt)
- if edt then
- local be,af
- local cp=copiedelement(element,e)
- if prepend then
- be,af=cp,edt
- else
- be,af=edt,cp
- end
- local bn=#be
- for i=1,#af do
- bn=bn+1
- be[bn]=af[i]
- end
- if rri then
- r.dt[rri].dt=be
- else
- d[k].dt=be
- end
- redo_ni(d)
- end
- end
- if not collected then
- elseif collected.tg then
- inject_e(collected)
- else
- for c=1,#collected do
- inject_e(collected[c])
- end
- end
-end
-local function insert_element(root,pattern,whatever,before)
- local element=root and xmltoelement(whatever,root)
- local collected=element and xmlapplylpath(root,pattern)
- local function insert_e(e)
- local r=e.__p__
- local d=r.dt
- local k=e.ni
- if not before then
- k=k+1
- end
- insert(d,k,copiedelement(element,r))
- redo_ni(d)
- end
- if not collected then
- elseif collected.tg then
- insert_e(collected)
- else
- for c=1,#collected do
- insert_e(collected[c])
- end
- end
-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,level)
- pattern=pattern or 'include'
- loaddata=loaddata or io.loaddata
- local collected=xmlapplylpath(xmldata,pattern)
- if collected then
- if not level then
- level=1
- end
- for c=1,#collected do
- local ek=collected[c]
- local name=nil
- local ekdt=ek.dt
- if ekdt then
- local ekat=ek.at
- local ekrt=ek.__p__
- if ekrt then
- local epdt=ekrt.dt
- if not attribute or attribute=="" then
- name=(type(ekdt)=="table" and ekdt[1]) or ekdt
- end
- if not name then
- for a in gmatch(attribute or "href","([^|]+)") do
- name=ekat[a]
- if name then
- break
- end
- end
- end
- local data=nil
- if name and name~="" then
- local d,n=loaddata(name)
- data=d or ""
- name=n or name
- if trace_inclusions then
- report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ")
- end
- end
- if not data or data=="" then
- epdt[ek.ni]=""
- elseif ekat["parse"]=="text" then
- epdt[ek.ni]=xml.escaped(data)
- else
- local settings=xmldata.settings
- local savedresource=settings.currentresource
- settings.currentresource=name
- local xi=xmlinheritedconvert(data,xmldata,true)
- if not xi then
- epdt[ek.ni]=""
- else
- if recursive then
- include(xi,pattern,attribute,recursive,loaddata,level+1)
- end
- local child=xml.body(xi)
- child.__p__=ekrt
- child.__f__=name
- child.cf=name
- epdt[ek.ni]=child
- local settings=xmldata.settings
- local inclusions=settings and settings.inclusions
- if inclusions then
- inclusions[#inclusions+1]=name
- elseif settings then
- settings.inclusions={ name }
- else
- settings={ inclusions={ name } }
- xmldata.settings=settings
- end
- if child.er then
- local badinclusions=settings.badinclusions
- if badinclusions then
- badinclusions[#badinclusions+1]=name
- else
- settings.badinclusions={ name }
- end
- end
- end
-settings.currentresource=savedresource
- end
- end
- end
- end
- end
-end
-xml.include=include
-function xml.inclusion(e,default)
- while e do
- local f=e.__f__
- if f then
- return f
- else
- e=e.__p__
- end
- end
- return default
-end
-local function getinclusions(key,e,sorted)
- while e do
- local settings=e.settings
- if settings then
- local inclusions=settings[key]
- if inclusions then
- inclusions=table.unique(inclusions)
- if sorted then
- table.sort(inclusions)
- end
- return inclusions
- else
- e=e.__p__
- end
- else
- e=e.__p__
- end
- end
-end
-function xml.inclusions(e,sorted)
- return getinclusions("inclusions",e,sorted)
-end
-function xml.badinclusions(e,sorted)
- return getinclusions("badinclusions",e,sorted)
-end
-local b_collapser=lpegpatterns.b_collapser
-local m_collapser=lpegpatterns.m_collapser
-local e_collapser=lpegpatterns.e_collapser
-local x_collapser=lpegpatterns.x_collapser
-local b_stripper=lpegpatterns.b_stripper
-local m_stripper=lpegpatterns.m_stripper
-local e_stripper=lpegpatterns.e_stripper
-local x_stripper=lpegpatterns.x_stripper
-local function stripelement(e,nolines,anywhere,everything)
- local edt=e.dt
- if edt then
- local n=#edt
- if n==0 then
- return e
- elseif everything then
- local t={}
- local m=0
- for i=1,n do
- local str=edt[i]
- if type(str)~="string" then
- m=m+1
- t[m]=str
- elseif str~="" then
- str=lpegmatch(x_collapser,str)
- if str~="" then
- m=m+1
- t[m]=str
- end
- end
- end
- e.dt=t
- elseif anywhere then
- local t={}
- local m=0
- for i=1,n do
- local str=edt[i]
- if type(str)~="string" then
- m=m+1
- t[m]=str
- elseif str~="" then
- if nolines then
- str=lpegmatch((i==1 and b_collapser) or (i==m and e_collapser) or m_collapser,str)
- else
- str=lpegmatch((i==1 and b_stripper) or (i==m and e_stripper) or m_stripper,str)
- end
- if str~="" then
- m=m+1
- t[m]=str
- end
- end
- end
- e.dt=t
- else
- local str=edt[1]
- if type(str)=="string" then
- if str~="" then
- str=lpegmatch(nolines and b_collapser or b_stripper,str)
- end
- if str=="" then
- remove(edt,1)
- n=n-1
- else
- edt[1]=str
- end
- end
- if n>0 then
- str=edt[n]
- if type(str)=="string" then
- if str=="" then
- remove(edt)
- else
- str=lpegmatch(nolines and e_collapser or e_stripper,str)
- if str=="" then
- remove(edt)
- else
- edt[n]=str
- end
- end
- end
- end
- end
- end
- return e
-end
-xml.stripelement=stripelement
-function xml.strip(root,pattern,nolines,anywhere,everything)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for i=1,#collected do
- stripelement(collected[i],nolines,anywhere,everything)
- end
- end
-end
-local function compactelement(e)
- local edt=e.dt
- if edt then
- for e=1,#edt do
- local str=edt[e]
- if type(str)=="string" and not find(str,"%S") then
- edt[e]=""
- end
- end
- end
- return e
-end
-xml.compactelement=compactelement
-local function renamespace(root,oldspace,newspace)
- local ndt=#root.dt
- for i=1,ndt or 0 do
- local e=root[i]
- if type(e)=="table" then
- if e.ns==oldspace then
- e.ns=newspace
- if e.rn then
- e.rn=newspace
- end
- end
- local edt=e.dt
- if edt then
- renamespace(edt,oldspace,newspace)
- end
- end
- end
-end
-xml.renamespace=renamespace
-function xml.remaptag(root,pattern,newtg)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- collected[c].tg=newtg
- end
- end
-end
-function xml.remapnamespace(root,pattern,newns)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- collected[c].ns=newns
- end
- end
-end
-function xml.checknamespace(root,pattern,newns)
- local collected=xmlapplylpath(root,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- if (not e.rn or e.rn=="") and e.ns=="" then
- e.rn=newns
- end
- end
- end
-end
-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]
- e.tg,e.ns,e.rn=newtg,newns,newrn
- end
- end
-end
-function xml.cdatatotext(e)
- local dt=e.dt
- if #dt==1 then
- local first=dt[1]
- if first.tg=="@cd@" then
- e.dt=first.dt
- end
- else
- end
-end
-function xml.texttocdata(e)
- local dt=e.dt
- local s=xml.tostring(dt)
- e.tg="@cd@"
- e.special=true
- e.ns=""
- e.rn=""
- e.dt={ s }
- e.at=nil
-end
-function xml.elementtocdata(e)
- local dt=e.dt
- local s=xml.tostring(e)
- e.tg="@cd@"
- e.special=true
- e.ns=""
- e.rn=""
- e.dt={ s }
- e.at=nil
-end
-xml.builtinentities=table.tohash { "amp","quot","apos","lt","gt" }
-local entities=characters and characters.entities or nil
-local builtinentities=xml.builtinentities
-function xml.addentitiesdoctype(root,option)
- if not entities then
- require("char-ent")
- entities=characters.entities
- end
- if entities and root and root.tg=="@rt@" and root.statistics then
- local list={}
- local hexify=option=="hexadecimal"
- for k,v in table.sortedhash(root.statistics.entities.names) do
- if not builtinentities[k] then
- local e=entities[k]
- if not e then
- e=format("[%s]",k)
- elseif hexify then
- e=format("&#%05X;",utfbyte(k))
- end
- list[#list+1]=format(" <!ENTITY %s %q >",k,e)
- end
- end
- local dt=root.dt
- local n=dt[1].tg=="@pi@" and 2 or 1
- if #list>0 then
- insert(dt,n,{ "\n" })
- insert(dt,n,{
- tg="@dt@",
- dt={ format("Something [\n%s\n] ",concat(list)) },
- ns="",
- special=true,
- })
- insert(dt,n,{ "\n\n" })
- else
- end
- end
-end
-xml.all=xml.each
-xml.insert=xml.insertafter
-xml.inject=xml.injectafter
-xml.after=xml.insertafter
-xml.before=xml.insertbefore
-xml.process=xml.each
-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.replace
-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
-function xml.cdata(e)
- if e then
- local dt=e.dt
- if dt and #dt==1 then
- local first=dt[1]
- return first.tg=="@cd@" and first.dt[1] or ""
- end
- end
- return ""
-end
-function xml.finalizers.xml.cdata(collected)
- if collected then
- local e=collected[1]
- if e then
- local dt=e.dt
- if dt and #dt==1 then
- local first=dt[1]
- return first.tg=="@cd@" and first.dt[1] or ""
- end
- end
- end
- return ""
-end
-function xml.insertcomment(e,str,n)
- insert(e.dt,n or 1,{
- tg="@cm@",
- ns="",
- special=true,
- at={},
- dt={ str },
- })
-end
-function xml.insertcdata(e,str,n)
- insert(e.dt,n or 1,{
- tg="@cd@",
- ns="",
- special=true,
- at={},
- dt={ str },
- })
-end
-function xml.setcomment(e,str,n)
- e.dt={ {
- tg="@cm@",
- ns="",
- special=true,
- at={},
- dt={ str },
- } }
-end
-function xml.setcdata(e,str)
- e.dt={ {
- tg="@cd@",
- ns="",
- special=true,
- at={},
- dt={ str },
- } }
-end
-function xml.separate(x,pattern)
- local collected=xmlapplylpath(x,pattern)
- if collected then
- for c=1,#collected do
- local e=collected[c]
- local d=e.dt
- if d==x then
- report_xml("warning: xml.separate changes root")
- x=d
- end
- local t={ "\n" }
- local n=1
- local i=1
- local nd=#d
- while i<=nd do
- while i<=nd do
- local di=d[i]
- if type(di)=="string" then
- if di=="\n" or find(di,"^%s+$") then
- i=i+1
- else
- d[i]=strip(di)
- break
- end
- else
- break
- end
- end
- if i>nd then
- break
- end
- t[n+1]="\n"
- t[n+2]=d[i]
- t[n+3]="\n"
- n=n+3
- i=i+1
- end
- t[n+1]="\n"
- setmetatable(t,getmetatable(d))
- e.dt=t
- end
- end
- return x
-end
-local helpers=xml.helpers or {}
-xml.helpers=helpers
-local function normal(e,action)
- local edt=e.dt
- if edt then
- for i=1,#edt do
- local str=edt[i]
- if type(str)=="string" and str~="" then
- edt[i]=action(str)
- end
- end
- end
-end
-local function recurse(e,action)
- local edt=e.dt
- if edt then
- for i=1,#edt do
- local str=edt[i]
- if type(str)~="string" then
- recurse(str,action)
- elseif str~="" then
- edt[i]=action(str)
- end
- end
- end
-end
-function helpers.recursetext(collected,action,recursive)
- if recursive then
- for i=1,#collected do
- recurse(collected[i],action)
- end
- else
- for i=1,#collected do
- normal(collected[i],action)
- end
- end
-end
-local specials={
- ["@rt@"]="root",
- ["@pi@"]="instruction",
- ["@cm@"]="comment",
- ["@dt@"]="declaration",
- ["@cd@"]="cdata",
-}
-local function convert(x,strip,flat)
- local ns=x.ns
- local tg=x.tg
- local at=x.at
- local dt=x.dt
- local node=flat and {
- [0]=(not x.special and (ns~="" and ns..":"..tg or tg)) or nil,
- } or {
- _namespace=ns~="" and ns or nil,
- _tag=not x.special and tg or nil,
- _type=specials[tg] or "_element",
- }
- if at then
- for k,v in next,at do
- node[k]=v
- end
- end
- local n=0
- for i=1,#dt do
- local di=dt[i]
- if type(di)=="table" then
- if flat and di.special then
- else
- di=convert(di,strip,flat)
- if di then
- n=n+1
- node[n]=di
- end
- end
- elseif strip then
- di=lpegmatch(strip,di)
- if di~="" then
- n=n+1
- node[n]=di
- end
- else
- n=n+1
- node[n]=di
- end
- end
- if next(node) then
- return node
- end
-end
-function xml.totable(x,strip,flat)
- if type(x)=="table" then
- if strip then
- strip=striplinepatterns[strip]
- end
- return convert(x,strip,flat)
- end
-end
-function xml.rename(e,namespace,name,attributes)
- if type(e)~="table" or not e.tg then
- return
- end
- if type(name)=="table" then
- attributes=name
- name=namespace
- namespace=""
- elseif type(name)~="string" then
- attributes={}
- name=namespace
- namespace=""
- end
- if type(attributes)~="table" then
- attributes={}
- end
- e.ns=namespace
- e.rn=namespace
- e.tg=name
- e.at=attributes
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true
-
--- original size: 11096, stripped down to: 7702
-
-if not modules then modules={} end modules ['lxml-xml']={
- version=1.001,
- comment="this module is the basis for the lxml-* ones",
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local tonumber,next=tonumber,next
-local concat=table.concat
-local find,lower,upper=string.find,string.lower,string.upper
-local xml=xml
-local finalizers=xml.finalizers.xml
-local xmlfilter=xml.filter
-local xmltostring=xml.tostring
-local xmlserialize=xml.serialize
-local xmlcollected=xml.collected
-local xmlnewhandlers=xml.newhandlers
-local reparsedentity=xml.reparsedentitylpeg
-local unescapedentity=xml.unescapedentitylpeg
-local parsedentity=reparsedentity
-local function first(collected)
- return collected and collected[1]
-end
-local function last(collected)
- return collected and collected[#collected]
-end
-local function all(collected)
- return collected
-end
-local reverse=table.reversed
-local function attribute(collected,name)
- if collected and #collected>0 then
- local at=collected[1].at
- return at and at[name]
- end
-end
-local function att(id,name)
- local at=id.at
- return at and at[name]
-end
-local function count(collected)
- return collected and #collected or 0
-end
-local function position(collected,n)
- if not collected then
- return 0
- end
- local nc=#collected
- if nc==0 then
- return 0
- end
- n=tonumber(n) or 0
- if n<0 then
- return collected[nc+n+1]
- elseif n>0 then
- return collected[n]
- else
- return collected[1].mi or 0
- end
-end
-local function match(collected)
- return collected and #collected>0 and collected[1].mi or 0
-end
-local function index(collected)
- return collected and #collected>0 and collected[1].ni or 0
-end
-local function attributes(collected,arguments)
- if collected and #collected>0 then
- local at=collected[1].at
- if arguments then
- return at[arguments]
- elseif next(at) then
- return at
- end
- end
-end
-local function chainattribute(collected,arguments)
- if collected and #collected>0 then
- local e=collected[1]
- while e do
- local at=e.at
- if at then
- local a=at[arguments]
- if a then
- return a
- end
- else
- break
- end
- e=e.__p__
- end
- end
- return ""
-end
-local function raw(collected)
- if collected and #collected>0 then
- local e=collected[1] or collected
- return e and xmltostring(e) or ""
- else
- return ""
- end
-end
-local xmltexthandler=xmlnewhandlers {
- name="string",
- initialize=function()
- result={}
- return result
- end,
- finalize=function()
- return concat(result)
- end,
- handle=function(...)
- result[#result+1]=concat {... }
- end,
- escape=false,
-}
-local function xmltotext(root)
- local dt=root.dt
- if not dt then
- return ""
- end
- local nt=#dt
- if nt==0 then
- return ""
- elseif nt==1 and type(dt[1])=="string" then
- return dt[1]
- else
- return xmlserialize(root,xmltexthandler) or ""
- end
-end
-function xml.serializetotext(root)
- return root and xmlserialize(root,xmltexthandler) or ""
-end
-local function text(collected)
- if collected then
- local e=collected[1] or collected
- return e and xmltotext(e) or ""
- else
- return ""
- end
-end
-local function texts(collected)
- if not collected then
- return {}
- end
- local nc=#collected
- if nc==0 then
- return {}
- end
- local t,n={},0
- for c=1,nc do
- local e=collected[c]
- if e and e.dt then
- n=n+1
- t[n]=e.dt
- end
- end
- return t
-end
-local function tag(collected,n)
- if not collected then
- return
- end
- local nc=#collected
- if nc==0 then
- return
- end
- local c
- if n==0 or not n then
- c=collected[1]
- elseif n>1 then
- c=collected[n]
- else
- c=collected[nc-n+1]
- end
- return c and c.tg
-end
-local function name(collected,n)
- if not collected then
- return
- end
- local nc=#collected
- if nc==0 then
- return
- end
- local c
- if n==0 or not n then
- c=collected[1]
- elseif n>1 then
- c=collected[n]
- else
- c=collected[nc-n+1]
- end
- if not c then
- elseif c.ns=="" then
- return c.tg
- else
- return c.ns..":"..c.tg
- end
-end
-local function tags(collected,nonamespace)
- if not collected then
- return
- end
- local nc=#collected
- if nc==0 then
- return
- end
- local t,n={},0
- for c=1,nc do
- local e=collected[c]
- local ns,tg=e.ns,e.tg
- n=n+1
- if nonamespace or ns=="" then
- t[n]=tg
- else
- t[n]=ns..":"..tg
- end
- end
- return t
-end
-local function empty(collected,spacesonly)
- if not collected then
- return true
- end
- local nc=#collected
- if nc==0 then
- return true
- end
- for c=1,nc do
- local e=collected[c]
- if e then
- local edt=e.dt
- if edt then
- local n=#edt
- if n==1 then
- local edk=edt[1]
- local typ=type(edk)
- if typ=="table" then
- return false
- elseif edk~="" then
- return false
- elseif spacesonly and not find(edk,"%S") then
- return false
- end
- elseif n>1 then
- return false
- end
- end
- end
- end
- return true
-end
-finalizers.first=first
-finalizers.last=last
-finalizers.all=all
-finalizers.reverse=reverse
-finalizers.elements=all
-finalizers.default=all
-finalizers.attribute=attribute
-finalizers.att=att
-finalizers.count=count
-finalizers.position=position
-finalizers.match=match
-finalizers.index=index
-finalizers.attributes=attributes
-finalizers.chainattribute=chainattribute
-finalizers.text=text
-finalizers.texts=texts
-finalizers.tag=tag
-finalizers.name=name
-finalizers.tags=tags
-finalizers.empty=empty
-function xml.first(id,pattern)
- return first(xmlfilter(id,pattern))
-end
-function xml.last(id,pattern)
- return last(xmlfilter(id,pattern))
-end
-function xml.count(id,pattern)
- return count(xmlfilter(id,pattern))
-end
-function xml.attribute(id,pattern,a,default)
- return attribute(xmlfilter(id,pattern),a,default)
-end
-function xml.raw(id,pattern)
- if pattern then
- return raw(xmlfilter(id,pattern))
- else
- return raw(id)
- end
-end
-function xml.text(id,pattern)
- if pattern then
- local collected=xmlfilter(id,pattern)
- return collected and #collected>0 and xmltotext(collected[1]) or ""
- elseif id then
- return xmltotext(id) or ""
- else
- return ""
- end
-end
-function xml.pure(id,pattern)
- if pattern then
- local collected=xmlfilter(id,pattern)
- if collected and #collected>0 then
- parsedentity=unescapedentity
- local s=collected and #collected>0 and xmltotext(collected[1]) or ""
- parsedentity=reparsedentity
- return s
- else
- return ""
- end
- else
- parsedentity=unescapedentity
- local s=xmltotext(id) or ""
- parsedentity=reparsedentity
- return s
- end
-end
-xml.content=text
-function xml.position(id,pattern,n)
- return position(xmlfilter(id,pattern),n)
-end
-function xml.match(id,pattern)
- return match(xmlfilter(id,pattern))
-end
-function xml.empty(id,pattern,spacesonly)
- return empty(xmlfilter(id,pattern),spacesonly)
-end
-xml.all=xml.filter
-xml.index=xml.position
-xml.found=xml.filter
-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)
- return concat(textonly(e,{}))
-end
-function finalizers.lowerall(collected)
- for c=1,#collected do
- local e=collected[c]
- if not e.special then
- e.tg=lower(e.tg)
- local eat=e.at
- if eat then
- local t={}
- for k,v in next,eat do
- t[lower(k)]=v
- end
- e.at=t
- end
- end
- end
-end
-function finalizers.upperall(collected)
- for c=1,#collected do
- local e=collected[c]
- if not e.special then
- e.tg=upper(e.tg)
- local eat=e.at
- if eat then
- local t={}
- for k,v in next,eat do
- t[upper(k)]=v
- end
- e.at=t
- end
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["trac-xml"] = package.loaded["trac-xml"] or true
-
--- original size: 6407, stripped down to: 4640
-
-if not modules then modules={} end modules ['trac-xml']={
- 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"
-}
-local formatters=string.formatters
-local reporters=logs.reporters
-local xmlserialize=xml.serialize
-local xmlcollected=xml.collected
-local xmltext=xml.text
-local xmlfirst=xml.first
-local function showhelp(specification,...)
- local root=xml.convert(specification.helpinfo or "")
- if not root then
- return
- end
- local xs=xml.gethandlers("string")
- xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end)
- xml.sethandlersfunction(xs,"ref",function(e,handler) handler.handle("--"..e.at.name) end)
- local wantedcategories=select("#",...)==0 and true or table.tohash {... }
- local nofcategories=xml.count(root,"/application/flags/category")
- local report=specification.report
- for category in xmlcollected(root,"/application/flags/category") do
- local categoryname=category.at.name or ""
- if wantedcategories==true or wantedcategories[categoryname] then
- if nofcategories>1 then
- report("%s options:",categoryname)
- report()
- end
- for subcategory in xmlcollected(category,"/subcategory") do
- for flag in xmlcollected(subcategory,"/flag") do
- local name=flag.at.name
- local value=flag.at.value
- local short=xmltext(xmlfirst(flag,"/short"))
- if value then
- report("--%-20s %s",formatters["%s=%s"](name,value),short)
- else
- report("--%-20s %s",name,short)
- end
- end
- report()
- end
- end
- end
- for category in xmlcollected(root,"/application/examples/category") do
- local title=xmltext(xmlfirst(category,"/title"))
- if title and title~="" then
- report()
- report(title)
- report()
- end
- for subcategory in xmlcollected(category,"/subcategory") do
- for example in xmlcollected(subcategory,"/example") do
- local command=xmltext(xmlfirst(example,"/command"))
- local comment=xmltext(xmlfirst(example,"/comment"))
- report(command)
- end
- report()
- end
- end
- for comment in xmlcollected(root,"/application/comments/comment") do
- local comment=xmltext(comment)
- report()
- report(comment)
- report()
- end
-end
-local reporthelp=reporters.help
-local exporthelp=reporters.export
-local function xmlfound(t)
- local helpinfo=t.helpinfo
- if type(helpinfo)=="table" then
- return false
- end
- if type(helpinfo)~="string" then
- helpinfo="Warning: no helpinfo found."
- t.helpinfo=helpinfo
- return false
- end
- if string.find(helpinfo,".xml$") then
- local ownscript=environment.ownscript
- local helpdata=false
- if ownscript then
- local helpfile=file.join(file.pathpart(ownscript),helpinfo)
- helpdata=io.loaddata(helpfile)
- if helpdata=="" then
- helpdata=false
- end
- end
- if not helpdata then
- local helpfile=resolvers.findfile(helpinfo,"tex")
- helpdata=helpfile and io.loaddata(helpfile)
- end
- if helpdata and helpdata~="" then
- helpinfo=helpdata
- else
- helpinfo=formatters["Warning: help file %a is not found."](helpinfo)
- end
- end
- t.helpinfo=helpinfo
- return string.find(t.helpinfo,"^<%?xml") and true or false
-end
-function reporters.help(t,...)
- if xmlfound(t) then
- showhelp(t,...)
- else
- reporthelp(t,...)
- end
-end
-function reporters.export(t,methods,filename)
- if not xmlfound(t) then
- return exporthelp(t)
- end
- if not methods or methods=="" then
- methods=environment.arguments["exporthelp"]
- end
- if not filename or filename=="" then
- filename=environment.files[1]
- end
- dofile(resolvers.findfile("trac-exp.lua","tex"))
- local exporters=logs.exporters
- if not exporters or not methods then
- return exporthelp(t)
- end
- if methods=="all" then
- methods=table.keys(exporters)
- elseif type(methods)=="string" then
- methods=utilities.parsers.settings_to_array(methods)
- else
- return exporthelp(t)
- end
- if type(filename)~="string" or filename=="" then
- filename=false
- elseif file.pathpart(filename)=="" then
- t.report("export file %a will not be saved on the current path (safeguard)",filename)
- return
- end
- for i=1,#methods do
- local method=methods[i]
- local exporter=exporters[method]
- if exporter then
- local result=exporter(t,method)
- if result and result~="" then
- if filename then
- local fullname=file.replacesuffix(filename,method)
- t.report("saving export in %a",fullname)
- dir.mkdirs(file.pathpart(fullname))
- io.savedata(fullname,result)
- else
- reporters.lines(t,result)
- end
- else
- t.report("no output from exporter %a",method)
- end
- else
- t.report("unknown exporter %a",method)
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-ini"] = package.loaded["data-ini"] or true
-
--- original size: 10947, stripped down to: 7176
-
-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 next,type,getmetatable,rawset=next,type,getmetatable,rawset
-local gsub,find,gmatch,char=string.gsub,string.find,string.gmatch,string.char
-local filedirname,filebasename,filejoin=file.dirname,file.basename,file.join
-local ostype,osname,osuname,ossetenv,osgetenv=os.type,os.name,os.uname,os.setenv,os.getenv
-local sortedpairs=table.sortedpairs
-local P,S,R,C,Cs,Cc,lpegmatch=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.match
-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_initialization=logs.reporter("resolvers","initialization")
-resolvers=resolvers or {}
-local resolvers=resolvers
-texconfig.kpse_init=false
-texconfig.shell_escape='t'
-if not (environment and environment.default_texmfcnf) and kpse and kpse.default_texmfcnf then
- local default_texmfcnf=kpse.default_texmfcnf()
- default_texmfcnf=gsub(default_texmfcnf,"$SELFAUTOLOC","selfautoloc:")
- default_texmfcnf=gsub(default_texmfcnf,"$SELFAUTODIR","selfautodir:")
- default_texmfcnf=gsub(default_texmfcnf,"$SELFAUTOPARENT","selfautoparent:")
- default_texmfcnf=gsub(default_texmfcnf,"$HOME","home:")
- environment.default_texmfcnf=default_texmfcnf
-end
-kpse={ original=kpse }
-setmetatable(kpse,{
- __index=function(kp,name)
- report_initialization("fatal error: kpse library is accessed (key: %s)",name)
- os.exit()
- end
-} )
-do
- local osfontdir=osgetenv("OSFONTDIR")
- if osfontdir and osfontdir~="" then
- 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
-if not environment.homedir then
- local oldhome=osgetenv('HOME')
- local homedir=osgetenv(ostype=="windows" and 'USERPROFILE' or 'HOME') or ''
- if not homedir or homedir=="" then
- homedir=char(127)
- end
- homedir=file.collapsepath(homedir)
- ossetenv("HOME",homedir)
- ossetenv("USERPROFILE",homedir)
- environment.oldhome=oldhome
- environment.homedir=homedir
-end
-do
- local args=environment.originalarguments or arg
- if not environment.ownmain then
- environment.ownmain=status and string.match(string.lower(status.banner),"this is ([%a]+)") or "luatex"
- end
- 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
- local olddir=lfs.currentdir()
- if lfs.chdir(p) then
- local pp=lfs.currentdir()
- if trace_locating and p~=pp then
- report_initialization("following symlink %a to %a",p,pp)
- end
- ownpath=pp
- lfs.chdir(olddir)
- else
- if trace_locating then
- report_initialization("unable to check path %a",p)
- end
- ownpath=p
- end
- break
- end
- end
- end
- end
- if not ownpath or ownpath=="" then
- ownpath="."
- report_initialization("forcing fallback to ownpath %a",ownpath)
- elseif trace_locating then
- report_initialization("using ownpath %a",ownpath)
- end
- end
- environment.ownbin=ownbin
- environment.ownpath=ownpath
-end
-resolvers.ownpath=environment.ownpath
-function resolvers.getownpath()
- return environment.ownpath
-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
-end
-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)
-ossetenv('TEXOS',texos)
-ossetenv('SELFAUTOSYSTEM',os.platform)
-environment.texos=texos
-environment.texmfos=texmfos
-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)
-local prefixes=utilities.storage.allocate()
-resolvers.prefixes=prefixes
-local resolved={}
-local abstract={}
-local dynamic={}
-function resolvers.resetresolve(str)
- resolved,abstract={},{}
-end
-function resolvers.allprefixes(separator)
- local all=table.sortedkeys(prefixes)
- if separator then
- for i=1,#all do
- all[i]=all[i]..":"
- end
- end
- return all
-end
-local function _resolve_(method,target)
- local action=prefixes[method]
- if action then
- return action(target)
- else
- return method..":"..target
- end
-end
-function resolvers.unresolve(str)
- return abstract[str] or str
-end
-function resolvers.setdynamic(str)
- dynamic[str]=true
-end
-local pattern=Cs((C(R("az")^2)*P(":")*C((1-S(" \"\';,"))^1)/_resolve_+P(1))^0)
-local prefix=C(R("az")^2)*P(":")
-local target=C((1-S(" \"\';,"))^1)
-local notarget=(#S(";,")+P(-1))*Cc("")
-local p_resolve=Cs(((prefix*(target+notarget))/_resolve_+P(1))^0)
-local p_simple=prefix*P(-1)
-local function resolve(str)
- if type(str)=="table" then
- local res={}
- for i=1,#str do
- res[i]=resolve(str[i])
- end
- return res
- end
- local res=resolved[str]
- if res then
- return res
- end
- local simple=lpegmatch(p_simple,str)
- local action=prefixes[simple]
- if action then
- local res=action(res)
- if not dynamic[simple] then
- resolved[simple]=res
- abstract[res]=simple
- end
- return res
- end
- res=lpegmatch(p_resolve,str)
- resolved[str]=res
- abstract[res]=str
- return res
-end
-resolvers.resolve=resolve
-if type(osuname)=="function" then
- for k,v in next,osuname() do
- if not prefixes[k] then
- prefixes[k]=function() return v end
- end
- end
-end
-if ostype=="unix" then
- local pattern
- local function makepattern(t,k,v)
- if t then
- rawset(t,k,v)
- end
- local colon=P(":")
- for k,v in sortedpairs(prefixes) do
- if p then
- p=P(k)+p
- else
- p=P(k)
- end
- end
- pattern=Cs((p*colon+colon/";"+P(1))^0)
- end
- makepattern()
- table.setmetatablenewindex(prefixes,makepattern)
- function resolvers.repath(str)
- return lpegmatch(pattern,str)
- end
-else
- function resolvers.repath(str)
- return str
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-exp"] = package.loaded["data-exp"] or true
-
--- original size: 18179, stripped down to: 10432
-
-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,char,sub=string.format,string.find,string.gmatch,string.lower,string.char,string.sub
-local concat,sort=table.concat,table.sort
-local sortedkeys=table.sortedkeys
-local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
-local Ct,Cs,Cc,Carg,P,C,S=lpeg.Ct,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.P,lpeg.C,lpeg.S
-local type,next=type,next
-local isdir=lfs.isdir
-local collapsepath,joinpath,basename=file.collapsepath,file.join,file.basename
-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 trace_globbing=true trackers.register("resolvers.globbing",function(v) trace_globbing=v end)
-local report_expansions=logs.reporter("resolvers","expansions")
-local report_globbing=logs.reporter("resolvers","globbing")
-local resolvers=resolvers
-local resolveprefix=resolvers.resolve
-local function f_both(a,b)
- local t,n={},0
- for sb in gmatch(b,"[^,]+") do
- for sa in gmatch(a,"[^,]+") do
- n=n+1;t[n]=sa..sb
- end
- end
- return concat(t,",")
-end
-local comma=P(",")
-local nocomma=(1-comma)^1
-local docomma=comma^1/","
-local before=Cs((nocomma*Carg(1)+docomma)^0)
-local after=Cs((Carg(1)*nocomma+docomma)^0)
-local both=Cs(((C(nocomma)*Carg(1))/function(a,b) return lpegmatch(before,b,1,a) end+docomma)^0)
-local function f_first (a,b) return lpegmatch(after,b,1,a) end
-local function f_second(a,b) return lpegmatch(before,a,1,b) end
-local function f_both (a,b) return lpegmatch(both,b,1,a) 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)
- if trace_expansions then
- report_expansions("expanding variable %a",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
- 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
-local function validate(s)
- s=collapsepath(s)
- return s~="" and not find(s,"^!*unset/*$") and s
-end
-resolvers.validatedpath=validate
-function resolvers.expandedpathfromlist(pathlist)
- local newlist={}
- for k=1,#pathlist do
- splitpathexpr(pathlist[k],newlist,validate)
- end
- return newlist
-end
-local usedhomedir=nil
-local donegation=(P("!")/"" )^0
-local doslashes=(P("\\")/"/"+1)^0
-local function expandedhome()
- if not usedhomedir then
- usedhomedir=lpegmatch(Cs(donegation*doslashes),environment.homedir or "")
- if usedhomedir=="~" or usedhomedir=="" or not isdir(usedhomedir) then
- if trace_expansions then
- report_expansions("no home dir set, ignoring dependent path using current path")
- end
- usedhomedir="."
- end
- end
- return usedhomedir
-end
-local dohome=((P("~")+P("$HOME")+P("%HOME%"))/expandedhome)^0
-local cleanup=Cs(donegation*dohome*doslashes)
-resolvers.cleanpath=function(str)
- return str and lpegmatch(cleanup,str) or ""
-end
-local expandhome=P("~")/"$HOME"
-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)
- return type(str)=="string" and lpegmatch(stripper,str) or str
-end
-local cache={}
-local splitter=lpeg.tsplitat(";")
-local backslashswapper=lpeg.replacer("\\","/")
-local function splitconfigurationpath(str)
- if str then
- local found=cache[str]
- if not found then
- if str=="" then
- found={}
- else
- local split=lpegmatch(splitter,lpegmatch(backslashswapper,str))
- 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 %a",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 joinpath(str)
- else
- return str
- end
-end
-local attributes,directory=lfs.attributes,lfs.dir
-local weird=P(".")^1+lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t"))
-local lessweird=P(".")^1+lpeg.anywhere(S("~`#$%^&*:;\"\'||<>,?\n\r\t"))
-local timer={}
-local scanned={}
-local nofscans=0
-local scancache={}
-local fullcache={}
-local nofsharedscans=0
-local addcasecraptoo=true
-local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant)
- local full=path=="" and spec or (spec..path..'/')
- local dirlist={}
- local nofdirs=0
- local pattern=tolerant and lessweird or weird
- local filelist={}
- local noffiles=0
- for name,mode in directory(full) do
- if not lpegmatch(pattern,name) then
- if not mode then
- mode=attributes(full..name,"mode")
- end
- if mode=="file" then
- n=n+1
- noffiles=noffiles+1
- filelist[noffiles]=name
- elseif mode=="directory" then
- m=m+1
- nofdirs=nofdirs+1
- if path~="" then
- dirlist[nofdirs]=path.."/"..name
- else
- dirlist[nofdirs]=name
- end
- end
- end
- end
- if noffiles>0 then
- sort(filelist)
- for i=1,noffiles do
- local name=filelist[i]
- local lower=lower(name)
- local paths=files[lower]
- if paths then
- if onlyone then
- else
- if name~=lower then
- local rl=remap[lower]
- if not rl then
- remap[lower]=name
- r=r+1
- elseif trace_globbing and rl~=name then
- report_globbing("confusing filename, name: %a, lower: %a, already: %a",name,lower,rl)
- end
- if addcasecraptoo then
- local paths=files[name]
- if not paths then
- files[name]=path
- elseif type(paths)=="string" then
- files[name]={ paths,path }
- else
- paths[#paths+1]=path
- end
- end
- end
- if type(paths)=="string" then
- files[lower]={ paths,path }
- else
- paths[#paths+1]=path
- end
- end
- else
- files[lower]=path
- if name~=lower then
- local rl=remap[lower]
- if not rl then
- remap[lower]=name
- r=r+1
- elseif trace_globbing and rl~=name then
- report_globbing("confusing filename, name: %a, lower: %a, already: %a",name,lower,rl)
- end
- end
- end
- end
- end
- if nofdirs>0 then
- sort(dirlist)
- for i=1,nofdirs do
- files,remap,n,m,r=scan(files,remap,spec,dirlist[i],n,m,r,onlyonce,tolerant)
- end
- end
- scancache[sub(full,1,-2)]=files
- return files,remap,n,m,r
-end
-local function scanfiles(path,branch,usecache,onlyonce,tolerant)
- local realpath=resolveprefix(path)
- if usecache then
- local content=fullcache[realpath]
- if content then
- if trace_locating then
- report_expansions("using cached scan of path %a, branch %a",path,branch or path)
- end
- nofsharedscans=nofsharedscans+1
- return content
- end
- end
- statistics.starttiming(timer)
- if trace_locating then
- report_expansions("scanning path %a, branch %a",path,branch or path)
- end
- local content
- if isdir(realpath) then
- local files,remap,n,m,r=scan({},{},realpath..'/',"",0,0,0,onlyonce,tolerant)
- content={
- metadata={
- path=path,
- files=n,
- directories=m,
- remappings=r,
- },
- files=files,
- remap=remap,
- }
- if trace_locating then
- report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r)
- end
- else
- content={
- metadata={
- path=path,
- files=0,
- directories=0,
- remappings=0,
- },
- files={},
- remap={},
- }
- if trace_locating then
- report_expansions("invalid path %a",realpath)
- end
- end
- if usecache then
- scanned[#scanned+1]=realpath
- fullcache[realpath]=content
- end
- nofscans=nofscans+1
- statistics.stoptiming(timer)
- return content
-end
-resolvers.scanfiles=scanfiles
-function resolvers.simplescanfiles(path,branch,usecache)
- return scanfiles(path,branch,usecache,true,true)
-end
-function resolvers.scandata()
- table.sort(scanned)
- return {
- n=nofscans,
- shared=nofsharedscans,
- time=statistics.elapsedtime(timer),
- paths=scanned,
- }
-end
-function resolvers.get_from_content(content,path,name)
- if not content then
- return
- end
- local files=content.files
- if not files then
- return
- end
- local remap=content.remap
- if not remap then
- return
- end
- if name then
- local used=lower(name)
- return path,remap[used] or used
- else
- local name=path
- local used=lower(name)
- local path=files[used]
- if path then
- return path,remap[used] or used
- end
- end
-end
-local nothing=function() end
-function resolvers.filtered_from_content(content,pattern)
- if content and type(pattern)=="string" then
- local pattern=lower(pattern)
- local files=content.files
- local remap=content.remap
- if files and remap then
- local f=sortedkeys(files)
- local n=#f
- local i=0
- local function iterator()
- while i<n do
- i=i+1
- local k=f[i]
- if find(k,pattern) then
- return files[k],remap and remap[k] or k
- end
- end
- end
- return iterator
- end
- end
- return nothing
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-env"] = package.loaded["data-env"] or true
-
--- original size: 9501, stripped down to: 6411
-
-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 next,rawget=next,rawget
-local resolvers=resolvers
-local allocate=utilities.storage.allocate
-local setmetatableindex=table.setmetatableindex
-local suffixonly=file.suffixonly
-local formats=allocate()
-local suffixes=allocate()
-local dangerous=allocate()
-local suffixmap=allocate()
-local usertypes=allocate()
-resolvers.formats=formats
-resolvers.suffixes=suffixes
-resolvers.dangerous=dangerous
-resolvers.suffixmap=suffixmap
-resolvers.usertypes=usertypes
-local luasuffixes=utilities.lua.suffixes
-local relations=allocate {
- core={
- ofm={
- names={ "ofm","omega font metric","omega font metrics" },
- variable='OFMFONTS',
- suffixes={ 'ofm','tfm' },
- },
- ovf={
- 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={
- names={ 'mem',"metapost format" },
- variable='MPMEMS',
- suffixes={ 'mem' },
- },
- mp={
- names={ "mp" },
- variable='MPINPUTS',
- suffixes=CONTEXTLMTXMODE>0
- and { 'mp','mpxl','mpvi','mpiv','mpii' }
- or { 'mp','mpvi','mpiv','mpii' },
- usertype=true,
- },
- tex={
- names={ "tex" },
- variable='TEXINPUTS',
- suffixes={ "tex","mkiv","mkvi","mkxl","mklx","mkii","cld","lfg","xml" },
- usertype=true,
- },
- icc={
- names={ "icc","icc profile","icc profiles" },
- variable='ICCPROFILES',
- suffixes={ 'icc' },
- },
- texmfscripts={
- names={ "texmfscript","texmfscripts","script","scripts" },
- variable='TEXMFSCRIPTS',
- suffixes={ 'lua','rb','pl','py' },
- },
- lua={
- names={ "lua" },
- variable='LUAINPUTS',
- suffixes={ luasuffixes.lua,luasuffixes.luc,luasuffixes.tma,luasuffixes.tmc },
- usertype=true,
- },
- lib={
- names={ "lib" },
- variable='CLUAINPUTS',
- suffixes=os.libsuffix and { os.libsuffix } or { 'dll','so' },
- },
- bib={
- names={ 'bib' },
- variable='BIBINPUTS',
- suffixes={ 'bib' },
- usertype=true,
- },
- bst={
- names={ 'bst' },
- variable='BSTINPUTS',
- suffixes={ 'bst' },
- usertype=true,
- },
- fontconfig={
- names={ 'fontconfig','fontconfig file','fontconfig files' },
- variable='FONTCONFIG_PATH',
- },
- pk={
- names={ "pk" },
- variable='PKFONTS',
- suffixes={ 'pk' },
- },
- },
- 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={
- 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={ '<resolution>gf' },
- },
- mf={
- names={ 'mf' },
- variable='MFINPUTS',
- suffixes={ 'mf' },
- },
- mft={
- names={ 'mft' },
- suffixes={ 'mft' },
- },
- pk={
- names={ 'pk' },
- suffixes={ '<resolution>pk' },
- },
- },
-}
-resolvers.relations=relations
-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
- if rn and rv then
- local rs=relation.suffixes
- local ru=relation.usertype
- 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
- if ru then
- usertypes[name]=true
- end
- end
- end
- end
-end
-resolvers.updaterelations()
-local function simplified(t,k)
- return k and rawget(t,lower(gsub(k," ",""))) or nil
-end
-setmetatableindex(formats,simplified)
-setmetatableindex(suffixes,simplified)
-setmetatableindex(suffixmap,simplified)
-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
-end
-dangerous.tex=nil
-function resolvers.formatofvariable(str)
- return formats[str] or ''
-end
-function resolvers.formatofsuffix(str)
- return suffixmap[suffixonly(str)] or 'tex'
-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[suffixonly(str)]
- if v then
- return formats[v]
- end
- return ''
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
-
--- original size: 16409, stripped down to: 11591
-
-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"
-}
-local next,type=next,type
-local pcall,loadfile,collectgarbage=pcall,loadfile,collectgarbage
-local format,lower,gsub=string.format,string.lower,string.gsub
-local concat,serialize,fastserialize,serializetofile=table.concat,table.serialize,table.fastserialize,table.tofile
-local mkdirs,expanddirname,isdir,isfile=dir.mkdirs,dir.expandname,lfs.isdir,lfs.isfile
-local is_writable,is_readable=file.is_writable,file.is_readable
-local collapsepath,joinfile,addsuffix,dirname=file.collapsepath,file.join,file.addsuffix,file.dirname
-local savedata=file.savedata
-local formatters=string.formatters
-local osexit,osdate,osuuid=os.exit,os.date,os.uuid
-local removefile=os.remove
-local md5hex=md5.hex
-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)
-local report_caches=logs.reporter("resolvers","caches")
-local report_resolvers=logs.reporter("resolvers","caching")
-local resolvers=resolvers
-local cleanpath=resolvers.cleanpath
-local resolvepath=resolvers.resolve
-local luautilities=utilities.lua
-do
- local directive_cleanup=false directives.register("system.compile.cleanup",function(v) directive_cleanup=v end)
- local directive_strip=false directives.register("system.compile.strip",function(v) directive_strip=v end)
- local compilelua=luautilities.compile
- function luautilities.compile(luafile,lucfile,cleanup,strip)
- if cleanup==nil then cleanup=directive_cleanup end
- if strip==nil then strip=directive_strip end
- return compilelua(luafile,lucfile,cleanup,strip)
- end
-end
-caches=caches or {}
-local caches=caches
-local writable=nil
-local readables={}
-local usedreadables={}
-local compilelua=luautilities.compile
-local luasuffixes=luautilities.suffixes
-caches.base=caches.base or "luatex-cache"
-caches.more=caches.more or "context"
-caches.defaults={ "TMPDIR","TEMPDIR","TMP","TEMP","HOME","HOMEPATH" }
-local direct_cache=false
-local fast_cache=false
-local cache_tree=false
-directives.register("system.caches.direct",function(v) direct_cache=true end)
-directives.register("system.caches.fast",function(v) fast_cache=true end)
-local function configfiles()
- return concat(resolvers.configurationfiles(),";")
-end
-local function hashed(tree)
- tree=gsub(tree,"[\\/]+$","")
- tree=lower(tree)
- local hash=md5hex(tree)
- if trace_cache or trace_locating then
- report_caches("hashing tree %a, hash %a",tree,hash)
- end
- return hash
-end
-local function treehash()
- local tree=configfiles()
- if not tree or tree=="" then
- return false
- else
- return hashed(tree)
- end
-end
-caches.hashed=hashed
-caches.treehash=treehash
-caches.configfiles=configfiles
-local function identify()
- local texmfcaches=resolvers.cleanpathlist("TEXMFCACHE")
- if texmfcaches then
- for k=1,#texmfcaches do
- local cachepath=texmfcaches[k]
- if cachepath~="" then
- cachepath=resolvepath(cachepath)
- cachepath=cleanpath(cachepath)
- cachepath=collapsepath(cachepath)
- local valid=isdir(cachepath)
- if valid then
- if is_readable(cachepath) then
- readables[#readables+1]=cachepath
- if not writable and is_writable(cachepath) then
- writable=cachepath
- end
- end
- elseif not writable then
- local cacheparent=dirname(cachepath)
- if is_writable(cacheparent) then
- mkdirs(cachepath)
- if isdir(cachepath) and is_writable(cachepath) then
- report_caches("path %a created",cachepath)
- writable=cachepath
- readables[#readables+1]=cachepath
- end
- end
- end
- end
- end
- end
- local texmfcaches=caches.defaults
- if texmfcaches then
- for k=1,#texmfcaches do
- local cachepath=texmfcaches[k]
- cachepath=resolvers.expansion(cachepath)
- if cachepath~="" then
- cachepath=resolvepath(cachepath)
- cachepath=cleanpath(cachepath)
- local valid=isdir(cachepath)
- if valid and is_readable(cachepath) then
- if not writable and is_writable(cachepath) then
- readables[#readables+1]=cachepath
- writable=cachepath
- break
- end
- end
- end
- end
- end
- if not writable then
- report_caches("fatal error: there is no valid writable cache path defined")
- osexit()
- elseif #readables==0 then
- report_caches("fatal error: there is no valid readable cache path defined")
- osexit()
- end
- writable=expanddirname(cleanpath(writable))
- local base=caches.base
- local more=caches.more
- local tree=cache_tree or treehash()
- if tree then
- cache_tree=tree
- writable=mkdirs(writable,base,more,tree)
- for i=1,#readables do
- readables[i]=joinfile(readables[i],base,more,tree)
- end
- else
- writable=mkdirs(writable,base,more)
- for i=1,#readables do
- readables[i]=joinfile(readables[i],base,more)
- end
- end
- if trace_cache then
- for i=1,#readables do
- report_caches("using readable path %a (order %s)",readables[i],i)
- end
- report_caches("using writable path %a",writable)
- end
- identify=function()
- return writable,readables
- end
- return writable,readables
-end
-function caches.usedpaths(separator)
- local writable,readables=identify()
- if #readables>1 then
- local result={}
- local done={}
- for i=1,#readables do
- local readable=readables[i]
- if readable==writable then
- done[readable]=true
- result[#result+1]=formatters["readable+writable: %a"](readable)
- elseif usedreadables[i] then
- done[readable]=true
- result[#result+1]=formatters["readable: %a"](readable)
- end
- end
- if not done[writable] then
- result[#result+1]=formatters["writable: %a"](writable)
- end
- return concat(result,separator or " | ")
- else
- return writable or "?"
- end
-end
-local r_cache={}
-local w_cache={}
-local function getreadablepaths(...)
- local tags={... }
- local hash=concat(tags,"/")
- local done=r_cache[hash]
- if not done then
- local writable,readables=identify()
- if #tags>0 then
- done={}
- for i=1,#readables do
- done[i]=joinfile(readables[i],...)
- end
- else
- done=readables
- end
- r_cache[hash]=done
- end
- 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()
- if #tags>0 then
- done=mkdirs(writable,...)
- else
- done=writable
- end
- w_cache[hash]=done
- end
- return done
-end
-local function setfirstwritablefile(filename,...)
- local wr=getwritablepath(...)
- local fullname=joinfile(wr,filename)
- return fullname,wr
-end
-local function setluanames(path,name)
- return
- format("%s/%s.%s",path,name,luasuffixes.tma),
- format("%s/%s.%s",path,name,luasuffixes.tmc)
-end
-local function getfirstreadablefile(filename,...)
- local fullname,path=setfirstwritablefile(filename,...)
- if is_readable(fullname) then
- return fullname,path
- end
- local rd=getreadablepaths(...)
- for i=1,#rd do
- local path=rd[i]
- local fullname=joinfile(path,filename)
- if is_readable(fullname) then
- usedreadables[i]=true
- return fullname,path
- end
- end
- return fullname,path
-end
-caches.getreadablepaths=getreadablepaths
-caches.getwritablepath=getwritablepath
-caches.setfirstwritablefile=setfirstwritablefile
-caches.getfirstreadablefile=getfirstreadablefile
-caches.setluanames=setluanames
-local checkmemory=utilities and utilities.lua and utilities.lua.checkmemory
-local threshold=100
-function caches.loaddata(readables,name,writable)
- local used=checkmemory and checkmemory()
- if type(readables)=="string" then
- readables={ readables }
- end
- for i=1,#readables do
- local path=readables[i]
- local loader=false
- local state=false
- local tmaname,tmcname=setluanames(path,name)
- if isfile(tmcname) then
- state,loader=pcall(loadfile,tmcname)
- end
- if not loader and isfile(tmaname) then
- local tmacrap,tmcname=setluanames(writable,name)
- if isfile(tmcname) then
- state,loader=pcall(loadfile,tmcname)
- end
- compilelua(tmaname,tmcname)
- if isfile(tmcname) then
- state,loader=pcall(loadfile,tmcname)
- end
- if not loader then
- state,loader=pcall(loadfile,tmaname)
- end
- end
- if loader then
- loader=loader()
- if checkmemory then
- checkmemory(used,threshold)
- else
- collectgarbage("step")
- end
- return loader
- end
- end
- return false
-end
-function caches.is_writable(filepath,filename)
- local tmaname,tmcname=setluanames(filepath,filename)
- return is_writable(tmaname)
-end
-local saveoptions={ compact=true,accurate=not JITSUPPORTED }
-function caches.savedata(filepath,filename,data,fast)
- local tmaname,tmcname=setluanames(filepath,filename)
- data.cache_uuid=osuuid()
- if fast or fast_cache then
- savedata(tmaname,fastserialize(data,true))
- elseif direct_cache then
- savedata(tmaname,serialize(data,true,saveoptions))
- else
- serializetofile(tmaname,data,true,saveoptions)
- end
- compilelua(tmaname,tmcname)
-end
-local content_state={}
-function caches.contentstate()
- return content_state or {}
-end
-function caches.loadcontent(cachename,dataname,filename)
- if not filename then
- local name=hashed(cachename)
- local full,path=getfirstreadablefile(addsuffix(name,luasuffixes.lua),"trees")
- filename=joinfile(path,name)
- end
- local state,blob=pcall(loadfile,addsuffix(filename,luasuffixes.luc))
- if not blob then
- state,blob=pcall(loadfile,addsuffix(filename,luasuffixes.lua))
- end
- 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 %a for %a from %a",dataname,cachename,filename)
- end
- return data.content
- else
- report_resolvers("skipping %a for %a from %a (version mismatch)",dataname,cachename,filename)
- end
- else
- report_resolvers("skipping %a for %a from %a (datatype mismatch)",dataname,cachename,filename)
- end
- elseif trace_locating then
- report_resolvers("skipping %a for %a from %a (no content)",dataname,cachename,filename)
- end
- elseif trace_locating then
- report_resolvers("skipping %a for %a from %a (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,filename)
- if not filename then
- local name=hashed(cachename)
- local full,path=setfirstwritablefile(addsuffix(name,luasuffixes.lua),"trees")
- filename=joinfile(path,name)
- end
- local luaname=addsuffix(filename,luasuffixes.lua)
- local lucname=addsuffix(filename,luasuffixes.luc)
- if trace_locating then
- report_resolvers("preparing %a for %a",dataname,cachename)
- end
- local data={
- type=dataname,
- root=cachename,
- version=resolvers.cacheversion,
- date=osdate("%Y-%m-%d"),
- time=osdate("%H:%M:%S"),
- content=content,
- uuid=osuuid(),
- }
- local ok=savedata(luaname,serialize(data,true))
- if ok then
- if trace_locating then
- report_resolvers("category %a, cachename %a saved in %a",dataname,cachename,luaname)
- end
- if compilelua(luaname,lucname) then
- if trace_locating then
- report_resolvers("%a compiled to %a",dataname,lucname)
- end
- return true
- else
- if trace_locating then
- report_resolvers("compiling failed for %a, deleting file %a",dataname,lucname)
- end
- removefile(lucname)
- end
- elseif trace_locating then
- report_resolvers("unable to save %a in %a (access error)",dataname,luaname)
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-met"] = package.loaded["data-met"] or true
-
--- original size: 5518, stripped down to: 3854
-
-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 type=type
-local find=string.find
-local addurlscheme,urlhashed=url.addscheme,url.hashed
-local collapsepath,joinfile=file.collapsepath,file.join
-local report_methods=logs.reporter("resolvers","methods")
-local trace_locating=false
-local trace_methods=false
-trackers.register("resolvers.locating",function(v) trace_methods=v end)
-trackers.register("resolvers.methods",function(v) trace_methods=v end)
-local allocate=utilities.storage.allocate
-local resolvers=resolvers
-local registered={}
-local function splitmethod(filename)
- if not filename then
- return {
- scheme="unknown",
- original=filename,
- }
- end
- if type(filename)=="table" then
- return filename
- end
- filename=collapsepath(filename,".")
- if not find(filename,"://",1,true) then
- return {
- scheme="file",
- path=filename,
- original=filename,
- filename=filename,
- }
- end
- local specification=urlhashed(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
-local function methodhandler(what,first,...)
- local method=registered[what]
- if method then
- local how=method.how
- local namespace=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("resolving, method %a, how %a, handler %a, argument %a",what,how,scheme,first)
- end
- return resolver(specification,...)
- else
- resolver=namespace.default or namespace.file
- if resolver then
- if trace_methods then
- report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,"default",first)
- end
- return resolver(specification,...)
- elseif trace_methods then
- report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,"unset")
- end
- end
- elseif how=="tag" then
- local resolver=namespace and namespace[first]
- if resolver then
- if trace_methods then
- report_methods("resolving, method %a, how %a, tag %a",what,how,first)
- end
- return resolver(...)
- else
- resolver=namespace.default or namespace.file
- if resolver then
- if trace_methods then
- report_methods("resolving, method %a, how %a, tag %a",what,how,"default")
- end
- return resolver(...)
- elseif trace_methods then
- report_methods("resolving, method %a, how %a, tag %a",what,how,"unset")
- end
- end
- end
- else
- report_methods("resolving, invalid method %a")
- 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=joinfile }
-local locators=allocate { notfound=function() end }
-local hashers=allocate { notfound=function() end }
-local generators=allocate { notfound=function() end }
-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")
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-res"] = package.loaded["data-res"] or true
-
--- original size: 69576, stripped down to: 44470
-
-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",
-}
-local gsub,find,lower,upper,match,gmatch=string.gsub,string.find,string.lower,string.upper,string.match,string.gmatch
-local concat,insert,remove=table.concat,table.insert,table.remove
-local next,type,rawget,loadfile=next,type,rawget,loadfile
-local mergedtable=table.merged
-local os=os
-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 formatters=string.formatters
-local filedirname=file.dirname
-local filebasename=file.basename
-local suffixonly=file.suffixonly
-local addsuffix=file.addsuffix
-local removesuffix=file.removesuffix
-local filejoin=file.join
-local collapsepath=file.collapsepath
-local joinpath=file.joinpath
-local is_qualified_path=file.is_qualified_path
-local allocate=utilities.storage.allocate
-local settings_to_array=utilities.parsers.settings_to_array
-local urlhasscheme=url.hasscheme
-local getcurrentdir=lfs.currentdir
-local isfile=lfs.isfile
-local isdir=lfs.isdir
-local setmetatableindex=table.setmetatableindex
-local luasuffixes=utilities.lua.suffixes
-local trace_locating=false trackers .register("resolvers.locating",function(v) trace_locating=v end)
-local trace_details=false trackers .register("resolvers.details",function(v) trace_details=v end)
-local trace_expansions=false trackers .register("resolvers.expansions",function(v) trace_expansions=v end)
-local trace_paths=false trackers .register("resolvers.paths",function(v) trace_paths=v end)
-local resolve_otherwise=true directives.register("resolvers.otherwise",function(v) resolve_otherwise=v end)
-local report_resolving=logs.reporter("resolvers","resolving")
-local resolvers=resolvers
-local expandedpathfromlist=resolvers.expandedpathfromlist
-local checkedvariable=resolvers.checkedvariable
-local splitconfigurationpath=resolvers.splitconfigurationpath
-local methodhandler=resolvers.methodhandler
-local filtered=resolvers.filtered_from_content
-local lookup=resolvers.get_from_content
-local cleanpath=resolvers.cleanpath
-local resolveprefix=resolvers.resolve
-local initializesetter=utilities.setters.initialize
-local ostype,osname,osenv,ossetenv,osgetenv=os.type,os.name,os.env,os.setenv,os.getenv
-resolvers.cacheversion="1.100"
-resolvers.configbanner=""
-resolvers.homedir=environment.homedir
-resolvers.luacnfname="texmfcnf.lua"
-resolvers.luacnffallback="contextcnf.lua"
-resolvers.luacnfstate="unknown"
-local criticalvars={
- "SELFAUTOLOC",
- "SELFAUTODIR",
- "SELFAUTOPARENT",
- "TEXMFCNF",
- "TEXMF",
- "TEXOS",
-}
-if environment.default_texmfcnf then
- resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
-else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
-end
-local unset_variable="unset"
-local formats=resolvers.formats
-local suffixes=resolvers.suffixes
-local usertypes=resolvers.usertypes
-local dangerous=resolvers.dangerous
-local suffixmap=resolvers.suffixmap
-resolvers.defaultsuffixes={ "tex" }
-local instance=nil
-local variable
-local expansion
-local setenv
-local getenv
-local formatofsuffix=resolvers.formatofsuffix
-local splitpath=resolvers.splitpath
-local splitmethod=resolvers.splitmethod
-setenv=function(key,value,raw)
- if instance then
- instance.environment[key]=value
- ossetenv(key,raw and value or resolveprefix(value))
- end
-end
-getenv=function(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
-end
-resolvers.getenv=getenv
-resolvers.setenv=setenv
-local dollarstripper=lpeg.stripper("$")
-local inhibitstripper=P("!")^0*Cs(P(1)^0)
-local expandedvariable,resolvedvariable do
- local function resolveinstancevariable(k)
- return instance.expansions[k]
- end
- local p_variable=P("$")/""
- local p_key=C(R("az","AZ","09","__","--")^1)
- local p_whatever=P(";")*((1-S("!{}/\\"))^1*P(";")/"")+P(";")*(P(";")/"")+P(1)
- local variableexpander=Cs((p_variable*(p_key/resolveinstancevariable)+p_whatever)^1 )
- local p_cleaner=P("\\")/"/"+P(";")*S("!{}/\\")^0*P(";")^1/";"
- local variablecleaner=Cs((p_cleaner+P(1))^0)
- local p_variable=R("az","AZ","09","__","--")^1/resolveinstancevariable
- local p_variable=(P("$")/"")*(p_variable+(P("{")/"")*p_variable*(P("}")/""))
- local variableresolver=Cs((p_variable+P(1))^0)
- expandedvariable=function(var)
- return lpegmatch(variableexpander,var) or var
- end
- function resolvers.reset()
- if trace_locating then
- report_resolving("creating instance")
- end
- local environment={}
- local variables={}
- local expansions={}
- local order={}
- instance={
- environment=environment,
- variables=variables,
- expansions=expansions,
- order=order,
- files={},
- setups={},
- found={},
- foundintrees={},
- hashes={},
- hashed={},
- pathlists=false,
- specification={},
- lists={},
- data={},
- fakepaths={},
- remember=true,
- diskcache=true,
- renewcache=false,
- renewtree=false,
- loaderror=false,
- savelists=true,
- pattern=nil,
- force_suffixes=true,
- pathstack={},
- }
- 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 v==nil then
- v=""
- end
- t[k]=v
- return v
- end)
- local repath=resolvers.repath
- setmetatableindex(environment,function(t,k)
- local v=osgetenv(k)
- if v==nil then
- v=variables[k]
- end
- if v~=nil then
- v=checkedvariable(v) or ""
- end
- v=repath(v)
- t[k]=v
- return v
- end)
- setmetatableindex(expansions,function(t,k)
- local v=environment[k]
- if type(v)=="string" then
- v=lpegmatch(variableresolver,v)
- v=lpegmatch(variablecleaner,v)
- end
- t[k]=v
- return v
- end)
- end
-end
-function resolvers.initialized()
- return instance~=nil
-end
-local function reset_hashes()
- instance.lists={}
- instance.pathlists=false
- instance.found={}
-end
-local function reset_caches()
- instance.lists={}
- instance.pathlists=false
-end
-local makepathexpression do
- local slash=P("/")
- local pathexpressionpattern=Cs (
- Cc("^")*(
- Cc("%")*S(".-")+slash^2*P(-1)/"/.*"
-+slash^2/"/"+(1-slash)*P(-1)*Cc("/")+P(1)
- )^1*Cc("$")
- )
- local cache={}
- makepathexpression=function(str)
- if str=="." then
- return "^%./$"
- else
- local c=cache[str]
- if not c then
- c=lpegmatch(pathexpressionpattern,str)
- cache[str]=c
- end
- return c
- end
- end
-end
-local function reportcriticalvariables(cnfspec)
- if trace_locating then
- for i=1,#criticalvars do
- local k=criticalvars[i]
- local v=getenv(k) or "unknown"
- report_resolving("variable %a set to %a",k,v)
- end
- report_resolving()
- if cnfspec then
- report_resolving("using configuration specification %a",type(cnfspec)=="table" and concat(cnfspec,",") or cnfspec)
- end
- report_resolving()
- end
- reportcriticalvariables=function() end
-end
-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(cnfspec)
- local cnfpaths=expandedpathfromlist(splitpath(cnfspec))
- local function locatecnf(luacnfname,kind)
- for i=1,#cnfpaths do
- local filepath=cnfpaths[i]
- local filename=collapsepath(filejoin(filepath,luacnfname))
- local realname=resolveprefix(filename)
- if trace_locating then
- local fullpath=gsub(resolveprefix(collapsepath(filepath)),"//","/")
- local weirdpath=find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c",1,true)
- report_resolving("looking for %s %a on %s path %a from specification %a",
- kind,luacnfname,weirdpath and "weird" or "given",fullpath,filepath)
- end
- if isfile(realname) then
- specification[#specification+1]=filename
- if trace_locating then
- report_resolving("found %s configuration file %a",kind,realname)
- end
- end
- end
- end
- locatecnf(resolvers.luacnfname,"regular")
- if #specification==0 then
- locatecnf(resolvers.luacnffallback,"fallback")
- end
- 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
- local setups=instance.setups
- local order=instance.order
- 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=resolveprefix(filename)
- local blob=loadfile(realname)
- if blob then
- local data=blob()
- local parent=data and data.parent
- if parent then
- local filename=filejoin(pathname,parent)
- local realname=resolveprefix(filename)
- local blob=loadfile(realname)
- if blob then
- local parentdata=blob()
- if parentdata then
- report_resolving("loading configuration file %a",filename)
- data=mergedtable(parentdata,data)
- end
- end
- end
- data=data and data.content
- if data then
- if trace_locating then
- report_resolving("loading configuration file %a",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 %a in configuration file %a should move to the 'variables' subtable",
- k,resolveprefix(filename))
- warning=true
- end
- variables[k]=v
- end
- end
- setups[pathname]=variables
- if resolvers.luacnfstate=="default" then
- local cnfspec=variables["TEXMFCNF"]
- if cnfspec then
- if trace_locating then
- report_resolving("reloading configuration due to TEXMF redefinition")
- end
- setenv("TEXMFCNF",cnfspec)
- instance.specification={}
- identify_configuration_files()
- load_configuration_files()
- resolvers.luacnfstate="configuration"
- break
- end
- end
- else
- if trace_locating then
- report_resolving("skipping configuration file %a (no content)",filename)
- end
- setups[pathname]={}
- instance.loaderror=true
- end
- elseif trace_locating then
- report_resolving("skipping configuration file %a (no valid format)",filename)
- end
- order[#order+1]=setups[pathname]
- if instance.loaderror then
- break
- end
- end
- elseif trace_locating then
- report_resolving("warning: no lua configuration files found")
- end
-end
-local expandedpathlist
-local unexpandedpathlist
-function resolvers.configurationfiles()
- return instance.specification or {}
-end
-local function load_file_databases()
- instance.loaderror=false
- instance.files={}
- 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
-local function locate_file_databases()
- local texmfpaths=expandedpathlist("TEXMF")
- if #texmfpaths>0 then
- for i=1,#texmfpaths do
- local path=collapsepath(texmfpaths[i])
- path=gsub(path,"/+$","")
- local stripped=lpegmatch(inhibitstripper,path)
- if stripped~="" then
- local runtime=stripped==path
- path=cleanpath(path)
- local spec=splitmethod(stripped)
- if runtime and (spec.noscheme or spec.scheme=="file") then
- stripped="tree:///"..stripped
- elseif spec.scheme=="cache" or spec.scheme=="file" then
- stripped=spec.path
- end
- if trace_locating then
- if runtime then
- report_resolving("locating list of %a (runtime) (%s)",path,stripped)
- else
- report_resolving("locating list of %a (cached)",path)
- end
- end
- 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
-end
-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
-local function save_file_databases()
- local hashes=instance.hashes
- local files=instance.files
- for i=1,#hashes do
- local hash=hashes[i]
- local cachename=hash.name
- if hash.cache then
- local content=files[cachename]
- caches.collapsecontent(content)
- if trace_locating then
- report_resolving("saving tree %a",cachename)
- end
- caches.savecontent(cachename,"files",content)
- elseif trace_locating then
- report_resolving("not saving runtime tree %a",cachename)
- end
- end
-end
-function resolvers.renew(hashname)
- local files=instance.files
- if hashname and hashname~="" then
- local expanded=expansion(hashname) or ""
- if expanded~="" then
- if trace_locating then
- report_resolving("identifying tree %a from %a",expanded,hashname)
- end
- hashname=expanded
- else
- if trace_locating then
- report_resolving("identifying tree %a",hashname)
- end
- end
- local realpath=resolveprefix(hashname)
- if isdir(realpath) then
- if trace_locating then
- report_resolving("using path %a",realpath)
- end
- methodhandler('generators',hashname)
- local content=files[hashname]
- caches.collapsecontent(content)
- if trace_locating then
- report_resolving("saving tree %a",hashname)
- end
- caches.savecontent(hashname,"files",content)
- else
- report_resolving("invalid path %a",realpath)
- end
- 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.appendhash(type,name,cache)
- local hashed=instance.hashed
- local hashes=instance.hashes
- if hashed[name] then
- else
- if trace_locating then
- report_resolving("hash %a appended",name)
- end
- insert(hashes,{ type=type,name=name,cache=cache } )
- hashed[name]=cache
- end
-end
-function resolvers.prependhash(type,name,cache)
- local hashed=instance.hashed
- local hashes=instance.hashes
- if hashed[name] then
- else
- if trace_locating then
- report_resolving("hash %a prepended",name)
- end
- insert(hashes,1,{ type=type,name=name,cache=cache } )
- hashed[name]=cache
- end
-end
-function resolvers.extendtexmfvariable(specification)
- local environment=instance.environment
- local variables=instance.variables
- local texmftrees=splitpath(getenv("TEXMF"))
- insert(texmftrees,1,specification)
- texmftrees=concat(texmftrees,",")
- if environment["TEXMF"] then
- environment["TEXMF"]=texmftrees
- elseif variables["TEXMF"] then
- variables["TEXMF"]=texmftrees
- else
- end
- reset_hashes()
-end
-function resolvers.splitexpansions()
- local expansions=instance.expansions
- for k,v in next,expansions 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 tn>1 then
- expansions[k]=t
- else
- expansions[k]=t[1]
- end
- end
-end
-function resolvers.datastate()
- return caches.contentstate()
-end
-variable=function(name)
- local variables=instance.variables
- local name=name and lpegmatch(dollarstripper,name)
- local result=name and variables[name]
- return result~=nil and result or ""
-end
-expansion=function(name)
- local expansions=instance.expansions
- local name=name and lpegmatch(dollarstripper,name)
- local result=name and expansions[name]
- return result~=nil and result or ""
-end
-resolvers.variable=variable
-resolvers.expansion=expansion
-unexpandedpathlist=function(str)
- local pth=variable(str)
- local lst=splitpath(pth)
- return expandedpathfromlist(lst)
-end
-function resolvers.unexpandedpath(str)
- return joinpath(unexpandedpathlist(str))
-end
-function resolvers.pushpath(name)
- local pathstack=instance.pathstack
- local lastpath=pathstack[#pathstack]
- local pluspath=filedirname(name)
- if lastpath then
- lastpath=collapsepath(filejoin(lastpath,pluspath))
- else
- lastpath=collapsepath(pluspath)
- end
- insert(pathstack,lastpath)
- if trace_paths then
- report_resolving("pushing path %a",lastpath)
- end
-end
-function resolvers.poppath()
- local pathstack=instance.pathstack
- if trace_paths and #pathstack>0 then
- report_resolving("popping path %a",pathstack[#pathstack])
- end
- remove(pathstack)
-end
-function resolvers.stackpath()
- local pathstack=instance.pathstack
- local currentpath=pathstack[#pathstack]
- return currentpath~="" and currentpath or nil
-end
-local done={}
-function resolvers.resetextrapaths()
- local extra_paths=instance.extra_paths
- if not extra_paths then
- done={}
- instance.extra_paths={}
- elseif #ep>0 then
- done={}
- reset_caches()
- end
-end
-function resolvers.getextrapaths()
- return instance.extra_paths or {}
-end
-function resolvers.registerextrapath(paths,subpaths)
- if not subpaths or subpaths=="" then
- if not paths or path=="" then
- return
- elseif done[paths] then
- return
- end
- end
- local paths=settings_to_array(paths)
- local subpaths=settings_to_array(subpaths)
- local extra_paths=instance.extra_paths or {}
- local oldn=#extra_paths
- local newn=oldn
- local nofpaths=#paths
- local nofsubpaths=#subpaths
- if nofpaths>0 then
- if nofsubpaths>0 then
- for i=1,nofpaths do
- local p=paths[i]
- for j=1,nofsubpaths do
- local s=subpaths[j]
- local ps=p.."/"..s
- if not done[ps] then
- newn=newn+1
- extra_paths[newn]=cleanpath(ps)
- done[ps]=true
- end
- end
- end
- else
- for i=1,nofpaths do
- local p=paths[i]
- if not done[p] then
- newn=newn+1
- extra_paths[newn]=cleanpath(p)
- done[p]=true
- end
- end
- end
- elseif nofsubpaths>0 then
- for i=1,oldn do
- for j=1,nofsubpaths do
- local s=subpaths[j]
- local ps=extra_paths[i].."/"..s
- if not done[ps] then
- newn=newn+1
- extra_paths[newn]=cleanpath(ps)
- done[ps]=true
- end
- end
- end
- end
- if newn>0 then
- instance.extra_paths=extra_paths
- end
- if newn~=oldn then
- reset_caches()
- end
-end
-function resolvers.pushextrapath(path)
- local paths=settings_to_array(path)
- local extra_stack=instance.extra_stack
- if extra_stack then
- insert(extra_stack,1,paths)
- else
- instance.extra_stack={ paths }
- end
- reset_caches()
-end
-function resolvers.popextrapath()
- local extra_stack=instance.extra_stack
- if extra_stack then
- reset_caches()
- return remove(extra_stack,1)
- end
-end
-local function made_list(instance,list,extra_too)
- local done={}
- local new={}
- local newn=0
- local function add(p)
- for k=1,#p do
- local v=p[k]
- if not done[v] then
- done[v]=true
- newn=newn+1
- new[newn]=v
- end
- end
- end
- for k=1,#list do
- local v=list[k]
- if done[v] then
- elseif find(v,"^[%.%/]$") then
- done[v]=true
- newn=newn+1
- new[newn]=v
- else
- break
- end
- end
- if extra_too then
- local extra_stack=instance.extra_stack
- local extra_paths=instance.extra_paths
- if extra_stack and #extra_stack>0 then
- for k=1,#extra_stack do
- add(extra_stack[k])
- end
- end
- if extra_paths and #extra_paths>0 then
- add(extra_paths)
- end
- end
- add(list)
- return new
-end
-expandedpathlist=function(str,extra_too)
- if not str then
- return {}
- elseif instance.savelists then
- str=lpegmatch(dollarstripper,str)
- local lists=instance.lists
- local lst=lists[str]
- if not lst then
- local l=made_list(instance,splitpath(expansion(str)),extra_too)
- lst=expandedpathfromlist(l)
- lists[str]=lst
- end
- return lst
- else
- local lst=splitpath(expansion(str))
- return made_list(instance,expandedpathfromlist(lst),extra_too)
- end
-end
-resolvers.expandedpathlist=expandedpathlist
-resolvers.unexpandedpathlist=unexpandedpathlist
-function resolvers.cleanpathlist(str)
- local t=expandedpathlist(str)
- if t then
- for i=1,#t do
- t[i]=collapsepath(cleanpath(t[i]))
- end
- end
- return t
-end
-function resolvers.expandpath(str)
- return joinpath(expandedpathlist(str))
-end
-local function expandedpathlistfromvariable(str)
- str=lpegmatch(dollarstripper,str)
- local tmp=resolvers.variableofformatorsuffix(str)
- return expandedpathlist(tmp~="" and tmp or str)
-end
-function resolvers.expandpathfromvariable(str)
- return joinpath(expandedpathlistfromvariable(str))
-end
-resolvers.expandedpathlistfromvariable=expandedpathlistfromvariable
-function resolvers.cleanedpathlist(v)
- local t=expandedpathlist(v)
- for i=1,#t do
- t[i]=resolveprefix(cleanpath(t[i]))
- end
- return t
-end
-function resolvers.expandbraces(str)
- local pth=expandedpathfromlist(splitpath(str))
- return joinpath(pth)
-end
-function resolvers.registerfilehash(name,content,someerror)
- local files=instance.files
- if content then
- files[name]=content
- else
- files[name]={}
- if somerror==true then
- instance.loaderror=someerror
- end
- end
-end
-function resolvers.getfilehashes()
- return instance and instance.files or {}
-end
-function resolvers.gethashes()
- return instance and instance.hashes or {}
-end
-function resolvers.renewcache()
- if instance then
- instance.renewcache=true
- end
-end
-local function isreadable(name)
- local readable=isfile(name)
- if trace_details then
- if readable then
- report_resolving("file %a is readable",name)
- else
- report_resolving("file %a is not readable",name)
- end
- end
- return readable
-end
-local function collect_files(names)
- local filelist={}
- local noffiles=0
- local function check(hash,root,pathname,path,basename,name)
- if not pathname or find(path,pathname) then
- local variant=hash.type
- local search=filejoin(root,path,name)
- local result=methodhandler('concatinators',variant,root,path,name)
- if trace_details then
- report_resolving("match: variant %a, search %a, result %a",variant,search,result)
- end
- noffiles=noffiles+1
- filelist[noffiles]={ variant,search,result }
- end
- end
- for k=1,#names do
- local filename=names[k]
- if trace_details then
- report_resolving("checking name %a",filename)
- end
- local basename=filebasename(filename)
- local pathname=filedirname(filename)
- if pathname=="" or find(pathname,"^%.") then
- pathname=false
- else
- pathname=gsub(pathname,"%*",".*")
- pathname="/"..pathname.."$"
- end
- local hashes=instance.hashes
- local files=instance.files
- for h=1,#hashes do
- local hash=hashes[h]
- local hashname=hash.name
- local content=hashname and files[hashname]
- if content then
- if trace_details then
- report_resolving("deep checking %a, base %a, pattern %a",hashname,basename,pathname)
- end
- local path,name=lookup(content,basename)
- if path then
- local metadata=content.metadata
- local realroot=metadata and metadata.path or hashname
- if type(path)=="string" then
- check(hash,realroot,pathname,path,basename,name)
- else
- for i=1,#path do
- check(hash,realroot,pathname,path[i],basename,name)
- end
- end
- end
- elseif trace_locating then
- report_resolving("no match in %a (%s)",hashname,basename)
- end
- end
- end
- return noffiles>0 and filelist or nil
-end
-local fit={}
-function resolvers.registerintrees(filename,format,filetype,usedmethod,foundname)
- local foundintrees=instance.foundintrees
- if usedmethod=="direct" and filename==foundname and fit[foundname] then
- else
- local collapsed=collapsepath(foundname,true)
- local t={
- filename=filename,
- format=format~="" and format or nil,
- filetype=filetype~="" and filetype or nil,
- usedmethod=usedmethod,
- foundname=foundname,
- fullname=collapsed,
- }
- fit[foundname]=t
- foundintrees[#foundintrees+1]=t
- end
-end
-function resolvers.foundintrees()
- return instance.foundintrees or {}
-end
-function resolvers.foundintree(fullname)
- local f=fit[fullname]
- return f and f.usedmethod=="database"
-end
-local function can_be_dir(name)
- local fakepaths=instance.fakepaths
- if not fakepaths[name] then
- if isdir(name) then
- fakepaths[name]=1
- else
- fakepaths[name]=2
- end
- end
- return fakepaths[name]==1
-end
-local preparetreepattern=Cs((P(".")/"%%."+P("-")/"%%-"+P(1))^0*Cc("$"))
-local collect_instance_files
-local function find_analyze(filename,askedformat,allresults)
- local filetype=''
- local filesuffix=suffixonly(filename)
- local wantedfiles={}
- wantedfiles[#wantedfiles+1]=filename
- if askedformat=="" then
- if filesuffix=="" or not suffixmap[filesuffix] then
- local defaultsuffixes=resolvers.defaultsuffixes
- for i=1,#defaultsuffixes do
- local forcedname=filename..'.'..defaultsuffixes[i]
- wantedfiles[#wantedfiles+1]=forcedname
- filetype=formatofsuffix(forcedname)
- if trace_locating then
- report_resolving("forcing filetype %a",filetype)
- end
- end
- else
- filetype=formatofsuffix(filename)
- if trace_locating then
- report_resolving("using suffix based filetype %a",filetype)
- end
- end
- else
- if filesuffix=="" or not suffixmap[filesuffix] 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 %a",filetype)
- end
- end
- return filetype,wantedfiles
-end
-local function find_direct(filename,allresults)
- if not dangerous[askedformat] and isreadable(filename) then
- if trace_details then
- report_resolving("file %a found directly",filename)
- end
- return "direct",{ filename }
- end
-end
-local function find_wildcard(filename,allresults)
- if find(filename,'*',1,true) then
- if trace_locating then
- report_resolving("checking wildcard %a",filename)
- end
- local result=resolvers.findwildcardfiles(filename)
- if result then
- return "wildcard",result
- end
- end
-end
-local function find_qualified(filename,allresults,askedformat,alsostripped)
- if not is_qualified_path(filename) then
- return
- end
- if trace_locating then
- report_resolving("checking qualified name %a",filename)
- end
- if isreadable(filename) then
- if trace_details then
- report_resolving("qualified file %a found",filename)
- end
- return "qualified",{ filename }
- end
- if trace_details then
- report_resolving("locating qualified file %a",filename)
- end
- local forcedname,suffix="",suffixonly(filename)
- if suffix=="" then
- local format_suffixes=askedformat=="" and resolvers.defaultsuffixes or suffixes[askedformat]
- if format_suffixes then
- for i=1,#format_suffixes do
- local suffix=format_suffixes[i]
- forcedname=filename.."."..suffix
- if isreadable(forcedname) then
- if trace_locating then
- report_resolving("no suffix, forcing format filetype %a",suffix)
- end
- return "qualified",{ forcedname }
- end
- end
- end
- end
- if alsostripped and suffix and suffix~="" then
- local basename=filebasename(filename)
- local pattern=lpegmatch(preparetreepattern,filename)
- local savedformat=askedformat
- local format=savedformat or ""
- if format=="" then
- askedformat=formatofsuffix(suffix)
- end
- if not format then
- askedformat="othertextfiles"
- 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 "qualified",result
- end
- end
- end
- end
-end
-local function check_subpath(fname)
- if isreadable(fname) then
- if trace_details then
- report_resolving("found %a by deep scanning",fname)
- end
- return fname
- end
-end
-local function makepathlist(list,filetype)
- local typespec=resolvers.variableofformat(filetype)
- local pathlist=expandedpathlist(typespec,filetype and usertypes[filetype])
- local entry={}
- if pathlist and #pathlist>0 then
- for k=1,#pathlist do
- local path=pathlist[k]
- local prescanned=find(path,'^!!')
- local resursive=find(path,'//$')
- local pathname=lpegmatch(inhibitstripper,path)
- local expression=makepathexpression(pathname)
- local barename=gsub(pathname,"/+$","")
- barename=resolveprefix(barename)
- local scheme=urlhasscheme(barename)
- local schemename=gsub(barename,"%.%*$",'')
- entry[k]={
- path=path,
- pathname=pathname,
- prescanned=prescanned,
- recursive=recursive,
- expression=expression,
- barename=barename,
- scheme=scheme,
- schemename=schemename,
- }
- end
- entry.typespec=typespec
- list[filetype]=entry
- else
- list[filetype]=false
- end
- return entry
-end
-local function find_intree(filename,filetype,wantedfiles,allresults)
- local pathlists=instance.pathlists
- if not pathlists then
- pathlists=setmetatableindex({},makepathlist)
- instance.pathlists=pathlists
- end
- local pathlist=pathlists[filetype]
- if pathlist then
- local method="intree"
- local filelist=collect_files(wantedfiles)
- local dirlist={}
- local result={}
- if filelist then
- for i=1,#filelist do
- dirlist[i]=filedirname(filelist[i][3]).."/"
- end
- end
- if trace_details then
- report_resolving("checking filename %a in tree",filename)
- end
- for k=1,#pathlist do
- local entry=pathlist[k]
- local path=entry.path
- local pathname=entry.pathname
- local done=false
- if filelist then
- local expression=entry.expression
- if trace_details then
- report_resolving("using pattern %a for path %a",expression,pathname)
- end
- for k=1,#filelist do
- local fl=filelist[k]
- local f=fl[2]
- local d=dirlist[k]
- if find(d,expression) or find(resolveprefix(d),expression) then
- result[#result+1]=resolveprefix(fl[3])
- done=true
- if allresults then
- if trace_details then
- report_resolving("match to %a in hash for file %a and path %a, continue scanning",expression,f,d)
- end
- else
- if trace_details then
- report_resolving("match to %a in hash for file %a and path %a, quit scanning",expression,f,d)
- end
- break
- end
- elseif trace_details then
- report_resolving("no match to %a in hash for file %a and path %a",expression,f,d)
- end
- end
- end
- if done then
- method="database"
- else
- method="filesystem"
- local scheme=entry.scheme
- if not scheme or scheme=="file" then
- local pname=entry.schemename
- if not find(pname,"*",1,true) then
- if can_be_dir(pname) then
- if not done and not entry.prescanned then
- if trace_details then
- report_resolving("quick root scan for %a",pname)
- end
- for k=1,#wantedfiles do
- local w=wantedfiles[k]
- local fname=check_subpath(filejoin(pname,w))
- if fname then
- result[#result+1]=fname
- done=true
- if not allresults then
- break
- end
- end
- end
- if not done and entry.recursive then
- if trace_details then
- report_resolving("scanning filesystem for %a",pname)
- end
- local files=resolvers.simplescanfiles(pname,false,true)
- for k=1,#wantedfiles do
- local w=wantedfiles[k]
- local subpath=files[w]
- if not subpath or subpath=="" then
- elseif type(subpath)=="string" then
- local fname=check_subpath(filejoin(pname,subpath,w))
- if fname then
- result[#result+1]=fname
- done=true
- if not allresults then
- break
- end
- end
- else
- for i=1,#subpath do
- local sp=subpath[i]
- if sp=="" then
- else
- local fname=check_subpath(filejoin(pname,sp,w))
- if fname then
- result[#result+1]=fname
- done=true
- if not allresults then
- break
- end
- end
- end
- end
- if done and not allresults then
- break
- end
- end
- end
- end
- end
- end
- else
- end
- else
- for k=1,#wantedfiles do
- local pname=entry.barename
- local fname=methodhandler('finders',pname.."/"..wantedfiles[k])
- if fname then
- result[#result+1]=fname
- done=true
- if not allresults then
- break
- end
- end
- end
- end
- end
- if done and not allresults then
- break
- end
- end
- if #result>0 then
- return method,result
- end
- end
-end
-local function find_onpath(filename,filetype,wantedfiles,allresults)
- if trace_details then
- report_resolving("checking filename %a, filetype %a, wanted files %a",filename,filetype,concat(wantedfiles," | "))
- end
- local result={}
- for k=1,#wantedfiles do
- local fname=wantedfiles[k]
- if fname and isreadable(fname) then
- filename=fname
- result[#result+1]=filejoin('.',fname)
- if not allresults then
- break
- end
- end
- end
- if #result>0 then
- return "onpath",result
- end
-end
-local function find_otherwise(filename,filetype,wantedfiles,allresults)
- local filelist=collect_files(wantedfiles)
- local fl=filelist and filelist[1]
- if fl then
- return "otherwise",{ resolveprefix(fl[3]) }
- end
-end
-collect_instance_files=function(filename,askedformat,allresults)
- if not filename or filename=="" then
- return {}
- end
- askedformat=askedformat or ""
- filename=collapsepath(filename,".")
- filename=gsub(filename,"^%./",getcurrentdir().."/")
- if allresults then
- local filetype,wantedfiles=find_analyze(filename,askedformat)
- local results={
- { find_direct (filename,true) },
- { find_wildcard (filename,true) },
- { find_qualified(filename,true,askedformat) },
- { find_intree (filename,filetype,wantedfiles,true) },
- { find_onpath (filename,filetype,wantedfiles,true) },
- { find_otherwise(filename,filetype,wantedfiles,true) },
- }
- local result={}
- local status={}
- local done={}
- for k,r in next,results do
- local method,list=r[1],r[2]
- if method and list then
- for i=1,#list do
- local c=collapsepath(list[i])
- if not done[c] then
- result[#result+1]=c
- done[c]=true
- end
- status[#status+1]=formatters["%-10s: %s"](method,c)
- end
- end
- end
- if trace_details then
- report_resolving("lookup status: %s",table.serialize(status,filename))
- end
- return result,status
- else
- local method,result,stamp,filetype,wantedfiles
- if instance.remember then
- if askedformat=="" then
- stamp=formatters["%s::%s"](suffixonly(filename),filename)
- else
- stamp=formatters["%s::%s"](askedformat,filename)
- end
- result=stamp and instance.found[stamp]
- if result then
- if trace_locating then
- report_resolving("remembered file %a",filename)
- end
- return result
- end
- end
- method,result=find_direct(filename)
- if not result then
- method,result=find_wildcard(filename)
- if not result then
- method,result=find_qualified(filename,false,askedformat)
- if not result then
- filetype,wantedfiles=find_analyze(filename,askedformat)
- method,result=find_intree(filename,filetype,wantedfiles)
- if not result then
- method,result=find_onpath(filename,filetype,wantedfiles)
- if resolve_otherwise and not result then
- method,result=find_otherwise(filename,filetype,wantedfiles)
- end
- end
- end
- end
- end
- if result and #result>0 then
- local foundname=collapsepath(result[1])
- resolvers.registerintrees(filename,askedformat,filetype,method,foundname)
- result={ foundname }
- else
- result={}
- end
- if stamp then
- if trace_locating then
- report_resolving("remembering file %a using hash %a",filename,stamp)
- end
- instance.found[stamp]=result
- end
- return result
- end
-end
-local function findfiles(filename,filetype,allresults)
- if not filename or filename=="" then
- return {}
- end
- if allresults==nil then
- allresults=true
- end
- local result,status=collect_instance_files(filename,filetype or "",allresults)
- if not result or #result==0 then
- local lowered=lower(filename)
- if filename~=lowered then
- result,status=collect_instance_files(lowered,filetype or "",allresults)
- end
- end
- return result or {},status
-end
-local function findfile(filename,filetype)
- if not filename or filename=="" then
- return ""
- else
- return findfiles(filename,filetype,false)[1] or ""
- end
-end
-resolvers.findfiles=findfiles
-resolvers.findfile=findfile
-resolvers.find_file=findfile
-resolvers.find_files=findfiles
-function resolvers.findpath(filename,filetype)
- return filedirname(findfiles(filename,filetype,false)[1] or "")
-end
-local function findgivenfiles(filename,allresults)
- local hashes=instance.hashes
- local files=instance.files
- local base=filebasename(filename)
- local result={}
- local function okay(hash,path,name)
- local found=methodhandler('concatinators',hash.type,hash.name,path,name)
- if found and found~="" then
- result[#result+1]=resolveprefix(found)
- return not allresults
- end
- end
- for k=1,#hashes do
- local hash=hashes[k]
- local content=files[hash.name]
- if content then
- local path,name=lookup(content,base)
- if not path then
- elseif type(path)=="string" then
- if okay(hash,path,name) then
- return result
- end
- else
- for i=1,#path do
- if okay(hash,path[i],name) then
- return result
- end
- end
- end
- end
- end
- return result
-end
-function resolvers.findgivenfiles(filename)
- return findgivenfiles(filename,true)
-end
-function resolvers.findgivenfile(filename)
- return findgivenfiles(filename,false)[1] or ""
-end
-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)
- local files=instance.files
- local hashes=instance.hashes
- local 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)
- if find(name,"*",1,true) then
- local function okay(found,path,base,hashname,hashtype)
- if find(found,path) then
- local full=methodhandler('concatinators',hashtype,hashname,found,base)
- if full and full~="" then
- result[#result+1]=resolveprefix(full)
- return not allresults
- end
- end
- end
- for k=1,#hashes do
- local hash=hashes[k]
- local hashname=hash.name
- local hashtype=hash.type
- if hashname and hashtype then
- for found,base in filtered(files[hashname],name) do
- if type(found)=='string' then
- if okay(found,path,base,hashname,hashtype) then
- break
- end
- else
- for i=1,#found do
- if okay(found[i],path,base,hashname,hashtype) then
- break
- end
- end
- end
- end
- end
- end
- else
- local function okayokay(found,path,base,hashname,hashtype)
- if find(found,path) then
- local full=methodhandler('concatinators',hashtype,hashname,found,base)
- if full and full~="" then
- result[#result+1]=resolveprefix(full)
- return not allresults
- end
- end
- end
- for k=1,#hashes do
- local hash=hashes[k]
- local hashname=hash.name
- local hashtype=hash.type
- if hashname and hashtype then
- local found,base=lookup(content,base)
- if not found then
- elseif type(found)=='string' then
- if okay(found,path,base,hashname,hashtype) then
- break
- end
- else
- for i=1,#found do
- if okay(found[i],path,base,hashname,hashtype) then
- break
- end
- end
- end
- end
- end
- end
- return result
-end
-function resolvers.findwildcardfiles(filename,result)
- return findwildcardfiles(filename,true,result)
-end
-function resolvers.findwildcardfile(filename)
- return findwildcardfiles(filename,false)[1] or ""
-end
-do
- local starttiming=statistics.starttiming
- local stoptiming=statistics.stoptiming
- local elapsedtime=statistics.elapsedtime
- function resolvers.starttiming()
- starttiming(instance)
- end
- function resolvers.stoptiming()
- stoptiming(instance)
- end
- function resolvers.loadtime()
- return elapsedtime(instance)
- end
-end
-function resolvers.automount()
-end
-function resolvers.load(option)
- resolvers.starttiming()
- identify_configuration_files()
- load_configuration_files()
- if option~="nofiles" then
- load_databases()
- resolvers.automount()
- end
- resolvers.stoptiming()
- local files=instance.files
- return files and next(files) and true
-end
-local function report(str)
- if trace_locating then
- report_resolving(str)
- else
- print(str)
- end
-end
-function resolvers.dowithfilesandreport(command,files,...)
- if files and #files>0 then
- if trace_locating then
- report('')
- end
- if type(files)=="string" then
- files={ files }
- end
- for f=1,#files do
- local file=files[f]
- local result=command(file,...)
- if type(result)=='string' then
- report(result)
- else
- for i=1,#result do
- report(result[i])
- end
- end
- end
- end
-end
-function resolvers.showpath(str)
- return joinpath(expandedpathlist(resolvers.formatofvariable(str)))
-end
-function resolvers.registerfile(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.dowithpath(name,func)
- local pathlist=expandedpathlist(name)
- for i=1,#pathlist do
- func("^"..cleanpath(pathlist[i]))
- end
-end
-function resolvers.dowithvariable(name,func)
- func(expandedvariable(name))
-end
-function resolvers.locateformat(name)
- local engine=environment.ownmain or "luatex"
- local barename=removesuffix(file.basename(name))
- local fullname=addsuffix(barename,"fmt")
- local fmtname=caches.getfirstreadablefile(fullname,"formats",engine) or ""
- if fmtname=="" then
- fmtname=findfile(fullname)
- fmtname=cleanpath(fmtname)
- end
- if fmtname~="" then
- local barename=removesuffix(fmtname)
- local luaname=addsuffix(barename,luasuffixes.lua)
- local lucname=addsuffix(barename,luasuffixes.luc)
- local luiname=addsuffix(barename,luasuffixes.lui)
- if isfile(luiname) then
- return fmtname,luiname
- elseif isfile(lucname) then
- return fmtname,lucname
- elseif isfile(luaname) then
- return fmtname,luaname
- end
- end
- return nil,nil
-end
-function resolvers.booleanvariable(str,default)
- local b=expansion(str)
- if b=="" then
- return default
- else
- b=toboolean(b)
- return (b==nil and default) or b
- end
-end
-function resolvers.dowithfilesintree(pattern,handle,before,after)
- local hashes=instance.hashes
- local files=instance.files
- for i=1,#hashes do
- local hash=hashes[i]
- local blobtype=hash.type
- local blobpath=hash.name
- if blobtype and blobpath then
- local total=0
- local checked=0
- local done=0
- if before then
- before(blobtype,blobpath,pattern)
- end
- for path,name in filtered(files[blobpath],pattern) do
- if type(path)=="string" then
- checked=checked+1
- if handle(blobtype,blobpath,path,name) then
- done=done+1
- end
- else
- checked=checked+#path
- for i=1,#path do
- if handle(blobtype,blobpath,path[i],name) then
- done=done+1
- end
- end
- end
- end
- if after then
- after(blobtype,blobpath,pattern,checked,done)
- end
- end
- end
-end
-function resolvers.knownvariables(pattern)
- if instance then
- local environment=instance.environment
- local variables=instance.variables
- local expansions=instance.expansions
- local order=instance.order
- local pattern=upper(pattern or "")
- local result={}
- for i=1,#order do
- for key in next,order[i] do
- if result[key]==nil and key~="" and (pattern=="" or find(upper(key),pattern)) then
- result[key]={
- environment=rawget(environment,key),
- variable=key,
- expansion=expansions[key],
- resolved=resolveprefix(expansions[key]),
- }
- end
- end
- end
- return result
- else
- return {}
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-pre"] = package.loaded["data-pre"] or true
-
--- original size: 5088, stripped down to: 3144
-
-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",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-local insert,remove=table.insert,table.remove
-local resolvers=resolvers
-local prefixes=resolvers.prefixes
-local cleanpath=resolvers.cleanpath
-local findgivenfile=resolvers.findgivenfile
-local expansion=resolvers.expansion
-local getenv=resolvers.getenv
-local basename=file.basename
-local dirname=file.dirname
-local joinpath=file.join
-local isfile=lfs.isfile
-prefixes.environment=function(str)
- return cleanpath(expansion(str))
-end
-local function relative(str,n)
- if not isfile(str) then
- local pstr="./"..str
- if isfile(pstr) then
- str=pstr
- else
- local p="../"
- for i=1,n or 2 do
- local pstr=p..str
- if isfile(pstr) then
- str=pstr
- break
- else
- p=p.."../"
- end
- end
- end
- end
- return cleanpath(str)
-end
-local function locate(str)
- local fullname=findgivenfile(str) or ""
- return cleanpath(fullname~="" and fullname or str)
-end
-prefixes.relative=relative
-prefixes.locate=locate
-prefixes.auto=function(str)
- local fullname=relative(str)
- if not isfile(fullname) then
- fullname=locate(str)
- end
- return fullname
-end
-prefixes.filename=function(str)
- local fullname=findgivenfile(str) or ""
- return cleanpath(basename((fullname~="" and fullname) or str))
-end
-prefixes.pathname=function(str)
- local fullname=findgivenfile(str) or ""
- return cleanpath(dirname((fullname~="" and fullname) or str))
-end
-prefixes.selfautoloc=function(str)
- local pth=getenv('SELFAUTOLOC')
- return cleanpath(str and joinpath(pth,str) or pth)
-end
-prefixes.selfautoparent=function(str)
- local pth=getenv('SELFAUTOPARENT')
- return cleanpath(str and joinpath(pth,str) or pth)
-end
-prefixes.selfautodir=function(str)
- local pth=getenv('SELFAUTODIR')
- return cleanpath(str and joinpath(pth,str) or pth)
-end
-prefixes.home=function(str)
- local pth=getenv('HOME')
- return cleanpath(str and joinpath(pth,str) or pth)
-end
-prefixes.env=prefixes.environment
-prefixes.rel=prefixes.relative
-prefixes.loc=prefixes.locate
-prefixes.kpse=prefixes.locate
-prefixes.full=prefixes.locate
-prefixes.file=prefixes.filename
-prefixes.path=prefixes.pathname
-local inputstack={}
-local stackpath=resolvers.stackpath
-local function toppath()
- if not inputstack then
- return "."
- end
- local pathname=dirname(inputstack[#inputstack] or "")
- if pathname=="" then
- return "."
- else
- return pathname
- end
-end
-local function jobpath()
- local path=stackpath()
- if not path or path=="" then
- return "."
- else
- return path
- end
-end
-local function pushinputname(name)
- insert(inputstack,name)
-end
-local function popinputname(name)
- return remove(inputstack)
-end
-resolvers.toppath=toppath
-resolvers.jobpath=jobpath
-resolvers.pushinputname=pushinputname
-resolvers.popinputname=popinputname
-prefixes.toppath=function(str) return cleanpath(joinpath(toppath(),str)) end
-prefixes.jobpath=function(str) return cleanpath(joinpath(jobpath(),str)) end
-resolvers.setdynamic("toppath")
-resolvers.setdynamic("jobpath")
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-inp"] = package.loaded["data-inp"] or true
-
--- original size: 910, stripped down to: 818
-
-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"
-}
-local allocate=utilities.storage.allocate
-local resolvers=resolvers
-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
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-out"] = package.loaded["data-out"] or true
-
--- original size: 551, stripped down to: 470
-
-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"
-}
-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
-
-package.loaded["data-fil"] = package.loaded["data-fil"] or true
-
--- original size: 4365, stripped down to: 3452
-
-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 ioopen=io.open
-local isdir=lfs.isdir
-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 resolveprefix=resolvers.resolve
-local findfile=resolvers.findfile
-local scanfiles=resolvers.scanfiles
-local registerfilehash=resolvers.registerfilehash
-local appendhash=resolvers.appendhash
-local loadcachecontent=caches.loadcontent
-function resolvers.locators.file(specification)
- local filename=specification.filename
- local realname=resolveprefix(filename)
- if realname and realname~='' and isdir(realname) then
- if trace_locating then
- report_files("file locator %a found as %a",filename,realname)
- end
- appendhash('file',filename,true)
- elseif trace_locating then
- report_files("file locator %a not found",filename)
- end
-end
-function resolvers.hashers.file(specification)
- local pathname=specification.filename
- local content=loadcachecontent(pathname,'files')
- registerfilehash(pathname,content,content==nil)
-end
-function resolvers.generators.file(specification)
- local pathname=specification.filename
- local content=scanfiles(pathname,false,true)
- registerfilehash(pathname,content,true)
-end
-resolvers.concatinators.file=file.join
-local finders=resolvers.finders
-local notfound=finders.notfound
-function finders.file(specification,filetype)
- local filename=specification.filename
- local foundname=findfile(filename,filetype)
- if foundname and foundname~="" then
- if trace_locating then
- report_files("file finder: %a found",filename)
- end
- return foundname
- else
- if trace_locating then
- report_files("file finder: %a not found",filename)
- end
- return notfound()
- end
-end
-local openers=resolvers.openers
-local notfound=openers.notfound
-local overloaded=false
-local function textopener(tag,filename,f)
- return {
- reader=function() return f:read () end,
- close=function() return f:close() end,
- }
-end
-function openers.helpers.textopener(...)
- return textopener(...)
-end
-function openers.helpers.settextopener(opener)
- if overloaded then
- report_files("file opener: %s overloaded","already")
- else
- if trace_locating then
- report_files("file opener: %s overloaded","once")
- end
- overloaded=true
- textopener=opener
- end
-end
-function openers.file(specification,filetype)
- local filename=specification.filename
- if filename and filename~="" then
- local f=ioopen(filename,"r")
- if f then
- if trace_locating then
- report_files("file opener: %a opened",filename)
- end
- return textopener("file",filename,f)
- end
- end
- if trace_locating then
- report_files("file opener: %a not found",filename)
- end
- return notfound()
-end
-local loaders=resolvers.loaders
-local notfound=loaders.notfound
-function loaders.file(specification,filetype)
- local filename=specification.filename
- if filename and filename~="" then
- local f=ioopen(filename,"rb")
- if f then
- if trace_locating then
- report_files("file loader: %a loaded",filename)
- end
- local s=f:read("*a")
- f:close()
- if s then
- return true,s,#s
- end
- end
- end
- if trace_locating then
- report_files("file loader: %a not found",filename)
- end
- return notfound()
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-con"] = package.loaded["data-con"] or true
-
--- original size: 5388, stripped down to: 3685
-
-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 setmetatable=setmetatable
-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)
-containers=containers or {}
-local containers=containers
-containers.usecache=true
-local getwritablepath=caches.getwritablepath
-local getreadablepaths=caches.getreadablepaths
-local cacheiswritable=caches.is_writable
-local loaddatafromcache=caches.loaddata
-local savedataincache=caches.savedata
-local report_containers=logs.reporter("resolvers","containers")
-local allocated={}
-local mt={
- __index=function(t,k)
- if k=="writable" then
- local writable=getwritablepath(t.category,t.subcategory) or { "." }
- t.writable=writable
- return writable
- elseif k=="readables" then
- local readables=getreadablepaths(t.category,t.subcategory) or { "." }
- t.readables=readables
- return readables
- end
- end,
- __storage__=true
-}
-function containers.define(category,subcategory,version,enabled)
- 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,
- trace=false,
- }
- setmetatable(s,mt)
- c[subcategory]=s
- end
- return s
- end
-end
-function containers.is_usable(container,name)
- return container.enabled and caches and cacheiswritable(container.writable,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)
- local storage=container.storage
- local stored=storage[name]
- if not stored and container.enabled and caches and containers.usecache then
- stored=loaddatafromcache(container.readables,name,container.writable)
- if stored and stored.cache_version==container.version then
- if trace_cache or trace_containers then
- report_containers("action %a, category %a, name %a","load",container.subcategory,name)
- end
- else
- stored=nil
- end
- storage[name]=stored
- elseif stored then
- if trace_cache or trace_containers then
- report_containers("action %a, category %a, name %a","reuse",container.subcategory,name)
- end
- end
- return stored
-end
-function containers.write(container,name,data,fast)
- if data then
- data.cache_version=container.version
- if container.enabled and caches then
- local unique=data.unique
- local shared=data.shared
- data.unique=nil
- data.shared=nil
- savedataincache(container.writable,name,data,fast)
- if trace_cache or trace_containers then
- report_containers("action %a, category %a, name %a","save",container.subcategory,name)
- end
- data.unique=unique
- data.shared=shared
- end
- if trace_cache or trace_containers then
- report_containers("action %a, category %a, name %a","store",container.subcategory,name)
- end
- 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\128-\255]+","-"))
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-use"] = package.loaded["data-use"] or true
-
--- original size: 5785, stripped down to: 2905
-
-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=string.format
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_mounts=logs.reporter("resolvers","mounts")
-local resolvers=resolvers
-local findfile=resolvers.findfile
-statistics.register("used config file",function() return caches.configfiles() end)
-statistics.register("used cache path",function() return caches.usedpaths() end)
-function statistics.savefmtstatus(texname,formatbanner,sourcefile,banner)
- local enginebanner=status.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(findfile(sourcefile)) or "unknown"),
- sourcefile=sourcefile,
- luaversion=LUAVERSION,
- formatid=LUATEXFORMATID,
- functionality=LUATEXFUNCTIONALITY,
- }
- io.savedata(luvname,table.serialize(luvdata,true))
- lua.registerfinalizer(function()
- if jit then
- logs.report("format banner","%s lua: %s jit",banner,LUAVERSION)
- else
- logs.report("format banner","%s lua: %s",banner,LUAVERSION)
- end
- logs.newline()
- end)
- end
-end
-function statistics.checkfmtstatus(texname)
- local enginebanner=status.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(findfile(luv.sourcefile)) or "unknown")
- local luvbanner=luv.enginebanner or "?"
- if luvbanner~=enginebanner then
- return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner)
- end
- local luvhash=luv.sourcehash or "?"
- if luvhash~=sourcehash then
- return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash)
- end
- local luvluaversion=luv.luaversion or 0
- local engluaversion=LUAVERSION or 0
- if luvluaversion~=engluaversion then
- return format("lua mismatch (luv: %s <> bin: %s)",luvluaversion,engluaversion)
- end
- local luvfunctionality=luv.functionality or 0
- local engfunctionality=status.development_id or 0
- if luvfunctionality~=engfunctionality then
- return format("functionality mismatch (luv: %s <> bin: %s)",luvfunctionality,engfunctionality)
- end
- local luvformatid=luv.formatid or 0
- local engformatid=status.format_id or 0
- if luvformatid~=engformatid then
- return format("formatid mismatch (luv: %s <> bin: %s)",luvformatid,engformatid)
- 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
-
-package.loaded["data-zip"] = package.loaded["data-zip"] or true
-
--- original size: 10725, stripped down to: 7949
-
-if not modules then modules={} end modules ['data-zip']={
- 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,match=string.format,string.find,string.match
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_zip=logs.reporter("resolvers","zip")
-local resolvers=resolvers
-local findfile=resolvers.findfile
-local registerfile=resolvers.registerfile
-local splitmethod=resolvers.splitmethod
-local prependhash=resolvers.prependhash
-local starttiming=resolvers.starttiming
-local extendtexmf=resolvers.extendtexmfvariable
-local stoptiming=resolvers.stoptiming
-local urlquery=url.query
-zip=zip or {}
-local zip=zip
-local archives=zip.archives or {}
-zip.archives=archives
-local registeredfiles=zip.registeredfiles or {}
-zip.registeredfiles=registeredfiles
-local zipfiles=utilities.zipfiles
-local openzip,closezip,validfile,wholefile,filehandle,traversezip
-if zipfiles then
- local ipairs=ipairs
- openzip=zipfiles.open
- closezip=zipfiles.close
- validfile=zipfiles.found
- wholefile=zipfiles.unzip
- local listzip=zipfiles.list
- traversezip=function(zfile)
- return ipairs(listzip(zfile))
- end
- local streams=utilities.streams
- local openstream=streams.open
- local readstring=streams.readstring
- local streamsize=streams.size
- local metatable={
- close=streams.close,
- read=function(stream,n)
- readstring(stream,n=="*a" and streamsize(stream) or n)
- end
- }
- filehandle=function(zfile,queryname)
- local data=wholefile(zfile,queryname)
- if data then
- local stream=openstream(data)
- if stream then
- return setmetatableindex(stream,metatable)
- end
- end
- end
-else
- openzip=zip.open
- closezip=zip.close
- validfile=function(zfile,queryname)
- local dfile=zfile:open(queryname)
- if dfile then
- dfile:close()
- return true
- end
- return false
- end
- traversezip=function(zfile)
- return z:files()
- end
- wholefile=function(zfile,queryname)
- local dfile=zfile:open(queryname)
- if dfile then
- local s=dfile:read("*all")
- dfile:close()
- return s
- end
- end
- filehandle=function(zfile,queryname)
- local dfile=zfile:open(queryname)
- if dfile then
- return dfile
- end
- end
-end
-local function validzip(str)
- if not find(str,"^zip://") then
- return "zip:///"..str
- else
- return str
- end
-end
-local function openarchive(name)
- if not name or name=="" then
- return nil
- else
- local arch=archives[name]
- if not arch then
- local full=findfile(name) or ""
- arch=full~="" and openzip(full) or false
- archives[name]=arch
- end
- return arch
- end
-end
-local function closearchive(name)
- if not name or (name=="" and archives[name]) then
- closezip(archives[name])
- archives[name]=nil
- end
-end
-zip.openarchive=openarchive
-zip.closearchive=closearchive
-function resolvers.locators.zip(specification)
- local archive=specification.filename
- local zipfile=archive and archive~="" and openarchive(archive)
- if trace_locating then
- if zipfile then
- report_zip("locator: archive %a found",archive)
- else
- report_zip("locator: archive %a not found",archive)
- end
- end
-end
-function resolvers.concatinators.zip(zipfile,path,name)
- if not path or path=="" then
- return format('%s?name=%s',zipfile,name)
- else
- return format('%s?name=%s/%s',zipfile,path,name)
- end
-end
-local finders=resolvers.finders
-local notfound=finders.notfound
-function finders.zip(specification)
- local original=specification.original
- local archive=specification.filename
- if archive then
- local query=urlquery(specification.query)
- local queryname=query.name
- if queryname then
- local zfile=openarchive(archive)
- if zfile then
- if trace_locating then
- report_zip("finder: archive %a found",archive)
- end
- if validfile(zfile,queryname) then
- if trace_locating then
- report_zip("finder: file %a found",queryname)
- end
- return specification.original
- elseif trace_locating then
- report_zip("finder: file %a not found",queryname)
- end
- elseif trace_locating then
- report_zip("finder: unknown archive %a",archive)
- end
- end
- end
- if trace_locating then
- report_zip("finder: %a not found",original)
- end
- return notfound()
-end
-local openers=resolvers.openers
-local notfound=openers.notfound
-local textopener=openers.helpers.textopener
-function openers.zip(specification)
- local original=specification.original
- local archive=specification.filename
- if archive then
- local query=urlquery(specification.query)
- local queryname=query.name
- if queryname then
- local zfile=openarchive(archive)
- if zfile then
- if trace_locating then
- report_zip("opener; archive %a opened",archive)
- end
- local handle=filehandle(zfile,queryname)
- if handle then
- if trace_locating then
- report_zip("opener: file %a found",queryname)
- end
- return textopener('zip',original,handle)
- elseif trace_locating then
- report_zip("opener: file %a not found",queryname)
- end
- elseif trace_locating then
- report_zip("opener: unknown archive %a",archive)
- end
- end
- end
- if trace_locating then
- report_zip("opener: %a not found",original)
- end
- return notfound()
-end
-local loaders=resolvers.loaders
-local notfound=loaders.notfound
-function loaders.zip(specification)
- local original=specification.original
- local archive=specification.filename
- if archive then
- local query=urlquery(specification.query)
- local queryname=query.name
- if queryname then
- local zfile=openarchive(archive)
- if zfile then
- if trace_locating then
- report_zip("loader: archive %a opened",archive)
- end
- local data=wholefile(zfile,queryname)
- if data then
- if trace_locating then
- report_zip("loader; file %a loaded",original)
- end
- return true,data,#data
- elseif trace_locating then
- report_zip("loader: file %a not found",queryname)
- end
- elseif trace_locating then
- report_zip("loader; unknown archive %a",archive)
- end
- end
- end
- if trace_locating then
- report_zip("loader: %a not found",original)
- end
- return notfound()
-end
-local function registerzipfile(z,tree)
- local names={}
- local files={}
- local remap={}
- local n=0
- local filter=tree=="" and "^(.+)/(.-)$" or format("^%s/(.+)/(.-)$",tree)
- if trace_locating then
- report_zip("registering: using filter %a",filter)
- end
- starttiming()
- for i in traversezip(z) do
- local filename=i.filename
- local path,name=match(filename,filter)
- if not path then
- n=n+1
- registerfile(names,filename,"")
- local usedname=lower(filename)
- files[usedname]=""
- if usedname~=filename then
- remap[usedname]=filename
- end
- elseif name and name~="" then
- n=n+1
- register(names,name,path)
- local usedname=lower(name)
- files[usedname]=path
- if usedname~=name then
- remap[usedname]=name
- end
- else
- end
- end
- stoptiming()
- report_zip("registering: %s files registered",n)
- return {
- files=files,
- remap=remap,
- }
-end
-local function usezipfile(archive)
- local specification=splitmethod(archive)
- local archive=specification.filename
- if archive and not registeredfiles[archive] then
- local z=openarchive(archive)
- if z then
- local tree=urlquery(specification.query).tree or ""
- if trace_locating then
- report_zip("registering: archive %a",archive)
- end
- prependhash('zip',archive)
- extendtexmf(archive)
- registeredfiles[archive]=z
- registerfilehash(archive,registerzipfile(z,tree))
- elseif trace_locating then
- report_zip("registering: unknown archive %a",archive)
- end
- elseif trace_locating then
- report_zip("registering: archive %a not found",archive)
- end
-end
-resolvers.usezipfile=usezipfile
-resolvers.registerzipfile=registerzipfile
-function resolvers.hashers.zip(specification)
- local archive=specification.filename
- if trace_locating then
- report_zip("loading file %a",archive)
- end
- usezipfile(specification.original)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-tre"] = package.loaded["data-tre"] or true
-
--- original size: 10802, stripped down to: 6619
-
-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"
-}
-local type=type
-local find,gsub,lower=string.find,string.gsub,string.lower
-local basename,dirname,joinname=file.basename,file.dirname,file.join
-local globdir,isdir,isfile=dir.glob,lfs.isdir,lfs.isfile
-local P,lpegmatch=lpeg.P,lpeg.match
-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 finders=resolvers.finders
-local openers=resolvers.openers
-local loaders=resolvers.loaders
-local locators=resolvers.locators
-local hashers=resolvers.hashers
-local generators=resolvers.generators
-do
- local collectors={}
- local found={}
- local notfound=finders.notfound
- function finders.tree(specification)
- local spec=specification.filename
- local okay=found[spec]
- if okay==nil then
- if spec~="" then
- local path=dirname(spec)
- local name=basename(spec)
- if path=="" then
- path="."
- end
- local names=collectors[path]
- if not names then
- local pattern=find(path,"/%*+$") and path or (path.."/*")
- names=globdir(pattern)
- collectors[path]=names
- end
- local pattern="/"..gsub(name,"([%.%-%+])","%%%1").."$"
- for i=1,#names do
- local fullname=names[i]
- if find(fullname,pattern) then
- found[spec]=fullname
- return fullname
- end
- end
- local pattern=lower(pattern)
- for i=1,#names do
- local fullname=lower(names[i])
- if find(fullname,pattern) then
- if isfile(fullname) then
- found[spec]=fullname
- return fullname
- else
- break
- end
- end
- end
- end
- okay=notfound()
- found[spec]=okay
- end
- return okay
- end
-end
-do
- local resolveprefix=resolvers.resolve
- local appendhash=resolvers.appendhash
- local function dolocate(specification)
- local name=specification.filename
- local realname=resolveprefix(name)
- if realname and realname~='' and isdir(realname) then
- if trace_locating then
- report_trees("locator %a found",realname)
- end
- appendhash('tree',name,false)
- elseif trace_locating then
- report_trees("locator %a not found",name)
- end
- end
- locators.tree=dolocate
- locators.dirlist=dolocate
- locators.dirfile=dolocate
-end
-do
- local filegenerator=generators.file
- generators.dirlist=filegenerator
- generators.dirfile=filegenerator
-end
-do
- local filegenerator=generators.file
- local methodhandler=resolvers.methodhandler
- local function dohash(specification)
- local name=specification.filename
- if trace_locating then
- report_trees("analyzing %a",name)
- end
- methodhandler("hashers",name)
- filegenerator(specification)
- end
- hashers.tree=dohash
- hashers.dirlist=dohash
- hashers.dirfile=dohash
-end
-local resolve do
- local collectors={}
- local splitter=lpeg.splitat("/**/")
- local stripper=lpeg.replacer { [P("/")*P("*")^1*P(-1)]="" }
- local loadcontent=caches.loadcontent
- local savecontent=caches.savecontent
- local notfound=finders.notfound
- local scanfiles=resolvers.scanfiles
- local lookup=resolvers.get_from_content
- table.setmetatableindex(collectors,function(t,k)
- local rootname=lpegmatch(stripper,k)
- local dataname=joinname(rootname,"dirlist")
- local content=loadcontent(dataname,"files",dataname)
- if not content then
- content=scanfiles(rootname,nil,nil,false,true)
- savecontent(dataname,"files",content,dataname)
- end
- t[k]=content
- return content
- end)
- local function checked(root,p,n)
- if p then
- if type(p)=="table" then
- for i=1,#p do
- local fullname=joinname(root,p[i],n)
- if isfile(fullname) then
- return fullname
- end
- end
- else
- local fullname=joinname(root,p,n)
- if isfile(fullname) then
- return fullname
- end
- end
- end
- return notfound()
- end
- resolve=function(specification)
- local filename=specification.filename
- if filename~="" then
- local root,rest=lpegmatch(splitter,filename)
- if root and rest then
- local path,name=dirname(rest),basename(rest)
- if name~=rest then
- local content=collectors[root]
- local p,n=lookup(content,name)
- if not p then
- return notfound()
- end
- local pattern=".*/"..path.."$"
- local istable=type(p)=="table"
- if istable then
- for i=1,#p do
- local pi=p[i]
- if pi==path or find(pi,pattern) then
- local fullname=joinname(root,pi,n)
- if isfile(fullname) then
- return fullname
- end
- end
- end
- elseif p==path or find(p,pattern) then
- local fullname=joinname(root,p,n)
- if isfile(fullname) then
- return fullname
- end
- end
- local queries=specification.queries
- if queries and queries.option=="fileonly" then
- return checked(root,p,n)
- else
- return notfound()
- end
- end
- end
- local path=dirname(filename)
- local name=basename(filename)
- local root=lpegmatch(stripper,path)
- local content=collectors[path]
- local p,n=lookup(content,name)
- if p then
- return checked(root,p,n)
- end
- end
- return notfound()
- end
- finders.dirlist=resolve
- function finders.dirfile(specification)
- local queries=specification.queries
- if queries then
- queries.option="fileonly"
- else
- specification.queries={ option="fileonly" }
- end
- return resolve(specification)
- end
-end
-do
- local fileopener=openers.file
- local fileloader=loaders.file
- openers.dirlist=fileopener
- loaders.dirlist=fileloader
- openers.dirfile=fileopener
- loaders.dirfile=fileloader
-end
-do
- local hashfile="dirhash.lua"
- local kind="HASH256"
- local version=1.0
- local loadtable=table.load
- local savetable=table.save
- local loaddata=io.loaddata
- function resolvers.dirstatus(patterns)
- local t=type(patterns)
- if t=="string" then
- patterns={ patterns }
- elseif t~="table" then
- return false
- end
- local status=loadtable(hashfile)
- if not status or status.version~=version or status.kind~=kind then
- status={
- version=1.0,
- kind=kind,
- hashes={},
- }
- end
- local hashes=status.hashes
- local changed={}
- local action=sha2[kind]
- local update={}
- for i=1,#patterns do
- local pattern=patterns[i]
- local files=globdir(pattern)
- for i=1,#files do
- local name=files[i]
- local hash=action(loaddata(name))
- if hashes[name]~=hash then
- changed[#changed+1]=name
- end
- update[name]=hash
- end
- end
- status.hashes=update
- savetable(hashfile,status)
- return #changed>0 and changed or false
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-sch"] = package.loaded["data-sch"] or true
-
--- original size: 6945, stripped down to: 5408
-
-if not modules then modules={} end modules ['data-sch']={
- 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 load,tonumber=load,tonumber
-local gsub,format=string.gsub,string.format
-local sortedhash,concat=table.sortedhash,table.concat
-local finders,openers,loaders=resolvers.finders,resolvers.openers,resolvers.loaders
-local addsuffix,suffix,splitbase=file.addsuffix,file.suffix,file.splitbase
-local md5hex=md5.hex
-local trace_schemes=false trackers.register("resolvers.schemes",function(v) trace_schemes=v end)
-local report_schemes=logs.reporter("resolvers","schemes")
-local http=require("socket.http")
-local ltn12=require("ltn12")
-if mbox then mbox=nil end
-local resolvers=resolvers
-local schemes=resolvers.schemes or {}
-resolvers.schemes=schemes
-local cleaners={}
-schemes.cleaners=cleaners
-local threshold=24*60*60
-directives.register("schemes.threshold",function(v) threshold=tonumber(v) or threshold end)
-function cleaners.none(specification)
- return specification.original
-end
-function cleaners.strip(specification)
- local path,name=splitbase(specification.original)
- if path=="" then
- return (gsub(name,"[^%a%d%.]+","-"))
- else
- return (gsub((gsub(path,"%.","-").."-"..name),"[^%a%d%.]+","-"))
- end
-end
-function cleaners.md5(specification)
- return addsuffix(md5hex(specification.original),suffix(specification.path))
-end
-local cleaner=cleaners.strip
-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 %a to %a",specification.original,hash)
- end
- return hash
-end
-local cached={}
-local loaded={}
-local reused={}
-local thresholds={}
-local handlers={}
-local runner=sandbox.registerrunner {
- name="curl resolver",
- method="execute",
- program="curl",
- template='--silent --insecure --create-dirs --output "%cachename%" "%original%"',
- checkers={
- cachename="cache",
- original="url",
- }
-}
-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)>(thresholds[protocol] or threshold)) then
- cached[original]=cachename
- local handler=handlers[scheme]
- if handler then
- if trace_schemes then
- report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in")
- end
- logs.flush()
- handler(specification,cachename)
- else
- if trace_schemes then
- report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl")
- end
- logs.flush()
- runner {
- original=original,
- cachename=cachename,
- }
- end
- end
- if io.exists(cachename) then
- cached[original]=cachename
- if trace_schemes then
- report_schemes("using cached %a, protocol %a, cachename %a",original,scheme,cachename)
- end
- else
- cached[original]=""
- if trace_schemes then
- report_schemes("using missing %a, protocol %a",original,scheme)
- end
- end
- loaded[scheme]=loaded[scheme]+1
- statistics.stoptiming(schemes)
- else
- if trace_schemes then
- report_schemes("reusing %a, protocol %a",original,scheme)
- end
- reused[scheme]=reused[scheme]+1
- end
- return cached[original]
-end
-local function finder(specification,filetype)
- return resolvers.methodhandler("finders",fetch(specification),filetype)
-end
-local opener=openers.file
-local loader=loaders.file
-local function install(scheme,handler,newthreshold)
- handlers [scheme]=handler
- loaded [scheme]=0
- reused [scheme]=0
- finders [scheme]=finder
- openers [scheme]=opener
- loaders [scheme]=loader
- thresholds[scheme]=newthreshold or threshold
-end
-schemes.install=install
-local function http_handler(specification,cachename)
- local tempname=cachename..".tmp"
- local handle=io.open(tempname,"wb")
- local status,message=http.request {
- url=specification.original,
- sink=ltn12.sink.file(handle)
- }
- if not status then
- os.remove(tempname)
- else
- os.remove(cachename)
- os.rename(tempname,cachename)
- end
- return cachename
-end
-install('http',http_handler)
-install('https')
-install('ftp')
-statistics.register("scheme handling time",function()
- local l,r,nl,nr={},{},0,0
- for k,v in sortedhash(loaded) do
- if v>0 then
- nl=nl+1
- l[nl]=k..":"..v
- end
- end
- for k,v in sortedhash(reused) do
- if v>0 then
- nr=nr+1
- r[nr]=k..":"..v
- end
- end
- local n=nl+nr
- if n>0 then
- if nl==0 then l={ "none" } end
- if nr==0 then r={ "none" } end
- return format("%s seconds, %s processed, threshold %s seconds, loaded: %s, reused: %s",
- statistics.elapsedtime(schemes),n,threshold,concat(l," "),concat(l," "))
- else
- return nil
- end
-end)
-local httprequest=http.request
-local toquery=url.toquery
-local function fetchstring(url,data)
- local q=data and toquery(data)
- if q then
- url=url.."?"..q
- end
- local reply=httprequest(url)
- return reply
-end
-schemes.fetchstring=fetchstring
-function schemes.fetchtable(url,data)
- local reply=fetchstring(url,data)
- if reply then
- local s=load("return "..reply)
- if s then
- return s()
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-lua"] = package.loaded["data-lua"] or true
-
--- original size: 4227, stripped down to: 3049
-
-if not modules then modules={} end modules ['data-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 package,lpeg=package,lpeg
-local loadfile=loadfile
-local addsuffix=file.addsuffix
-local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
-local luasuffixes={ 'tex','lua' }
-local libsuffixes={ 'lib' }
-local luaformats={ 'TEXINPUTS','LUAINPUTS' }
-local libformats={ 'CLUAINPUTS' }
-local helpers=package.helpers or {}
-local methods=helpers.methods or {}
-local resolvers=resolvers
-local resolveprefix=resolvers.resolve
-local expandedpaths=resolvers.expandedpathlistfromvariable
-local findfile=resolvers.findfile
-helpers.report=logs.reporter("resolvers","libraries")
-trackers.register("resolvers.libraries",function(v) helpers.trace=v end)
-trackers.register("resolvers.locating",function(v) helpers.trace=v end)
-helpers.sequence={
- "already loaded",
- "preload table",
- "lua variable format",
- "lib variable format",
- "lua extra list",
- "lib extra list",
- "path specification",
- "cpath specification",
- "all in one fallback",
- "not loaded",
-}
-local pattern=Cs(P("!")^0/""*(P("/")*P(-1)/"/"+P("/")^1/"/"+1)^0)
-function helpers.cleanpath(path)
- return resolveprefix(lpegmatch(pattern,path))
-end
-local loadedaslib=helpers.loadedaslib
-local registerpath=helpers.registerpath
-local lualibfile=helpers.lualibfile
-local luaformatpaths
-local libformatpaths
-local function getluaformatpaths()
- if not luaformatpaths then
- luaformatpaths={}
- for i=1,#luaformats do
- registerpath("lua format","lua",luaformatpaths,expandedpaths(luaformats[i]))
- end
- end
- return luaformatpaths
-end
-local function getlibformatpaths()
- if not libformatpaths then
- libformatpaths={}
- for i=1,#libformats do
- registerpath("lib format","lib",libformatpaths,expandedpaths(libformats[i]))
- end
- end
- return libformatpaths
-end
-local function loadedbyformat(name,rawname,suffixes,islib,what)
- local trace=helpers.trace
- local report=helpers.report
- for i=1,#suffixes do
- local format=suffixes[i]
- local resolved=findfile(name,format) or ""
- if trace then
- report("%s format, identifying %a using format %a",what,name,format)
- end
- if resolved~="" then
- if trace then
- report("%s format, %a found on %a",what,name,resolved)
- end
- if islib then
- return loadedaslib(resolved,rawname)
- else
- return loadfile(resolved)
- end
- end
- end
-end
-helpers.loadedbyformat=loadedbyformat
-methods["lua variable format"]=function(name)
- if helpers.trace then
- helpers.report("%s format, checking %s paths","lua",#getluaformatpaths())
- end
- return loadedbyformat(addsuffix(lualibfile(name),"lua"),name,luasuffixes,false,"lua")
-end
-methods["lib variable format"]=function(name)
- if helpers.trace then
- helpers.report("%s format, checking %s paths","lib",#getlibformatpaths())
- end
- return loadedbyformat(addsuffix(lualibfile(name),os.libsuffix),name,libsuffixes,true,"lib")
-end
-resolvers.loadlualib=require
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-aux"] = package.loaded["data-aux"] or true
-
--- original size: 2610, stripped down to: 2019
-
-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 type,next=type,next
-local addsuffix,removesuffix=file.addsuffix,file.removesuffix
-local loaddata,savedata=io.loaddata,io.savedata
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local resolvers=resolvers
-local cleanpath=resolvers.cleanpath
-local findfiles=resolvers.findfiles
-local report_scripts=logs.reporter("resolvers","scripts")
-function resolvers.updatescript(oldname,newname)
- local scriptpath="context/lua"
- local oldscript=cleanpath(oldname)
- local newname=addsuffix(newname,"lua")
- local newscripts=findfiles(newname) or {}
- if trace_locating then
- report_scripts("to be replaced old script %a",oldscript)
- end
- if #newscripts==0 then
- if trace_locating then
- report_scripts("unable to locate new script")
- end
- else
- for i=1,#newscripts do
- local newscript=cleanpath(newscripts[i])
- if trace_locating then
- report_scripts("checking new script %a",newscript)
- end
- if oldscript==newscript then
- if trace_locating then
- report_scripts("old and new script are the same")
- end
- elseif not find(newscript,scriptpath,1,true) then
- if trace_locating then
- report_scripts("new script should come from %a",scriptpath)
- end
- elseif not (find(oldscript,removesuffix(newname).."$") or find(oldscript,newname.."$")) then
- if trace_locating then
- report_scripts("invalid new script name")
- end
- else
- local newdata=loaddata(newscript)
- if newdata then
- if trace_locating then
- report_scripts("old script content replaced by new content: %s",oldscript)
- end
- savedata(oldscript,newdata)
- break
- elseif trace_locating then
- report_scripts("unable to load new script")
- end
- end
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-tmf"] = package.loaded["data-tmf"] or true
-
--- original size: 2601, stripped down to: 1549
-
-if not modules then modules={} end modules ['data-tmf']={
- 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 resolvers=resolvers
-local report_tds=logs.reporter("resolvers","tds")
-function resolvers.load_tree(tree,resolve)
- if type(tree)=="string" and tree~="" then
- local getenv,setenv=resolvers.getenv,resolvers.setenv
- 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 %a under tree %a",texos,tree)
- os.exit()
- end
- if not lfs.isdir(newpath) then
- report_tds("no '%s/bin' under tree %a",texos,tree)
- os.exit()
- end
- local texmfos=newtree
- environment.texroot=newroot
- environment.texos=texos
- environment.texmfos=texmfos
- if resolve then
- resolvers.luacnfspec=resolvers.resolve(resolvers.luacnfspec)
- end
- setenv('SELFAUTOPARENT',newroot)
- setenv('SELFAUTODIR',newtree)
- setenv('SELFAUTOLOC',newpath)
- setenv('TEXROOT',newroot)
- setenv('TEXOS',texos)
- setenv('TEXMFOS',texmfos)
- setenv('TEXMFCNF',resolvers.luacnfspec,true)
- setenv('PATH',newpath..io.pathseparator..getenv('PATH'))
- report_tds("changing from root %a to %a",oldroot,newroot)
- report_tds("prepending %a to PATH",newpath)
- report_tds("setting TEXMFCNF to %a",resolvers.luacnfspec)
- report_tds()
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["data-lst"] = package.loaded["data-lst"] or true
-
--- original size: 2038, stripped down to: 1696
-
-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"
-}
-local type=type
-local sortedhash=table.sortedhash
-local isdir=lfs.isdir
-local resolvers=resolvers
-local listers=resolvers.listers or {}
-resolvers.listers=listers
-local resolveprefix=resolvers.resolve
-local configurationfiles=resolvers.configurationfiles
-local expandedpathfromlist=resolvers.expandedpathfromlist
-local splitpath=resolvers.splitpath
-local knownvariables=resolvers.knownvariables
-local report_lists=logs.reporter("resolvers","lists")
-local report_resolved=logs.reporter("system","resolved")
-local function tabstr(str)
- if not str then
- return "unset"
- elseif type(str)=='table' then
- return concat(str," | ")
- else
- return str
- end
-end
-function listers.variables(pattern)
- local result=resolvers.knownvariables(pattern)
- for key,value in sortedhash(result) do
- report_lists(key)
- report_lists(" env: %s",tabstr(value.environment))
- report_lists(" var: %s",tabstr(value.variable))
- report_lists(" exp: %s",tabstr(value.expansion))
- report_lists(" res: %s",tabstr(value.resolved))
- end
-end
-function listers.configurations()
- local configurations=configurationfiles()
- for i=1,#configurations do
- report_resolved("file : %s",resolveprefix(configurations[i]))
- end
- report_resolved("")
- local list=expandedpathfromlist(splitpath(resolvers.luacnfspec))
- for i=1,#list do
- local li=resolveprefix(list[i])
- if isdir(li) then
- report_resolved("path - %s",li)
- else
- report_resolved("path + %s",li)
- end
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
-
--- original size: 6459, stripped down to: 4006
-
-if not modules then modules={} end modules ['libs-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 type,unpack=type,unpack
-local find=string.find
-local nameonly=file.nameonly
-local joinfile=file.join
-local addsuffix=file.addsuffix
-local qualifiedpath=file.is_qualified_path
-local isfile=lfs.isfile
-local findfile=resolvers.findfile
-local expandpaths=resolvers.expandedpathlistfromvariable
-local report=logs.reporter("resolvers","libraries")
-local trace=false
-local silent=false
-trackers.register("resolvers.lib",function(v) trace=v end)
-trackers.register("resolvers.lib.silent",function(v) silent=v end)
-local function findlib(required)
- local suffix=os.libsuffix or "so"
- if not qualifiedpath(required) then
- local list=directives.value("system.librarynames" )
- local only=nameonly(required)
- if type(list)=="table" then
- list=list[only]
- if type(list)~="table" then
- list={ only }
- end
- else
- list={ only }
- end
- if trace then
- report("using lookup list for library %a: % | t",only,list)
- end
- for i=1,#list do
- local name=list[i]
- local found=findfile(name,"lib")
- if not found then
- found=findfile(addsuffix(name,suffix),"lib")
- end
- if found then
- if trace then
- report("library %a resolved via %a path to %a",name,"tds lib",found)
- end
- return found
- end
- end
- if expandpaths then
- local list=expandpaths("PATH")
- local base=addsuffix(only,suffix)
- for i=1,#list do
- local full=joinfile(list[i],base)
- local found=isfile(full) and full
- if found then
- if trace then
- report("library %a resolved via %a path to %a",name,"system",found)
- end
- return found
- end
- end
- end
- elseif isfile(addsuffix(required,suffix)) then
- if trace then
- report("library with qualified name %a %sfound",required,"")
- end
- return required
- else
- if trace then
- report("library with qualified name %a %sfound",required,"not ")
- end
- end
- return false
-end
-local foundlibraries=table.setmetatableindex(function(t,k)
- local v=findlib(k)
- t[k]=v
- return v
-end)
-function resolvers.findlib(required)
- return foundlibraries[required]
-end
-local libraries={}
-resolvers.libraries=libraries
-local report=logs.reporter("optional")
-if optional then optional.loaded={} end
-function libraries.validoptional(name)
- local thelib=optional and optional[name]
- if not thelib then
- elseif thelib.initialize then
- return thelib
- else
- report("invalid optional library %a",libname)
- end
-end
-function libraries.optionalloaded(name,libnames)
- local thelib=optional and optional[name]
- if not thelib then
- report("no optional %a library found",name)
- else
- local thelib_initialize=thelib.initialize
- if not thelib_initialize then
- report("invalid optional library %a",name)
- else
- if type(libnames)=="string" then
- libnames={ libnames }
- end
- if type(libnames)=="table" then
- for i=1,#libnames do
- local libname=libnames[i]
- local filename=foundlibraries[libname]
- if filename then
- libnames[i]=filename
- else
- report("unable to locate library %a",libname)
- return
- end
- end
- local initialized=thelib_initialize(unpack(libnames))
- if not initialized then
- report("unable to initialize library '% + t'",libnames)
- elseif not silent then
- report("using library '% + t'",libnames)
- end
- return initialized
- end
- end
- end
-end
-if FFISUPPORTED and ffi and ffi.load then
- local ffiload=ffi.load
- function ffi.load(name)
- local full=name and foundlibraries[name]
- if full then
- return ffiload(full)
- else
- return ffiload(name)
- end
- end
-end
-local dofile=dofile
-local savedrequire=require
-function require(name,version)
- if find(name,"%.lua$") or find(name,"%.lmt$") then
- local m=dofile(findfile(name))
- if m then
- package.loaded[name]=m
- return m
- end
- else
- return savedrequire(name)
- end
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["luat-sta"] = package.loaded["luat-sta"] or true
-
--- original size: 5703, stripped down to: 2321
-
-if not modules then modules={} end modules ['luat-sta']={
- version=1.001,
- author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright="PRAGMA ADE / ConTeXt Development Team",
- license="see context related readme files"
-}
-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.tag=states.tag or ""
-states.filename=states.filename or ""
-function states.save(filename,tag)
- tag=tag or states.tag
- filename=file.addsuffix(filename or states.filename,'lus')
- io.savedata(filename,
- "-- generator : luat-sta.lua\n".."-- state tag : "..tag.."\n\n"..table.serialize(data[tag or states.tag] or {},true)
- )
-end
-function states.load(filename,tag)
- states.filename=filename
- states.tag=tag or "whatever"
- states.filename=file.addsuffix(states.filename,'lus')
- data[states.tag],hash[states.tag]=(io.exists(filename) and dofile(filename)) or {},{}
-end
-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
- local pre,post=match(key,"(.+)%.([^%.]+)$")
- if pre and post then
- for k in gmatch(pre,"[^%.]+") do
- local dk=d[k]
- if not dk then
- dk={}
- d[k]=dk
- elseif type(dk)=="string" then
- break
- end
- d=dk
- end
- dkey,hkey=post,key
- end
- if value==nil then
- value=default
- elseif value==false then
- elseif persistent then
- value=value or d[dkey] or default
- else
- value=value or default
- end
- d[dkey],h[hkey]=value,value
- elseif type(d)=="string" then
- data[tag],hash[tag]=value,value
- end
- end
-end
-local function get_by_tag(tag,key,default)
- local h=hash[tag]
- if h and h[key] then
- return h[key]
- else
- local d=data[tag]
- if d then
- for k in gmatch(key,"[^%.]+") do
- local dk=d[k]
- if dk~=nil then
- d=dk
- else
- return default
- end
- end
- 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)
- set_by_tag(states.tag,key,value,default,persistent)
-end
-function states.get(key,default)
- return get_by_tag(states.tag,key,default)
-end
-
-
-end -- of closure
-
-do -- create closure to overcome 200 locals limit
-
-package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
-
--- original size: 11691, stripped down to: 8350
-
-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 concat=table.concat
-local quoted=string.quoted
-local luasuffixes=utilities.lua.suffixes
-local report_format=logs.reporter("resolvers","formats")
-local function primaryflags(arguments)
- local flags={}
- if arguments.silent then
- flags[#flags+1]="--interaction=batchmode"
- end
- return concat(flags," ")
-end
-local function secondaryflags(arguments)
- local trackers=arguments.trackers
- local directives=arguments.directives
- local flags={}
- if trackers and trackers~="" then
- flags[#flags+1]="--c:trackers="..quoted(trackers)
- end
- if directives and directives~="" then
- flags[#flags+1]="--c:directives="..quoted(directives)
- end
- if arguments.silent then
- flags[#flags+1]="--c:silent"
- end
- if arguments.errors then
- flags[#flags+1]="--c:errors"
- end
- if arguments.ansi then
- flags[#flags+1]="--c:ansi"
- end
- if arguments.ansilog then
- flags[#flags+1]="--c:ansilog"
- end
- if arguments.strip then
- flags[#flags+1]="--c:strip"
- end
- if arguments.lmtx then
- flags[#flags+1]="--c:lmtx"
- end
- return concat(flags," ")
-end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
-local checkers={
- primaryflags="verbose",
- secondaryflags="verbose",
- luafile="readable",
- texfile="readable",
- redirect="string",
- binarypath="string",
-}
-local runners={
- luametatex=sandbox.registerrunner {
- name="make luametatex format",
- program="luametatex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
- luatex=sandbox.registerrunner {
- name="make luatex format",
- program="luatex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
- luajittex=sandbox.registerrunner {
- name="make luajittex format",
- program="luajittex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
-}
-local stubfiles={
- luametatex="luat-cod.lmt",
- luatex="luat-cod.lua",
- luajittex="luat-cod.lua",
-}
-local suffixes={
- luametatex="mkxl",
- luatex="mkiv",
- luajittex="mkiv",
-}
-local function validbinarypath()
- if not environment.arguments.nobinarypath then
- local path=environment.ownpath or file.dirname(environment.ownname)
- if path and path~="" then
- path=dir.expandname(path)
- if path~="" and lfs.isdir(path) then
- return path
- end
- end
- end
-end
-local function fatalerror(startupdir,...)
- report_format(...)
- lfs.chdir(startupdir)
-end
-function environment.make_format(formatname)
- local arguments=environment.arguments
- local engine=environment.ownmain or "luatex"
- local silent=arguments.silent
- local errors=arguments.errors
- local runner=runners[engine]
- local startupdir=dir.current()
- if not runner then
- return fatalerror(startupdir,"the format %a cannot be generated, no runner available for engine %a",name,engine)
- end
- local luasourcename=stubfiles[engine]
- if not luasourcename then
- return fatalerror(startupdir,"no lua stub file specified for %a",engine)
- end
- local texsourcename=file.addsuffix(formatname,suffixes[engine])
- local fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
- if fulltexsourcename=="" then
- return fatalerror(startupdir,"no tex source file with name %a (mkiv or tex)",formatname)
- end
- local fulltexsourcename=dir.expandname(fulltexsourcename)
- local texsourcepath=file.dirname(fulltexsourcename)
- if lfs.isfile(fulltexsourcename) then
- report_format("using tex source file %a",fulltexsourcename)
- else
- return fatalerror(startupdir,"no accessible tex source file with name %a",fulltexsourcename)
- end
- local fullluasourcename=dir.expandname(file.join(texsourcepath,luasourcename) or "")
- if lfs.isfile(fullluasourcename) then
- report_format("using lua stub file %a",fullluasourcename)
- else
- return fatalerror(startupdir,"no accessible lua stub file with name %a",fulltexsourcename)
- end
- local validformatpath=caches.getwritablepath("formats",engine) or ""
- if validformatpath=="" then
- return fatalerror(startupdir,"invalid format path, insufficient write access")
- end
- local binarypath=validbinarypath()
- report_format("changing to format path %a",validformatpath)
- if not lfs.chdir(validformatpath) then
- return fatalerror(startupdir,"unable to change to format path %a",validformatpath)
- end
- local primaryflags=primaryflags(arguments)
- local secondaryflags=secondaryflags(arguments)
- local specification={
- binarypath=binarypath,
- primaryflags=primaryflags,
- secondaryflags=secondaryflags,
- luafile=quoted(fullluasourcename),
- texfile=quoted(fulltexsourcename),
- }
- if silent then
- specification.redirect="> temp.log"
- end
- statistics.starttiming("format")
- local result=runner(specification)
- statistics.stoptiming("format")
- if silent then
- os.remove("temp.log")
- end
- report_format()
- if binarypath and binarypath~="" then
- report_format("binary path : %s",binarypath or "?")
- end
- report_format("format path : %s",validformatpath)
- report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",fullluasourcename)
- if primaryflags~="" then
- report_format("primary flags : %s",primaryflags)
- end
- if secondaryflags~="" then
- report_format("secondary flags : %s",secondaryflags)
- end
- report_format("context file : %s",fulltexsourcename)
- report_format("run time : %.3f seconds",statistics.elapsed("format"))
- report_format("return value : %s",result==0 and "okay" or "error")
- report_format()
- lfs.chdir(startupdir)
-end
-local template=[[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
-local checkers={
- primaryflags="verbose",
- secondaryflags="verbose",
- fmtfile="readable",
- luafile="readable",
- texfile="readable",
-}
-local runners={
- luatex=sandbox.registerrunner {
- name="run luatex format",
- program="luatex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
- luametatex=sandbox.registerrunner {
- name="run luametatex format",
- program="luametatex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
- luajittex=sandbox.registerrunner {
- name="run luajittex format",
- program="luajittex",
- template=template,
- checkers=checkers,
- reporter=report_format,
- },
-}
-function environment.run_format(formatname,scriptname,filename,primaryflags,secondaryflags,verbose)
- local engine=environment.ownmain or "luatex"
- if not formatname or formatname=="" then
- report_format("missing format name")
- return
- end
- if not scriptname or scriptname=="" then
- report_format("missing script name")
- return
- end
- if not lfs.isfile(formatname) or not lfs.isfile(scriptname) then
- formatname,scriptname=resolvers.locateformat(formatname)
- end
- if not formatname or formatname=="" then
- report_format("invalid format name")
- return
- end
- if not scriptname or scriptname=="" then
- report_format("invalid script name")
- return
- end
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be run, no runner available for engine %a",file.nameonly(name),engine)
- return
- end
- if not filename then
- filename ""
- end
- local binarypath=validbinarypath()
- local specification={
- binarypath=binarypath,
- primaryflags=primaryflags or "",
- secondaryflags=secondaryflags or "",
- fmtfile=quoted(formatname),
- luafile=quoted(scriptname),
- texfile=filename~="" and quoted(filename) or "",
- }
- statistics.starttiming("make format")
- local result=runner(specification)
- statistics.stoptiming("make format")
- if verbose then
- report_format()
- if binarypath and binarypath~="" then
- report_format("binary path : %s",binarypath)
- end
- report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",scriptname)
- report_format("tex format file : %s",formatname)
- if filename~="" then
- report_format("tex input file : %s",filename)
- end
- if primaryflags~="" then
- report_format("primary flags : %s",primaryflags)
- end
- if secondaryflags~="" then
- report_format("secondary flags : %s",secondaryflags)
- end
- report_format("run time : %0.3f seconds",statistics.elapsed("make format"))
- report_format("return value : %s",result==0 and "okay" or "error")
- report_format()
- end
- return result
-end
-
-
-end -- of closure
-
--- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.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-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
--- skipped libraries : -
--- original bytes : 1025947
--- stripped bytes : 405652
-
--- end library merge
-
--- We need this hack till luatex is fixed.
---
--- for k,v in pairs(arg) do print(k,v) 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
-
--- End of hack.
-
-local format, gsub, gmatch, match, find = string.format, string.gsub, string.gmatch, string.match, string.find
-local concat = table.concat
-
-local ownname = environment and environment.ownname or arg[0] or 'mtxrun.lua'
-local ownpath = gsub(match(ownname,"^(.+)[\\/].-$") or ".","\\","/")
-local owntree = environment and environment.ownpath or ownpath
-
-local ownlibs = { -- order can be made better
-
- 'l-bit32.lua',
- 'l-lua.lua',
- 'l-macro.lua',
- 'l-sandbox.lua',
- 'l-package.lua',
- 'l-lpeg.lua',
- 'l-function.lua',
- 'l-string.lua',
- 'l-table.lua',
- 'l-io.lua',
- 'l-number.lua',
- 'l-set.lua',
- 'l-os.lua',
- 'l-file.lua',
- 'l-gzip.lua',
- 'l-md5.lua',
- 'l-sha.lua',
- 'l-url.lua',
- 'l-dir.lua',
- 'l-boolean.lua',
- 'l-unicode.lua',
- 'l-math.lua',
-
- 'util-str.lua', -- code might move to l-string
- 'util-tab.lua',
- 'util-fil.lua',
- 'util-sac.lua',
- 'util-sto.lua',
- 'util-prs.lua',
- 'util-fmt.lua',
-
- 'util-soc-imp-reset.lua',
- 'util-soc-imp-socket.lua',
- 'util-soc-imp-copas.lua',
- 'util-soc-imp-ltn12.lua',
- -- 'util-soc-imp-mbox.lua',
- 'util-soc-imp-mime.lua',
- 'util-soc-imp-url.lua',
- 'util-soc-imp-headers.lua',
- 'util-soc-imp-tp.lua',
- 'util-soc-imp-http.lua',
- 'util-soc-imp-ftp.lua',
- 'util-soc-imp-smtp.lua',
-
- 'trac-set.lua',
- 'trac-log.lua',
- 'trac-inf.lua', -- was before trac-set
- 'trac-pro.lua', -- not really needed
- 'util-lua.lua', -- indeed here?
- 'util-deb.lua',
-
- 'util-tpl.lua',
- 'util-sbx.lua',
- 'util-mrg.lua',
-
- 'util-env.lua',
- 'luat-env.lua', -- can come before inf (as in mkiv)
-
- 'util-zip.lua',
-
- 'lxml-tab.lua',
- 'lxml-lpt.lua',
- -- 'lxml-ent.lua',
- 'lxml-mis.lua',
- 'lxml-aux.lua',
- 'lxml-xml.lua',
-
- 'trac-xml.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-sch.lua',
- 'data-lua.lua',
- 'data-aux.lua', -- updater
- 'data-tmf.lua',
- 'data-lst.lua',
-
- 'libs-ini.lua',
-
- 'luat-sta.lua',
- 'luat-fmt.lua',
-
-}
-
--- c:/data/develop/tex-context/tex/texmf-win64/bin/../../texmf-context/tex/context/base/mkiv/data-tmf.lua
--- c:/data/develop/context/sources/data-tmf.lua
-
-local ownlist = {
- -- '.',
- -- ownpath ,
- owntree .. "/../../../../context/sources", -- HH's development path
- --
- owntree .. "/../../texmf-local/tex/context/base/mkiv",
- owntree .. "/../../texmf-context/tex/context/base/mkiv",
- owntree .. "/../../texmf/tex/context/base/mkiv",
- owntree .. "/../../../texmf-local/tex/context/base/mkiv",
- owntree .. "/../../../texmf-context/tex/context/base/mkiv",
- owntree .. "/../../../texmf/tex/context/base/mkiv",
- --
- owntree .. "/../../texmf-local/tex/context/base",
- owntree .. "/../../texmf-context/tex/context/base",
- owntree .. "/../../texmf/tex/context/base",
- owntree .. "/../../../texmf-local/tex/context/base",
- owntree .. "/../../../texmf-context/tex/context/base",
- owntree .. "/../../../texmf/tex/context/base",
-}
-
-if ownpath == "." then table.remove(ownlist,1) end
-
-own = {
- name = ownname,
- path = ownpath,
- tree = owntree,
- list = ownlist,
- libs = ownlibs,
-}
-
-local function locate_libs()
- for l=1,#ownlibs do
- local lib = ownlibs[l]
- for p =1,#ownlist do
- local pth = ownlist[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
-
-local function load_libs()
- local found = locate_libs()
- if found then
- for l=1,#ownlibs do
- local filename = found .. "/" .. ownlibs[l]
- local codeblob = loadfile(filename)
- if codeblob then
- codeblob()
- end
- end
- else
- resolvers = nil
- end
-end
-
-if not resolvers then
- load_libs()
-end
-
-if not resolvers then
- print("")
- print("Mtxrun is unable to start up due to lack of libraries. You may")
- print("try to run 'lua mtxrun.lua --selfmerge' in the path where this")
- print("script is located (normally under ..../scripts/context/lua) which")
- print("will make this script library independent.")
- os.exit()
-end
-
--- verbosity
-
------ e_verbose = environment.arguments["verbose"]
-
-local e_verbose = false
-
--- some common flags (also passed through environment)
-
-local e_silent = environment.argument("silent")
-local e_errors = environment.argument("errors")
-local e_noconsole = environment.argument("noconsole")
-
-local e_trackers = environment.argument("trackers")
-local e_directives = environment.argument("directives")
-local e_experiments = environment.argument("experiments")
-
-local t = { }
-
-if type(e_directives) == "string" then
- t[#t+1] = e_directives
-end
-
-if type(e_silent) == "string" then
- t[#t+1] = format("logs.blocked={%s}",e_silent)
-elseif e_silent == true then
- t[#t+1] = "logs.blocked"
-end
-
-if type(e_errors) == "string" then
- t[#t+1] = format("logs.errors={%s}",e_errors)
-elseif e_errors == true then
- t[#t+1] = "logs.errors"
-end
-
-if e_noconsole then
- t[#t+1] = format("logs.target=file")
-end
-
-if #t > 0 then
- e_directives = concat(t,",")
-end
-
-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
-
---
-
-resolvers.reset()
-
-local helpinfo = [[
-<?xml version="1.0" ?>
-<application>
- <metadata>
- <entry name="name">mtxrun</entry>
- <entry name="detail">ConTeXt TDS Runner Tool</entry>
- <entry name="version">1.33</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag>
- <flag name="evaluate"><short>run code passed on the commandline (between quotes) (=loop) (exit|quit aborts)</short></flag>
- <flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag>
- <flag name="resolve"><short>resolve prefixed arguments</short></flag>
- <flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag>
- <flag name="internal"><short>run script using built in libraries (same as <ref name="ctxlua"/>)</short></flag>
- <flag name="locate"><short>locate given filename in database (default) or system (<ref name="first"/> <ref name="all"/> <ref name="detail"/>)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="tree" value="pathtotree"><short>use given texmf tree (default file: setuptex.tmf)</short></flag>
- <flag name="path" value="runpath"><short>go to given path before execution</short></flag>
- <flag name="ifchanged" value="filename"><short>only execute when given file has changed (md checksum)</short></flag>
- <flag name="iftouched" value="old,new"><short>only execute when given file has changed (time stamp)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="makestubs"><short>create stubs for (context related) scripts</short></flag>
- <flag name="removestubs"><short>remove stubs (context related) scripts</short></flag>
- <flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag>
- <flag name="windows"><short>create windows (mswin) stubs</short></flag>
- <flag name="unix"><short>create unix (linux) stubs</short></flag>
- <flag name="addbinarypath"><short>prepend the (found) binarypath to runners</short></flag>
- </subcategory>
- <subcategory>
- <flag name="verbose"><short>give a bit more info</short></flag>
- <flag name="trackers" value="list"><short>enable given trackers</short></flag>
- <flag name="progname" value="str"><short>format or backend</short></flag>
- <flag name="systeminfo" value="str"><short>show current operating system, processor, etc</short></flag>
- </subcategory>
- <subcategory>
- <flag name="edit"><short>launch editor with found file</short></flag>
- <flag name="launch"><short>launch files like manuals, assumes os support (<ref name="all"/>,<ref name="list"/>)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="timedrun"><short>run a script and time its run</short></flag>
- <flag name="autogenerate"><short>regenerate databases if needed (handy when used to run context in an editor)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="usekpse"><short>use kpse as fallback (when no mkiv and cache installed, often slower)</short></flag>
- <flag name="forcekpse"><short>force using kpse (handy when no mkiv and cache installed but less functionality)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="prefixes"><short>show supported prefixes</short></flag>
- </subcategory>
- <subcategory>
- <flag name="generate"><short>generate file database</short></flag>
- </subcategory>
- <subcategory>
- <flag name="variables"><short>show configuration variables</short></flag>
- <flag name="configurations"><short>show configuration order</short></flag>
- </subcategory>
- <subcategory>
- <flag name="directives"><short>show (known) directives</short></flag>
- <flag name="trackers"><short>show (known) trackers</short></flag>
- <flag name="experiments"><short>show (known) experiments</short></flag>
- </subcategory>
- <subcategory>
- <flag name="expand-braces"><short>expand complex variable</short></flag>
- <flag name="resolve-path"><short>expand variable (completely resolve paths)</short></flag>
- <flag name="expand-path"><short>expand variable (resolve paths)</short></flag>
- <flag name="expand-var"><short>expand variable (resolve references)</short></flag>
- <flag name="show-path"><short>show path expansion of ...</short></flag>
- <flag name="var-value"><short>report value of variable</short></flag>
- <flag name="find-file"><short>report file location</short></flag>
- <flag name="find-path"><short>report path of file</short></flag>
- </subcategory>
- <subcategory>
- <flag name="pattern" value="string"><short>filter variables</short></flag>
- </subcategory>
- </category>
- </flags>
-</application>
-]]
-
-local application = logs.application {
- name = "mtxrun",
- banner = "ConTeXt TDS Runner Tool 1.32",
- 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",
- ["pl"] = "perl",
- ["py"] = "python",
- ["rb"] = "ruby",
-}
-
-runners.suffixes = {
- 'rb', 'lua', 'py', 'pl'
-}
-
-runners.registered = {
- texexec = { 'texexec.rb', false }, -- context mkii runner (only tool not to be luafied)
- texutil = { 'texutil.rb', true }, -- old perl based index sorter for mkii (old versions need it)
- texfont = { 'texfont.pl', true }, -- perl script that makes mkii font metric files
- texfind = { 'texfind.pl', false }, -- perltk based tex searching tool, mostly used at pragma
- texshow = { 'texshow.pl', false }, -- perltk based context help system, will be luafied
- -- texwork = { 'texwork.pl', false }, -- perltk based editing environment, only used at pragma
- 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 },
- concheck = { 'concheck.rb', false },
- runtools = { 'runtools.rb', true },
- textools = { 'textools.rb', true },
- tmftools = { 'tmftools.rb', true },
- ctxtools = { 'ctxtools.rb', true },
- rlxtools = { 'rlxtools.rb', true },
- pdftools = { 'pdftools.rb', true },
- mpstools = { 'mpstools.rb', true },
- -- exatools = { 'exatools.rb', true },
- xmltools = { 'xmltools.rb', true },
- -- luatools = { 'luatools.lua', true },
- mtxtools = { 'mtxtools.rb', true },
- pdftrimwhite = { 'pdftrimwhite.pl', false },
-}
-
-runners.launchers = {
- windows = { },
- unix = { },
-}
-
--- like runners.libpath("framework"): looks on script's subpath
-
-function runners.libpath(...)
- package.prepend_libpath(file.dirname(environment.ownscript),...)
- package.prepend_libpath(file.dirname(environment.ownname) ,...)
-end
-
-function runners.prepare()
- local checkname = environment.argument("ifchanged")
- if type(checkname) == "string" and checkname ~= "" then
- local oldchecksum = file.loadchecksum(checkname)
- local newchecksum = file.checksum(checkname)
- if oldchecksum == newchecksum then
- if e_verbose then
- report("file '%s' is unchanged",checkname)
- end
- return "skip"
- elseif e_verbose then
- report("file '%s' is changed, processing started",checkname)
- end
- file.savechecksum(checkname)
- end
- local touchname = environment.argument("iftouched")
- if type(touchname) == "string" and touchname ~= "" then
- local oldname, newname = string.splitup(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 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
-
-function runners.execute_script(fullname,internal,nosplit)
- local noquote = environment.argument("noquotes")
- if fullname and fullname ~= "" then
- local state = runners.prepare()
- if state == 'error' then
- return false
- elseif state == 'skip' then
- return true
- elseif state == "run" then
- local path, name, suffix = file.splitname(fullname)
- local result = ""
- if path ~= "" then
- result = fullname
- elseif name then
- name = gsub(name,"^int[%a]*:",function()
- internal = true
- return ""
- end )
- name = gsub(name,"^script:","")
- if suffix == "" and runners.registered[name] and runners.registered[name][1] then
- name = runners.registered[name][1]
- suffix = file.suffix(name)
- end
- if suffix == "" then
- -- loop over known suffixes
- for _,s in pairs(runners.suffixes) do
- result = resolvers.findfile(name .. "." .. s, 'texmfscripts')
- if result ~= "" then
- break
- end
- end
- elseif runners.applications[suffix] then
- result = resolvers.findfile(name, 'texmfscripts')
- else
- -- maybe look on path
- result = resolvers.findfile(name, 'other text files')
- end
- end
- if result and result ~= "" then
- if not no_split then
- local before, after = environment.splitarguments(fullname) -- already done
- environment.arguments_before, environment.arguments_after = before, after
- end
- if internal then
- arg = { } for _,v in pairs(environment.arguments_after) do arg[#arg+1] = v end
- environment.ownscript = result
- dofile(result)
- else
-local texmfcnf = resolvers.getenv("TEXMFCNF")
-if not texmfcnf or texmfcnf == "" then
- texmfcnf = resolvers.expandedpathfromlist(resolvers.splitpath(resolvers.resolve(resolvers.luacnfspec)))
- resolvers.setenv("TEXMFCNF",table.concat(texmfcnf,";")) -- for running texexec etc (after tl change to texmf-dist)
-end
- local binary = runners.applications[file.suffix(result)]
- result = string.quoted(string.unquoted(result))
- -- if string.match(result,' ') and not string.match(result,"^\".*\"$") then
- -- result = '"' .. result .. '"'
- -- end
- if binary and binary ~= "" then
- result = binary .. " " .. result
- end
- local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote)
- if e_verbose then
- report()
- report("executing: %s",command)
- report()
- report()
- io.flush()
- end
- local code = os.execute(command)
- if code == 0 then
- return true
- else
- if binary then
- binary = file.addsuffix(binary,os.binsuffix)
- for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
- if lfs.isfile(file.join(p,binary)) then
- return false
- end
- end
- report()
- report("This script needs '%s' which seems not to be installed.",binary)
- report()
- end
- return false
- end
- end
- end
- end
- end
- return false
-end
-
-function runners.execute_program(fullname)
- local noquote = environment.argument("noquotes")
- if fullname and fullname ~= "" then
- local state = runners.prepare()
- if state == 'error' then
- return false
- elseif state == 'skip' then
- return true
- elseif state == "run" then
- local before, after = environment.splitarguments(fullname)
- for k=1,#after do after[k] = resolvers.resolve(after[k]) end
- environment.initializearguments(after)
- fullname = gsub(fullname,"^bin:","")
- local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "")
- report()
- report("executing: %s",command)
- report()
- report()
- io.flush()
- local code = os.execute(command)
- return code == 0
- end
- end
- return false
-end
-
--- 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'
-
-function runners.handle_stubs(create)
- local stubpath = environment.argument('stubpath') or '.' -- 'auto' no longer subpathssupported
- local windows = environment.argument('windows') or environment.argument('mswin') or false
- local unix = environment.argument('unix') or environment.argument('linux') or false
- if not windows and not unix then
- if os.platform == "unix" then
- unix = true
- else
- windows = true
- end
- end
- for _,v in pairs(runners.registered) do
- local name, doit = v[1], v[2]
- if doit then
- local base = gsub(file.basename(name), "%.(.-)$", "")
- if create then
- if windows then
- 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),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
- 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
- report("unix stub for '%s' removed",base)
- end
- end
- end
- end
-end
-
-function runners.resolve_string(filename)
- if filename and filename ~= "" then
- runners.report_location(resolvers.resolve(filename))
- end
-end
-
--- differs from texmfstart where locate appends .com .exe .bat ... todo
-
-function runners.locate_file(filename) -- was given file but only searches in tree
- if filename and filename ~= "" then
- if environment.argument("first") then
- runners.report_location(resolvers.findfile(filename))
- -- resolvers.dowithfilesandreport(resolvers.findfile,filename)
- elseif environment.argument("all") then
- local result, status = resolvers.findfiles(filename)
- if status and environment.argument("detail") then
- runners.report_location(status)
- else
- runners.report_location(result)
- end
- else
- runners.report_location(resolvers.findgivenfile(filename))
- -- resolvers.dowithfilesandreport(resolvers.findgivenfile,filename)
- end
- end
-end
-
-function runners.locate_platform()
- runners.report_location(os.platform)
-end
-
-function runners.report_location(result)
- if type(result) == "table" then
- for i=1,#result do
- if i > 1 then
- io.write("\n")
- end
- io.write(result[i])
- end
- else
- io.write(result)
- end
-end
-
-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 e_verbose then
- report()
- report("starting editor: %s",command)
- report()
- report()
- end
- os.launch(command)
- end
-end
-
-function runners.save_script_session(filename, list)
- if type(list) == "table" then
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
- end
- io.savedata(filename,table.serialize(t,true))
- end
-end
-
-function runners.load_script_session(filename)
- if lfs.isfile(filename) then
- local t = io.loaddata(filename)
- if t then
- t = loadstring(t)
- if t then t = t() end
- for key, value in pairs(t) do
- environment.arguments[key] = value
- end
- end
- end
-end
-
-function resolvers.launch(str)
- -- maybe we also need to test on mtxrun.launcher.suffix environment
- -- variable or on windows consult the assoc and ftype vars and such
- local launchers = runners.launchers[os.platform] if launchers then
- local suffix = file.suffix(str) if suffix then
- local runner = launchers[suffix] if runner then
- str = runner .. " " .. str
- end
- end
- end
- os.launch(str)
-end
-
-function runners.launch_file(filename)
- local allresults = environment.arguments["all"]
- local pattern = environment.arguments["pattern"]
- local listonly = environment.arguments["list"]
- if not pattern or pattern == "" then
- pattern = filename
- end
- if not pattern or pattern == "" then
- report("provide name or --pattern=")
- else
- local t = resolvers.findfiles(pattern,nil,allresults)
- if not t or #t == 0 then
- t = resolvers.findfiles("*/" .. pattern,nil,allresults)
- end
- if not t or #t == 0 then
- t = resolvers.findfiles("*/" .. pattern .. "*",nil,allresults)
- end
- if t and #t > 0 then
- for i=1,#t do
- local name = t[i]
- if listonly then
- report("% 3i: %-30s %s",i,file.basename(name),file.dirname(name))
- else
- report("launching: %s",name)
- resolvers.launch(name)
- if not allresults then
- break
- end
- end
- end
- if listonly then
- io.write("\n")
- io.write("\n[select number]\n\n>> ")
- local answer = tonumber(io.read())
- if answer then
- io.write("\n")
- local name = t[answer]
- if name then
- report("launching: %s",name)
- resolvers.launch(name)
- else
- report("invalid number")
- end
- end
- end
- else
- report("no match for %s", pattern)
- end
- end
-end
-
-local mtxprefixes = {
- { "^mtx%-", "mtx-" },
- { "^mtx%-t%-", "mtx-t-" },
-}
-
-function runners.find_mtx_script(filename)
- local function found(name)
- local path = file.dirname(name)
- if path and path ~= "" then
- return false
- else
- local fullname = own and own.path and file.join(own.path,name)
- return io.exists(fullname) and fullname
- end
- end
- filename = file.addsuffix(filename,"lua")
- local basename = file.removesuffix(file.basename(filename))
- local suffix = file.suffix(filename)
- -- qualified path, raw name
- local fullname = file.is_qualified_path(filename) and io.exists(filename) and filename
- if fullname and fullname ~= "" then
- return fullname
- end
- -- current path, raw name
- fullname = "./" .. filename
- fullname = io.exists(fullname) and fullname
- if fullname and fullname ~= "" then
- return fullname
- end
- -- mtx- prefix checking
- for i=1,#mtxprefixes do
- local mtxprefix = mtxprefixes[i]
- mtxprefix = find(filename,mtxprefix[1]) and "" or mtxprefix[2]
- -- context namespace, mtx-<filename>
- fullname = mtxprefix .. filename
- fullname = found(fullname) or resolvers.findfile(fullname)
- if fullname and fullname ~= "" then
- return fullname
- end
- -- context namespace, mtx-<filename>s
- fullname = mtxprefix .. basename .. "s" .. "." .. suffix
- fullname = found(fullname) or resolvers.findfile(fullname)
- if fullname and fullname ~= "" then
- return fullname
- end
- -- context namespace, mtx-<filename minus trailing s>
- fullname = mtxprefix .. gsub(basename,"s$","") .. "." .. suffix
- fullname = found(fullname) or resolvers.findfile(fullname)
- if fullname and fullname ~= "" then
- return fullname
- end
- end
- -- context namespace, just <filename>
- fullname = resolvers.findfile(filename)
- return fullname
-end
-
-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.suffix(fullname) == "cld" then
- -- handy in editors where we force --autopdf
- report("running cld script: %s",filename)
- table.insert(arguments,1,fullname)
- table.insert(arguments,"--autopdf")
- fullname = runners.find_mtx_script("context") or ""
- end
- -- retry after generate but only if --autogenerate
- if fullname == "" and environment.argument("autogenerate") then -- might become the default
- resolvers.renewcache()
- trackers.enable("resolvers.locating")
- resolvers.load()
- --
- fullname = runners.find_mtx_script(filename) or ""
- end
- -- that should do it
- if fullname ~= "" then
- local state = runners.prepare()
- if state == 'error' then
- return false
- elseif state == 'skip' then
- return true
- 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.initializearguments(arg)
- local loadname = environment.arguments['load']
- if loadname then
- if type(loadname) ~= "string" then loadname = file.basename(fullname) end
- loadname = file.replacesuffix(loadname,"cfg")
- runners.load_script_session(loadname)
- end
- filename = environment.files[1]
- if e_verbose then
- report("using script: %s (if --path is used don't run on path where mtxrun lives)\n",fullname)
- end
- environment.ownscript = fullname
- dofile(fullname)
- local savename = environment.arguments['save']
- if savename then
- if type(savename) ~= "string" then savename = file.basename(fullname) end
- savename = file.replacesuffix(savename,"cfg")
- runners.save_script_session(savename,save_list)
- end
- return true
- end
- else
- if filename == "" or filename == "help" then
- local context = resolvers.findfile("mtx-context.lua")
- trackers.enable("resolvers.locating")
- if context ~= "" then
- 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 = match(scriptname,".*mtx%-([^%-]-)%.lua")
- if scriptbase then
- local data = io.loaddata(scriptname)
- local application = match(data,"local application.-=.-(%{.-%})")
- if application then
- application = loadstring("return " .. application)
- if application then
- application = application()
- local banner = application.banner
- if banner then
- local description, version = match(banner,"^(.-) ([%d.]+)$")
- if description then
- valid[#valid+1] = { scriptbase, version, description }
- else
- valid[#valid+1] = { scriptbase, "", banner }
- end
- end
- end
- end
- end
- end
- if #valid > 0 then
- application.identify()
- report("no script name given, known scripts:")
- report()
- for k=1,#valid do
- local v = valid[k]
- report("%-12s %4s %s",v[1],v[2],v[3])
- end
- end
- else
- report("no script name given")
- end
- else
- filename = file.addsuffix(filename,"lua")
- if file.is_qualified_path(filename) then
- report("unknown script '%s'",filename)
- else
- report("unknown script '%s' or 'mtx-%s'",filename,filename)
- end
- end
- return false
- end
-end
-
-function runners.prefixes()
- application.identify()
- report()
- report(concat(resolvers.allprefixes(true)," "))
-end
-
-function runners.timedrun(filename) -- just for me
- if filename and filename ~= "" then
- runners.timed(function() os.execute(filename) end)
- end
-end
-
-function runners.timed(action)
- statistics.timed(action,true)
-end
-
-function runners.associate(filename)
- os.launch(filename)
-end
-
-function runners.evaluate(code,filename) -- for Luigi
- local environment = table.setmetatableindex(_G)
- if code == "loop" then
- while true do
- io.write("lua > ")
- local code = io.read()
- if code == "quit" or code == "exit" then
- break
- elseif code ~= "" then
- local temp = string.match(code,"^= (.*)$")
- if temp then
- code = "inspect("..temp..")"
- end
- local compiled, message = load(code,"console","t",environment)
- if type(compiled) ~= "function" then
- compiled = load("inspect("..code..")","console","t",environment)
- end
- if type(compiled) ~= "function" then
- io.write("! " .. (message or code).."\n")
- else
- io.write(compiled())
- end
- end
- end
- else
- if type(code) ~= "string" or code == "" then
- code = filename
- end
- if code ~= "" then
- local compiled, message = load(code,"console","t",environment)
- if type(compiled) ~= "function" then
- compiled = load("inspect("..code..")","console","t",environment)
- end
- if type(compiled) ~= "function" then
- io.write("invalid lua code: " .. (message or code))
- return
- end
- io.write(compiled())
- end
- end
-end
-
-function runners.gethelp(filename)
- local url = environment.argument("url")
- if url and url ~= "" then
- local command = string.gsub(environment.argument("command") or "unknown","^%s*\\*(.-)%s*$","%1")
- url = utilities.templates.replace(url,{ command = command })
- os.launch(url)
- else
- report("no --url given")
- end
-end
-
-function runners.systeminfo()
- report("architecture : %s",os.platform or "<unset>")
- report("operating system : %s",os.name or "<unset>")
- report("file architecture : %s",os.type or "<unset>")
- report("binary path : %s",os.selfdir or "<unset>")
- report("binary suffix : %s",os.binsuffix or "<unset>")
- report("library suffix : %s",os.libsuffix or "<unset>")
-end
-
--- this is a bit dirty ... first we store the first filename and next we
--- split the arguments so that we only see the ones meant for this script
--- ... later we will use the second half
-
-local filename = environment.files[1] or ""
-local ok = true
-
-local before, after = environment.splitarguments(filename)
-environment.arguments_before, environment.arguments_after = before, after
-environment.initializearguments(before)
-
-e_verbose = environment.arguments["verbose"] -- delayed till here (we need the ones before script)
-
-if e_verbose then
- trackers.enable("resolvers.locating")
-end
-
--- maybe the unset has to go to this level
-
-local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename))]
-
-local e_argument = environment.argument
-
-if e_argument("timedlog") then
- logs.settimedlog()
-end
-
-if e_argument("usekpse") or e_argument("forcekpse") or is_mkii_stub then
-
- resolvers.load_tree(e_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",
- other = "other text files",
- }
-
- local progname = e_argument("progname") or 'context'
-
- local function kpse_initialized()
- texconfig.kpse_init = true
- local t = os.clock()
- local k = kpse.original.new("luatex",progname)
- local dummy = k:find_file("mtxrun.lua") -- so that we're initialized
- report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
- kpse_initialized = function() return k end
- return k
- end
-
- local findfile = resolvers.findfile
- local showpath = resolvers.showpath
-
- if e_argument("forcekpse") then
-
- 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.showpath(name)
- return (kpse_initialized():show_path(name)) or ""
- end
-
- elseif e_argument("usekpse") or is_mkii_stub then
-
- resolvers.load()
-
- function resolvers.findfile(name,kind)
- local found = findfile(name,kind) or ""
- if found ~= "" then
- return found
- else
- return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or ""
- end
- end
- function resolvers.showpath(name)
- local found = showpath(name) or ""
- if found ~= "" then
- return found
- else
- return (kpse_initialized():show_path(name)) or ""
- end
- end
-
- end
-
- function runners.loadbase()
- end
-
-else
-
- function runners.loadbase(...)
- if not resolvers.load(...) then
- report("forcing cache reload")
- resolvers.renewcache()
- trackers.enable("resolvers.locating")
- if not resolvers.load(...) then
- report("the resolver databases are not present or outdated")
- end
- end
- end
-
- resolvers.load_tree(e_argument('tree'),e_argument("resolve"))
-
-end
-
--- joke .. reminds me of messing with gigi terminals
-
-do
-
- local a_locale = e_argument("locale")
-
- if a_locale then
-
- -- I really hate this crap but am too tired of discussing it over and over
- -- again so for the sake of usiage outside context we will provide ways to
- -- use locales in an otherwise supposed to be locale agnostic system. And
- -- forget about support in case of interferences.
-
- report()
- report(what == "force" and "forcing locale:" or "original locale:")
- report()
- report(" collate : %s",status.lc_collate or "<unset>")
- report(" ctype : %s",status.lc_ctype or "<unset>")
- report(" monetary : %s",status.lc_monetary or "<unset>")
- report(" numeric : %s",status.lc_numeric or "<unset>")
- report(" time : %s",status.lc_time or "<unset>")
- report()
-
- end
-
- if a_locale == "force" then
- os.setlocale(status.lc_collate ,"collate")
- os.setlocale(status.lc_ctype ,"ctype")
- os.setlocale(status.lc_monetary,"monetary")
- os.setlocale(status.lc_numeric ,"numeric")
- os.setlocale(status.lc_time ,"time")
- else
- function os.setlocale()
- end
- end
-
-end
-
--- if e_argument("ansi") or e_argument("ansilog") then
-
--- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
-
--- -- local script = e_argument("script") or e_argument("scripts")
--- --
--- -- if type(script) == "string" then
--- -- logs.writer("]0;"..script.."") -- for Alan to test
--- -- end
-
--- end
-
-if e_argument("script") or e_argument("scripts") then
-
- -- run a script by loading it (using libs), pass args
-
- if e_argument("nofiledatabase") then
- -- handy for mtx-update
- else
- runners.loadbase()
- end
- if is_mkii_stub then
- ok = runners.execute_script(filename,false,true)
- else
- ok = runners.execute_ctx_script(filename)
- end
-
-elseif e_argument("evaluate") then
-
- runners.evaluate(e_argument("evaluate"),filename)
-
-elseif e_argument("selfmerge") then
-
- -- embed used libraries
-
- runners.loadbase()
- local found = locate_libs()
-
- if found then
- local mtxrun = resolvers.findfile("mtxrun.lua") -- includes local name
- if lfs.isfile(mtxrun) then
- utilities.merger.selfmerge(mtxrun,own.libs,{ found })
- application.report("runner updated on resolved path: %s",mtxrun)
- else
- utilities.merger.selfmerge(own.name,own.libs,{ found })
- application.report("runner updated on relative path: %s",own.name)
- end
- end
-
-elseif e_argument("selfclean") then
-
- -- remove embedded libraries
-
- runners.loadbase()
-
- local mtxrun = resolvers.findfile("mtxrun.lua") -- includes local name
- if lfs.isfile(mtxrun) then
- utilities.merger.selfclean(mtxrun)
- application.report("runner cleaned on resolved path: %s",mtxrun)
- else
- utilities.merger.selfclean(own.name)
- application.report("runner cleaned on relative path: %s",own.name)
- end
-
-elseif e_argument("selfupdate") then
-
- runners.loadbase()
- trackers.enable("resolvers.locating")
- resolvers.updatescript(own.name,"mtxrun")
-
-elseif e_argument("ctxlua") or e_argument("internal") then
-
- -- run a script by loading it (using libs)
-
- runners.loadbase()
- ok = runners.execute_script(filename,true)
-
-elseif e_argument("execute") then
-
- -- execute script
-
- runners.loadbase()
- ok = runners.execute_script(filename)
-
-elseif e_argument("direct") then
-
- -- equals bin:
-
- runners.loadbase()
- ok = runners.execute_program(filename)
-
-elseif e_argument("edit") then
-
- -- edit file
-
- runners.loadbase()
- runners.edit_script(filename)
-
-elseif e_argument("launch") then
-
- runners.loadbase()
- runners.launch_file(filename)
-
-elseif e_argument("associate") then
-
- runners.associate(filename)
-
-elseif e_argument("gethelp") then
-
- runners.gethelp()
-
-elseif e_argument("makestubs") then
-
- -- make stubs (depricated)
-
- runners.handle_stubs(true)
-
-elseif e_argument("removestubs") then
-
- -- remove stub (depricated)
-
- runners.loadbase()
- runners.handle_stubs(false)
-
-elseif e_argument("resolve") then
-
- -- resolve string
-
- runners.loadbase()
- runners.resolve_string(filename)
-
-elseif e_argument("locate") then
-
- -- locate file (only database)
-
- runners.loadbase()
- runners.locate_file(filename)
-
-elseif e_argument("platform") or e_argument("show-platform") then
-
- -- locate platform
-
- runners.loadbase()
- runners.locate_platform()
-
-elseif e_argument("prefixes") then
-
- runners.loadbase()
- runners.prefixes()
-
-elseif e_argument("timedrun") then
-
- -- locate platform
-
- runners.loadbase()
- runners.timedrun(filename)
-
-elseif e_argument("variables") or e_argument("show-variables") or e_argument("expansions") or e_argument("show-expansions") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename)
-
- resolvers.load("nofiles")
- resolvers.listers.variables(e_argument("pattern"))
-
-elseif e_argument("configurations") or e_argument("show-configurations") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename)
-
- resolvers.load("nofiles")
- resolvers.listers.configurations()
-
-elseif e_argument("find-file") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename)
-
- resolvers.load()
- local e_all = e_argument("all")
- local e_pattern = e_argument("pattern")
- local e_format = e_argument("format")
- local finder = e_all and resolvers.findfiles or resolvers.findfile
- if not e_pattern then
- runners.register_arguments(filename)
- environment.initializearguments(environment.arguments_after)
- resolvers.dowithfilesandreport(finder,environment.files,e_format)
- elseif type(e_pattern) == "string" then
- resolvers.dowithfilesandreport(finder,{ e_pattern },e_format)
- end
-
-elseif e_argument("find-path") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename)
-
- resolvers.load()
- local path = resolvers.findpath(filename)
- if e_verbose then
- report(path)
- else
- print(path)
- end
-
-elseif e_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 e_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 e_argument("resolve-path") then
-
- resolvers.load("nofiles")
- runners.register_arguments(filename)
- environment.initializearguments(environment.arguments_after)
- resolvers.dowithfilesandreport(resolvers.cleanedpathlist, environment.files)
-
-elseif e_argument("expand-var") or e_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 e_argument("show-path") or e_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 e_argument("var-value") or e_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 e_argument("format-path") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename)
-
- resolvers.load()
- report(caches.getwritablepath("format"))
-
--- elseif e_argument("pattern") then
---
--- -- luatools
---
--- runners.execute_ctx_script("mtx-base","--pattern='" .. e_argument("pattern") .. "'",filename)
-
-elseif e_argument("generate") then
-
- -- luatools
-
- if filename and filename ~= "" then
- resolvers.load("nofiles")
- trackers.enable("resolvers.locating")
- resolvers.renew(filename)
- else
- resolvers.renewcache()
- trackers.enable("resolvers.locating")
- resolvers.load()
- end
-
- e_verbose = true
-
-elseif e_argument("make") or e_argument("ini") or e_argument("compile") then
-
- -- luatools: runners.execute_ctx_script("mtx-base","--make",filename)
-
- resolvers.load()
- trackers.enable("resolvers.locating")
- environment.make_format(filename)
-
-elseif e_argument("run") then
-
- -- luatools
-
- runners.execute_ctx_script("mtx-base","--run",filename)
-
-elseif e_argument("fmt") then
-
- -- luatools
-
- runners.execute_ctx_script("mtx-base","--fmt",filename)
-
-elseif e_argument("help") and filename=='base' then
-
- -- luatools
-
- runners.execute_ctx_script("mtx-base","--help")
-
-elseif e_argument("version") then
-
- application.version()
-
- application.report("source path",environment.ownbin)
-
-elseif e_argument("directives") then
-
- directives.show()
-
-elseif e_argument("trackers") then
-
- trackers.show()
-
-elseif e_argument("experiments") then
-
- experiments.show()
-
-elseif e_argument("exporthelp") then
-
- runners.loadbase()
- application.export(e_argument("exporthelp"),filename)
-
-elseif e_argument("systeminfo") then
-
- runners.systeminfo()
-
-elseif e_argument("locale") then
-
- -- already done
-
-elseif e_argument("help") or filename=='help' or filename == "" then
-
- application.help()
-
-elseif find(filename,"^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)
-
-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("elapsed lua time: %0.3f seconds",os.runtime())
-end
-
-if os.type ~= "windows" then
- texio.write("\n") -- is this still valid?
-end
-
-if ok == false then ok = 1 elseif ok == true or ok == nil then ok = 0 end
-
--- os.exit(ok,true) -- true forces a cleanup in 5.2+
-
-os.exit(ok) -- true forces a cleanup in 5.2+ but reports a wrong number then
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrunjit b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrunjit
deleted file mode 100755
index 117105aa5c0..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/mtxrunjit
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-luajittex --luaonly $(dirname $0)/mtxrun "$@"
-
-# luajittex --luaonly ${0%jit} "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/pstopdf b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/pstopdf
deleted file mode 100755
index 116f5f4a32e..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/pstopdf
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --script pstopdf "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texexec b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texexec
deleted file mode 100755
index cd5900ff84c..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texexec
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --usekpse --execute texexec "$@"
diff --git a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texmfstart b/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texmfstart
deleted file mode 100755
index 1799b357915..00000000000
--- a/Build/source/texk/texlive/linked_scripts/context/stubs/unix/texmfstart
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mtxrun --usekpse "$@"
diff --git a/Master/bin/aarch64-linux/luametatex b/Master/bin/aarch64-linux/luametatex
index 510f75311f7..7ef2ca03861 100755
--- a/Master/bin/aarch64-linux/luametatex
+++ b/Master/bin/aarch64-linux/luametatex
Binary files differ
diff --git a/Master/bin/amd64-freebsd/luametatex b/Master/bin/amd64-freebsd/luametatex
index db20750a2a3..f3ca40325d1 100755
--- a/Master/bin/amd64-freebsd/luametatex
+++ b/Master/bin/amd64-freebsd/luametatex
Binary files differ
diff --git a/Master/bin/armhf-linux/luametatex b/Master/bin/armhf-linux/luametatex
index 0ada2c271f9..06bf251af6e 100755
--- a/Master/bin/armhf-linux/luametatex
+++ b/Master/bin/armhf-linux/luametatex
Binary files differ
diff --git a/Master/bin/i386-freebsd/luametatex b/Master/bin/i386-freebsd/luametatex
index 36377d15a13..182e534f388 100755
--- a/Master/bin/i386-freebsd/luametatex
+++ b/Master/bin/i386-freebsd/luametatex
Binary files differ
diff --git a/Master/bin/i386-linux/luametatex b/Master/bin/i386-linux/luametatex
index ec56c2772c7..e078586c377 100755
--- a/Master/bin/i386-linux/luametatex
+++ b/Master/bin/i386-linux/luametatex
Binary files differ
diff --git a/Master/bin/i386-solaris/luametatex b/Master/bin/i386-solaris/luametatex
index edfbdaee242..74392bea502 100755
--- a/Master/bin/i386-solaris/luametatex
+++ b/Master/bin/i386-solaris/luametatex
Binary files differ
diff --git a/Master/bin/windows/context.lua b/Master/bin/windows/context.lua
index da2442d85ab..b44312cfab1 100644
--- a/Master/bin/windows/context.lua
+++ b/Master/bin/windows/context.lua
@@ -1,41 +1,41 @@
--- This file is a companion to "context(.exe)" and is effectively the same
--- as:
---
--- mtxrun -script context ...
---
--- which will locate "mtx-context.lua" and load that one. The binary is a
--- copy of "luametatex(.exe)" aka luatex 2.0 for context lmtx. In a similar
--- fashion "mtxrun(.exe)" will load the "mtrun.lua" script.
---
--- The installation of context should do this on Windows:
---
--- luametatex.exe -> tex/texmf-win64/bin/luatex.exe
--- luametatex.exe -> tex/texmf-win64/bin/mtxrun.exe
--- luametatex.exe -> tex/texmf-win64/bin/context.exe
--- mtxrun.lua -> tex/texmf-win64/bin/mtxrun.lua
--- context.lua -> tex/texmf-win64/bin/context.lua
---
--- and this on Unix:
---
--- luametatex -> tex/texmf-linux-64/bin/luatex
--- luametatex -> tex/texmf-linux-64/bin/mtxrun
--- luametatex -> tex/texmf-linux-64/bin/context
--- mtxrun.lua -> tex/texmf-linux-64/bin/mtxrun.lua
--- context.lua -> tex/texmf-linux-64/bin/context.lua
---
--- The static binary is smaller than 3MB so the few copies provide no real
--- overhead.
-
-local selfpath = os.selfpath
-
-if not arg or not selfpath then
- print("invalid stub")
- os.exit()
-end
-
-arg[0] = "mtxrun"
-
-table.insert(arg,1,"mtx-context")
-table.insert(arg,1,"--script")
-
-dofile(selfpath .. "/" .. "mtxrun.lua")
+-- This file is a companion to "context(.exe)" and is effectively the same
+-- as:
+--
+-- mtxrun -script context ...
+--
+-- which will locate "mtx-context.lua" and load that one. The binary is a
+-- copy of "luametatex(.exe)" aka luatex 2.0 for context lmtx. In a similar
+-- fashion "mtxrun(.exe)" will load the "mtrun.lua" script.
+--
+-- The installation of context should do this on Windows:
+--
+-- luametatex.exe -> tex/texmf-win64/bin/luatex.exe
+-- luametatex.exe -> tex/texmf-win64/bin/mtxrun.exe
+-- luametatex.exe -> tex/texmf-win64/bin/context.exe
+-- mtxrun.lua -> tex/texmf-win64/bin/mtxrun.lua
+-- context.lua -> tex/texmf-win64/bin/context.lua
+--
+-- and this on Unix:
+--
+-- luametatex -> tex/texmf-linux-64/bin/luatex
+-- luametatex -> tex/texmf-linux-64/bin/mtxrun
+-- luametatex -> tex/texmf-linux-64/bin/context
+-- mtxrun.lua -> tex/texmf-linux-64/bin/mtxrun.lua
+-- context.lua -> tex/texmf-linux-64/bin/context.lua
+--
+-- The static binary is smaller than 3MB so the few copies provide no real
+-- overhead.
+
+local selfpath = os.selfpath
+
+if not arg or not selfpath then
+ print("invalid stub")
+ os.exit()
+end
+
+arg[0] = "mtxrun"
+
+table.insert(arg,1,"mtx-context")
+table.insert(arg,1,"--script")
+
+dofile(selfpath .. "/" .. "mtxrun.lua")
diff --git a/Master/bin/windows/luametatex.exe b/Master/bin/windows/luametatex.exe
index 7bd6876f4e8..2be235a9119 100755
--- a/Master/bin/windows/luametatex.exe
+++ b/Master/bin/windows/luametatex.exe
Binary files differ
diff --git a/Master/bin/windows/mtxrun.lua b/Master/bin/windows/mtxrun.lua
index cd83189a40f..f8ef741105e 100755
--- a/Master/bin/windows/mtxrun.lua
+++ b/Master/bin/windows/mtxrun.lua
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -8657,7 +8666,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 14071, stripped down to: 10417
+-- original size: 14107, stripped down to: 10453
if not modules then modules={} end modules ['util-sac']={
version=1.001,
@@ -9136,13 +9145,13 @@ if bit32 and not streams.tocardinal1 then
local extract=bit32.extract
local char=string.char
streams.tocardinal1=char
- function streams.tocardinal2(n) return char(extract(8,8),extract(0,8)) end
- function streams.tocardinal3(n) return char(extract(16,8),extract(8,8),extract(0,8)) end
- function streams.tocardinal4(n) return char(extract(24,8),extract(16,8),extract(8,8),extract(0,8)) end
+ function streams.tocardinal2(n) return char(extract(n,8,8),extract(n,0,8)) end
+ function streams.tocardinal3(n) return char(extract(n,16,8),extract(n,8,8),extract(n,0,8)) end
+ function streams.tocardinal4(n) return char(extract(n,24,8),extract(n,16,8),extract(n,8,8),extract(n,0,8)) end
streams.tocardinal1le=char
- function streams.tocardinal2le(n) return char(extract(0,8),extract(8,8)) end
- function streams.tocardinal3le(n) return char(extract(0,8),extract(8,8),extract(16,8)) end
- function streams.tocardinal4le(n) return char(extract(0,8),extract(8,8),extract(16,8),extract(24,8)) end
+ function streams.tocardinal2le(n) return char(extract(n,0,8),extract(n,8,8)) end
+ function streams.tocardinal3le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8)) end
+ function streams.tocardinal4le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8),extract(n,24,8)) end
end
if not streams.readcstring then
local readchar=streams.readchar
@@ -9338,7 +9347,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 25542, stripped down to: 16783
+-- original size: 25716, stripped down to: 16805
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9546,7 +9555,9 @@ function parsers.groupedsplitat(symbol,withaction)
if not pattern then
local symbols=S(symbol)
local separator=space^0*symbols*space^0
- local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+(1-(space^0*(symbols+P(-1)))))^0)
+ local value=lbrace*C((nobrace+nestedbraces)^0)
+*(rbrace*(#symbols+P(-1)))
++C((nestedbraces+(1-(space^0*(symbols+P(-1)))))^0)
if withaction then
local withvalue=Carg(1)*value/function(f,s) return f(s) end
pattern=spaces*withvalue*(separator*withvalue)^0
@@ -9940,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9953,19 +9964,21 @@ 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 tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9987,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ 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
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -14760,7 +14803,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 21145, stripped down to: 13271
+-- original size: 21146, stripped down to: 13272
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15070,7 +15113,7 @@ local runners={
if trace then
report("resultof: %s",command)
end
- local handle=iopopen(command,"r")
+ local handle=iopopen(command,"rb")
if handle then
local result=handle:read("*all") or ""
handle:close()
@@ -16395,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17876,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19127,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19196,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21703,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22238,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22306,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24247,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24465,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -25806,7 +25851,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11691, stripped down to: 8350
+-- original size: 12056, stripped down to: 8398
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -26093,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.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-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035743
--- stripped bytes : 408144
+-- original bytes : 1037585
+-- stripped bytes : 408686
-- end library merge
diff --git a/Master/bin/x86_64-darwinlegacy/luametatex b/Master/bin/x86_64-darwinlegacy/luametatex
index 07c07ee28cf..dab706a6b9f 100755
--- a/Master/bin/x86_64-darwinlegacy/luametatex
+++ b/Master/bin/x86_64-darwinlegacy/luametatex
Binary files differ
diff --git a/Master/bin/x86_64-linuxmusl/luametatex b/Master/bin/x86_64-linuxmusl/luametatex
index 9ad7ff17734..d091d1c6114 100755
--- a/Master/bin/x86_64-linuxmusl/luametatex
+++ b/Master/bin/x86_64-linuxmusl/luametatex
Binary files differ
diff --git a/Master/bin/x86_64-solaris/luametatex b/Master/bin/x86_64-solaris/luametatex
index c38a8627a36..8db94b94825 100755
--- a/Master/bin/x86_64-solaris/luametatex
+++ b/Master/bin/x86_64-solaris/luametatex
Binary files differ
diff --git a/Master/source/luametatex-2.10.08.tar.xz b/Master/source/luametatex-2.10.08.tar.xz
new file mode 100644
index 00000000000..9382494f4ea
--- /dev/null
+++ b/Master/source/luametatex-2.10.08.tar.xz
Binary files differ
diff --git a/Master/source/luametatex-230310.tar.xz b/Master/source/luametatex-230310.tar.xz
deleted file mode 100644
index f141d8239af..00000000000
--- a/Master/source/luametatex-230310.tar.xz
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-context.lua b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-context.lua
index 4c88849713a..15b1cca86ae 100644
--- a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-context.lua
+++ b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-context.lua
@@ -1,4 +1,4 @@
return {
- ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "maxiterator", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "semicolonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", "extendaccentsmathcontrolcode", "extenddelimitersmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", "Ux", "eUx", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" },
- ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "newinteger", "newdimension", "newgluespec", "newmugluespec", "aliasinteger", "aliasdimension", "then", "begcsname", "autorule", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "vkern", "hkern", "vpenalty", "hpenalty", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "hsplit", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruleddbox", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruleddpack", "ruledvsplit", "ruledtsplit", "ruleddsplit", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "resetdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" },
+ ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "maxiterator", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "semicolonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", "extendaccentsmathcontrolcode", "extenddelimitersmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startlocalcomponent", "stoplocalcomponent", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", "Ux", "eUx", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" },
+ ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newfloat", "newlanguage", "newfamily", "newfam", "newhelp", "newinteger", "newdimension", "newgluespec", "newmugluespec", "newposit", "aliasinteger", "aliasdimension", "aliasposit", "then", "begcsname", "autorule", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "vkern", "hkern", "vpenalty", "hpenalty", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "hsplit", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruleddbox", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruleddpack", "ruledvsplit", "ruledtsplit", "ruleddsplit", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "resetdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" },
} \ No newline at end of file
diff --git a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-metapost.lua b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
index 53271d674ef..f06e3596925 100644
--- a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
+++ b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
@@ -1,5 +1,5 @@
return {
- ["commands"]={ "on", "off", "interpath", "upto", "downto", "beginfig", "endfig", "beginglyph", "endglyph", "beginfont", "endfont", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "pensquare", "penrazor", "penspec", "origin", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "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", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk", "triplet", "quadruplet", "totransform", "bymatrix", "closedcurve", "closedlines", "primitive", "permanent", "immutable", "mutable", "frozen", "showproperty", "showhashentry", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt" },
+ ["commands"]={ "on", "off", "interpath", "upto", "downto", "beginfig", "endfig", "beginglyph", "endglyph", "beginfont", "endfont", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "pensquare", "penrazor", "penspec", "origin", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "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", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk", "es", "ts", "triplet", "quadruplet", "totransform", "bymatrix", "closedcurve", "closedlines", "primitive", "permanent", "immutable", "mutable", "frozen", "showproperty", "showhashentry", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt" },
["disabled"]={ "verbatimtex", "troffmode" },
["internals"]={ "mitered", "rounded", "beveled", "butt", "squared", "eps", "epsilon", "infinity", "bboxmargin", "ahlength", "ahangle", "labeloffset", "dotlabeldiam", "defaultpen", "defaultscale", "join_radius", "charscale", "inicatcoderegime", "texcatcoderegime", "luacatcoderegime", "notcatcoderegime", "vrbcatcoderegime", "prtcatcoderegime", "ctxcatcoderegime", "txtcatcoderegime", "catcoderegime", "ditto", "EOF", "pen_lft", "pen_rt", "pen_top", "pen_bot" },
["metafont"]={ "autorounding", "beginchar", "blacker", "boundarychar", "capsule_def", "capsule_end", "change_width", "chardp", "chardx", "chardy", "charexists", "charext", "charht", "charic", "charlist", "charwd", "cull", "cullit", "currenttransform", "currentwindow", "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", "designsize", "display", "displaying", "endchar", "extensible", "extra_beginchar", "extra_endchar", "extra_setup", "fillin", "font_coding_scheme", "font_extra_space", "font_identifier", "font_normal_shrink", "font_normal_space", "font_normal_stretch", "font_quad", "font_size", "font_slant", "font_x_height", "fontdimen", "fontmaking", "gfcorners", "granularity", "grayfont", "headerbyte", "hppp", "hround", "imagerules", "italcorr", "kern", "labelfont", "ligtable", "lowres_fix", "makebox", "makegrid", "maketicks", "mode_def", "mode_setup", "nodisplays", "notransforms", "numspecial", "o_correction", "openit", "openwindow", "pixels_per_inch", "proofing", "proofoffset", "proofrule", "proofrulethickness", "rulepen", "screenchars", "screenrule", "screenstrokes", "screen_cols", "screen_rows", "showit", "slantfont", "smode", "smoothing", "titlefont", "totalweight", "tracingedges", "tracingpens", "turningcheck", "unitpixel", "vppp", "vround", "xoffset", "yoffset" },
diff --git a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-tex.lua b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-tex.lua
index 6cb881a1f66..4ed2037840a 100644
--- a/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-tex.lua
+++ b/Master/texmf-dist/context/data/scite/context/lexers/data/scite-context-data-tex.lua
@@ -1,7 +1,7 @@
return {
["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" },
["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "everyeof", "firstmarks", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "ifcsname", "ifdefined", "iffontchar", "interactionmode", "interlinepenalties", "lastlinefit", "lastnodetype", "marks", "muexpr", "mutoglue", "numexpr", "pagediscards", "parshapedimen", "parshapeindent", "parshapelength", "predisplaydirection", "protected", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" },
- ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "amcode", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxvadjust", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "cdef", "cdefcsname", "cfcode", "clearmarks", "constant", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csactive", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "dbox", "defcsname", "detokenized", "dimensiondef", "dimexpression", "directlua", "dpack", "dsplit", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandactive", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "flushmarks", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchkdimension", "ifchknum", "ifchknumber", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzeronum", "ignorearguments", "ignoredepthcriterium", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathbinary", "mathcheckfencesmode", "mathclose", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfraction", "mathghost", "mathgluemode", "mathgroupingmode", "mathinner", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathopen", "mathoperator", "mathordinary", "mathoverline", "mathpenaltiesmode", "mathpunctuation", "mathradical", "mathrelation", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "mathunderline", "meaningasis", "meaningfull", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracinglists", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "tsplit", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "variablefam", "virtualhrule", "virtualvrule", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" },
+ ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterextendmargin", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "amcode", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxvadjust", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "cdef", "cdefcsname", "cfcode", "clearmarks", "constant", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csactive", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "dbox", "defcsname", "deferred", "detokenized", "dimensiondef", "dimexpression", "directlua", "dpack", "dsplit", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "eufactor", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandactive", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "float", "floatdef", "floatexpr", "flushmarks", "fontcharba", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsfloat", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchkdimension", "ifchknum", "ifchknumber", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "iffloat", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzerofloat", "ifzeronum", "ignorearguments", "ignoredepthcriterium", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathbinary", "mathcheckfencesmode", "mathclose", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfraction", "mathghost", "mathgluemode", "mathgroupingmode", "mathinner", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathopen", "mathoperator", "mathordinary", "mathoverline", "mathpenaltiesmode", "mathpunctuation", "mathradical", "mathrelation", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "mathunderline", "meaningasis", "meaningful", "meaningfull", "meaningles", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "positdef", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracinglists", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "tsplit", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "variablefam", "virtualhrule", "virtualvrule", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" },
["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" },
["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfomitinfodict", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" },
["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "advanceby", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "divideby", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathcode", "mathop", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "multiplyby", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parinitleftskip", "parinitrightskip", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topskip", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "unboundary", "underline", "unhbox", "unhcopy", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" },
diff --git a/Master/texmf-dist/context/data/scite/context/scite-context-data-context.properties b/Master/texmf-dist/context/data/scite/context/scite-context-data-context.properties
index 45479331b0a..88b20999f3c 100644
--- a/Master/texmf-dist/context/data/scite/context/scite-context-data-context.properties
+++ b/Master/texmf-dist/context/data/scite/context/scite-context-data-context.properties
@@ -70,56 +70,56 @@ stopmodeset doifmode doifelsemode doifmodeelse doifnotmode \
startmodeset stopmodeset startallmodes stopallmodes startnotallmodes \
stopnotallmodes doifallmodes doifelseallmodes doifallmodeselse doifnotallmodes \
startenvironment stopenvironment environment startcomponent stopcomponent \
-component startproduct stopproduct product startproject \
-stopproject project starttext stoptext startnotext \
-stopnotext startdocument stopdocument documentvariable unexpandeddocumentvariable \
-setupdocument presetdocument doifelsedocumentvariable doifdocumentvariableelse doifdocumentvariable \
-doifnotdocumentvariable startmodule stopmodule usemodule usetexmodule \
-useluamodule setupmodule currentmoduleparameter moduleparameter everystarttext \
-everystoptext startTEXpage stopTEXpage enablemode disablemode \
-preventmode definemode globalenablemode globaldisablemode globalpreventmode \
-pushmode popmode typescriptone typescripttwo typescriptthree \
-mathsizesuffix mathordinarycode mathordcode mathoperatorcode mathopcode \
-mathbinarycode mathbincode mathrelationcode mathrelcode mathopencode \
-mathclosecode mathpunctuationcode mathpunctcode mathovercode mathundercode \
-mathinnercode mathradicalcode mathfractioncode mathmiddlecode mathaccentcode \
-mathfencedcode mathghostcode mathvariablecode mathactivecode mathvcentercode \
-mathconstructcode mathwrappedcode mathbegincode mathendcode mathexplicitcode \
-mathdivisioncode mathfactorialcode mathdimensioncode mathexperimentalcode mathtextpunctuationcode \
-mathimaginarycode mathdifferentialcode mathexponentialcode mathellipsiscode mathfunctioncode \
-mathdigitcode mathalphacode mathboxcode mathchoicecode mathnothingcode \
-mathlimopcode mathnolopcode mathunsetcode mathunspacedcode mathallcode \
-mathfakecode mathunarycode mathmaybeordinarycode mathmayberelationcode mathmaybebinarycode \
-mathnumbergroupcode constantnumber constantnumberargument constantdimen constantdimenargument \
-constantemptyargument luastringsep !!bs !!es lefttorightmark \
-righttoleftmark lrm rlm bidilre bidirle \
-bidipop bidilro bidirlo breakablethinspace nobreakspace \
-nonbreakablespace narrownobreakspace zerowidthnobreakspace ideographicspace ideographichalffillspace \
-twoperemspace threeperemspace fourperemspace fiveperemspace sixperemspace \
-figurespace punctuationspace hairspace enquad emquad \
-zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj zwj \
-optionalspace asciispacechar softhyphen autoinsertedspace Ux \
-eUx parfillleftskip parfillrightskip startlmtxmode stoplmtxmode \
-startmkivmode stopmkivmode wildcardsymbol normalhyphenationcode automatichyphenationcode \
-explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode collapsehyphenationcode compoundhyphenationcode \
-strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode permitgluehyphenationcode \
-permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode lazyligatureshyphenationcode forcehandlerhyphenationcode \
-feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode completehyphenationcode normalizelinenormalizecode \
-parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode breakafterdirnormalizecode removemarginkernsnormalizecode \
-clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode flattenhleadersnormalizecode normalizeparnormalizeparcode \
-flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode lefttopkernclassoptioncode righttopkernclassoptioncode \
-leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode defaultmathclassoptions \
-checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode flattenclassoptioncode omitpenaltyclassoptioncode \
-unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode \
-carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode \
-noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode noleftkernglyphoptioncode norightligatureglyphoptioncode \
-norightkernglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode noitaliccorrectionglyphoptioncode nokerningcode \
-noligaturingcode frozenflagcode tolerantflagcode protectedflagcode primitiveflagcode \
-permanentflagcode noalignedflagcode immutableflagcode mutableflagcode globalflagcode \
-overloadedflagcode immediateflagcode conditionalflagcode valueflagcode instanceflagcode \
-ordmathflattencode binmathflattencode relmathflattencode punctmathflattencode innermathflattencode \
-normalworddiscoptioncode preworddiscoptioncode postworddiscoptioncode continueifinputfile continuewhenlmtxmode \
-continuewhenmkivmode
+component startlocalcomponent stoplocalcomponent startproduct stopproduct \
+product startproject stopproject project starttext \
+stoptext startnotext stopnotext startdocument stopdocument \
+documentvariable unexpandeddocumentvariable setupdocument presetdocument doifelsedocumentvariable \
+doifdocumentvariableelse doifdocumentvariable doifnotdocumentvariable startmodule stopmodule \
+usemodule usetexmodule useluamodule setupmodule currentmoduleparameter \
+moduleparameter everystarttext everystoptext startTEXpage stopTEXpage \
+enablemode disablemode preventmode definemode globalenablemode \
+globaldisablemode globalpreventmode pushmode popmode typescriptone \
+typescripttwo typescriptthree mathsizesuffix mathordinarycode mathordcode \
+mathoperatorcode mathopcode mathbinarycode mathbincode mathrelationcode \
+mathrelcode mathopencode mathclosecode mathpunctuationcode mathpunctcode \
+mathovercode mathundercode mathinnercode mathradicalcode mathfractioncode \
+mathmiddlecode mathaccentcode mathfencedcode mathghostcode mathvariablecode \
+mathactivecode mathvcentercode mathconstructcode mathwrappedcode mathbegincode \
+mathendcode mathexplicitcode mathdivisioncode mathfactorialcode mathdimensioncode \
+mathexperimentalcode mathtextpunctuationcode mathimaginarycode mathdifferentialcode mathexponentialcode \
+mathellipsiscode mathfunctioncode mathdigitcode mathalphacode mathboxcode \
+mathchoicecode mathnothingcode mathlimopcode mathnolopcode mathunsetcode \
+mathunspacedcode mathallcode mathfakecode mathunarycode mathmaybeordinarycode \
+mathmayberelationcode mathmaybebinarycode mathnumbergroupcode constantnumber constantnumberargument \
+constantdimen constantdimenargument constantemptyargument luastringsep !!bs \
+!!es lefttorightmark righttoleftmark lrm rlm \
+bidilre bidirle bidipop bidilro bidirlo \
+breakablethinspace nobreakspace nonbreakablespace narrownobreakspace zerowidthnobreakspace \
+ideographicspace ideographichalffillspace twoperemspace threeperemspace fourperemspace \
+fiveperemspace sixperemspace figurespace punctuationspace hairspace \
+enquad emquad zerowidthspace zerowidthnonjoiner zerowidthjoiner \
+zwnj zwj optionalspace asciispacechar softhyphen \
+autoinsertedspace Ux eUx parfillleftskip parfillrightskip \
+startlmtxmode stoplmtxmode startmkivmode stopmkivmode wildcardsymbol \
+normalhyphenationcode automatichyphenationcode explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode \
+collapsehyphenationcode compoundhyphenationcode strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode \
+explicitpenaltyhyphenationcode permitgluehyphenationcode permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode \
+lazyligatureshyphenationcode forcehandlerhyphenationcode feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode \
+completehyphenationcode normalizelinenormalizecode parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode \
+breakafterdirnormalizecode removemarginkernsnormalizecode clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode \
+flattenhleadersnormalizecode normalizeparnormalizeparcode flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode \
+lefttopkernclassoptioncode righttopkernclassoptioncode leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode \
+noitaliccorrectionclassoptioncode defaultmathclassoptions checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode \
+flattenclassoptioncode omitpenaltyclassoptioncode unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode \
+carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode \
+removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode \
+noleftkernglyphoptioncode norightligatureglyphoptioncode norightkernglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode \
+noitaliccorrectionglyphoptioncode nokerningcode noligaturingcode frozenflagcode tolerantflagcode \
+protectedflagcode primitiveflagcode permanentflagcode noalignedflagcode immutableflagcode \
+mutableflagcode globalflagcode overloadedflagcode immediateflagcode conditionalflagcode \
+valueflagcode instanceflagcode ordmathflattencode binmathflattencode relmathflattencode \
+punctmathflattencode innermathflattencode normalworddiscoptioncode preworddiscoptioncode postworddiscoptioncode \
+continueifinputfile continuewhenlmtxmode continuewhenmkivmode
keywordclass.context.helpers=\
startsetups stopsetups startxmlsetups stopxmlsetups \
@@ -134,184 +134,184 @@ setmode resetmode newsystemmode setsystemmode resetsystemmode \
pushsystemmode popsystemmode globalsetmode globalresetmode globalsetsystemmode \
globalresetsystemmode booleanmodevalue newcount newdimen newskip \
newmuskip newbox newtoks newread newwrite \
-newmarks newinsert newattribute newif newlanguage \
-newfamily newfam newhelp newinteger newdimension \
-newgluespec newmugluespec aliasinteger aliasdimension then \
-begcsname autorule strippedcsname checkedstrippedcsname nofarguments \
-firstargumentfalse firstargumenttrue secondargumentfalse secondargumenttrue thirdargumentfalse \
-thirdargumenttrue fourthargumentfalse fourthargumenttrue fifthargumentfalse fifthargumenttrue \
-sixthargumentfalse sixthargumenttrue seventhargumentfalse seventhargumenttrue vkern \
-hkern vpenalty hpenalty doglobal dodoglobal \
-redoglobal resetglobal donothing untraceddonothing dontcomplain \
-moreboxtracing lessboxtracing noboxtracing forgetall donetrue \
-donefalse foundtrue foundfalse inlineordisplaymath indisplaymath \
-forcedisplaymath startforceddisplaymath stopforceddisplaymath startpickupmath stoppickupmath \
-reqno forceinlinemath mathortext thebox htdp \
-unvoidbox hfilll vfilll mathbox mathlimop \
-mathnolop mathnothing mathalpha currentcatcodetable defaultcatcodetable \
-catcodetablename newcatcodetable startcatcodetable stopcatcodetable startextendcatcodetable \
-stopextendcatcodetable pushcatcodetable popcatcodetable restorecatcodes setcatcodetable \
-letcatcodecommand defcatcodecommand uedcatcodecommand hglue vglue \
-hfillneg vfillneg hfilllneg vfilllneg hsplit \
-ruledhss ruledhfil ruledhfill ruledhfilll ruledhfilneg \
-ruledhfillneg normalhfillneg normalhfilllneg ruledvss ruledvfil \
-ruledvfill ruledvfilll ruledvfilneg ruledvfillneg normalvfillneg \
-normalvfilllneg ruledhbox ruledvbox ruledvtop ruleddbox \
-ruledvcenter ruledmbox ruledhpack ruledvpack ruledtpack \
-ruleddpack ruledvsplit ruledtsplit ruleddsplit ruledhskip \
-ruledvskip ruledkern ruledmskip ruledmkern ruledhglue \
-ruledvglue normalhglue normalvglue ruledpenalty filledhboxb \
-filledhboxr filledhboxg filledhboxc filledhboxm filledhboxy \
-filledhboxk scratchstring scratchstringone scratchstringtwo tempstring \
-scratchcounter globalscratchcounter privatescratchcounter scratchdimen globalscratchdimen \
-privatescratchdimen scratchskip globalscratchskip privatescratchskip scratchmuskip \
-globalscratchmuskip privatescratchmuskip scratchtoks globalscratchtoks privatescratchtoks \
-scratchbox globalscratchbox privatescratchbox scratchmacro scratchmacroone \
-scratchmacrotwo scratchconditiontrue scratchconditionfalse ifscratchcondition scratchconditiononetrue \
-scratchconditiononefalse ifscratchconditionone scratchconditiontwotrue scratchconditiontwofalse ifscratchconditiontwo \
-globalscratchcounterone globalscratchcountertwo globalscratchcounterthree groupedcommand groupedcommandcs \
-triggergroupedcommand triggergroupedcommandcs simplegroupedcommand simplegroupedcommandcs pickupgroupedcommand \
-pickupgroupedcommandcs mathgroupedcommandcs usedbaselineskip usedlineskip usedlineskiplimit \
-availablehsize localhsize setlocalhsize distributedhsize hsizefraction \
-next nexttoken nextbox dowithnextbox dowithnextboxcs \
-dowithnextboxcontent dowithnextboxcontentcs flushnextbox boxisempty boxtostring \
-contentostring prerolltostring givenwidth givenheight givendepth \
-scangivendimensions scratchwidth scratchheight scratchdepth scratchoffset \
-scratchdistance scratchtotal scratchitalic scratchhsize scratchvsize \
-scratchxoffset scratchyoffset scratchhoffset scratchvoffset scratchxposition \
-scratchyposition scratchtopoffset scratchbottomoffset scratchleftoffset scratchrightoffset \
-scratchcounterone scratchcountertwo scratchcounterthree scratchcounterfour scratchcounterfive \
-scratchcountersix scratchdimenone scratchdimentwo scratchdimenthree scratchdimenfour \
-scratchdimenfive scratchdimensix scratchskipone scratchskiptwo scratchskipthree \
-scratchskipfour scratchskipfive scratchskipsix scratchmuskipone scratchmuskiptwo \
-scratchmuskipthree scratchmuskipfour scratchmuskipfive scratchmuskipsix scratchtoksone \
-scratchtokstwo scratchtoksthree scratchtoksfour scratchtoksfive scratchtokssix \
-scratchboxone scratchboxtwo scratchboxthree scratchboxfour scratchboxfive \
-scratchboxsix scratchnx scratchny scratchmx scratchmy \
-scratchunicode scratchmin scratchmax scratchleftskip scratchrightskip \
-scratchtopskip scratchbottomskip doif doifnot doifelse \
-firstinset doifinset doifnotinset doifelseinset doifinsetelse \
-doifelsenextchar doifnextcharelse doifelsenextcharcs doifnextcharcselse doifelsenextoptional \
-doifnextoptionalelse doifelsenextoptionalcs doifnextoptionalcselse doifelsefastoptionalcheck doiffastoptionalcheckelse \
-doifelsefastoptionalcheckcs doiffastoptionalcheckcselse doifelsenextbgroup doifnextbgroupelse doifelsenextbgroupcs \
-doifnextbgroupcselse doifelsenextparenthesis doifnextparenthesiselse doifelseundefined doifundefinedelse \
-doifelsedefined doifdefinedelse doifundefined doifdefined doifelsevalue \
-doifvalue doifnotvalue doifnothing doifsomething doifelsenothing \
-doifnothingelse doifelsesomething doifsomethingelse doifvaluenothing doifvaluesomething \
-doifelsevaluenothing doifvaluenothingelse doifelsedimension doifdimensionelse doifelsenumber \
-doifnumberelse doifnumber doifnotnumber doifelsecommon doifcommonelse \
-doifcommon doifnotcommon doifinstring doifnotinstring doifelseinstring \
-doifinstringelse doifelseassignment doifassignmentelse docheckassignment doifelseassignmentcs \
-doifassignmentelsecs validassignment novalidassignment doiftext doifelsetext \
-doiftextelse doifnottext quitcondition truecondition falsecondition \
-tracingall tracingnone loggingall tracingcatcodes showluatokens \
-aliasmacro removetoks appendtoks prependtoks appendtotoks \
-prependtotoks to endgraf endpar reseteverypar \
-finishpar empty null space quad \
-enspace emspace charspace nbsp crlf \
-obeyspaces obeylines obeytabs obeypages obeyedspace \
-obeyedline obeyedtab obeyedpage normalspace naturalspace \
-controlspace normalspaces ignoretabs ignorelines ignorepages \
-ignoreeofs setcontrolspaces executeifdefined singleexpandafter doubleexpandafter \
-tripleexpandafter dontleavehmode removelastspace removeunwantedspaces keepunwantedspaces \
-removepunctuation ignoreparskip forcestrutdepth onlynonbreakablespace wait \
-writestatus define defineexpandable redefine setmeasure \
-setemeasure setgmeasure setxmeasure definemeasure freezemeasure \
-measure measured directmeasure setquantity setequantity \
-setgquantity setxquantity definequantity freezequantity quantity \
-quantitied directquantity installcorenamespace getvalue getuvalue \
-setvalue setevalue setgvalue setxvalue letvalue \
-letgvalue resetvalue undefinevalue ignorevalue setuvalue \
-setuevalue setugvalue setuxvalue globallet udef \
-ugdef uedef uxdef checked unique \
-getparameters geteparameters getgparameters getxparameters forgetparameters \
-copyparameters getdummyparameters dummyparameter directdummyparameter setdummyparameter \
-letdummyparameter setexpandeddummyparameter resetdummyparameter usedummystyleandcolor usedummystyleparameter \
-usedummycolorparameter processcommalist processcommacommand quitcommalist quitprevcommalist \
-processaction processallactions processfirstactioninset processallactionsinset unexpanded \
-expanded startexpanded stopexpanded protect unprotect \
-firstofoneargument firstoftwoarguments secondoftwoarguments firstofthreearguments secondofthreearguments \
-thirdofthreearguments firstoffourarguments secondoffourarguments thirdoffourarguments fourthoffourarguments \
-firstoffivearguments secondoffivearguments thirdoffivearguments fourthoffivearguments fifthoffivearguments \
-firstofsixarguments secondofsixarguments thirdofsixarguments fourthofsixarguments fifthofsixarguments \
-sixthofsixarguments firstofoneunexpanded firstoftwounexpanded secondoftwounexpanded firstofthreeunexpanded \
-secondofthreeunexpanded thirdofthreeunexpanded gobbleoneargument gobbletwoarguments gobblethreearguments \
-gobblefourarguments gobblefivearguments gobblesixarguments gobblesevenarguments gobbleeightarguments \
-gobbleninearguments gobbletenarguments gobbleoneoptional gobbletwooptionals gobblethreeoptionals \
-gobblefouroptionals gobblefiveoptionals dorecurse doloop exitloop \
-dostepwiserecurse recurselevel recursedepth dofastloopcs fastloopindex \
-fastloopfinal dowith doloopovermatch doloopovermatched doloopoverlist \
-newconstant setnewconstant setconstant setconstantvalue newconditional \
-settrue setfalse settruevalue setfalsevalue setconditional \
-newmacro setnewmacro newfraction newsignal newboundary \
-dosingleempty dodoubleempty dotripleempty doquadrupleempty doquintupleempty \
-dosixtupleempty doseventupleempty dosingleargument dodoubleargument dotripleargument \
-doquadrupleargument doquintupleargument dosixtupleargument doseventupleargument dosinglegroupempty \
-dodoublegroupempty dotriplegroupempty doquadruplegroupempty doquintuplegroupempty permitspacesbetweengroups \
-dontpermitspacesbetweengroups nopdfcompression maximumpdfcompression normalpdfcompression onlypdfobjectcompression \
-nopdfobjectcompression modulonumber dividenumber getfirstcharacter doifelsefirstchar \
-doiffirstcharelse mathclassvalue startnointerference stopnointerference twodigits \
-threedigits leftorright offinterlineskip oninterlineskip nointerlineskip \
-strut halfstrut quarterstrut depthstrut halflinestrut \
-noheightstrut setstrut strutbox strutht strutdp \
-strutwd struthtdp strutgap begstrut endstrut \
-lineheight leftboundary rightboundary signalcharacter aligncontentleft \
-aligncontentmiddle aligncontentright shiftbox vpackbox hpackbox \
-vpackedbox hpackedbox normalreqno startimath stopimath \
-normalstartimath normalstopimath startdmath stopdmath normalstartdmath \
-normalstopdmath normalsuperscript normalsubscript normalnosuperscript normalnosubscript \
-normalprimescript superscript subscript nosuperscript nosubscript \
-primescript superprescript subprescript nosuperprescript nosubsprecript \
-uncramped cramped mathstyletrigger triggermathstyle triggeredmathstyle \
-mathstylefont mathsmallstylefont mathstyleface mathsmallstyleface mathstylecommand \
-mathpalette mathstylehbox mathstylevbox mathstylevcenter mathstylevcenteredhbox \
-mathstylevcenteredvbox mathtext setmathsmalltextbox setmathtextbox pushmathstyle \
-popmathstyle triggerdisplaystyle triggertextstyle triggerscriptstyle triggerscriptscriptstyle \
-triggeruncrampedstyle triggercrampedstyle triggersmallstyle triggeruncrampedsmallstyle triggercrampedsmallstyle \
-triggerbigstyle triggeruncrampedbigstyle triggercrampedbigstyle luaexpr expelsedoif \
-expdoif expdoifnot expdoifelsecommon expdoifcommonelse expdoifelseinset \
-expdoifinsetelse ctxdirectlua ctxlatelua ctxsprint ctxwrite \
-ctxcommand ctxdirectcommand ctxlatecommand ctxreport ctxlua \
-luacode lateluacode directluacode registerctxluafile ctxloadluafile \
-luaversion luamajorversion luaminorversion ctxluacode luaconditional \
-luaexpanded ctxluamatch startluaparameterset stopluaparameterset luaparameterset \
-definenamedlua obeylualines obeyluatokens startluacode stopluacode \
-startlua stoplua startctxfunction stopctxfunction ctxfunction \
-startctxfunctiondefinition stopctxfunctiondefinition installctxfunction installprotectedctxfunction installprotectedctxscanner \
-installctxscanner resetctxscanner cldprocessfile cldloadfile cldloadviafile \
-cldcontext cldcommand carryoverpar freezeparagraphproperties defrostparagraphproperties \
-setparagraphfreezing forgetparagraphfreezing updateparagraphproperties updateparagraphpenalties updateparagraphdemerits \
-updateparagraphshapes updateparagraphlines lastlinewidth assumelongusagecs righttolefthbox \
-lefttorighthbox righttoleftvbox lefttorightvbox righttoleftvtop lefttorightvtop \
-rtlhbox ltrhbox rtlvbox ltrvbox rtlvtop \
-ltrvtop autodirhbox autodirvbox autodirvtop leftorrighthbox \
-leftorrightvbox leftorrightvtop lefttoright righttoleft checkedlefttoright \
-checkedrighttoleft synchronizelayoutdirection synchronizedisplaydirection synchronizeinlinedirection dirlre \
-dirrle dirlro dirrlo rtltext ltrtext \
-lesshyphens morehyphens nohyphens dohyphens dohyphencollapsing \
-nohyphencollapsing compounddiscretionary Ucheckedstartdisplaymath Ucheckedstopdisplaymath break \
-nobreak allowbreak goodbreak nospace nospacing \
-dospacing naturalhbox naturalvbox naturalvtop naturalhpack \
-naturalvpack naturaltpack reversehbox reversevbox reversevtop \
-reversehpack reversevpack reversetpack hcontainer vcontainer \
-tcontainer frule compoundhyphenpenalty start stop \
-unsupportedcs openout closeout write openin \
-closein read readline readfromterminal boxlines \
-boxline setboxline copyboxline boxlinewd boxlineht \
-boxlinedp boxlinenw boxlinenh boxlinend boxlinels \
-boxliners boxlinelh boxlinerh boxlinelp boxlinerp \
-boxlinein boxrangewd boxrangeht boxrangedp bitwiseset \
-bitwiseand bitwiseor bitwisexor bitwisenot bitwisenil \
-ifbitwiseand bitwise bitwiseshift bitwiseflip textdir \
-linedir pardir boxdir prelistbox postlistbox \
-prelistcopy postlistcopy setprelistbox setpostlistbox noligaturing \
-nokerning noexpansion noprotrusion noleftkerning noleftligaturing \
-norightkerning norightligaturing noitaliccorrection futureletnexttoken defbackslashbreak \
-letbackslashbreak pushoverloadmode popoverloadmode pushrunstate poprunstate \
-suggestedalias showboxhere discoptioncodestring flagcodestring frozenparcodestring \
-glyphoptioncodestring groupcodestring hyphenationcodestring mathcontrolcodestring mathflattencodestring \
-normalizecodestring parcontextcodestring newlocalcount newlocaldimen newlocalskip \
-newlocalmuskip newlocaltoks newlocalbox newlocalwrite newlocalread \
-setnewlocalcount setnewlocaldimen setnewlocalskip setnewlocalmuskip setnewlocaltoks \
-setnewlocalbox ifexpression
+newmarks newinsert newattribute newif newfloat \
+newlanguage newfamily newfam newhelp newinteger \
+newdimension newgluespec newmugluespec newposit aliasinteger \
+aliasdimension aliasposit then begcsname autorule \
+strippedcsname checkedstrippedcsname nofarguments firstargumentfalse firstargumenttrue \
+secondargumentfalse secondargumenttrue thirdargumentfalse thirdargumenttrue fourthargumentfalse \
+fourthargumenttrue fifthargumentfalse fifthargumenttrue sixthargumentfalse sixthargumenttrue \
+seventhargumentfalse seventhargumenttrue vkern hkern vpenalty \
+hpenalty doglobal dodoglobal redoglobal resetglobal \
+donothing untraceddonothing dontcomplain moreboxtracing lessboxtracing \
+noboxtracing forgetall donetrue donefalse foundtrue \
+foundfalse inlineordisplaymath indisplaymath forcedisplaymath startforceddisplaymath \
+stopforceddisplaymath startpickupmath stoppickupmath reqno forceinlinemath \
+mathortext thebox htdp unvoidbox hfilll \
+vfilll mathbox mathlimop mathnolop mathnothing \
+mathalpha currentcatcodetable defaultcatcodetable catcodetablename newcatcodetable \
+startcatcodetable stopcatcodetable startextendcatcodetable stopextendcatcodetable pushcatcodetable \
+popcatcodetable restorecatcodes setcatcodetable letcatcodecommand defcatcodecommand \
+uedcatcodecommand hglue vglue hfillneg vfillneg \
+hfilllneg vfilllneg hsplit ruledhss ruledhfil \
+ruledhfill ruledhfilll ruledhfilneg ruledhfillneg normalhfillneg \
+normalhfilllneg ruledvss ruledvfil ruledvfill ruledvfilll \
+ruledvfilneg ruledvfillneg normalvfillneg normalvfilllneg ruledhbox \
+ruledvbox ruledvtop ruleddbox ruledvcenter ruledmbox \
+ruledhpack ruledvpack ruledtpack ruleddpack ruledvsplit \
+ruledtsplit ruleddsplit ruledhskip ruledvskip ruledkern \
+ruledmskip ruledmkern ruledhglue ruledvglue normalhglue \
+normalvglue ruledpenalty filledhboxb filledhboxr filledhboxg \
+filledhboxc filledhboxm filledhboxy filledhboxk scratchstring \
+scratchstringone scratchstringtwo tempstring scratchcounter globalscratchcounter \
+privatescratchcounter scratchdimen globalscratchdimen privatescratchdimen scratchskip \
+globalscratchskip privatescratchskip scratchmuskip globalscratchmuskip privatescratchmuskip \
+scratchtoks globalscratchtoks privatescratchtoks scratchbox globalscratchbox \
+privatescratchbox scratchmacro scratchmacroone scratchmacrotwo scratchconditiontrue \
+scratchconditionfalse ifscratchcondition scratchconditiononetrue scratchconditiononefalse ifscratchconditionone \
+scratchconditiontwotrue scratchconditiontwofalse ifscratchconditiontwo globalscratchcounterone globalscratchcountertwo \
+globalscratchcounterthree groupedcommand groupedcommandcs triggergroupedcommand triggergroupedcommandcs \
+simplegroupedcommand simplegroupedcommandcs pickupgroupedcommand pickupgroupedcommandcs mathgroupedcommandcs \
+usedbaselineskip usedlineskip usedlineskiplimit availablehsize localhsize \
+setlocalhsize distributedhsize hsizefraction next nexttoken \
+nextbox dowithnextbox dowithnextboxcs dowithnextboxcontent dowithnextboxcontentcs \
+flushnextbox boxisempty boxtostring contentostring prerolltostring \
+givenwidth givenheight givendepth scangivendimensions scratchwidth \
+scratchheight scratchdepth scratchoffset scratchdistance scratchtotal \
+scratchitalic scratchhsize scratchvsize scratchxoffset scratchyoffset \
+scratchhoffset scratchvoffset scratchxposition scratchyposition scratchtopoffset \
+scratchbottomoffset scratchleftoffset scratchrightoffset scratchcounterone scratchcountertwo \
+scratchcounterthree scratchcounterfour scratchcounterfive scratchcountersix scratchdimenone \
+scratchdimentwo scratchdimenthree scratchdimenfour scratchdimenfive scratchdimensix \
+scratchskipone scratchskiptwo scratchskipthree scratchskipfour scratchskipfive \
+scratchskipsix scratchmuskipone scratchmuskiptwo scratchmuskipthree scratchmuskipfour \
+scratchmuskipfive scratchmuskipsix scratchtoksone scratchtokstwo scratchtoksthree \
+scratchtoksfour scratchtoksfive scratchtokssix scratchboxone scratchboxtwo \
+scratchboxthree scratchboxfour scratchboxfive scratchboxsix scratchnx \
+scratchny scratchmx scratchmy scratchunicode scratchmin \
+scratchmax scratchleftskip scratchrightskip scratchtopskip scratchbottomskip \
+doif doifnot doifelse firstinset doifinset \
+doifnotinset doifelseinset doifinsetelse doifelsenextchar doifnextcharelse \
+doifelsenextcharcs doifnextcharcselse doifelsenextoptional doifnextoptionalelse doifelsenextoptionalcs \
+doifnextoptionalcselse doifelsefastoptionalcheck doiffastoptionalcheckelse doifelsefastoptionalcheckcs doiffastoptionalcheckcselse \
+doifelsenextbgroup doifnextbgroupelse doifelsenextbgroupcs doifnextbgroupcselse doifelsenextparenthesis \
+doifnextparenthesiselse doifelseundefined doifundefinedelse doifelsedefined doifdefinedelse \
+doifundefined doifdefined doifelsevalue doifvalue doifnotvalue \
+doifnothing doifsomething doifelsenothing doifnothingelse doifelsesomething \
+doifsomethingelse doifvaluenothing doifvaluesomething doifelsevaluenothing doifvaluenothingelse \
+doifelsedimension doifdimensionelse doifelsenumber doifnumberelse doifnumber \
+doifnotnumber doifelsecommon doifcommonelse doifcommon doifnotcommon \
+doifinstring doifnotinstring doifelseinstring doifinstringelse doifelseassignment \
+doifassignmentelse docheckassignment doifelseassignmentcs doifassignmentelsecs validassignment \
+novalidassignment doiftext doifelsetext doiftextelse doifnottext \
+quitcondition truecondition falsecondition tracingall tracingnone \
+loggingall tracingcatcodes showluatokens aliasmacro removetoks \
+appendtoks prependtoks appendtotoks prependtotoks to \
+endgraf endpar reseteverypar finishpar empty \
+null space quad enspace emspace \
+charspace nbsp crlf obeyspaces obeylines \
+obeytabs obeypages obeyedspace obeyedline obeyedtab \
+obeyedpage normalspace naturalspace controlspace normalspaces \
+ignoretabs ignorelines ignorepages ignoreeofs setcontrolspaces \
+executeifdefined singleexpandafter doubleexpandafter tripleexpandafter dontleavehmode \
+removelastspace removeunwantedspaces keepunwantedspaces removepunctuation ignoreparskip \
+forcestrutdepth onlynonbreakablespace wait writestatus define \
+defineexpandable redefine setmeasure setemeasure setgmeasure \
+setxmeasure definemeasure freezemeasure measure measured \
+directmeasure setquantity setequantity setgquantity setxquantity \
+definequantity freezequantity quantity quantitied directquantity \
+installcorenamespace getvalue getuvalue setvalue setevalue \
+setgvalue setxvalue letvalue letgvalue resetvalue \
+undefinevalue ignorevalue setuvalue setuevalue setugvalue \
+setuxvalue globallet udef ugdef uedef \
+uxdef checked unique getparameters geteparameters \
+getgparameters getxparameters forgetparameters copyparameters getdummyparameters \
+dummyparameter directdummyparameter setdummyparameter letdummyparameter setexpandeddummyparameter \
+resetdummyparameter usedummystyleandcolor usedummystyleparameter usedummycolorparameter processcommalist \
+processcommacommand quitcommalist quitprevcommalist processaction processallactions \
+processfirstactioninset processallactionsinset unexpanded expanded startexpanded \
+stopexpanded protect unprotect firstofoneargument firstoftwoarguments \
+secondoftwoarguments firstofthreearguments secondofthreearguments thirdofthreearguments firstoffourarguments \
+secondoffourarguments thirdoffourarguments fourthoffourarguments firstoffivearguments secondoffivearguments \
+thirdoffivearguments fourthoffivearguments fifthoffivearguments firstofsixarguments secondofsixarguments \
+thirdofsixarguments fourthofsixarguments fifthofsixarguments sixthofsixarguments firstofoneunexpanded \
+firstoftwounexpanded secondoftwounexpanded firstofthreeunexpanded secondofthreeunexpanded thirdofthreeunexpanded \
+gobbleoneargument gobbletwoarguments gobblethreearguments gobblefourarguments gobblefivearguments \
+gobblesixarguments gobblesevenarguments gobbleeightarguments gobbleninearguments gobbletenarguments \
+gobbleoneoptional gobbletwooptionals gobblethreeoptionals gobblefouroptionals gobblefiveoptionals \
+dorecurse doloop exitloop dostepwiserecurse recurselevel \
+recursedepth dofastloopcs fastloopindex fastloopfinal dowith \
+doloopovermatch doloopovermatched doloopoverlist newconstant setnewconstant \
+setconstant setconstantvalue newconditional settrue setfalse \
+settruevalue setfalsevalue setconditional newmacro setnewmacro \
+newfraction newsignal newboundary dosingleempty dodoubleempty \
+dotripleempty doquadrupleempty doquintupleempty dosixtupleempty doseventupleempty \
+dosingleargument dodoubleargument dotripleargument doquadrupleargument doquintupleargument \
+dosixtupleargument doseventupleargument dosinglegroupempty dodoublegroupempty dotriplegroupempty \
+doquadruplegroupempty doquintuplegroupempty permitspacesbetweengroups dontpermitspacesbetweengroups nopdfcompression \
+maximumpdfcompression normalpdfcompression onlypdfobjectcompression nopdfobjectcompression modulonumber \
+dividenumber getfirstcharacter doifelsefirstchar doiffirstcharelse mathclassvalue \
+startnointerference stopnointerference twodigits threedigits leftorright \
+offinterlineskip oninterlineskip nointerlineskip strut halfstrut \
+quarterstrut depthstrut halflinestrut noheightstrut setstrut \
+strutbox strutht strutdp strutwd struthtdp \
+strutgap begstrut endstrut lineheight leftboundary \
+rightboundary signalcharacter aligncontentleft aligncontentmiddle aligncontentright \
+shiftbox vpackbox hpackbox vpackedbox hpackedbox \
+normalreqno startimath stopimath normalstartimath normalstopimath \
+startdmath stopdmath normalstartdmath normalstopdmath normalsuperscript \
+normalsubscript normalnosuperscript normalnosubscript normalprimescript superscript \
+subscript nosuperscript nosubscript primescript superprescript \
+subprescript nosuperprescript nosubsprecript uncramped cramped \
+mathstyletrigger triggermathstyle triggeredmathstyle mathstylefont mathsmallstylefont \
+mathstyleface mathsmallstyleface mathstylecommand mathpalette mathstylehbox \
+mathstylevbox mathstylevcenter mathstylevcenteredhbox mathstylevcenteredvbox mathtext \
+setmathsmalltextbox setmathtextbox pushmathstyle popmathstyle triggerdisplaystyle \
+triggertextstyle triggerscriptstyle triggerscriptscriptstyle triggeruncrampedstyle triggercrampedstyle \
+triggersmallstyle triggeruncrampedsmallstyle triggercrampedsmallstyle triggerbigstyle triggeruncrampedbigstyle \
+triggercrampedbigstyle luaexpr expelsedoif expdoif expdoifnot \
+expdoifelsecommon expdoifcommonelse expdoifelseinset expdoifinsetelse ctxdirectlua \
+ctxlatelua ctxsprint ctxwrite ctxcommand ctxdirectcommand \
+ctxlatecommand ctxreport ctxlua luacode lateluacode \
+directluacode registerctxluafile ctxloadluafile luaversion luamajorversion \
+luaminorversion ctxluacode luaconditional luaexpanded ctxluamatch \
+startluaparameterset stopluaparameterset luaparameterset definenamedlua obeylualines \
+obeyluatokens startluacode stopluacode startlua stoplua \
+startctxfunction stopctxfunction ctxfunction startctxfunctiondefinition stopctxfunctiondefinition \
+installctxfunction installprotectedctxfunction installprotectedctxscanner installctxscanner resetctxscanner \
+cldprocessfile cldloadfile cldloadviafile cldcontext cldcommand \
+carryoverpar freezeparagraphproperties defrostparagraphproperties setparagraphfreezing forgetparagraphfreezing \
+updateparagraphproperties updateparagraphpenalties updateparagraphdemerits updateparagraphshapes updateparagraphlines \
+lastlinewidth assumelongusagecs righttolefthbox lefttorighthbox righttoleftvbox \
+lefttorightvbox righttoleftvtop lefttorightvtop rtlhbox ltrhbox \
+rtlvbox ltrvbox rtlvtop ltrvtop autodirhbox \
+autodirvbox autodirvtop leftorrighthbox leftorrightvbox leftorrightvtop \
+lefttoright righttoleft checkedlefttoright checkedrighttoleft synchronizelayoutdirection \
+synchronizedisplaydirection synchronizeinlinedirection dirlre dirrle dirlro \
+dirrlo rtltext ltrtext lesshyphens morehyphens \
+nohyphens dohyphens dohyphencollapsing nohyphencollapsing compounddiscretionary \
+Ucheckedstartdisplaymath Ucheckedstopdisplaymath break nobreak allowbreak \
+goodbreak nospace nospacing dospacing naturalhbox \
+naturalvbox naturalvtop naturalhpack naturalvpack naturaltpack \
+reversehbox reversevbox reversevtop reversehpack reversevpack \
+reversetpack hcontainer vcontainer tcontainer frule \
+compoundhyphenpenalty start stop unsupportedcs openout \
+closeout write openin closein read \
+readline readfromterminal boxlines boxline setboxline \
+copyboxline boxlinewd boxlineht boxlinedp boxlinenw \
+boxlinenh boxlinend boxlinels boxliners boxlinelh \
+boxlinerh boxlinelp boxlinerp boxlinein boxrangewd \
+boxrangeht boxrangedp bitwiseset bitwiseand bitwiseor \
+bitwisexor bitwisenot bitwisenil ifbitwiseand bitwise \
+bitwiseshift bitwiseflip textdir linedir pardir \
+boxdir prelistbox postlistbox prelistcopy postlistcopy \
+setprelistbox setpostlistbox noligaturing nokerning noexpansion \
+noprotrusion noleftkerning noleftligaturing norightkerning norightligaturing \
+noitaliccorrection futureletnexttoken defbackslashbreak letbackslashbreak pushoverloadmode \
+popoverloadmode pushrunstate poprunstate suggestedalias showboxhere \
+discoptioncodestring flagcodestring frozenparcodestring glyphoptioncodestring groupcodestring \
+hyphenationcodestring mathcontrolcodestring mathflattencodestring normalizecodestring parcontextcodestring \
+newlocalcount newlocaldimen newlocalskip newlocalmuskip newlocaltoks \
+newlocalbox newlocalwrite newlocalread setnewlocalcount setnewlocaldimen \
+setnewlocalskip setnewlocalmuskip setnewlocaltoks setnewlocalbox ifexpression
diff --git a/Master/texmf-dist/context/data/scite/context/scite-context-data-metapost.properties b/Master/texmf-dist/context/data/scite/context/scite-context-data-metapost.properties
index 0dff1ccd5f5..badf738287e 100644
--- a/Master/texmf-dist/context/data/scite/context/scite-context-data-metapost.properties
+++ b/Master/texmf-dist/context/data/scite/context/scite-context-data-metapost.properties
@@ -28,11 +28,12 @@ penlabels range thru z laboff \
bye red green blue cyan \
magenta yellow black white background \
mm pt dd bp cm \
-pc cc in dk triplet \
-quadruplet totransform bymatrix closedcurve closedlines \
-primitive permanent immutable mutable frozen \
-showproperty showhashentry top bot lft \
-rt ulft urt llft lrt
+pc cc in dk es \
+ts triplet quadruplet totransform bymatrix \
+closedcurve closedlines primitive permanent immutable \
+mutable frozen showproperty showhashentry top \
+bot lft rt ulft urt \
+llft lrt
keywordclass.metapost.disabled=\
verbatimtex troffmode
diff --git a/Master/texmf-dist/context/data/scite/context/scite-context-data-tex.properties b/Master/texmf-dist/context/data/scite/context/scite-context-data-tex.properties
index 70627e12c8b..c1d632957ac 100644
--- a/Master/texmf-dist/context/data/scite/context/scite-context-data-tex.properties
+++ b/Master/texmf-dist/context/data/scite/context/scite-context-data-tex.properties
@@ -23,73 +23,75 @@ Umathaccentbaseheight Umathaccentbottomovershoot Umathaccentbottomshiftdown Umat
Umathaccentsuperscriptpercent Umathaccenttopovershoot Umathaccenttopshiftup Umathaccentvariant Umathadapttoleft \
Umathadapttoright Umathaxis Umathbottomaccentvariant Umathchar Umathcharclass \
Umathchardef Umathcharfam Umathcharslot Umathclass Umathcode \
-Umathconnectoroverlapmin Umathdegreevariant Umathdelimiterovervariant Umathdelimiterpercent Umathdelimitershortfall \
-Umathdelimiterundervariant Umathdenominatorvariant Umathdict Umathdictdef Umathdiscretionary \
-Umathextrasubpreshift Umathextrasubprespace Umathextrasubshift Umathextrasubspace Umathextrasuppreshift \
-Umathextrasupprespace Umathextrasupshift Umathextrasupspace Umathflattenedaccentbasedepth Umathflattenedaccentbaseheight \
-Umathflattenedaccentbottomshiftdown Umathflattenedaccenttopshiftup Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap \
-Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathfractionvariant Umathhextensiblevariant \
-Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap Umathlimitbelowkern \
-Umathlimitbelowvgap Umathlimits Umathnoaxis Umathnolimits Umathnolimitsubfactor \
-Umathnolimitsupfactor Umathnumeratorvariant Umathopenupdepth Umathopenupheight Umathoperatorsize \
-Umathoverbarkern Umathoverbarrule Umathoverbarvgap Umathoverdelimiterbgap Umathoverdelimitervariant \
-Umathoverdelimitervgap Umathoverlayaccentvariant Umathoverlinevariant Umathphantom Umathpresubshiftdistance \
-Umathpresupshiftdistance Umathprimeraise Umathprimeraisecomposed Umathprimeshiftdrop Umathprimeshiftup \
-Umathprimespaceafter Umathprimevariant Umathprimewidth Umathquad Umathradicaldegreeafter \
-Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalextensibleafter Umathradicalextensiblebefore Umathradicalkern \
-Umathradicalrule Umathradicalvariant Umathradicalvgap Umathruledepth Umathruleheight \
-Umathskeweddelimitertolerance Umathskewedfractionhgap Umathskewedfractionvgap Umathsource Umathspaceafterscript \
-Umathspacebeforescript Umathstackdenomdown Umathstacknumup Umathstackvariant Umathstackvgap \
-Umathsubscriptvariant Umathsubshiftdistance Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown \
-Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsuperscriptvariant Umathsupshiftdistance \
-Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax Umathtopaccentvariant Umathunderbarkern \
-Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervariant Umathunderdelimitervgap \
-Umathunderlinevariant Umathuseaxis Umathvextensiblevariant Umathvoid Umathxscale \
-Umathyscale Umiddle Unosubprescript Unosubscript Unosuperprescript \
-Unosuperscript Uoperator Uover Uoverdelimiter Uoverwithdelims \
-Uprimescript Uradical Uright Uroot Urooted \
-Ushiftedsubprescript Ushiftedsubscript Ushiftedsuperprescript Ushiftedsuperscript Uskewed \
-Uskewedwithdelims Ustack Ustartdisplaymath Ustartmath Ustartmathmode \
-Ustopdisplaymath Ustopmath Ustopmathmode Ustretched Ustretchedwithdelims \
-Ustyle Usubprescript Usubscript Usuperprescript Usuperscript \
-Uunderdelimiter Uvextensible adjustspacing adjustspacingshrink adjustspacingstep \
-adjustspacingstretch afterassigned aftergrouped aliased aligncontent \
-alignmark alignmentcellsource alignmentwrapsource aligntab allcrampedstyles \
-alldisplaystyles allmainstyles allmathstyles allscriptscriptstyles allscriptstyles \
-allsplitstyles alltextstyles alluncrampedstyles allunsplitstyles amcode \
-atendofgroup atendofgrouped attribute attributedef automaticdiscretionary \
-automatichyphenpenalty automigrationmode autoparagraphmode begincsname beginlocalcontrol \
-beginmathgroup beginsimplegroup boundary boxadapt boxanchor \
-boxanchors boxattribute boxdirection boxfreeze boxgeometry \
-boxorientation boxrepack boxshift boxsource boxtarget \
-boxtotal boxvadjust boxxmove boxxoffset boxymove \
-boxyoffset catcodetable cdef cdefcsname cfcode \
-clearmarks constant copymathatomrule copymathparent copymathspacing \
-crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle csactive \
-csstring currentloopiterator currentloopnesting currentmarks dbox \
-defcsname detokenized dimensiondef dimexpression directlua \
-dpack dsplit edefcsname efcode endlocalcontrol \
-endmathgroup endsimplegroup enforced etoks etoksapp \
-etokspre everybeforepar everymathatom everytab exceptionpenalty \
-expand expandactive expandafterpars expandafterspaces expandcstoken \
-expanded expandedafter expandedloop expandtoken explicitdiscretionary \
-explicithyphenpenalty firstvalidlanguage flushmarks fontcharta fontid \
-fontmathcontrol fontspecdef fontspecid fontspecifiedname fontspecifiedsize \
-fontspecscale fontspecxscale fontspecyscale fonttextcontrol formatname \
-frozen futurecsname futuredef futureexpand futureexpandis \
-futureexpandisap gdefcsname gleaders glet gletcsname \
-glettonothing gluespecdef glyph glyphdatafield glyphoptions \
-glyphscale glyphscriptfield glyphscriptscale glyphscriptscriptscale glyphstatefield \
-glyphtextscale glyphxoffset glyphxscale glyphxscaled glyphyoffset \
-glyphyscale glyphyscaled gtoksapp gtokspre hccode \
-hjcode hmcode holdingmigrations hpack hyphenationmin \
-hyphenationmode ifabsdim ifabsnum ifarguments ifboolean \
-ifchkdim ifchkdimension ifchknum ifchknumber ifcmpdim \
-ifcmpnum ifcondition ifcstok ifdimexpression ifdimval \
-ifempty ifflags ifhaschar ifhastok ifhastoks \
-ifhasxtoks ifincsname ifinsert ifmathparameter ifmathstyle \
-ifnumexpression ifnumval ifparameter ifparameters ifrelax \
-iftok ifzerodim ifzeronum ignorearguments ignoredepthcriterium \
+Umathconnectoroverlapmin Umathdegreevariant Umathdelimiterextendmargin Umathdelimiterovervariant Umathdelimiterpercent \
+Umathdelimitershortfall Umathdelimiterundervariant Umathdenominatorvariant Umathdict Umathdictdef \
+Umathdiscretionary Umathextrasubpreshift Umathextrasubprespace Umathextrasubshift Umathextrasubspace \
+Umathextrasuppreshift Umathextrasupprespace Umathextrasupshift Umathextrasupspace Umathflattenedaccentbasedepth \
+Umathflattenedaccentbaseheight Umathflattenedaccentbottomshiftdown Umathflattenedaccenttopshiftup Umathfractiondelsize Umathfractiondenomdown \
+Umathfractiondenomvgap Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathfractionvariant \
+Umathhextensiblevariant Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap \
+Umathlimitbelowkern Umathlimitbelowvgap Umathlimits Umathnoaxis Umathnolimits \
+Umathnolimitsubfactor Umathnolimitsupfactor Umathnumeratorvariant Umathopenupdepth Umathopenupheight \
+Umathoperatorsize Umathoverbarkern Umathoverbarrule Umathoverbarvgap Umathoverdelimiterbgap \
+Umathoverdelimitervariant Umathoverdelimitervgap Umathoverlayaccentvariant Umathoverlinevariant Umathphantom \
+Umathpresubshiftdistance Umathpresupshiftdistance Umathprimeraise Umathprimeraisecomposed Umathprimeshiftdrop \
+Umathprimeshiftup Umathprimespaceafter Umathprimevariant Umathprimewidth Umathquad \
+Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalextensibleafter Umathradicalextensiblebefore \
+Umathradicalkern Umathradicalrule Umathradicalvariant Umathradicalvgap Umathruledepth \
+Umathruleheight Umathskeweddelimitertolerance Umathskewedfractionhgap Umathskewedfractionvgap Umathsource \
+Umathspaceafterscript Umathspacebeforescript Umathstackdenomdown Umathstacknumup Umathstackvariant \
+Umathstackvgap Umathsubscriptvariant Umathsubshiftdistance Umathsubshiftdown Umathsubshiftdrop \
+Umathsubsupshiftdown Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsuperscriptvariant \
+Umathsupshiftdistance Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax Umathtopaccentvariant \
+Umathunderbarkern Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervariant \
+Umathunderdelimitervgap Umathunderlinevariant Umathuseaxis Umathvextensiblevariant Umathvoid \
+Umathxscale Umathyscale Umiddle Unosubprescript Unosubscript \
+Unosuperprescript Unosuperscript Uoperator Uover Uoverdelimiter \
+Uoverwithdelims Uprimescript Uradical Uright Uroot \
+Urooted Ushiftedsubprescript Ushiftedsubscript Ushiftedsuperprescript Ushiftedsuperscript \
+Uskewed Uskewedwithdelims Ustack Ustartdisplaymath Ustartmath \
+Ustartmathmode Ustopdisplaymath Ustopmath Ustopmathmode Ustretched \
+Ustretchedwithdelims Ustyle Usubprescript Usubscript Usuperprescript \
+Usuperscript Uunderdelimiter Uvextensible adjustspacing adjustspacingshrink \
+adjustspacingstep adjustspacingstretch afterassigned aftergrouped aliased \
+aligncontent alignmark alignmentcellsource alignmentwrapsource aligntab \
+allcrampedstyles alldisplaystyles allmainstyles allmathstyles allscriptscriptstyles \
+allscriptstyles allsplitstyles alltextstyles alluncrampedstyles allunsplitstyles \
+amcode atendofgroup atendofgrouped attribute attributedef \
+automaticdiscretionary automatichyphenpenalty automigrationmode autoparagraphmode begincsname \
+beginlocalcontrol beginmathgroup beginsimplegroup boundary boxadapt \
+boxanchor boxanchors boxattribute boxdirection boxfreeze \
+boxgeometry boxorientation boxrepack boxshift boxsource \
+boxtarget boxtotal boxvadjust boxxmove boxxoffset \
+boxymove boxyoffset catcodetable cdef cdefcsname \
+cfcode clearmarks constant copymathatomrule copymathparent \
+copymathspacing crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle \
+csactive csstring currentloopiterator currentloopnesting currentmarks \
+dbox defcsname deferred detokenized dimensiondef \
+dimexpression directlua dpack dsplit edefcsname \
+efcode endlocalcontrol endmathgroup endsimplegroup enforced \
+etoks etoksapp etokspre eufactor everybeforepar \
+everymathatom everytab exceptionpenalty expand expandactive \
+expandafterpars expandafterspaces expandcstoken expanded expandedafter \
+expandedloop expandtoken explicitdiscretionary explicithyphenpenalty firstvalidlanguage \
+float floatdef floatexpr flushmarks fontcharba \
+fontcharta fontid fontmathcontrol fontspecdef fontspecid \
+fontspecifiedname fontspecifiedsize fontspecscale fontspecxscale fontspecyscale \
+fonttextcontrol formatname frozen futurecsname futuredef \
+futureexpand futureexpandis futureexpandisap gdefcsname gleaders \
+glet gletcsname glettonothing gluespecdef glyph \
+glyphdatafield glyphoptions glyphscale glyphscriptfield glyphscriptscale \
+glyphscriptscriptscale glyphstatefield glyphtextscale glyphxoffset glyphxscale \
+glyphxscaled glyphyoffset glyphyscale glyphyscaled gtoksapp \
+gtokspre hccode hjcode hmcode holdingmigrations \
+hpack hyphenationmin hyphenationmode ifabsdim ifabsfloat \
+ifabsnum ifarguments ifboolean ifchkdim ifchkdimension \
+ifchknum ifchknumber ifcmpdim ifcmpnum ifcondition \
+ifcstok ifdimexpression ifdimval ifempty ifflags \
+iffloat ifhaschar ifhastok ifhastoks ifhasxtoks \
+ifincsname ifinsert ifmathparameter ifmathstyle ifnumexpression \
+ifnumval ifparameter ifparameters ifrelax iftok \
+ifzerodim ifzerofloat ifzeronum ignorearguments ignoredepthcriterium \
ignorepars immediate immutable indexofcharacter indexofregister \
inherited initcatcodetable insertbox insertcopy insertdepth \
insertdistance insertheight insertheights insertlimit insertmaxdepth \
@@ -114,33 +116,33 @@ mathnolimitsmode mathopen mathoperator mathordinary mathoverline \
mathpenaltiesmode mathpunctuation mathradical mathrelation mathrightclass \
mathrulesfam mathrulesmode mathscale mathscriptsmode mathslackmode \
mathspacingmode mathstackstyle mathstyle mathstylefontid mathsurroundmode \
-mathsurroundskip maththreshold mathunderline meaningasis meaningfull \
-meaningless mugluespecdef mutable noaligned noatomruling \
-noboundary nohrule norelax normalizelinemode normalizeparmode \
-nospaces novrule numericscale numexpression orelse \
-orphanpenalties orphanpenalty orunless outputbox overloaded \
-overloadmode overshoot pageboundary pageextragoal pagevsize \
-parametercount parametermark parattribute pardirection permanent \
-pettymuskip postexhyphenchar posthyphenchar postinlinepenalty prebinoppenalty \
-predisplaygapfactor preexhyphenchar prehyphenchar preinlinepenalty prerelpenalty \
-protrudechars protrusionboundary pxdimen quitloop quitvmode \
-resetmathspacing retokenized rightmarginkern rpcode savecatcodetable \
-scaledemwidth scaledexheight scaledextraspace scaledfontdimen scaledinterwordshrink \
-scaledinterwordspace scaledinterwordstretch scaledmathstyle scaledslantperpoint scantextokens \
-semiexpand semiexpanded semiprotected setdefaultmathcodes setfontid \
-setmathatomrule setmathdisplaypostpenalty setmathdisplayprepenalty setmathignore setmathoptions \
-setmathpostpenalty setmathprepenalty setmathspacing shapingpenaltiesmode shapingpenalty \
-snapshotpar srule supmarkmode swapcsvalues tabsize \
-textdirection thewithoutunit tinymuskip todimension tohexadecimal \
-tointeger tokenized toksapp tokspre tolerant \
-tomathstyle toscaled tosparsedimension tosparsescaled tpack \
-tracingadjusts tracingalignments tracingexpressions tracingfonts tracingfullboxes \
-tracinghyphenation tracinginserts tracinglevels tracinglists tracingmarks \
-tracingmath tracingnodes tracingpenalties tsplit uleaders \
-undent unexpandedloop unhpack unletfrozen unletprotected \
-untraced unvpack variablefam virtualhrule virtualvrule \
-vpack wordboundary wrapuppar xdefcsname xtoks \
-xtoksapp xtokspre
+mathsurroundskip maththreshold mathunderline meaningasis meaningful \
+meaningfull meaningles meaningless mugluespecdef mutable \
+noaligned noatomruling noboundary nohrule norelax \
+normalizelinemode normalizeparmode nospaces novrule numericscale \
+numexpression orelse orphanpenalties orphanpenalty orunless \
+outputbox overloaded overloadmode overshoot pageboundary \
+pageextragoal pagevsize parametercount parametermark parattribute \
+pardirection permanent pettymuskip positdef postexhyphenchar \
+posthyphenchar postinlinepenalty prebinoppenalty predisplaygapfactor preexhyphenchar \
+prehyphenchar preinlinepenalty prerelpenalty protrudechars protrusionboundary \
+pxdimen quitloop quitvmode resetmathspacing retokenized \
+rightmarginkern rpcode savecatcodetable scaledemwidth scaledexheight \
+scaledextraspace scaledfontdimen scaledinterwordshrink scaledinterwordspace scaledinterwordstretch \
+scaledmathstyle scaledslantperpoint scantextokens semiexpand semiexpanded \
+semiprotected setdefaultmathcodes setfontid setmathatomrule setmathdisplaypostpenalty \
+setmathdisplayprepenalty setmathignore setmathoptions setmathpostpenalty setmathprepenalty \
+setmathspacing shapingpenaltiesmode shapingpenalty snapshotpar srule \
+supmarkmode swapcsvalues tabsize textdirection thewithoutunit \
+tinymuskip todimension tohexadecimal tointeger tokenized \
+toksapp tokspre tolerant tomathstyle toscaled \
+tosparsedimension tosparsescaled tpack tracingadjusts tracingalignments \
+tracingexpressions tracingfonts tracingfullboxes tracinghyphenation tracinginserts \
+tracinglevels tracinglists tracingmarks tracingmath tracingnodes \
+tracingpenalties tsplit uleaders undent unexpandedloop \
+unhpack unletfrozen unletprotected untraced unvpack \
+variablefam virtualhrule virtualvrule vpack wordboundary \
+wrapuppar xdefcsname xtoks xtoksapp xtokspre
keywordclass.tex.omega=\
Omegaminorversion Omegarevision Omegaversion
diff --git a/Master/texmf-dist/context/data/texfont/type-buy.dat b/Master/texmf-dist/context/data/texfont/type-buy.dat
new file mode 100644
index 00000000000..a65d2e806bc
--- /dev/null
+++ b/Master/texmf-dist/context/data/texfont/type-buy.dat
@@ -0,0 +1,146 @@
+# itc officina
+
+--en=? --ve=itc --co=officina --re
+--en=? --ve=itc --co=officina --so=itc/officina --ma --in
+
+--en=? --ve=itc --co=officina --so=itc/officina --ca=* --pattern=ovbk_*
+--en=? --ve=itc --co=officina --so=itc/officina --sl=* --pattern=ovbk_*
+--en=? --ve=itc --co=officina --so=itc/officina --sl=* --pattern=ovb_*
+
+--en=? --ve=itc --co=officina --so=itc/officina --ca=* --pattern=owbk_*
+--en=? --ve=itc --co=officina --so=itc/officina --sl=* --pattern=owbk_*
+--en=? --ve=itc --co=officina --so=itc/officina --sl=* --pattern=owb_*
+
+# bh lucida
+
+--en=? --ve=bh --co=lucida --re
+--en=? --ve=bh --co=lucida --so=bh/lucida --ma --in --expert
+
+# fontfont meta
+
+--en=? --ve=fontfont --co=meta --re
+--en=? --ve=fontfont --co=meta --so=fontfont/meta-1 --ma --in --expert
+--en=? --ve=fontfont --co=meta --so=fontfont/meta-2 --ma --in --expert
+
+--en=? --ve=fontfont --co=meta --so=fontfont/meta-1 --sl=* --pattern=mtbk_*
+--en=? --ve=fontfont --co=meta --so=fontfont/meta-1 --sl=* --pattern=mtbd_*
+
+# lucas sun
+
+--en=? --ve=lucas --co=sun --re
+--en=? --ve=lucas --co=sun --so=lucas/sun --ma --in
+
+# lucas antiqua
+
+--en=? --ve=lucas --co=antiqua --re
+--en=? --ve=lucas --co=antiqua --so=lucas/antiqua --ma --in
+
+# lucas thesans
+
+--en=? --ve=lucas --co=thesans --re
+--en=? --ve=lucas --co=thesans --so=lucas/thesans --ma --in
+--en=? --ve=lucas --co=thesans --so=lucas/thesans --ma --in --expert
+
+# creative arcadia
+
+--en=? --ve=creative --co=arcadia --re
+--en=? --ve=creative --co=arcadia --so=creative/arcadia --ma --in
+
+# creative industria
+
+--en=? --ve=creative --co=industria --re
+--en=? --ve=creative --co=industria --so=creative/industria --ma --in
+
+# creative insignia
+
+--en=? --ve=creative --co=insignia --re
+--en=? --ve=creative --co=insignia --so=creative/insignia --ma --in
+
+# fontfont din
+
+--en=? --ve=fontfont --co=din --re
+--en=? --ve=fontfont --co=din --so=fontfont/din --ma --in
+
+# adobe myriad
+
+--en=? --so=adobe/myriad --weight=400 --width=600 MyriadMM
+--en=? --so=adobe/myriad --weight=700 --width=600 MyriadMM
+--en=? --so=adobe/myriad --weight=400 --width=600 MyriadMM-It
+--en=? --so=adobe/myriad --weight=700 --width=600 MyriadMM-It
+
+--en=? --ve=adobe --co=myriad --so=adobe/myriad --ma --in --pattern=MyriadMM-we*
+--en=? --ve=adobe --co=myriad --so=adobe/myriad --ma --in --pattern=MyriadMM-It-we*
+
+--en=? --ve=adobe --co=myriad --so=adobe/myriad --sl=* --pattern=MyriadMM-we*
+--en=? --ve=adobe --co=myriad --so=adobe/myriad --ca=* --pattern=MyriadMM-we*
+
+# adobe frutiger
+
+--en=? --ve=adobe --co=frutiger --re
+--en=? --ve=adobe --co=frutiger --so=adobe/frutiger --ma --in
+
+# itc mendoza
+
+--en=? --ve=itc --co=mendoza --re
+--en=? --ve=itc --co=mendoza --so=itc/mendoza --ma --in
+
+# linotype univers
+
+--en=? --ve=linotype --co=univers --re
+--en=? --ve=linotype --co=univers --so=linotype/univers --ma --in
+
+# linotype linoletter
+
+--en=? --ve=linotype --co=linoletter --re
+--en=? --ve=linotype --co=linoletter --so=linotype/linoletter --ma --in
+
+# adobe utopia
+#
+# --en=? --ve=adobe --co=utopia --re
+# --en=? --ve=adobe --co=utopia --so=adobe/utopia --ma --in
+
+# itc kabel
+
+--en=? --ve=itc --co=kabel --re
+--en=? --ve=itc --co=kabel --so=itc/kabel --ma --in
+
+# monotype sabon
+
+--en=? --ve=monotype --co=sabon --re
+--en=? --ve=monotype --co=sabon --so=monotype/sabon --ma --in
+
+# linotype industria
+
+--en=? --ve=linotype --co=industria --re
+--en=? --ve=linotype --co=industria --so=linotype/industria --ma --in
+
+# itc stone
+
+--en=? --ve=itc --co=stone --re
+--en=? --ve=itc --co=stone --so=itc/stone --ma --in
+
+# itc bauhaus
+
+--en=? --ve=itc --co=bauhaus --re
+--en=? --ve=itc --co=bauhaus --so=itc/bauhaus --ma --in
+--en=? --ve=itc --co=bauhaus --so=itc/bauhaus --sl=* --pattern=bh*
+
+# ef swift
+
+--en=? --ve=ef --co=swift --re
+--en=? --ve=ef --co=swift --so=ef/swift --ma --in --pattern=sw*
+
+# linotype optima-nova
+
+--en=? --ve=linotype --co=optima-nova --re
+--en=? --ve=linotype --co=optima-nova --so=linotype/optima-nova --ma --in
+
+# linotype palatino-nova
+
+--en=? --ve=linotype --co=palatino-nova --re
+--en=? --ve=linotype --co=palatino-nova --so=linotype/palatino-nova --ma --in
+
+# linotype syntax
+
+--en=? --ve=linotype --co=syntax --re
+--en=? --ve=linotype --co=syntax --so=linotype/syntax --ma --in
diff --git a/Master/texmf-dist/context/data/texfont/type-fsf.dat b/Master/texmf-dist/context/data/texfont/type-fsf.dat
new file mode 100644
index 00000000000..c303bdcd893
--- /dev/null
+++ b/Master/texmf-dist/context/data/texfont/type-fsf.dat
@@ -0,0 +1,25 @@
+# Please use the originals instead ! ! ! ! !
+
+# fontsite opus
+
+--en=? --ve=fontsite --co=opus --re
+--en=? --ve=fontsite --co=opus --so=fsf/all --ma --in --pattern=opus*
+
+--en=? --ve=fontsite --co=opus --so=fsf/all --sl=* --pattern=opusrg_*
+--en=? --ve=fontsite --co=opus --so=fsf/all --sl=* --pattern=opusb_*
+
+# fontsite typewriter
+
+--en=? --ve=fontsite --co=typewriter --re
+--en=? --ve=fontsite --co=typewriter --so=fsf/all --ma --in --pattern=type*
+
+--en=? --ve=fontsite --co=typewriter --so=fsf/all --sl=* --pattern=typerg_*
+--en=? --ve=fontsite --co=typewriter --so=fsf/all --sl=* --pattern=typeb_*
+
+# fontsite garamond
+
+--en=? --ve=fontsite --co=garamond --re
+--en=? --ve=fontsite --co=garamond --so=fsf/all --ma --in --pattern=gara*
+
+--en=? --ve=fontsite --co=garamond --so=fsf/all --sl=* --pattern=garamond*
+--en=? --ve=fontsite --co=garamond --so=fsf/all --sl=* --pattern=garab_*
diff --git a/Master/texmf-dist/context/data/texfont/type-ghz.dat b/Master/texmf-dist/context/data/texfont/type-ghz.dat
new file mode 100644
index 00000000000..37ce5d6f9a5
--- /dev/null
+++ b/Master/texmf-dist/context/data/texfont/type-ghz.dat
@@ -0,0 +1,78 @@
+# Gudrun and Hermann Zapf Collection
+
+# linotype alcuin
+
+# linotype aldus
+
+# linotype ams-euler
+
+# linotype ariadne
+
+# linotype aurelia
+
+# linotype carmina
+
+# linotype colombine
+
+# linotype diotima
+
+# linotype edison
+
+# linotype itc-zapf-book
+
+# linotype itc-zapf-chancery
+
+# linotype itc-zapf-dingbats
+
+# linotype itc-zapf-international-lt
+
+# linotype kompakt
+
+# linotype zapfino
+
+--en=? --ve=linotype --co=zapfino --re
+--en=? --ve=linotype --co=zapfino --so=ghz/linotype-zapfino --ma --in
+
+# linotype marconi
+
+# linotype medici-script
+
+# linotype melior
+
+--en=? --ve=linotype --co=melior --re
+--en=? --ve=linotype --co=melior --so=ghz/melior --ma --in
+
+# linotype noris
+
+# linotype optima
+
+--en=? --ve=linotype --co=optima --re
+--en=? --ve=linotype --co=optima --so=ghz/optima --ma --in
+
+# linotype optima-nova
+
+--en=? --ve=linotype --co=optima-nova --re
+--en=? --ve=linotype --co=optima-nova --so=linotype/optima-nova --ma --in
+
+# linotype orion
+
+# linotype palatino
+
+--en=? --ve=linotype --co=palatino --re
+--en=? --ve=linotype --co=palatino --so=ghz/palatino --ma --in
+
+# linotype saphir
+
+# linotype shakespeare
+
+# linotype sistina
+
+# linotype smaragd
+
+# linotype vario
+
+# linotype venture-script
+
+# linotype zapf-essentials-lt
+
+# linotype zapf-renaissance-antiqua
diff --git a/Master/texmf-dist/context/data/texfont/type-tmf.dat b/Master/texmf-dist/context/data/texfont/type-tmf.dat
new file mode 100644
index 00000000000..a226e936299
--- /dev/null
+++ b/Master/texmf-dist/context/data/texfont/type-tmf.dat
@@ -0,0 +1,75 @@
+# You can process this file as follows, using texfont.pl:
+#
+# texfont --encoding=ec --batch texfont.dat
+#
+# where 'ec' can be replaced by 'texnansi', '8r' or otherwise.
+#
+# The TEXMFTE and TEXMFGW paths are used by gwtex.
+
+
+# public antp
+
+--en=? --ve=public --co=antp --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# no longer needed, public antt
+#
+# --en=? --ve=public --co=antt --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# urw helvetica
+
+--en=? --ve=urw --co=helvetica --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# urw courier
+
+--en=? --ve=urw --co=courier --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# urw zapfchan
+
+--en=? --ve=urw --co=zapfchan --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# urw times
+
+--en=? --ve=urw --co=times --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=times --so=auto --ca=* utmr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=times --so=auto --sl=* utmr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=times --so=auto --sl=* utmb8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# urw palatino
+
+--en=? --ve=urw --co=palatino --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=palatino --so=auto --ca=* uplr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=palatino --so=auto --sl=* uplr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=palatino --so=auto --sl=* uplb8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# adobe utopia
+
+--en=? --ve=adobe --co=utopia --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --ca=* putr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --sl=* putr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --sl=* putb8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+--en=? --ve=adobe --co=utopia --so=auto --ro=TEXMFMAIN,TEXMFEXTRA,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --ca=* putr8a --ro=TEXMFMAIN,TEXMFEXTRA,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --sl=* putr8a --ro=TEXMFMAIN,TEXMFEXTRA,TEXMFTE,TEXMFGW
+--en=? --ve=adobe --co=utopia --so=auto --sl=* putb8a --ro=TEXMFMAIN,TEXMFEXTRA,TEXMFTE,TEXMFGW
+
+# bitstream charter
+
+--en=? --ve=bitstrea --co=charter --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=bitstrea --co=charter --so=auto --ca=* bchr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=bitstrea --co=charter --so=auto --sl=* bchr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=bitstrea --co=charter --so=auto --sl=* bchb8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# uwr bookman
+
+--en=? --ve=urw --co=bookman --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=bookman --so=auto --ca=* ubkl8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=bookman --so=auto --sl=* ubkl8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=bookman --so=auto --sl=* ubkd8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+
+# uwr schoolbook
+
+--en=? --ve=urw --co=ncntrsbk --so=auto --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=ncntrsbk --so=auto --ca=* uncr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=ncntrsbk --so=auto --sl=* uncr8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
+--en=? --ve=urw --co=ncntrsbk --so=auto --sl=* uncb8a --ro=TEXMFMAIN,TEXMFTE,TEXMFGW
diff --git a/Master/texmf-dist/doc/context/README.adoc b/Master/texmf-dist/doc/context/README.adoc
new file mode 100644
index 00000000000..130aa717025
--- /dev/null
+++ b/Master/texmf-dist/doc/context/README.adoc
@@ -0,0 +1,18 @@
+== ConTeXt source code
+
+This repository hosts ConTeXt, a TeX macro package. There are three versions:
+
+MkII:: the frozen version meant for pdfTeX
+MkIV:: the mostly frozen version meant for LuaTeX
+MkXL:: the latest version running on LuaMetaTeX
+
+Here we collect all the file needed to run ConTeXt, including the sources of
+LuaMetaTeX. More information can be found on the wiki:
+
+* https://wiki.contextgarden.net
+
+For support there is a mailing list available ntg-context@ntg.nl
+
+* https://www.ntg.nl/mailman/listinfo/ntg-context
+
+Hans Hagen
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-alignments.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-alignments.pdf
index 86b9a60b1c7..1dcc320c788 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-alignments.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-alignments.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-boxes.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-boxes.pdf
index 028519623df..76c08681e47 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-boxes.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-boxes.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-buffers.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-buffers.pdf
new file mode 100644
index 00000000000..dc8ca068f20
--- /dev/null
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-buffers.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-characters.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-characters.pdf
index 13867666baa..4c794482005 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-characters.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-characters.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-conditionals.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-conditionals.pdf
index 251ccc758e1..4522e6717fa 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-conditionals.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-conditionals.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-expansion.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-expansion.pdf
index d9f2528bc43..e390e4122ae 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-expansion.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-expansion.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-grouping.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-grouping.pdf
index 316edda6711..1289c75028a 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-grouping.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-grouping.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-inserts.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-inserts.pdf
index d305899c16b..d5b87594491 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-inserts.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-inserts.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-localboxes.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-localboxes.pdf
new file mode 100644
index 00000000000..c92ed00cd85
--- /dev/null
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-localboxes.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-loops.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-loops.pdf
index 83620457c1c..48a619793f7 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-loops.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-loops.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-macros.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-macros.pdf
index 5b3bcae1423..a33a3b659ae 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-macros.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-macros.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-marks.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-marks.pdf
index a00a7f2aecf..4e59f11b80c 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-marks.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-marks.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
index 9115642ad05..11c70780f50 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-registers.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-registers.pdf
index 5c5400ec640..9b0b5a7cbd6 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-registers.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-registers.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-scope.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-scope.pdf
index d5b62839686..66c00d983ba 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-scope.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-scope.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-security.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-security.pdf
index d4c7d871c24..26a195e9f23 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-security.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-security.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-tokens.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-tokens.pdf
new file mode 100644
index 00000000000..03eaa7f81f6
--- /dev/null
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel-tokens.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel.pdf
index 8290f2118d6..16c3f91c45d 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/lowlevel.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.1 b/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.1
deleted file mode 100644
index 18206589835..00000000000
--- a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.1
+++ /dev/null
@@ -1,33 +0,0 @@
-.TH "mptopdf" "1" "01-01-2023" "version 1.4.1" "convert MetaPost figures to PDF"
-.SH NAME
- mptopdf - convert MetaPost figures to PDF
-.SH SYNOPSIS
-.B mptopdf [
-.I OPTIONS ...
-.B ] [
-.I FILENAMES
-.B ]
-.SH DESCRIPTION
-.B convert MetaPost figures to PDF
-.SH OPTIONS
-.TP
-.B --metafun
-use the metafun format to process the file (default is mpost)
-.TP
-.B --texexec
-use texexec (context) to process text snippets
-.TP
-.B --latex
-use latex to process text snippets
-.SH AUTHOR
-More information about ConTeXt and the tools that come with it can be found at:
-
-
-.B "maillist:"
-ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
-
-.B "webpage:"
-http://www.pragma-ade.nl / http://tex.aanhet.net
-
-.B "wiki:"
-http://contextgarden.net
diff --git a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man1.pdf b/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man1.pdf
deleted file mode 100644
index 0dff2ae85d3..00000000000
--- a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man1.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.html b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.html
index 2932b942c53..3e4541a0ccb 100644
--- a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.html
+++ b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.html
@@ -44,6 +44,7 @@
<tr><th>--pretty</th><td></td><td>replace newlines in metadata</td></tr>
<tr><th>--fonts</th><td></td><td>show used fonts (--detail)</td></tr>
<tr><th>--object</th><td></td><td>show object"/></td></tr>
+ <tr><th>--links</th><td></td><td>show links"/></td></tr>
<tr><th/><td/><td/></tr>
</table>
<br/>
diff --git a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.man b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.man
index 54fdb6d14f4..222261a8184 100644
--- a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.man
+++ b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.man
@@ -25,6 +25,9 @@ show used fonts (--detail)
.TP
.B --object
show object"/>
+.TP
+.B --links
+show links"/>
.SH AUTHOR
More information about ConTeXt and the tools that come with it can be found at:
diff --git a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.xml b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.xml
index 08b04d85e0c..6b2efdcb802 100644
--- a/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.xml
+++ b/Master/texmf-dist/doc/context/scripts/mkiv/mtx-pdf.xml
@@ -13,6 +13,7 @@
<flag name="pretty"><short>replace newlines in metadata</short></flag>
<flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag>
<flag name="object"><short>show object"/></short></flag>
+ <flag name="links"><short>show links"/></short></flag>
</subcategory>
<subcategory>
<example><command>mtxrun --script pdf --info foo.pdf</command></example>
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/details/detcow.mp b/Master/texmf-dist/doc/context/sources/general/manuals/details/detcow.mp
index 18fc570e5c4..4713e6036f2 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/details/detcow.mp
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/details/detcow.mp
@@ -1,6 +1,4 @@
% Converted from PostScript(TM) to MetaPost by pstoedit
-%
-% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
% MetaPost backend contributed by Scott Pakin <pakin@uiuc.edu>
% pstoedit is Copyright (C) 1993 - 1999 Wolfgang Glunz <wglunz@geocities.com>
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-tokens.tex b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-tokens.tex
new file mode 100644
index 00000000000..483b4a8dcd5
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-tokens.tex
@@ -0,0 +1,540 @@
+% language=us runpath=texruns:manuals/lowlevel
+
+\environment lowlevel-style
+
+\usemodule[system-tokens]
+
+\startdocument
+ [title=tokens,
+ color=middleblue]
+
+\startsectionlevel[title=Introduction]
+
+Most users don't need to know anything about tokens but it happens that when \TEX
+ies meet in person (users group meetings), or online (support platforms) there
+always seem to pop up folks who love token speak. When you try to explain
+something to a user it makes sense to talk in terms of characters but then those
+token speakers can jump in and start correcting you. In the past I have been
+puzzled by this because, when one can write a decent macro that does the job
+well, it really doesn't matter if one knows about tokens. Of course one should
+never make the assumption that token speakers really know \TEX\ that well or can
+come up with better solutions than users but that is another matter. \footnote
+{Talking about fashion: it would be more impressive to talk about \TEX\ and
+friends as a software stack than calling it a distribution. Today, it's all about
+marketing.}
+
+That said, because in documents about \TEX\ the word \quote {token} does pop up I
+will try to give a little insight here. But for using \TEX\ it's mostly
+irrelevant. The descriptions below for sure won't match the proper token speak
+criteria which is why at a presentation for the 2020 user meeting I used the
+title \quotation {Tokens as I see them.}
+
+\stopsectionlevel
+
+\startsectionlevel[title=What are tokens]
+
+Both the words \quote {node} and \quote {token} are quite common in programming
+and also rather old which is proven by the fact that they also are used in the
+\TEX\ source. A node is a storage container that is part of a linked list. When
+you input the characters \type {tex} the three characters become part of the
+current linked list. They become \quote {character} nodes (or in \LUATEX\ speak
+\quote {glyph} nodes) with properties like the font and the character referred
+to. But before that happens, the three characters in the input \type {t}, \type
+{e} and \type {x}, are interpreted as in this case being just that: characters.
+When you enter \type {\TeX} the input processors first sees a backslash and
+because that has a special meaning in \TEX\ it will read following characters and
+when done does a lookup in it's internal hash table to see what it actually is: a
+macro that assembled the word \TEX\ in uppercase with special kerning and a
+shifted (therefore boxed) \quote {E}. When you enter \type {$} \TEX\ will look
+ahead for a second one in order to determine display math, push back the found
+token when there is no match and then enter inline math mode.
+
+A token is internally just a 32 bit number that encodes what \TEX\ has seen. It
+is the assembled token that travels through the system, get stored, interpreted
+and often discarded afterwards. So, the character \quote {e} in our example gets
+tagged as such and encoded in this number in a way that the intention can be
+derived later on.
+
+Now, the way \TEX\ looks at these tokens can differ. In some cases it will just
+look at this (32 bit) number, for instance when checking for a specific token,
+which is fast, but sometimes it needs to know some detail. The mentioned integer
+actually encodes a command (opcode) and a so called char code (operand). The
+second name is somewhat confusing because in many cases that code is not
+representing a character but that is not that relevant here. When you look at the
+source code of a \TEX\ engine it is enough to know that a char can also be a sub
+command.
+
+\startlinecorrection[blank]
+ \setupTABLE[each][align=middle]
+ \setupTABLE[c][1][width=44mm]
+ \setupTABLE[c][2][width=4em]
+ \setupTABLE[c][3][width=11mm]
+ \setupTABLE[c][4][width=33mm]
+ \bTABLE
+ \bTR
+ \bTD token \eTD
+ \bTD[frame=off] = \eTD
+ \bTD cmd \eTD
+ \bTD chr \eTD
+ \eTR
+ \eTABLE
+\stoplinecorrection
+
+Back to the three characters: these become tokens where the command code
+indicates that it is a letter and the char code stores what letter we have at
+hand and in the case of \LUATEX\ and \LUAMETATEX\ these are \UNICODE\ values.
+Contrary to the traditional 8 bit \TEX\ engine, in the \UNICODE\ engines an \UTF\
+sequence is read, but these multiple bytes still become one number that will be
+encoded in the token number. In order to determine that something is a letter the
+engine has to be told (which is what a macro package does when it sets up the
+engine). For instance, digits are so called other characters and the backslash is
+called escape. Every \TEX\ user knows that curly braces are special and so are
+dollar symbols and hashes. If this rings a bell, and you relate this to catcodes,
+you can indeed assume that the command codes of these tokens have the same
+numbers as the catcodes. Given that \UNICODE\ has plenty of characters slots you
+can imagine that combining 16 catcode commands with all the possible \UNICODE\
+values makes a large repertoire of tokens.
+
+There are more commands than the 16 basic characters related ones, in
+\LUAMETATEX\ we have just over 150 command codes (\LUATEX\ has a few more but
+they are also organized differently). Each of these codes can have a sub
+command, For instance the primitives \type {\vbox} and \type {\hbox} are both a
+\type {make_box_cmd} (we use the symbolic name here) and in \LUAMETATEX\ the
+first one has sub command code 9 (\type {vbox_code}) and the second one has code
+10 (\type {hbox_code}). There are twelve primitives that are in the same
+category. The many primitives that make up the core of the engine are grouped in
+a way that permits processing similar ones with one function and also makes it
+possible to distinguish between the way commands are handled, for instance with
+respect to expansion.
+
+Now, before we move on it is important to know that al these codes are in fact
+abstract numbers. Although it is quite likely that engines that are derived from
+each other have similar numbers (just more) this is not the case for \LUAMETATEX.
+Because the internals have been opened up (even more than in \LUATEX) the command
+and char codes have been reorganized in a such a way that exposure is consistent.
+We could not use some of the reuse and remap tricks that the other engines use
+because it would simply be too confusing (and demand real in depth knowledge of
+the internals). This is also the reason why development took some time. You
+probably won't notice it from the current source but it was a very stepwise
+process. We not only had to make sure that all kept working (\CONTEXT\ \LMTX\ and
+\LUAMETATEX\ were pretty useable during the process), but also had to
+(re)consider intermediate choices.
+
+So, input is converted into tokens, in most cases one|-|by|-|one. When a token is
+assembled, it either gets stored (deliberately or as part of some look ahead
+scanning), or it immediately gets (what is called:) expanded. Depending on what
+the command is, some action is triggered. For instance, a character gets appended
+to the node list immediately. An \type {\hbox} command will start assembling a
+box which its own node list that then gets some treatment: if this primitive was a
+follow up on \type {\setbox} it will get stored, otherwise it might end up in the
+current node list as so called hlist node. Commands that relate to registers have
+\type {0xFFFF} char codes because that is how many registers we have per category.
+
+When a token gets stored for later processing it becomes part of a larger data
+structure, a so called memory word. These memory words are taken from a large
+pool of words and they store a token and additional properties. The info field
+contains the token value, the mentioned command and char. When there is no linked
+list, the link can actually be used to store a value, something that in
+\LUAMETATEX\ we actually do.
+
+\startlinecorrection[blank]
+ \setupTABLE[each][align=middle]
+ \setupTABLE[c][1][width=8mm]
+ \setupTABLE[c][2][width=64mm]
+ \setupTABLE[c][3][width=64mm]
+ \bTABLE
+ \bTR \bTD 1 \eTD \bTD info \eTD \bTD link \eTD \eTR
+ \bTR \bTD 2 \eTD \bTD info \eTD \bTD link \eTD \eTR
+ \bTR \bTD 3 \eTD \bTD info \eTD \bTD link \eTD \eTR
+ \bTR \bTD n \eTD \bTD info \eTD \bTD link \eTD \eTR
+ \eTABLE
+\stoplinecorrection
+
+When for instance we say \typ {\toks 0 {tex}} the scanner sees an escape,
+followed by 4 letters (\type {toks}) and the escape triggers a lookup of the
+primitive (or macro or \unknown) with that name, in this case a primitive
+assignment command. The found primitive (its property gets stored in the token)
+triggers scanning for a number and when that is successful scanning of a brace
+delimited token list starts. The three characters become three letter tokens and
+these are a linked list of the mentioned memory words. This list then gets stored
+in token register zero. The input sequence \typ {\the \toks 0} will push back a
+copy of this list into the input.
+
+In addition to the token memory pool, there is also a table of equivalents. That
+one is part of a larger table of memory words where \TEX\ stores all it needs to
+store. The 16 groups of character commands are virtual, storing these makes no
+sense, so the first real entries are all these registers (count, dimension, skip,
+box, etc). The rest is taken up by possible hash entries.
+
+\startlinecorrection[blank]
+ \bTABLE
+ \bTR \bTD[ny=4] main hash \eTD \bTD null control sequence \eTD \eTR
+ \bTR \bTD 128K hash entries \eTD \eTR
+ \bTR \bTD frozen control sequences \eTD \eTR
+ \bTR \bTD special sequences (undefined) \eTD \eTR
+ \bTR \bTD[ny=7] registers \eTD \bTD 17 internal & 64K user glues \eTD \eTR
+ \bTR \bTD 4 internal & 64K user mu glues \eTD \eTR
+ \bTR \bTD 12 internal & 64K user tokens \eTD \eTR
+ \bTR \bTD 2 internal & 64K user boxes \eTD \eTR
+ \bTR \bTD 116 internal & 64K user integers \eTD \eTR
+ \bTR \bTD 0 internal & 64K user attribute \eTD \eTR
+ \bTR \bTD 22 internal & 64K user dimensions \eTD \eTR
+ \bTR \bTD specifications \eTD \bTD 5 internal & 0 user \eTD \eTR
+ \bTR \bTD extra hash \eTD \bTD additional entries (grows dynamic) \eTD \eTR
+ \eTABLE
+\stoplinecorrection
+
+So, a letter token \type {t} is just that, a token. A token referring to a register
+is again just a number, but its char code points to a slot in the equivalents table.
+A macro, which we haven't discussed yet, is actually just a token list. When a name
+lookup happens the hash table is consulted and that one runs in parallel to part of the
+table of equivalents. When there is a match, the corresponding entry in the equivalents
+table points to a token list.
+
+\startlinecorrection[blank]
+ \setupTABLE[each][align=middle]
+ \setupTABLE[c][1][width=16mm]
+ \setupTABLE[c][2][width=64mm]
+ \setupTABLE[c][3][width=64mm]
+ \bTABLE
+ \bTR \bTD 1 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \bTR \bTD 2 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \bTR \bTD n \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \bTR \bTD n + 1 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \bTR \bTD n + 2 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \bTR \bTD n + m \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR
+ \eTABLE
+\stoplinecorrection
+
+It sounds complex and it actually also is somewhat complex. It is not made easier
+by the fact that we also track information related to grouping (saving and
+restoring), need reference counts for copies of macros and token lists, sometimes
+store information directly instead of via links to token lists, etc. And again
+one cannot compare \LUAMETATEX\ with the other engines. Because we did away with
+some of the limitations of the traditional engine we not only could save some
+memory but in the end also simplify matters (we're 32/64 bit after all). On the one
+hand some traditional speedups were removed but these have been compensated by
+improvements elsewhere, so overall processing is more efficient.
+
+\startlinecorrection[blank]
+ \setupTABLE[each][align=middle]
+ \setupTABLE[c][1][width=8mm]
+ \setupTABLE[c][2][width=32mm]
+ \setupTABLE[c][3][width=16mm]
+ \setupTABLE[c][4][width=16mm]
+ \setupTABLE[c][5][width=64mm]
+ \bTABLE
+ \bTR \bTD 1 \eTD \bTD level \eTD \bTD type \eTD \bTD flag \eTD \bTD value \eTD \eTR
+ \bTR \bTD 2 \eTD \bTD level \eTD \bTD type \eTD \bTD flag \eTD \bTD value \eTD \eTR
+ \bTR \bTD 3 \eTD \bTD level \eTD \bTD type \eTD \bTD flag \eTD \bTD value \eTD \eTR
+ \bTR \bTD n \eTD \bTD level \eTD \bTD type \eTD \bTD flag \eTD \bTD value \eTD \eTR
+ \eTABLE
+\stoplinecorrection
+
+So, here \LUAMETATEX\ differs from other engines because it combines two tables,
+which is possible because we have at least 32 bits. There are at most \type
+{0xFFFF} levels but we need at most \type {0xFF} types. in \LUAMETATEX\ macros
+can have extra properties (flags) and these also need one byte. Contrary to the
+other engines, \type {\protected} macros are native and have their own command
+code, but \type {\tolerant} macros duplicate that (so we have four distinct macro
+commands). All other properties, like the \type {\permanent} ones are stored in
+the flags.
+
+Because a macro starts with a reference count we have some room in the info field
+to store information about it having arguments or not. It is these details that
+make \LUAMETATEX\ a bit more efficient in terms of memory usage and performance
+than its ancestor \LUATEX. But as with the other changes, it was a very stepwise
+process in order to keep the system compatible and working.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Some implementation details]
+
+Sometimes there is a special head token at the start. This makes for easier
+appending of extra tokens. In traditional \TEX\ node lists are forward linked, in
+\LUATEX\ they are double linked \footnote {On the agenda of \LUAMETATEX\ is to
+use this property in the underlying code, that doesn't yet profit from this and
+therefore keep previous pointers in store.}. Token lists are always forward
+linked. Shared token lists use the head node for a reference count.
+
+For various reasons original \TEX\ uses global variables temporary lists. This is
+for instance needed when we expand (nested) and need to report issues. But in
+\LUATEX\ we often just serialize lists and using local variables makes more
+sense. One of the first things done in \LUAMETATEX\ was to group all global
+variables in (still global) structures but well isolated. That also made it
+possible to actually get rid of some globals.
+
+Because \TEX\ had to run on machines that we nowadays consider rather limited, it
+had to be sparse and efficient. There are quite some optimizations to limit code
+and memory consumption. The engine also does its own memory management. Freed
+token memory words are collected in a cache and reused but they can get scattered
+which is not that bad, apart from maybe cache hits. In \LUAMETATEX\ we stay as
+close to original \TEX\ as possible but there have been some improvements. The
+\LUA\ interfaces force us to occasionally divert from the original, and that in
+fact might lead to some retrofit but the original documentation still mostly
+applies. However, keep in mind that in \LUATEX\ we store much more in nodes (each
+has a prev pointer and an attribute list pointer and for instance glyph nodes
+have some 20 extra fields compared to traditional \TEX\ character nodes).
+
+\stopsectionlevel
+
+\startsectionlevel[title=Other data management]
+
+There is plenty going on in \TEX\ when it processes your input, just to mention a
+few:
+
+\startitemize[packed]
+\startitem Grouping is handled by a nesting stack. \stopitem
+\startitem Nested conditionals (\type {\if...}) have their own stack. \stopitem
+\startitem The values before assignments are saved on the save stack. \stopitem
+\startitem Also other local changes (housekeeping) ends up in the save stack. \stopitem
+\startitem Token lists and macro aliases have references pointers (reuse). \stopitem
+\startitem Attributes, being linked node lists, have their own management. \stopitem
+\stopitemize
+
+In all these subsystems tokens or references to tokens can play a role. Reading a
+single character from the input can trigger a lot of action. A curly brace tagged
+as begin group command will push the grouping level and from then on registers
+and some other quantities that are changed will be stored on the save stack
+so that after the group ends they can be restored. When primitives take keywords,
+and no match happens, tokens are pushed back into the input which introduces a
+new input level (also some stack). When numbers are read a token that represents
+no digit is pushed back too and macro packages use numbers and dimensions a lot.
+It is a surprise that \TEX\ is so fast.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Macros]
+
+There is a distinction between primitives, the build in commands, and macros, the
+commands defined by users. A primitive relates to a command code and char code
+but macros are, unless they are made an alias to something else, like a \type
+{\countdef} or \type {\let} does, basically pointers to a token list. There is
+some additional data stored that makes it possible to parse and grab arguments.
+
+When we have a control sequence (macro) \type {\controlsequence} the name is
+looked up in the hash table. When found its value will point to the table of
+equivalents. As mentioned, that table keeps track of the cmd and points to a
+token list (the meaning). We saw that this table also stores the current level
+of grouping and flags.
+
+If we say, in the input, \typ {\hbox to 10pt {x\hss}}, the box is assembled as we
+go and when it is appended to the current node list there are no tokens left.
+When scanning this, the engine literally sees a backslash and the four letters
+\type {hbox}. However when we have this:
+
+\starttyping[option=TEX]
+\def\MyMacro{\hbox to 10pt {x\hss}}
+\stoptyping
+
+the \type {\hbox} has become one memory word which has a token representing the
+\type {\hbox} primitive plus a link to the next token. The space after a control
+sequence is gobbled so the next two tokens, again stored in a linked memory word,
+are letter tokens, followed by two other and two letter tokens for the
+dimensions. Then we have a space, a brace, a letter, a primitive and a brace. The
+about 20 characters in the input became a dozen memory words each two times four
+bytes, so in terms of memory usage we end up with quite a bit more. However, when
+\TEX\ runs over that list it only has to interpret the token values because the
+scanning and conversion already happened. So, the space that a macro takes is
+more than compensated by efficient reprocessing.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Looking at tokens]
+
+When you say \type {\tracingall} you will see what the engine does: read input,
+expand primitives and macros, typesetting etc.\ You might need to set \type
+{\tracingonline} to get a bit more output on the console. One way to look at
+macros is to use the \type {\meaning} command, so if we have:
+
+\startbuffer[definition]
+\permanent\protected\def\MyMacro#1#2{Do #1 or #2!}
+\stopbuffer
+
+\startbuffer[meaning]
+\meaning \MyMacro
+\meaningless\MyMacro
+\meaningfull\MyMacro
+\stopbuffer
+
+\typebuffer[definition][option=TEX]
+
+we can say this:
+
+\typebuffer[meaning][option=TEX]
+
+and get:
+
+{\getbuffer[definition]\startlines\tttf \getbuffer[meaning]\stoplines}
+
+You get less when you ask for the meaning of a primitive, just its name. The
+\type {\meaningfull} primitive gives the most information. In \LUAMETATEX\
+protected macros are first class commands: they have their own command code. In
+the other engines they are just regular macros with an initial token indicating
+that they are protected. There are specific command codes for \type {\outer} and
+\type {\long} macros but we dropped that in \LUAMETATEX . Instead we have \type
+{\tolerant} macros but that's another story. The flags that were mentioned can
+mark macros in a way that permits overload protection as well as some special
+treatment in otherwise tricky cases (like alignments). The overload related flags
+permits a rather granular way to prevent users from redefining macros and such.
+They are set via prefixes, and add to that repertoire: we have 14 prefixes but
+only some eight deal with flags (we can add more if really needed). The probably
+most wel known prefix is \type {\global} and that one will not become a flag: it
+has immediate effect.
+
+For the above definition, the \type {\showluatokens} command will show a meaning
+on the console.
+
+\starttyping[option=TEX]
+\showluatokens\MyMacro
+\stoptyping
+
+% {\getbuffer[definition]\getbuffer}
+
+This gives the next list, where the first column is the address of the token, the
+second one the command code, and the third one the char code. When there are
+arguments involved, the list of what needs to get matched is shown.
+
+\starttyping
+permanent protected control sequence: MyMacro
+501263 19 49 match argument 1
+501087 19 50 match argument 2
+385528 20 0 end match
+--------------
+501090 11 68 letter D (U+00044)
+ 30833 11 111 letter o (U+0006F)
+500776 10 32 spacer
+385540 21 1 parameter reference
+112057 10 32 spacer
+431886 11 111 letter o (U+0006F)
+ 30830 11 114 letter r (U+00072)
+ 30805 10 32 spacer
+500787 21 2 parameter reference
+213412 12 33 other char ! (U+00021)
+\stoptyping
+
+In the next subsections I will give some examples. This time we use
+helper defined in a module:
+
+\starttyping[option=TEX]
+\usemodule[system-tokens]
+\stoptyping
+
+\startsectionlevel[title=Example 1: in the input]
+
+\startbuffer
+\luatokentable{1 \bf{2} 3\what {!}}
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 2: in the input]
+
+\startbuffer
+\luatokentable{a \the\scratchcounter b \the\parindent \hbox to 10pt{x}}
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 3: user registers]
+
+\startbuffer
+\scratchtoks{foo \framed{\red 123}456}
+
+\luatokentable\scratchtoks
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 4: internal variables]
+
+\startbuffer
+\luatokentable\everypar
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 5: macro definitions]
+
+\startbuffer
+\protected\def\whatever#1[#2](#3)\relax
+ {oeps #1 and #2 & #3 done ## error}
+
+\luatokentable\whatever
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 6: commands]
+
+\startbuffer
+\luatokentable\startitemize
+\luatokentable\stopitemize
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 7: commands]
+
+\startbuffer
+\luatokentable\doifelse
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer }
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 8: nothing]
+
+\startbuffer
+\luatokentable\relax
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer }
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 9: hashes]
+
+\startbuffer
+\edef\foo#1#2{(#1)(\letterhash)(#2)} \luatokentable\foo
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer }
+
+\stopsectionlevel
+
+\startsectionlevel[title=Example 10: nesting]
+
+\startbuffer
+\def\foo#1{\def\foo##1{(#1)(##1)}} \luatokentable\foo
+\stopbuffer
+
+\typebuffer[option=TEX] \blank[line] {\switchtobodyfont[8pt] \getbuffer }
+
+\stopsectionlevel
+
+\startsectionlevel[title=Remark]
+
+In all these examples the numbers are to be seen as abstractions. Some command
+codes and sub command codes might change as the engine evolves. This is why the
+\LUAMETATEX\ engine has lots of \LUA\ functions that provide information about
+what number represents what command.
+
+\stopsectionlevel
+
+\stopsectionlevel
+
+\stopdocument
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel.tex b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel.tex
index 2d689883536..8f58e16c170 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel.tex
@@ -39,6 +39,7 @@
\startsectionlevel[title=Loops] \component [lowlevel-loops] \stopsectionlevel
\startsectionlevel[title=Tokens] \component [lowlevel-tokens] \stopsectionlevel
\startsectionlevel[title=Buffers] \component [lowlevel-buffers] \stopsectionlevel
+ % \startsectionlevel[title=Accuracy] \component [lowlevel-accuracy] \stopsectionlevel
\stoptext
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-building.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
index ca09c53f945..277d39251db 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
@@ -792,6 +792,60 @@ we can freeze them.
{everybeforepar}, \prm {snapshotpar}, \prm {wrapuppar}, etc. For the moment the
manuals that come with \CONTEXT\ have to do.}
+% The concept of paragraph in \TEX\ can be a bit confusing, and what follows here
+% is even more so. In \LUAMETATEX\ we distinguish three different cases:
+%
+% \startitemize[packed]
+% \starthead {normal}
+% This state is entered when we have an explicit \type {\par}.
+% \stophead
+% \starthead {inserted}
+% This state is entered when \TEX\ forces a new paragraph which can happen when
+% we automatically change to horizontal mode.
+% \stophead
+% \starthead{newline}
+% This state is entered when an empty line is encoduntered.
+% \stophead
+% \stopitemize
+%
+% When defining macros, a \type {\par} can be a delimiter and an empty line is then
+% equivalent to that. With \type {\autoparagraphmode} we can change this behaviour.
+% The bits set in this variable determines how \type {\par} tokens are interpreted
+% and processed in different situations. It is good to know that this experimental
+% feature is pretty much \CONTEXT\ specific. Here are a few characteristics:
+%
+% \startitemize[packed]
+% \startitem
+% When any bit is set, a par token is appended when with property inserted.
+% The reason behind different properties (mentioned above) is that we can
+% intercept them with callbacks.
+% \stopitem
+% \startitem
+% When bit~1 (text) is set, \type {\par} will be appended to a string when
+% a token list is serialized.
+% \stopitem
+% \startitem
+% When bit~2 (macro) is set when a macro is defined there is an explicit
+% check for a par token when \type {\par} is part of the preamble.
+% \stopitem
+% \startitem
+% When bit~4 (go on) is not set we enter the same state as a new line.
+% After that when bit~1 (text) is set, a regular par token command is
+% injected (with an associated newline state), otherwise the meaning of
+% \type {\par} kicks in (users can have redefined \type {\par}).
+% \stopitem
+% \stopitemize
+%
+% In \CONTEXT\ we currently default to one, because we still have a few \type {\par}
+% delimited macros but these will go and then we will set the mode to two. This
+% means that in \CONTEXT\ such macro expects an explicit \type {\par} and not an
+% empty line which in turn encourages users to use the proper alternatives. We
+% anyway don't support redefined \type {\par} tokens. Therefore, when we load for
+% instance tikz, we set the mode to zero (normal \TEX) and afterwards back to one.
+% This is still an experimental feature that we occasionally review so don't bother
+% us with questions about it (just don't set the mode).
+
+
\stopsubsection
\startsubsection[title=Penalties]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
index 13bc3a3e369..46d986bfb57 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
@@ -248,7 +248,7 @@ input that would have generated an error when processed by older \TEX|-|based
engines. The affected commands with an altered initial (left of the equal sign)
or secondary (right of the equal sign) value are: \prm {char}, \prm {lccode},
\prm {uccode}, \prm {hjcode}, \prm {catcode}, \prm {sfcode}, \prm {efcode}, \prm
-{lpcode}, \prm {rpcode}, \prm {chardef}.
+{cfcode}, \prm {lpcode}, \prm {rpcode}, \prm {chardef}.
As far as the core engine is concerned, all input and output to text files is
\UTF-8 encoded. Input files can be pre|-|processed using the \type {reader}
@@ -1710,7 +1710,8 @@ less storage demands) for macros with no arguments, and flags that can be set fo
macros the way macros are traced can be different in details (we therefore have
for instance \prm {meaningfull} (double l's indeed) and \prm {meaningless} as
variants of \prm {meaning} as well as \prm {meaningasis} for more literal
-alternative).
+alternative). The \prm {meaningful} and \prm {meaningles} variants show no body
+but do show the preamble when we have arguments.
\stopsubsection
@@ -1914,6 +1915,16 @@ by the engine for the same reasons: less code and less tracing clutter.
\stopsubsection
+\startsubsection[title={\prm{cdef}, \prm {cdefcsname} and \prm {constant}}]
+
+These primitives are like \prm {edef} and \prm {edefcsname} but tag the macro as
+being kind of simple, which means that in some scenarios they are serialized in a
+fast way, not going through the expansion machinery. This is actually an
+experiment but it will stay. The \prm {constant} prefix can be used with other
+definition primitives instead.
+
+\stopsubsection
+
\startsubsection[title={\prm {csstring}, \prm {begincsname} and \prm {lastnamedcs}}]
These are somewhat special. The \prm {csstring} primitive is like
@@ -2002,6 +2013,21 @@ defined (or used).
\stopsubsection
+\startsubsection[title=Prefixes]
+
+Quite some primitive usage can be preceded by a prefix. For instance assignments
+can be \prm {global} and macros can be defined \prm {protected}. In \LUAMETATEX\
+we have more prefixes, like \prm {tolerant} that signals a different way of
+interpreting macro arguments and \type {permanent} that flags a definition in
+away that, when overload protection is enabled, will prevent redefinition.
+Prefixes like \prm {immediate} and its counterpart \prm {deferred} are backend
+related and, as we don't have one in the engine, are not doing much. They are
+just intercepted and passed to e.g.\ some \LUA\ function called so that one can
+use them to construct additional (\LUA\ based) pseudo primitives. Various
+prefixes are discussed elsewhere.
+
+\stopsubsection
+
\startsubsection[title=Arguments]
\topicindex {macros+arguments}
@@ -2421,6 +2447,45 @@ omits the unit.
\stopsubsection
+\startsubsection[title={Units}]
+
+The familiar \TEX\ units like \type {pt} and \type {cm} are supported but since
+the 2021 \CONTEXT\ meeting we also support the Knuthian Potrzebie, cf.\ \typ
+{en.wikipedia.org/wiki/Potrzebie}. The two character acronym is \type {dk}. One
+\type {dk} is 6.43985pt. This unit is particularly suited for offsets in framed
+examples.
+
+In 2023 we added the Edith (\type {es}) and Tove (\type {ts}) as metric
+replacements for the inch (\type {in}). As with the \type {dk} more background
+information can be found in documents that come with \CONTEXT\ and user group
+journals. The \type {eu} unit starts out as one \type {es} but can be scaled with
+\prm {eufactor}.
+
+\startbuffer
+\localcontrolledloop -5 55 5 {
+ \eufactor=\currentloopiterator
+ \dontleavehmode\strut
+ \vrule height .1es depth .25ts width 1dk\relax\quad
+ \vrule height .1es depth .25ts width 1eu\relax\quad
+ \the\currentloopiterator
+ \par
+}
+\stopbuffer
+
+\typebuffer
+
+This example code shows all four new units. Watch how \prm {eufactor} is clipped
+to a value in the range $1-50$. The default factor of $10$ makes the European
+Unit equivalent to ten Toves or one Edith.
+
+\startpacked
+\startcolor[darkgray]
+\getbuffer
+\stopcolor
+\stoppacked
+
+\stopsubsection
+
\stopsection
\startsection[title=Expressions]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex
index b4e6925457f..7f0a7a62c3b 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex
@@ -130,8 +130,14 @@ optical paragraph optimization:
\NC \type {leftprotruding} \NC number \NC left protruding factor (\prm {lpcode}) \NC\NR
\NC \type {rightprotruding} \NC number \NC right protruding factor (\prm {rpcode}) \NC\NR
\NC \type {expansion} \NC number \NC expansion factor (\prm {efcode}) \NC\NR
+\NC \type {compression} \NC number \NC compression factor (\prm {cfcode}) \NC\NR
\stoptabulate
+The \prm {lpcode}, \prm {rpcode} and \prm {efcode} are comparable to the ones
+introduced by \PDFTEX, while \prm {cfcode} complements \prm {efcode}: a
+compression alongside expansion code per character. In \LUAMETATEX\ the expansion
+mechanism is also available in math.
+
From \TEX\ we inherit the following tables. Ligatures are only used in so call
base mode, when the engine does the font magic. Kerns are used in text and
optionally in math: More details follow below.
@@ -850,15 +856,15 @@ instance content moved into the margin:
\stopsubsection
-\startsubsection[title={\prm{fontcharta}}]
+\startsubsection[title={\prm{fontcharta} and \prm{fontcharba}}]
\topicindex {glyphs + properties}
The \prm {fontcharwd}, \prm {fontcharht}, \prm {fontchardp} and \prm {fontcharic}
give access to character properties. To this repertoire \LUAMETATEX\ adds the top
-accent accessor \prm {fontcharta} which came in handy for tracing. You pass a
-font reference and character code. Normally only \OPENTYPE\ math fonts have this
-property.
+and bottom accent accessors \prm {fontcharta} and \prm {fontcharba} that came in
+handy for tracing. You pass a font reference and character code. Normally only
+\OPENTYPE\ math fonts have this property.
\stopsubsection
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
index 08b7d94bc5d..142f18c3259 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
@@ -130,7 +130,7 @@ Hans Hagen
\NC \LUAMETATEX\ Version \EQ \currentdate \NC \NR
\NC \CONTEXT\ Version \EQ LMTX \contextversion \NC \NR
\NC \LUATEX\ Team \EQ Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi Scarso \NC \NR
-\NC \LUAMETATEX\ Team \EQ Hans Hagen, Alan Braslau, Mojca Miklavec and Wolfgang Schuster, Mikael Sundqvist \NC \NR
+\NC \LUAMETATEX\ Team \EQ Hans Hagen, Alan Braslau, Mojca Miklavec, Wolfgang Schuster and Mikael Sundqvist \NC \NR
\NC resources and info at \EQ www.contextgarden.net\space\vl\space
www.pragma-ade.nl\space\vl\space
www.luametatex.org\space\vl\space
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
index 83e19dcc95e..daa4420c9d5 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
@@ -130,7 +130,7 @@ hyphenation happens is (normally) when the paragraph or a horizontal box is
constructed. When \prm {savinghyphcodes} was zero when the language got
initialized you start out with nothing, otherwise you already have a set.
-When a \prm {hjcode} is greater than 0 but less than 32 is indicates the
+When a \prm {hjcode} is greater than 0 but less than 32 the value indicates the
to be used length. In the following example we map a character (\type {x}) onto
another one in the patterns and tell the engine that \type {œ} counts as two
characters. Because traditionally zero itself is reserved for inhibiting
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
index c18a2bc485a..f19cee29ef6 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
@@ -588,17 +588,19 @@ that over time system dependencies have been handles with \TEX\ change files, th
When it became unavoidable that we output more detail, it also became clear that
it made no sense to stay log and trace compatible. Some is controlled by
parameters in order to stay close the original, but \CONTEXT\ is configured such
-that we benefit from the new possibilities. Examples are that in addition to
-\prm {meaning} we have \prm {meaningfull} that also exposes macro properties,
-and \prm {meaningless} that only exposes the body. The \prm {untraced} prefix
-will suppress some in the log, and we set \prm {tracinglevels} to 3 in order to
-get details about the input and grouping level. When there's less shown than
-expected keep in mind that \LUAMETATEX\ has a somewhat optimized saving and
-restoring of meanings so less can happen which is reflected in tracing. When node
-lists are serialized (as with \prm {showbox}) some nodes, like discretionaries
-report more detail. The compact serializer, used for instance to signal overfull
-boxes, also shows a bit more detail with respect to non|-|content nodes. I math
-more is shown if only because we have more control and additional mechanisms.
+that we benefit from the new possibilities. Examples are that in addition to \prm
+{meaning} we have \prm {meaningfull} that also exposes macro properties, and \prm
+{meaningless} that only exposes the body; their companions \prm {meaningful} and
+\prm {meaningles} show no body but do show the preamble when present. The \prm
+{untraced} prefix will suppress some in the log, and we set \prm {tracinglevels}
+to 3 in order to get details about the input and grouping level. When there's
+less shown than expected keep in mind that \LUAMETATEX\ has a somewhat optimized
+saving and restoring of meanings so less can happen which is reflected in
+tracing. When node lists are serialized (as with \prm {showbox}) some nodes, like
+discretionaries report more detail. The compact serializer, used for instance to
+signal overfull boxes, also shows a bit more detail with respect to non|-|content
+nodes. I math more is shown if only because we have more control and additional
+mechanisms.
\stopsubsection
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
index c3ac0a29489..df4da576e65 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
@@ -24,21 +24,63 @@ such a user data object is represented as \syntax {<node>}.
\blank
You can ask for a list of fields with \type {node.fields} and for valid subtypes
-with \type {node.subtypes}. The \type {node.values} function reports some used
-values. Valid arguments are \type {glue}, \type {style} and \type {math}. Keep in
-mind that the setters normally expect a number, but this helper gives you a list
-of what numbers matter. For practical reason the \type {pagestate} values are
-also reported with this helper, but they are backend specific.
+with \type {node.subtypes}. There are plenty specific field values and you can
+some idea about them by calling \type {tex.get*values()} which returns a table if
+numbers (exclusive numbers or bits):
-\def\ShowValues#1{
+\starttexdefinition ShowTeXValues #1
\blank
\dontleavehmode
- {\bf The return values of \type {node.values("#1")} are:}
+% {\bf The return values of \type {tex.get#1values()} are:}\space
+ {\bf #1:}\space
\showvalues{#1}
+% \showhexvalues{#1}
\blank
-}
-
-\ShowValues{glue} \ShowValues{style} \ShowValues{math} \ShowValues{pagestate}
+\stoptexdefinition
+
+\ShowTeXValues{fill}
+\ShowTeXValues{alignmentcontext}
+\ShowTeXValues{appendlinecontext}
+% \ShowTeXValues{automigration}
+\ShowTeXValues{charactertag}
+\ShowTeXValues{direction}
+\ShowTeXValues{discoption}
+\ShowTeXValues{discstate}
+% \ShowTeXValues{error}
+% \ShowTeXValues{flag}
+% \ShowTeXValues{frozenpar}
+\ShowTeXValues{glyphoption}
+\ShowTeXValues{group}
+\ShowTeXValues{hyphenation}
+\ShowTeXValues{io}
+\ShowTeXValues{kerneloption}
+\ShowTeXValues{listanchor}
+\ShowTeXValues{listgeometry}
+\ShowTeXValues{listsign}
+\ShowTeXValues{mathclassoption}
+\ShowTeXValues{mathcontrol}
+\ShowTeXValues{mathparameter}
+\ShowTeXValues{mathstylename}
+\ShowTeXValues{mathstyle}
+% \ShowTeXValues{mathvariant}
+% \ShowTeXValues{mode}
+\ShowTeXValues{noadoption}
+\ShowTeXValues{normalizeline}
+\ShowTeXValues{normalizepar}
+\ShowTeXValues{packtype}
+\ShowTeXValues{pagecontext}
+\ShowTeXValues{parbegin}
+\ShowTeXValues{parcontext}
+\ShowTeXValues{parmode}
+% \ShowTeXValues{runstate}
+% \ShowTeXValues{shapingpenalties}
+% \ShowTeXValues{specialmathclass}
+% \ShowTeXValues{textcontrol}
+
+There are a lot of helpers, especially for direct nodes. When possible they adapt
+to the kind of node they get passed. Often multiple values are returned which
+lessens the number of additional calls. It will take a while before all gets
+documented (which is no big deal as the main usage for them is in \CONTEXT).
\stopsection
@@ -754,8 +796,6 @@ but don't rely on that for the future. Fields are: \showfields {style}.
\LL
\stoptabulate
-Valid styles are: \showvalues{style}.
-
\stopsubsubsection
\startsubsubsection[title={\nod {parameter} nodes}]
@@ -1381,14 +1421,14 @@ The \type {traversechar} iterator loops over the \nod {glyph} nodes in a list.
Only nodes with a subtype less than 256 are seen.
\startfunctioncall
-<direct> n, font, char = node.direct.traversechar(<direct> n)
+<direct> n, char, font = node.direct.traversechar(<direct> n)
\stopfunctioncall
The \type{traverseglyph} iterator loops over a list and returns the list and
filters all glyphs:
\startfunctioncall
-<direct> n, font, char = node.traverseglyph(<direct> n)
+<direct> n, char, font = node.traverseglyph(<direct> n)
\stopfunctioncall
These functions are only available for direct nodes.
@@ -2398,9 +2438,9 @@ number, for a glue, kern, hlist, vlist, rule and math nodes as well as glyph
nodes (although this last one is not used in native \SYNCTEX).
\startfunctioncall
-node.setsynctexfields(<integer> f, <integer> l)
+node.direct.setsynctexfields(<integer> f, <integer> l)
<integer> f, <integer> l =
- node.getsynctexfields(<node> n)
+ node.direct.getsynctexfields(<node> n)
\stopfunctioncall
Of course you need to know what you're doing as no checking on sane values takes
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex
index 1394df9f5c4..b08433b2913 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex
@@ -83,12 +83,12 @@ pdfe.getstatus(<pdfe document>)
The returned codes are:
\starttabulate[|c|l|]
-\DB value \BC explanation \NC \NR
+\DB value \BC explanation \NC \NR
\TB
-\NC \type {-2} \NC the document failed to open \NC \NR
-\NC \type {-1} \NC the document is (still) protected \NC \NR
-\NC \type {0} \NC the document is not encrypted \NC \NR
-\NC \type {2} \NC the document has been unencrypted \NC \NR
+\NC \type {-2} \NC the document is (still) protected \NC \NR
+\NC \type {-1} \NC the document failed to open \NC \NR
+\NC \type {0} \NC the document is not encrypted \NC \NR
+\NC \type {1} \NC the document has been unencrypted \NC \NR
\LL
\stoptabulate
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-style.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
index 6586e6fc162..b3591344ab2 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
@@ -84,13 +84,14 @@
end
end
- function document.functions.showvalues(l)
+ function document.functions.showvalues(l,hex)
if l then
local n = table.count(l)
local i = 0
+ local f = hex and "%s{\\tttf %s} (0x%02X)" or "%s{\\tttf %s} (%i)"
for k, v in table.sortedhash(l) do
i = i + 1
- context("%s{\\tttf %s} (%i)", (i == 1 and "") or (i == n and " and ") or ", ", v,k)
+ context(f, (i == 1 and "") or (i == n and " and ") or ", ", v,k)
end
end
end
@@ -120,11 +121,11 @@
\protected\def\showfields #1{\ctxlua{document.functions.showfields("#1")}}
\protected\def\showid #1{\ctxlua{document.functions.showid("#1")}}
\protected\def\showsubtypes #1{\ctxlua{document.functions.showsubtypes("#1")}}
-\protected\def\showvalues #1{\ctxlua{document.functions.showvalues(node.values("#1"))}}
+\protected\def\showvalues #1{\ctxlua{document.functions.showvalues(tex.get#1values())}}
+\protected\def\showhexvalues#1{\ctxlua{document.functions.showvalues(tex.get#1values(),true)}}
\protected\def\showtypes {\ctxlua{document.functions.showvalues(node.types())}}
\protected\def\showvaluelist#1{\ctxlua{document.functions.showvalues(#1)}}
-
\definecolor[blue] [b=.5]
\definecolor[red] [r=.5]
\definecolor[green] [g=.5]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
index f845fed1711..e7505397219 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -110,7 +110,7 @@
% because the amount of output which is sensitive for refresh delays set. The new
% target is nwo 50 pages per second for this manual but on this laptop that is
% unlikely to happen any time soon. With tabulateusesize and tabulatesparseskips
-% experimends enabled we needed 8.1 second and 44.3 pps.
+% experiments enabled we needed 8.1 second and 44.3 pps.
% \enableexperiments [tabulateusesize]
% \enableexperiments [tabulatesparseskips]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
index b0921c70cd7..cfbc9c32f15 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
@@ -728,12 +728,13 @@ font.setfont(<number> n, <table> f)
Note that at the moment, each access to the \type {font.fonts} or call to \type
{font.getfont} creates a \LUA\ table for the whole font unless you cached it.
+If you want a copy of the internal data you can use \type {font.getcopy}:
\startfunctioncall
-<table> f = font.getfont(<number> n)
+<table> f = font.getcopy(<number> n)
\stopfunctioncall
-So, this one will return a table of the parameters as known to \TEX. These can be
+This one will return a table of the parameters as known to \TEX. These can be
different from the ones in the cached table:
\startfunctioncall
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-languages.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-languages.tex
index cb9ca10f32d..9b32fffd325 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-languages.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-languages.tex
@@ -140,7 +140,7 @@ hyphenation happens is (normally) when the paragraph or a horizontal box is
constructed. When \prm {savinghyphcodes} was zero when the language got
initialized you start out with nothing, otherwise you already have a set.
-When a \lpr {hjcode} is greater than 0 but less than 32 is indicates the
+When a \lpr {hjcode} is greater than 0 but less than 32 it indicates the
to be used length. In the following example we map a character (\type {x}) onto
another one in the patterns and tell the engine that \type {œ} counts as one
character. Because traditionally zero itself is reserved for inhibiting
@@ -369,7 +369,7 @@ before---after \par
\stopcombination
\stopbuffer
-\startplacefigure[locationreference=automatichyphenmode:1,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with a \prm {hsize}
+\startplacefigure[reference=automatichyphenmode:1,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with a \prm {hsize}
of 6em and 2pt (which triggers a linebreak).}]
\dontcomplain \tt \getbuffer[demo]
\stopplacefigure
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-lua.tex
index 9765051895f..3b2f9b1a7dc 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-lua.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-lua.tex
@@ -68,40 +68,41 @@ similar fashion as the other \TEX\ engines. Some options are accepted but have n
consequence. The following command|-|line options are understood:
\starttabulate[|l|p|]
-\DB commandline argument \BC explanation \NC \NR
+\DB commandline argument \BC explanation \NC \NR
\TB
-\NC \type{--credits} \NC display credits and exit \NC \NR
-\NC \type{--debug-format} \NC enable format debugging \NC \NR
-\NC \type{--draftmode} \NC switch on draft mode i.e.\ generate no output in \PDF\ mode \NC \NR
-\NC \type{--[no-]file-line-error} \NC disable/enable \type {file:line:error} style messages \NC \NR
-\NC \type{--[no-]file-line-error-style} \NC aliases of \type {--[no-]file-line-error} \NC \NR
-\NC \type{--fmt=FORMAT} \NC load the format file \type {FORMAT} \NC\NR
-\NC \type{--halt-on-error} \NC stop processing at the first error\NC \NR
-\NC \type{--help} \NC display help and exit \NC\NR
-\NC \type{--ini} \NC be \type {iniluatex}, for dumping formats \NC\NR
-\NC \type{--interaction=STRING} \NC set interaction mode: \type {batchmode}, \type {nonstopmode},
- \type {scrollmode} or \type {errorstopmode} \NC \NR
-\NC \type{--jobname=STRING} \NC set the job name to \type {STRING} \NC \NR
-\NC \type{--kpathsea-debug=NUMBER} \NC set path searching debugging flags according to the bits of
- \type {NUMBER} \NC \NR
-\NC \type{--lua=FILE} \NC load and execute a \LUA\ initialization script \NC\NR
-\NC \type{--[no-]mktex=FMT} \NC disable/enable \type {mktexFMT} generation with \type {FMT} is
- \type {tex} or \type {tfm} \NC \NR
-\NC \type{--nosocket} \NC disable the \LUA\ socket library \NC\NR
-\NC \type{--output-comment=STRING} \NC use \type {STRING} for \DVI\ file comment instead of date (no
- effect for \PDF) \NC \NR
-\NC \type{--output-directory=DIR} \NC use \type {DIR} as the directory to write files to \NC \NR
-\NC \type{--output-format=FORMAT} \NC use \type {FORMAT} for job output; \type {FORMAT} is \type {dvi}
- or \type {pdf} \NC \NR
-\NC \type{--progname=STRING} \NC set the program name to \type {STRING} \NC \NR
-\NC \type{--recorder} \NC enable filename recorder \NC \NR
-\NC \type{--safer} \NC disable easily exploitable \LUA\ commands \NC\NR
-\NC \type{--[no-]shell-escape} \NC disable/enable system calls \NC \NR
-\NC \type{--shell-restricted} \NC restrict system calls to a list of commands given in \type
- {texmf.cnf} \NC \NR
-\NC \type{--synctex=NUMBER} \NC enable \type {synctex} \NC \NR
-\NC \type{--utc} \NC use utc times when applicable \NC \NR
-\NC \type{--version} \NC display version and exit \NC \NR
+\NC \type{--credits} \NC display credits and exit \NC \NR
+\NC \type{--debug-format} \NC enable format debugging \NC \NR
+\NC \type{--draftmode} \NC switch on draft mode i.e.\ generate no output in \PDF\ mode \NC \NR
+\NC \type{--[no-]file-line-error} \NC disable/enable \type {file:line:error} style messages \NC \NR
+\NC \type{--[no-]file-line-error-style} \NC aliases of \type {--[no-]file-line-error} \NC \NR
+\NC \type{--fmt=FORMAT} \NC load the format file \type {FORMAT} \NC\NR
+\NC \type{--halt-on-error} \NC stop processing at the first error\NC \NR
+\NC \type{--help} \NC display help and exit \NC\NR
+\NC \type{--ini} \NC be \type {iniluatex}, for dumping formats \NC\NR
+\NC \type{--interaction=STRING} \NC set interaction mode: \type {batchmode}, \type {nonstopmode},
+ \type {scrollmode} or \type {errorstopmode} \NC \NR
+\NC \type{--jobname=STRING} \NC set the job name to \type {STRING} \NC \NR
+\NC \type{--kpathsea-debug=NUMBER} \NC set path searching debugging flags according to the bits of
+ \type {NUMBER} \NC \NR
+\NC \type{--lua=FILE} \NC load and execute a \LUA\ initialization script \NC\NR
+\NC \type{--[no-]mktex=FMT} \NC disable/enable \type {mktexFMT} generation with \type {FMT} is
+ \type {tex} or \type {tfm} \NC \NR
+\NC \type{--nosocket} or \type{--no-socket} \NC disable the \LUA\ socket library \NC\NR
+\NC \type{--socket} \NC enable the \LUA\ socket library \NC\NR
+\NC \type{--output-comment=STRING} \NC use \type {STRING} for \DVI\ file comment instead of date (no
+ effect for \PDF) \NC \NR
+\NC \type{--output-directory=DIR} \NC use \type {DIR} as the directory to write files to \NC \NR
+\NC \type{--output-format=FORMAT} \NC use \type {FORMAT} for job output; \type {FORMAT} is \type {dvi}
+ or \type {pdf} \NC \NR
+\NC \type{--progname=STRING} \NC set the program name to \type {STRING} \NC \NR
+\NC \type{--recorder} \NC enable filename recorder \NC \NR
+\NC \type{--safer} \NC disable easily exploitable \LUA\ commands \NC\NR
+\NC \type{--[no-]shell-escape} \NC disable/enable system calls \NC \NR
+\NC \type{--shell-restricted} \NC restrict system calls to a list of commands given in \type
+ {texmf.cnf} \NC \NR
+\NC \type{--synctex=NUMBER} \NC enable \type {synctex} \NC \NR
+\NC \type{--utc} \NC use utc times when applicable \NC \NR
+\NC \type{--version} \NC display version and exit \NC \NR
\LL
\stoptabulate
@@ -146,10 +147,10 @@ in the following order:
\startitem
First, it will parse the command line as usual, but it will only interpret a
- small subset of the options immediately: \type {--safer}, \type {--nosocket},
- \type {--[no-]shell-escape}, \type {--enable-write18}, \type
- {--disable-write18}, \type {--shell-restricted}, \type {--help}, \type
- {--version}, and \type {--credits}.
+ small subset of the options immediately: \type {--safer}, \type {--nosocket}
+ (\type {--no-socket}), \type {--socket}, \type {--[no-]shell-escape}, \type
+ {--enable-write18}, \type {--disable-write18}, \type {--shell-restricted},
+ \type {--help}, \type {--version}, and \type {--credits}.
\stopitem
\startitem
@@ -169,7 +170,8 @@ in the following order:
\starttabulate[|c|l|]
\DB library \BC functions \NC \NR
\TB
- \NC \type {os} \NC \type {execute} \type {exec} \type {spawn} \type {setenv}
+ \NC \type {os} \NC \type {execute} \type {exec} \type{kpsepopen}
+ \type {spawn} \type {setenv}
\type {rename} \type {remove} \type {tmpdir} \NC \NR
\NC \type {io} \NC \type {popen} \type {output} \type {tmpfile} \NC \NR
\NC \type {lfs} \NC \type {rmdir} \type {mkdir} \type {chdir} \type {lock}
@@ -181,6 +183,9 @@ in the following order:
Furthermore, it disables loading of compiled \LUA\ libraries and it makes
\type {io.open()} fail on files that are opened for anything besides reading.
+
+ Finally, it disables the \type {socket} library unconditionally (but not the
+ \type {mime} library which is always available).
\stopitem
\startitem
@@ -193,13 +198,24 @@ in the following order:
os.setlocale(nil,nil)
\stoptyping
- The \type {--nosocket} option makes the socket library unavailable, so that \LUA\
- cannot use networking.
+ The \type {--nosocket} (\type {--no-socket}) option makes the socket library
+ unavailable, so that \LUA\ cannot use networking; the \type {--socket} option
+ makes the socket library available.
+
+ The switches \type {--[no-]shell-escape}, \type {--[enable|disable]-write18},
+ and \type {--shell-restricted} have the same effects as in \PDFTEX, and
+ additionally make \type {io.popen()}, \type {os.execute}, \type {os.exec},
+ \type {os.kpsepopen} and \type {os.spawn} adhere to the requested option.
+
+ By default the socket library is not enabled: one can enable it with with
+ \type {--socket} or with \type {--shell-escape} (but without \type
+ {--shell-restricted}) and disable it with \type {--nosocket} (\type
+ {--no-socket}) or unconditionally with \type {--safer}.
+
+ In case of conflictual options, the most restrictive wins.
+
+ The \type{mime} library is always available.
- The switches \type {--[no-]shell-escape}, \type {--[enable|disable]-write18}, and
- \type {--shell-restricted} have the same effects as in \PDFTEX, and additionally
- make \type {io.popen()}, \type {os.execute}, \type {os.exec} and \type {os.spawn}
- adhere to the requested option.
\stopitem
\startitem
@@ -319,8 +335,8 @@ of the module itself).
\startsubsection[title={Executing programs}]
-In keeping with the other \TEX|-|like programs in \TEXLIVE, the two \LUA\ functions
-\type {os.execute} and \type {io.popen}, as well as the two new functions \type
+In keeping with the other \TEX|-|like programs in \TEXLIVE, the \LUA\ functions
+\type {os.execute}, \type{os.kpsepopen} and \type {io.popen}, as well as the two new functions \type
{os.exec} and \type {os.spawn} that are explained below, take the value of \type
{shell_escape} and|/|or \type {shell_escape_commands} in account. Whenever
\LUATEX\ is run with the assumed intention to typeset a document (and by that we
@@ -339,7 +355,7 @@ be done with \type {lfs.attributes}. The additional function \type
{lfs.shortname} takes a file name and returns its short name on \type {win32}
platforms. Finally, for non|-|\type {win32} platforms only, we provided \type
{lfs.readlink} that takes an existing symbolic link as argument and returns its
-name. However, the \type library evolved so we have dropped these in favour of
+name. However, the \type {lfs} library evolved so we have dropped these in favour of
pure \LUA\ variants. The \type {shortname} helper is obsolete and now just
returns the name.
@@ -372,7 +388,7 @@ piecemeal: \libidx {string} {utfvalues}, \libidx {string} {utfcharacters},
\type {string.utfcharacters(s)}: a string with a single \UTF-8 token in it
\stopitem
\startitem
- \type {string.cWharacters(s)}: a string containing one byte
+ \type {string.characters(s)}: a string containing one byte
\stopitem
\startitem
\type {string.characterpairs(s)}: two strings each containing one byte or an
@@ -421,7 +437,7 @@ and \libidx {string} {utflength}.
the given code points
\stopitem
\startitem
- \type {string.utflength(s)}: returns the length oif the given string
+ \type {string.utflength(s)}: returns the length of the given string
\stopitem
\stopitemize
@@ -432,10 +448,14 @@ used as building blocks for other helpers.
\startsubsection[title={Extra \type {os} library functions}]
-The \type {os} library has a few extra functions and variables: \libidx {os}
-{selfdir}, \libidx {os} {exec}, \libidx {os} {spawn}, \libidx {os} {setenv},
-\libidx {os} {env}, \libidx {os} {gettimeofday}, \libidx {os} {times}, \libidx
-{os} {tmpdir}, \libidx {os} {type}, \libidx {os} {name} and \libidx {os} {uname},
+The \type {os} library has a few extra functions and
+variables: \libidx {os} {selfdir}, \libidx {os} {exec},
+\libidx {os} {kpsepopen},
+\libidx {os} {socketgettime}, \libidx {os} {socketsleep},
+\libidx {os} {spawn}, \libidx {os} {setenv},
+\libidx {os} {env}, \libidx {os} {gettimeofday}, \libidx {os} {times},
+\libidx {os} {sleep}, \libidx {os} {tmpdir}, \libidx {os} {type},
+\libidx {os} {name} and \libidx {os} {uname},{os} {uname},
that we will discuss here.
\startitemize
@@ -496,6 +516,18 @@ that we will discuss here.
\stopitem
\startitem
+ \type {os.kpsepopen(commandline,[opt])} is similar to \type {io.popen}
+ but with a preliminary check of the commandline;
+ if the check is ok then the return value is the same as in \type{io.popen};
+ Otherwise it will return the two values \type {nil} and \type {error}.
+\stopitem
+
+\startitem
+ \type {os.socketgettime} and \type {os.socketsleep} are the same as for
+ \type{socket.gettime} and \type{socket.sleep} but they are always available.
+\stopitem
+
+\startitem
\type {os.spawn(commandline)} is a returning version of \type {os.exec},
with otherwise identical calling conventions.
@@ -522,19 +554,29 @@ that we will discuss here.
\stopitem
\startitem
- \type {os.times()}returns the current process times according to \ the
+ \type {os.times()}returns the current process times according to the
\UNIX\ C library function \quote {times}. This function is not available on
the \MSWINDOWS\ and \SUNOS\ platforms, so do not use this function for
portable documents.
\stopitem
\startitem
- \type {os.tmpdir()} creates a directory in the \quote {current directory}
+ \type {os.sleep(interval[, unit])} suspends the execution of the current run for
+ a given number of seconds. If the optional argument \type {unit} is present, the
+ function waits \type {interval / units} seconds. \type {os.sleep(1, 1000)}
+ for example pauses the program for one millisecond.
+\stopitem
+
+\startitem
+ \type {os.tmpdir([template])} creates a directory in the \quote {current directory}
with the name \type {luatex.XXXXXX} where the \type {X}-es are replaced by a
unique string. The function also returns this string, so you can \type
{lfs.chdir()} into it, or \type {nil} if it failed to create the directory.
The user is responsible for cleaning up at the end of the run, it does not
- happen automatically.
+ happen automatically. You can also use your own \type {template} for the name
+ of the temporary folder. However, the passed string must end with six capital
+ \type {X}-es. For example, the template \type {tmp.XXXXXX} could result in the
+ folder name \type {tmp.vX3gPo}.
\stopitem
\startitem
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-modifications.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
index 3bd23ff2724..d28bc4fdac3 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
@@ -1148,7 +1148,7 @@ so a separate grouping related stack is used. A side effect is that there can be
paragraphs with only a local par node followed by direction synchronization
nodes. Paragraphs like that are seen as empty paragraphs and therefore ignored.
Because \type {\noindent} doesn't inject anything but a \type {\indent} injects
-an box, paragraphs with only an indent and directions are handles ad paragraphs
+an box, paragraphs with only an indent and directions are handled as paragraphs
with content.
\stopsubsection
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-nodes.tex
index 1883a0c46cb..a57ed98b2d9 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-nodes.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex-nodes.tex
@@ -962,7 +962,7 @@ what you generate.
\NC \type{width} \NC number \NC the width (not used in calculations) \NC \NR
\NC \type{height} \NC number \NC the height (not used in calculations) \NC \NR
\NC \type{depth} \NC number \NC the depth (not used in calculations) \NC \NR
-\NC \type{objnum} \NC number \NC the referenced \PDF\ (structure) object number \NC \NR
+\NC \type{objnum} \NC number \NC the referenced \PDF\ object number \NC \NR
\NC \type{data} \NC string \NC the annotation data \NC \NR
\LL
\stoptabulate
@@ -1005,7 +1005,7 @@ what you generate.
\NC \NC string \NC the destination name \NC \NR
\NC \type{dest_type} \NC number \NC type of destination \NC \NR
\NC \type{xyz_zoom} \NC number \NC the zoom factor (times 1000) \NC \NR
-\NC \type{objnum} \NC number \NC the \PDF\ object number \NC \NR
+\NC \type{objnum} \NC number \NC the \PDF\ object number; for structure references the \PDF\ object number of the linked structure element \NC \NR
\LL
\stoptabulate
@@ -1250,9 +1250,9 @@ This converts a single type name to its internal numeric representation.
\libindex {type}
\libindex {subtype}
-If the argument is a number, then the next function converts an internal
-numeric representation to an external string representation. Otherwise, it will
-return the string \type {node} if the object represents a node, and \type {nil}
+If the argument is a number, then the next function converts an internal numeric
+representation to an external string representation. Otherwise, it will return
+the string \type {node} if the object represents a node, and \type {nil}
otherwise.
\startfunctioncall
@@ -1321,7 +1321,7 @@ creates a node at the \TEX\ level.
\libindex{flush_node}
\libindex{flush_list}
-The next one the node \type {n} from \TEX's memory. Be careful: no checks are
+The next one removes the node \type {n} from \TEX's memory. Be careful: no checks are
done on whether this node is still pointed to from a register or some \type
{next} field: it is up to you to make sure that the internal data structures
remain correct.
@@ -1722,7 +1722,7 @@ The \type{traverse_char} iterator loops over the \nod {glyph} nodes in a list.
Only nodes with a subtype less than 256 are seen.
\startfunctioncall
-<node> n, font, char =
+<node> n, char, font =
node.traverse_char(<node> n)
\stopfunctioncall
@@ -1730,7 +1730,7 @@ The \type{traverse_glyph} iterator loops over a list and returns the list and
filters all glyphs:
\startfunctioncall
-<node> n, font, char =
+<node> n, char, font =
node.traverse_glyph(<node> n)
\stopfunctioncall
@@ -1877,7 +1877,7 @@ word boundaries are possible).
\startfunctioncall
node.unprotect_glyph(<node> n)
-node.unprotect_glyphs(<node> n,[<node> n])
+node.unprotect_glyphs(<node> n,[<node> ,m])
\stopfunctioncall
Subtracts 256 from all glyph node subtypes. This and the next function are
@@ -1891,7 +1891,7 @@ processing. The second argument is optional and indicates the end of a range.
\startfunctioncall
node.protect_glyph(<node> n)
-node.protect_glyphs(<node> n,[<node> n])
+node.protect_glyphs(<node> n,[<node> m])
\stopfunctioncall
Adds 256 to all glyph node subtypes in the node list starting at \type {n},
@@ -2195,8 +2195,8 @@ number often is reported when you print node related information. You go from
userdata nodes and there numeric references and back with:
\startfunctioncall
-<integer> d = node.todirect(<node> n))
-<node> n = node.tonode(<integer> d))
+<integer> d = node.direct.todirect(<node> n))
+<node> n = node.direct.tonode(<integer> d))
\stopfunctioncall
The userdata model is rather robust as it is a virtual interface with some
@@ -2334,21 +2334,26 @@ consistency. You can of course always define additional accessors using \type
\supported {fields} \yes \nop
\supported {find_attribute} \yes \yes
\supported {first_glyph} \yes \yes
+\supported {fix_node_lists} \yes \nop
\supported {flatten_discretionaries} \yes \yes
\supported {flush_list} \yes \yes
\supported {flush_node} \yes \yes
+\supported {flush_properties_table} \yes \yes
\supported {free} \yes \yes
\supported {get_attribute} \yes \yes
+\supported {get_properties_table} \yes \yes
\supported {get_synctex_fields} \nop \yes
\supported {getattributelist} \nop \yes
\supported {getboth} \yes \yes
\supported {getbox} \nop \yes
\supported {getchar} \yes \yes
\supported {getcomponents} \nop \yes
+\supported {getdata} \nop \yes
\supported {getdepth} \nop \yes
\supported {getdirection} \nop \yes
\supported {getdir} \nop \yes
\supported {getdisc} \yes \yes
+\supported {getexpansion} \nop \yes
\supported {getfam} \nop \yes
\supported {getfield} \yes \yes
\supported {getfont} \yes \yes
@@ -2369,13 +2374,13 @@ consistency. You can of course always define additional accessors using \type
\supported {getsubtype} \yes \yes
\supported {getsub} \nop \yes
\supported {getsup} \nop \yes
-\supported {getdata} \nop \yes
\supported {getwhd} \yes \yes
\supported {getwidth} \nop \yes
\supported {has_attribute} \yes \yes
\supported {has_field} \yes \yes
\supported {has_glyph} \yes \yes
\supported {hpack} \yes \yes
+\supported {hyphenating} \nop \yes
\supported {id} \yes \nop
\supported {insert_after} \yes \yes
\supported {insert_before} \yes \yes
@@ -2388,10 +2393,11 @@ consistency. You can of course always define additional accessors using \type
\supported {last_node} \yes \yes
\supported {length} \yes \yes
\supported {ligaturing} \yes \yes
+\supported {make_extensible} \yes \nop
\supported {mlist_to_hlist} \yes \nop
\supported {new} \yes \yes
\supported {next} \yes \nop
-\supported {prepend_prevdepth} \nop \yes
+\supported {prepend_prevdepth} \yes \yes
\supported {prev} \yes \nop
\supported {protect_glyphs} \yes \yes
\supported {protect_glyph} \yes \yes
@@ -2399,20 +2405,22 @@ consistency. You can of course always define additional accessors using \type
\supported {rangedimensions} \yes \yes
\supported {remove} \yes \yes
\supported {set_attribute} \yes \yes
+\supported {set_properties_mode} \yes \yes
\supported {set_synctex_fields} \nop \yes
\supported {setattributelist} \nop \yes
\supported {setboth} \nop \yes
\supported {setbox} \nop \yes
\supported {setchar} \nop \yes
\supported {setcomponents} \nop \yes
+\supported {setdata} \nop \yes
\supported {setdepth} \nop \yes
\supported {setdirection} \nop \yes
\supported {setdir} \nop \yes
\supported {setdisc} \nop \yes
+\supported {setexpansion} \nop \yes
\supported {setfam} \nop \yes
\supported {setfield} \yes \yes
\supported {setfont} \nop \yes
-\supported {setexpansion} \nop \yes
\supported {setglue} \yes \yes
\supported {setheight} \nop \yes
\supported {setkern} \nop \yes
@@ -2437,12 +2445,13 @@ consistency. You can of course always define additional accessors using \type
\supported {subtypes} \yes \nop
\supported {subtype} \yes \nop
\supported {tail} \yes \yes
-\supported {todirect} \yes \yes
-\supported {tonode} \yes \yes
+\supported {todirect} \nop \yes
+\supported {tonode} \nop \yes
\supported {tostring} \yes \yes
\supported {traverse_char} \yes \yes
\supported {traverse_glyph} \yes \yes
\supported {traverse_id} \yes \yes
+\supported {traverse_list} \nop \yes
\supported {traverse} \yes \yes
\supported {types} \yes \nop
\supported {type} \yes \nop
@@ -2451,6 +2460,7 @@ consistency. You can of course always define additional accessors using \type
\supported {unset_attribute} \yes \yes
\supported {usedlist} \yes \yes
\supported {uses_font} \yes \yes
+\supported {values} \yes \nop
\supported {vpack} \yes \yes
\supported {whatsits} \yes \nop
\supported {write} \yes \yes
@@ -2490,9 +2500,9 @@ number, for a glue, kern, hlist, vlist, rule and math nodes as well as glyph
nodes (although this last one is not used in native \SYNCTEX).
\startfunctioncall
-node.set_synctex_fields(<integer> f, <integer> l)
+node.direct.set_synctex_fields(<integer> n, <integer> f, <integer> l)
<integer> f, <integer> l =
- node.get_synctex_fields(<node> n)
+ node.direct.get_synctex_fields(<integer> n)
\stopfunctioncall
Of course you need to know what you're doing as no checking on sane values takes
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex.tex
index 6031b7c5fc9..2dd4a8bf1d1 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luatex/luatex.tex
@@ -73,7 +73,7 @@
\startdocument
[manual=Lua\TeX,
status=stable,
- version=1.10]
+ version=1.16]
\startnotmode[*export]
\component luatex-titlepage
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp
index 5076c729ae1..8f6ea4b4b1e 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp
@@ -1,6 +1,4 @@
% Converted from PostScript(TM) to MetaPost by pstoedit
-%
-% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
% MetaPost backend contributed by Scott Pakin <pakin@uiuc.edu>
% pstoedit is Copyright (C) 1993 - 1999 Wolfgang Glunz <wglunz@geocities.com>
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/mycow.mp b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/mycow.mp
index 24c3e0f7d94..c0d7b3d0ad5 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/mycow.mp
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/mycow.mp
@@ -1,6 +1,4 @@
% Converted from PostScript(TM) to MetaPost by pstoedit
-%
-% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
% MetaPost backend contributed by Scott Pakin <pakin@uiuc.edu>
% pstoedit is Copyright (C) 1993 - 1999 Wolfgang Glunz <wglunz@geocities.com>
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-hownotto.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-hownotto.tex
new file mode 100644
index 00000000000..48e9adcf3ce
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-hownotto.tex
@@ -0,0 +1,76 @@
+% language=us runpath=texruns:manuals/musings
+
+\startcomponent musings-hownotto
+
+\environment musings-style
+
+\startchapter[title={How not to install \CONTEXT}]
+
+\startalign[flushleft]
+
+Installing LuaMetaTeX can be a complex process that requires some technical
+expertise, but the following steps should give you a general idea of what is
+involved:
+
+\startitemize[n]
+
+\startitem
+ First, you need to ensure that you have a recent version of the Lua
+ programming language installed on your system. You can download the latest
+ version of Lua from the official website at http://www.lua.org/download.html.
+ \footnote {The \LUA\ code needed is part of the source tree that can be
+ downloaded from GitHub or websites.}
+\stopitem
+
+\startitem
+ Next, you need to download the latest version of the MetaTeX distribution,
+ which includes the LuaMetaTeX engine, from the official ConTeXt Garden
+ website at https://wiki.contextgarden.net/ConTeXt_Standalone. \footnote
+ {There is no \METATEX, although we sometimes joke about it.}
+\stopitem
+
+\startitem
+ Once you have downloaded the MetaTeX distribution, extract the files to a
+ directory on your system. \footnote {So here one is stuck.}
+\stopitem
+
+\startitem
+ You can then run the LuaMetaTeX engine by opening a command prompt or
+ terminal window and navigating to the directory where you extracted the
+ MetaTeX files. From there, you can run the command "luametatex" followed by
+ the name of the TeX file you want to process. \footnote {Shouldn't it be
+ compiled first? And even then it needs some format, so one needs \type
+ {context} and \type {mtxrun}.}
+\stopitem
+
+\startitem
+ To make it easier to use LuaMetaTeX with your favorite text editor, you may
+ also want to install a TeX distribution such as TeX Live or MiKTeX, which
+ includes support for LuaMetaTeX. These distributions typically include a
+ graphical user interface that makes it easier to manage your TeX installation
+ and configure your system for use with LuaMetaTeX. \footnote {Indeed
+ installing \TEXLIVE\ is easier, as is installing the smaller reference
+ installation which uses \LUAMETATEX\ as its own installer. As far as we know,
+ \MIKTEX\ doesn't include \LMTX. And yes, consulting the documentation might
+ be best.}
+\stopitem
+
+\stopitemize
+
+It's worth noting that the exact steps for installing LuaMetaTeX may vary
+depending on your operating system and the specific TeX distribution you are
+using. For more detailed instructions, you may want to consult the official
+documentation for LuaMetaTeX and the TeX distribution you are using. \footnote
+{So here is the way out of the proposed mess.}
+
+\start \blank
+\bf by ChatGPT
+\footnote {Queried by Mikael Sundqvist.}
+\footnote {Which (at least here) is more about well formed sentences than about
+verified content. We can only hope that new \TEX\ users are able to recognize
+a fake.}
+\stop
+
+\stopalign
+
+\stoptext
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-texlive.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-texlive.tex
new file mode 100644
index 00000000000..906b7e88d29
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-texlive.tex
@@ -0,0 +1,319 @@
+% language=us runpath=texruns:manuals/musings
+
+\startcomponent musings-assumptions
+
+\environment musings-style
+
+\setuptolerance[tolerant,stretch]
+
+\startchapter[title={\CONTEXT\ in \TEXLIVE\ 2023}]
+
+Starting with \TEXLIVE\ 2023 the default \CONTEXT\ distribution is \LMTX, a
+follow up on \MKIV, running on top of the \LUAMETATEX\ engine instead of \LUATEX.
+Already for a long time the \MKII\ version used with \PDFTEX, \XETEX\ and \ALEPH\
+has been frozen and most users moved on from \MKIV\ to \LMTX\ (a more distinctive
+tag for what internally is version \MKXL).
+
+In principle one can argue that we now have three versions of \CONTEXT\ and there
+can be the impression that they are very different. However, although \MKXL\ can
+do more than \MKIV\ which can do more than \MKII, the user interface hasn't
+changed that much and old functionality is available in newer versions. Of course
+some old features make no sense in newer variants, like eight|-|bit font
+encodings in an \OPENTYPE\ font realm and input encodings when one uses \UTF,
+although we still support input encodings a.k.a.\ regimes. When we started using
+the \type {Mk*} suffixes the main reason was that we had to distinguish files and
+the official \TEX\ distribution doesn't permit duplicate file names. Using a
+distinctive suffix also makes it possible to treat files differently.
+
+\starttabulate[|T|c|c|c|Tl|]
+\BC suffix \BC engine \BC template \BC arguments \BC main file \NC \NR
+\HL
+\NC MkII \NC \PDFTEX, \XETEX, \ALEPH \NC \NC \NC context.mkii \NC \NR
+\HL
+\NC MkIV \NC \LUATEX, \LUAJITTEX, \LUAMETATEX \NC \NC \NC context.mkiv \NC \NR
+\NC MkVI \NC idem \NC \NC yes \NC \NC \NR
+\NC MkIX \NC idem \NC yes \NC \NC \NC \NR
+\NC MkXI \NC idem \NC yes \NC yes \NC \NC \NR
+\HL
+\NC MkXL \NC \LUAMETATEX \NC \NC \NC context.mkxl \NC \NR
+\NC MkLX \NC idem \NC \NC yes \NC \NC \NR
+\stoptabulate
+
+In this table \quote {template} files are a mix of \TEX\ and \LUA\ and originate
+in the early days of \MKIV; basically, they are a wink to active server pages.
+With \quote {arguments} we refer to files that accept named macro arguments which
+means that they need to be preprocessed. That started as a proof of concept but
+some core files are defined that way. Users will normally just use a \type {.tex}
+file.
+
+The \LUA\ files in the code base have the suffix \type {lua}, or when meant for
+\LUAMETATEX\ that uses a newer \LUA\ engine they can have the suffix \type {lmt}.
+There can also be \type {lfg} (font goodies) and \type {llg} (language goodies)
+plus byte|-|compiled files with various suffixes but these are normally not seen
+by users. We leave it at that.
+
+So, while \TEXLIVE\ 2022 installed \MKII\ and \MKIV, \TEXLIVE\ 2023 installs
+\MKIV\ and \LMTX. Therefore the most significant upgrade is in the engine that is
+used by default: \LUAMETATEX\ instead of \LUATEX. The \MKII\ files are no longer
+installed so we don't need \PDFTEX.
+
+So how did we end up here? Initially the idea was that, because \LUATEX\ is
+basically frozen, \LUAMETATEX\ would be the engine that we conduct experiments
+with and from which occasionally we could backport code to \LUATEX. However it
+soon became clear that this would not work out well so backporting is off the
+table now. Just for the record: the project started years ago so we're not
+talking about something experimental here. There have been articles in \TUGBOAT\
+about what we've been doing over the years.
+
+One of the first decisions I made when starting with \LUAMETATEX\ was to remove
+the built|-|in backend, which then meant also removing the bitmap image inclusion
+code. That made us get rid of dependencies on external libraries. In fact, a
+proof|-|of|-|concept experimental variant didn't use the built|-|in backend at
+all. The font loading code could be removed as well because that was not used in
+\MKIV\ either. In \MKIV\ we also don't use the \KPSE\ library for managing files
+so that code could be dropped from the engine tool; it can be loaded as
+so|-|called optional library if needed but I'll not discuss that here. If you
+look at what happens with the \LUATEX\ code base, you'll notice that updating
+libraries happens frequently and that is not a burden that we want to impose on
+users, especially because it also can involve updating build|-|related files.
+Another advantage of not using them is that the code base remains small.
+
+A direct consequence of all this was that the build process became much more
+efficient and less complex. A fast compilation (seconds instead of minutes) meant
+that more drastic experiments became possible, like most recently an upgrade of
+the math subsystem. All this, combined with an overhaul of the code base, both
+the \TEX\ and \METAPOST\ part, meant that backporting was no longer reasonable.
+Being freed from the constraint that other macro packages might use \LUAMETATEX\
+in turn resulted in more drastic experiments and adding features that had been on
+our wish list for decades. Another side effect was that we could easily compile
+native \MSWINDOWS\ binaries and immediately support transitions to \ARM|-|based
+hardware.
+
+Instead of \quotation {backporting after experimenting}, a leading motive became
+\quotation {fundamentally move forward} while at the same time tightening the
+relation between \CONTEXT\ and the engine: the engine code became part of the
+distribution so that users can compile themselves, which fits perfectly in the
+paradigm (and demands) of distributing all the source code, even that of the
+engine. There is also less danger that patches on behalf of other usage
+interferes with stable support for \CONTEXT. A specific installation is now more
+or less long|-|term stable by design because it no longer depends on binaries
+and|/|or libraries being provided for a specific platform and operating system
+version. Of course installers and \TEXLIVE\ do provide the binaries, so users
+aren't forced to worry about it, but they can move along with a system update by
+recompiling an old, and for their purpose, frozen \CONTEXT\ code base.
+
+An unofficial objective (or challenge) became that the accumulated source stays
+around 12~\MB\ uncompressed, (compressed a bit over 2~\MB) and the binary around
+3~\MB\ so that we could use the engine as an efficient \LUA\ runner as well as a
+launcher stub, thereby removing yet another dependency. That way the official
+\CONTEXT\ distribution didn't grow much in size. A bonus is that we now use the
+same setup for all operating systems. It also opened up the possibility of a
+exceptionally small installation with all bells and whistles included. Another
+nice side effect, combined with automatic compilation on the compile farm, makes
+that we can provide installations that reflect the latest state of affairs: a
+recent binary combined with the latest \CONTEXT. As a result, most users quickly
+went for \LMTX\ instead of \MKIV.
+
+In the code base we avoid dependencies on specific platforms but there are a few
+cases where the code for \MSWINDOWS\ and \UNIX\ differs. However, the
+functionality should be the same. A good test is that for \MSWINDOWS\ we can
+compile with mingw (cross|-|compilation), \MSVC\ (native) and clang (native);
+that order is also the order of runtime performance. The native \MSVC\ binary is
+the smallest but users probably don't care. In any case, it is nice to have a
+fallback plan in place. The code is all in \CCODE; the \METAPOST\ code is
+converted from \CWEB\ into \CCODE\ using a \LUA\ script but we also ship the
+resulting \CCODE\ code. The code base provides a couple of \CMAKE\ files and
+comes with a trivial build script.
+
+When I say that there are no libraries used, I mean external libraries. We do use
+code from elsewhere: adapted \type {avl} as well as \type {decnumber} (for the
+\METAPOST\ library), adapted \type {hjn} (hyphenation), \type {miniz} (zip
+compression), \type {pplib} (for loading \PDF\ files), \type {libcerf} (to
+complement other math library support, but it might be dropped), and \type
+{mimalloc} for memory management. However all the code is in the \LUAMETATEX\
+code base and only updated after checking what changed. The most important
+library originating elsewhere is of course \LUA: we use the latest and greatest
+(currently) 5.4 release. We kept the \type {socket} library but it might be
+dropped or replaced at some point. In addition there is a subsystem for
+dynamically loading libraries; the main reason for that being that I needed \type
+{zint} for barcodes, interfaces to sql databases, a bunch of compression
+libraries, etc. But all that is tagged {\em optional} and \CONTEXT\ will never
+depend on it. There are no consequences for compilation either because we don't
+need the header files. The glue code is very minimalistic and most work gets
+delegated to \LUA.
+
+Initially, because the backend is written in \LUA, there was a drop in
+performance of some 15\percent\ but that was stepwise compensated by gains in
+performance in the engine and additional or improved functionality. The \CONTEXT\
+code base is rather optimized so there was little to gain there, apart from using
+new features. Existing primitive support could also be done a bit more
+efficiently; it helps if one knows where potential bottlenecks are. Therefore, in
+the meantime an \LMTX\ run can be quite a bit faster than a \MKIV\ run and it can
+even outperform a \LUAJITTEX\ run. In practice, the difference between an
+eight|-|bit \MKII\ run using the eight|-|bit \PDFTEX\ engine and a 32|-|bit
+\LUAMETATEX\ run with \LMTX\ can be neglected, definitely on more complex
+documents. I never get complaints about performance from \CONTEXT\ users, so it
+might be a minor concern.
+
+So what are the main differences in the installation? If you really want to
+experience it you should use the standard installation. Currently the small
+installer is the engine that synchronizes the installation over the net and,
+assuming a reasonable internet connection, that takes little time. The
+installation is relatively small, and many of the bytes used are for the
+documentation. Updates are done by transferring only the changed files. The
+\TEXLIVE\ installation is a bit larger because it shares for instance fonts with
+the main installation and these come with resources used by other macro packages.
+Both installations bring \MKIV\ as well as \LMTX\ and therefore provide \LUATEX\
+as well as \LUAMETATEX. However, a \MKIV\ run is now managed by \LUAMETATEX\
+because we use that engine for the runner. The \MKII\ code is no longer in
+\TEXLIVE\ but is in the repositories and used to test and compare with \PDFTEX.
+It just works.
+
+The number of binaries and stubs is reduced to a minimum:
+
+\starttabulate[|T|T||]
+\BC file \BC symlink \BC \NC \NR
+\NC tex/texmf-platform/luametatex \NC \NC combined \TEX, \METAPOST\ and \LUA\ engine \NC \NR
+\NC tex/texmf-platform/mtxrun \NC luametatex \NC script runner, binary \NC \NR
+\NC tex/texmf-platform/context \NC luametatex \NC CONTEXT\ runner, binary \NC \NR
+\NC tex/texmf-platform/mtxrun.lua \NC \NC script runner, lua code \NC \NR
+\NC tex/texmf-platform/context.lua \NC \NC loader for \CONTEXT\ runner \NC \NR
+\NC tex/texmf-platform/luatex \NC \NC the good old ancestor \NC \NR
+\stoptabulate
+
+All of these programs are in the \CONTEXT\ distribution directory \typ
+{tex/texmf-<platform>/}. In addition, \type {context} and \type {mtxrun} are
+symlinks to the \type {luametatex} binary, where possible.
+
+So, the \type {context} command runs \type {luametatex}, but loads the \LUA\ file
+with the same name which in turn will locate the \CONTEXT\ management script
+(\type {mtx-context}) in the \TEX\ tree and run it. The same is true for \type
+{mtxrun}: it is a binary (link) that loads the script in (this time) the same
+path and then can perform numerous tasks. For instance, identifying the installed
+fonts so that they can be accessed by name is done with:
+
+\starttyping
+mtxrun --script font --reload
+\stoptyping
+
+Where in \MKII\ we had stubs for various utility scripts, already in \MKIV\ we
+went for a generic runner and a bit more keying. It's not like these scripts are
+used a lot and by avoiding shortcuts there is also little danger for a mixup with
+the ever|-|growing list of other scripts in \TEXLIVE\ or commands that the
+operating system provides.
+
+The \LUATEX\ binary is optional and only needed if a user also wants to process
+\MKIV\ files. There are no shell scripts used for launching. The two main calls
+used by users are:
+
+\starttyping
+context foo.tex
+context --luatex foo.tex
+\stoptyping
+
+A user has only to make sure that the binaries are in the path specification.
+When you run from an editor, the next command does the work:
+
+\starttyping
+mtxrun --autogenerate --script context <filename>
+\stoptyping
+
+with \type {<filename>} being an editor|-|specific placeholder. Like other
+engines, \LUAMETATEX\ (and \CONTEXT) needs a file database and format file, and
+although it should generate these automatically you can make them with:
+
+\starttyping
+mtxrun --generate
+context --make
+\stoptyping
+
+The rest of the installation is similar to what we always had and is \TDS\
+compliant. The source code of \LUAMETATEX\ is included in the distribution itself
+(which nicely fulfills the requirements) but can also be found at:
+
+\starttyping
+https://github.com/contextgarden/luametatex
+\stoptyping
+
+There are also some optional libraries there but \CONTEXT\ works fine without
+them. The official latest distribution of \CONTEXT\ itself is:
+
+\starttyping
+https://github.com/contextgarden/context
+https://github.com/contextgarden/context-distribution-fonts
+\stoptyping
+
+We see users grab fonts from the Internet and play with them. They can install
+additional fonts in \typ {tex/texmf-fonts/data/<vendor>}. Project|-|specific
+files can be collected in \typ {tex/texmf-project/tex/context/user/<project>}.
+These directories are not touched by installations and can easily be copied or
+shared between different installations. After adding files to the tree \typ
+{mtxrun --generate} will update the file database.
+
+In the distribution there are plenty of documents that describe how \LUAMETATEX\
+with \LMTX\ differs from \MKIV\ with \LUATEX: new primitives, macro extensions,
+more granular math rendering, improved memory management, new (or extended)
+(rendering) concepts, more \METAPOST\ features; most is covered in one way or
+another, and much is already applied in the \CONTEXT\ source code. After all, it
+took a few years before we arrived here so you can expect substantial refactoring
+of the engine as well as the code base, and therefore eventually there is (and
+will be) more than in \MKIV.
+
+When you compare a \CONTEXT\ installation with what is needed for other macro
+packages you will notice a few differences. One concerns the way \TEX\ is
+launched. An engine starts with a blank slate but can be populated with a
+so|-|called format file that is basically a memory dump of a preloaded macro
+package. So, the original way to process a file is to pass a format filename to
+the engine. In order to avoid that a trick is used: when an engine (or
+symlink|/|stub to it) is launched by its format name, the loading happens
+automatically. So, for instance \type {pdflatex} is actually an equivalent for
+starting \PDFTEX\ with the format file \typ {pdflatex.fmt} while \type {latex} is
+\PDFTEX\ with another format file (\typ {latex.fmt}) starting up in \DVI\ mode.
+And, as there are many engines, a specific macro package can have many such
+combinations of its name and engine.
+
+In \CONTEXT\ we don't do it that way. One reason is that we never distinguished
+between backends: \MKII\ uses an abstract backend layer and load driver files at
+runtime (it was one of the reasons why we could support \ACROBAT\ as soon as it
+showed up, because we already supported the now obsolete but quite nice
+\DVIWINDO\ viewer). And that model hasn't changed much as we moved on. Because we
+use a runner, we also don't need to distinguish between engines: all formats have
+the same name but sit on an engine subpath in the \TEX\ tree. Anyway, this
+already removes quite some formats. On the other hand, \CONTEXT\ can be run with
+different language specific user interfaces which means that instead of just
+\type {context.fmt} we have \type {cont-en.fmt} and possibly more, like \type
+{cont-nl.fmt}. So that can increase the number again but by default only the
+English interface is installed. As a side note: where with \MKII\ we needed to
+generate \METAPOST\ mem files, with its descendants having \MPLIB\ we load the
+(actually quite a bit of) \METAPOST\ code at runtime. \footnote {Occasionally I
+do experiments with loading the \TEX\ format code at runtime, but at this moment
+the difference in startup time of about one second (assuming files are cached) is
+too large and running over networks will be less fun, so the format file will
+stay. The time involved in loading \METAPOST\ can be brought down but for now I
+leave it as it is.}
+
+In addition to a format file, for the \LUATEX\ and \LUAMETATEX\ engine we also
+have a (small) \LUA\ loader alongside the format file. All this is handled by the
+runner, also because we provide extensive command line features, and therefore of
+no concern to users and package maintainers. However, it does make integrating
+\CONTEXT\ in for instance \TEXLIVE\ different from other macro packages and
+thereby puts an extra burden on the \TEXLIVE\ team. Here I want to thank the team
+for making it possible to move forward this way, in spite of this rather
+different approach. Hopefully a \LUAMETATEX\ integration is a bit easier in the
+long run because we no longer have different stubs per platform and at least the
+binary part now has no dependencies and only has a handful of files.
+
+For those new to \CONTEXT\ or those who want to try it in \TEXLIVE\ 2023 there is
+not much difference between the versions. However, \MKIV\ is now frozen and new
+functionality only gets added to \LMTX. Of course we could backport some but with
+most users already having moved on, it makes no sense. Just as we keep \MKII\
+around for testing with \PDFTEX, we also keep \MKIV\ alive for testing with
+\LUATEX. Maybe in a couple of years \MKIV\ will go the same route as \MKII:
+ending up in the archives as an optional installation. \footnote {This text
+appeared in \TUGBOAT\ around the 2023 \TEXLIVE\ release. Thanks to Karl Berry for
+his careful reading and fixing of the text and of course for keeping \TEXLIVE\
+alive.}
+
+\stopchapter
+
+\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-unicode.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-unicode.tex
new file mode 100644
index 00000000000..06ec019854b
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-unicode.tex
@@ -0,0 +1,1584 @@
+% language=us runpath=texruns:manuals/math
+
+\def\unichar#1#2{#1 (U+#2: \char"#2)}
+
+\def\APL{\ss apl}
+
+% \useMPlibrary[dum]
+
+\startcomponent musings-unicode
+
+\environment musings-style
+
+% \usemodule[mathfun]
+
+\startchapter[title=Unicode]
+
+\startsection[title=Introduction]
+
+When working on a \TEX\ macro package for decades one can hardly avoid dealing
+with math; after all \TEX\ is pretty much about math. When this wonderful
+typesetting infrastructure was written it was all about quality and how to make
+your documents look nice. And for sure, Don Knuths documents looks nice, also
+because he pays a lot of attention to the \quotation {fine points of math
+typesetting}.
+
+The constraints of those time (like hardware, compilers, fonts, and for sure also
+time) made \TEX\ into what it is: eight bit character sets, eight bit fonts,
+eight bit hyphenation patterns, efficient memory usage and therefore carrying
+around as little as possible. It all makes sense. But one needs to pay attention.
+\footnote {And that is what Mikael Sundqvist and I have been doing a lot since we
+started upgrading math in \CONTEXT\ in combination with enhancing the math engine
+in \LUAMETATEX. The story here is a byproduct of our explorations and very much a
+combined effort.}
+
+Math typesetting is actually a sort of separated process in the engine:
+unprocessed lists go in and after some juggling a list of assembled boxes,
+glyphs, glues and penalties come out. I will not go into detail about that and
+only mention that in \LUAMETATEX\ we extended all this to be a bit more flexible
+and controllable, something that has been driven by the fact that we need to
+support \UNICODE\ fonts. This is all part of a related effort to move from eight
+bit \quote {everything} to \UNICODE\ \quote {everywhere}.
+
+Now, one can say a lot about \UNICODE\ but the main advantage is that it tries to
+cover \quote {all} characters ever encountered, including scripts (used in
+languages) that are long gone, as well as these little pictures that people like
+to see on the web: emojis. One can safely say that \UNICODE\ simplifies mixing
+languages and scripts, and thereby makes \TEX\ macro packages less complex. On
+the other hand, \UNICODE\ (or more precisely, related wide) fonts makes all kind
+of features possible and thereby add a complication.
+
+So, how about math? When Don Knuth gave us \TEX\ he also gave us fonts and there
+are plenty symbols in these fonts. But, as mathematicians seem to love variations
+on symbols soon more fonts arrived, most noticeably those from the \AMS\ that
+also added some more alphabets: mathematicians also love to render the shapes of
+letters differently. In order to access these glyphs names were invented that
+also sometimes suggested that there was some order in the matter. And, for some
+reason these names got aliases and soon we had a huge list of often obscure and
+inconsistent macro names. It didn't take long for a little mess and confusion to
+creep in.
+
+It has been said that the verbose \TEX\ math \ASCII\ input format is also a way
+for mathematicians to communicate, just because many use the same tool to render
+the formulas. Of course that gets obscured when one starts to add additional
+macros. It gets even more tricky once we start talking \quote {standard} as in
+\quotation {\LATEX\ is the standard}. That has for instance resulted in browsers
+interpreting \TEX\ like input without using \TEX\ (so how about expansion?). It
+has also sort of put \TEX\ into the range of possible word processing systems,
+which in turn leads to these \MSWORD\ versus Google docs versus \LATEX\ debates
+that can get rather nasty and unrealistic when it comes to discussing usage and
+quality. Interestingly, \MSWORD\ now has reasonable math, to some extent
+modelled after \TEX. It has some verbose \TEX\ like (but constrained) input and
+would do well for probably mostly people who occasionally have to inject some
+math. There were also attempts by the people at \MICROSOFT\ to normalize the
+input but we leave that aside now.
+
+However, because we now do have all these symbols and because source code editors
+make them accessible and show them there is a good chance that users will inject
+them, if only by cut and paste, so we do have to deal with that. This
+automatically puts us in the position that we need to deal with different
+meanings for the same symbol, which in turn might demand different spacing,
+penalties and such. In the end it is users that drive all this, not publishers;
+they don't really care and out|-|source typesetting anyway. We're not aware of
+any research and development being done and I suppose we would have noticed
+because after all we're involved in developing \LUATEX. It is one of the engines
+that does \OPENTYPE\ and \UNICODE\ math and no publisher or supplier ever took
+serious interest in it. From our perspective what users do is visible, everything
+else is hidden behind corporate curtains. And this is why nowadays we only need
+to care about users (mainly authors).
+
+Back to typesetting. For a long time all went well: one could typeset documents
+that looked good. Okay, not all looked good because not everyone paid attention to
+details, and the more the web evolved the more patching cut'n'paste of bad
+examples made its way into documents, but let's not start talking quality here.
+But then came \UNICODE\ and a while later people started talking about
+accessibility, cutting and pasting and more. In the meantime there had been
+developments like \MATHML\ and \OPENMATH\ that tried to structure and organize
+formulas in a more symbolic way. \footnote {It probably went unnoticed that
+\CONTEXT\ always supported rendering \MATHML, and as such had to deal with all
+the weird aspects (read: way it was used). Although one is not supposed to
+directly edit \MATHML\ we work with authors who are quite happy to do that simply
+because they code the documents in \XML\ because there is a need for high quality
+\PDF\ as well as \HTML\ output and a \CONTEXT\ based workflow can handle the
+\XML\ well. We're talking of large volumes here (mostly for basically free
+school math).}
+
+In the meantime the \TEX\ community had lost the edge on fonts, and \OPENTYPE\
+math was invented by \MICROSOFT\ and implemented in \MSWORD\ before a substantial
+number of \TEX\ users understood what was happening. They had it coming. To a
+large extend one can say the same about math in \UNICODE. Where a Greek capital
+\quote {A} is seen as different from a Latin capital \quote {A}, even when they
+often have the same shape, a math italic variable \quote {h} was made synonym to
+\quote {Planck constant}, as if the letters used in math had no meaning at all.
+We'll see that a wide hat is an extensible character of zero width combining hat
+accent, which makes for curious handling of the initial character. There is more
+granularity in some symbols, especially popular symbols like slashes and bars,
+than in letters. It is as if the math community didn't care much about how the
+letters (variables) were communicated and perceived but were picky about the
+slope of slashes. It seems more of a visual world, which might actually be the
+reason structured input never really took of. Maybe \TEX ies just love the mix of
+characters, commands, spacing directives. Maybe they just love to reposition and
+space these glyphs to suit all kind of curious non|-|standard math rendering.
+
+All this makes it pretty hard to communicate meaning, and it is just one of the
+examples where the \TEX\ community, for as far involved, failed to make a strong
+case. Our personal opinion is that no one really cared because in the \TEX\
+community it is all about rendering. The fact that we use math to communicate
+only gained attention when accessibility became hot and by then it was too late.
+Efforts like \OPENMATH\ started ambitious and in the end basically failed. Coding
+in \XML\ using \MATHML\ isn't much better and one always had to adapt to the
+latest fashion. Also, once plenty code shows up bugs become features. Browser
+support came and went and came back. Simplified input using for instance
+\ASCIIMATH\ started indeed simple but quickly became a (somewhat inconsistent)
+mess. What we see here is the same as everything web (and computer languages): we
+can do better, we start some project, then move on, and we end up with half|-|way
+abandoned results. The development cycles are short, results have to be achieved
+fast, there is no time (or interest) for iterating and refactoring. The word
+\quote {standard} and mantra \quote {everyone should use this} are quite popular.
+
+So where does that leave us with \TEX ? Well, with a mess. Decades of various
+efforts have not brought us a coherent system of organizing symbols and
+properties, made us end up with inconsistencies, made users revert to hacks,
+didn't make math easily transferable and complicates rendering. Personally we
+find it sort of strange that we spend time on for instance tagging and
+accessibility before we get these math alphabets and shared math specific symbols
+sorted out. If we cannot make good arguments for that (math being a script on its
+own with semantics and such) we waste energy and are pulling a dead horse. What
+puzzles us most is that one would expect mathematicians to be able to come up
+with strong arguments for a structured approach. But maybe it was simply the fact
+that \TEX\ math typesetting was pretty much driven by large commercial publishers
+and those providing services for them: the first category doesn't invest in these
+matters and even less today, and the second category makes money from sorting out
+the mess, so why get rid of it. Who knows. For us, it means that any complain
+about these matters deserves the same answer: the \TEX\ community created this
+mess, so it has to live with it. And the bad thing is: bugs and work|-|arounds
+eventually become features and then one is supposed to conform, even if deep down
+one knows better. It doesn't help that the community is proud of what it can
+render and has built itself a reputation that all is good.
+
+So why this criticism? Why not just abandon \TEX ? The answer is simple: \TEX\ is
+quite okay and cannot be blamed for where we are now. We need to think of
+solutions and in that respect the \CONTEXT\ users are lucky! They have always
+been told not to use this macro package for math because there are other
+standards and because publishers want \LATEX\ (even if they just let the
+manuscripts be recoded). That means that we don't really need to care much about
+the past. Those who use \CONTEXT\ can benefit from the compatibility we have
+anyway but also move forward to more structured and consistent math. It is in
+this perspective that we will discuss some more details next so that eventually
+we can draw some conclusions. The end goal is to have an additional layer of
+grouping math symbols that permits consistent high quality rendering in a mixed
+input environment.
+
+\stopsection
+
+\startsection[title=Molecules]
+
+Before we go into details about some characters, we spend some word on the
+rendering. The building blocks of a formula are atoms and internally the term
+nucleus is used for what we have without scripts. The simple sequence \type {1 +
+x} will result in a linked list of three atoms with three nuclei. In \type {x^2}
+the \type {x} is the nucleus. Atoms can have scripts: prescripts, postscripts and
+a prime. The majority of \UNICODE\ math characters become such atoms (nuclei and
+scripts) and they get a class property that determines their spacing, but that is
+not part of the \UNICODE\ specification. From the upcoming sections it will be
+clear that when we classify we don't get that much help from \MATHML\ or even the
+\TEX\ community either.
+
+In addition to these atoms the \LUAMETATEX\ engine (which builds upon \TEX) has
+what we can call molecules. There are several types: fractions, accents, fences,
+radicals. This distinction is to some extent present in \UNICODE: plenty of
+fraction related slashes, all kind of accents, vertical delimiters that can be
+made from snippets and act as fences, and a radical symbol. In \MATHML\ we see
+similar constructs but there in practice quite often operators need to be
+interpreted in a way that can distinguish between atoms and molecules. That is
+partly a side effect of applications that generate \MATHML. And as usual with
+standards pushed upon the world without years of exploration the confusion became
+part of the norm and will stay.
+
+In the \TEX\ engine over and under delimiters are implemented on top of radicals
+(using the same noad, the wrapper node for yet unprocessed math) but they have
+different code paths. Basically we have vertically fenced material and just like
+fractions have left and right fences as part of the concept (for binominals) the
+radical has a sort of left fence too. You can also wonder why we need accent
+noads while we support other delimiters with radicals. This organization mostly
+relates to subtypes and classes (and likely some limitations of the past) that
+have related spacing properties, but we can think if a generic structure noad and
+meaningful subtypes. However, that is not what we get so let's be more precise:
+
+{\bf Fractions:} these stack two atoms (or molecules) and separate them by a
+visible or phantom rule, or in \LUAMETATEX\ by a delimiter. They can have a left
+and right fence which originates in them also suitable for binominals. You may
+wonder why we don't use regular fences here. One reason we can think of is that
+when you fence something, you have an open and close class at the edges while
+with a fenced fraction the whole still is fraction. In \LUAMETATEX\ we can tweak
+classes at the edges but in regular \TEX\ there are fewer classes, so there
+constructs become ordinary or inner.
+
+{\bf Accents:} these put something on top of or below an atom (or molecule) and
+are driven by characters. The accent related commands take an integer
+(traditional) or three integers (extended) and it is this expected input that
+drives it. However, they are treated like delimiters. In traditional \TEX\ a
+delimiter is defined by two characters: the direct unscaled one, and when not
+found a second one drives the lookup from wider variants and eventually an
+extensible character. Accents just have the second one, which probably relates to
+the fact that the text ones that would be the starting point make no sense. It is
+this \quote {looking} for a single code point that makes that accents are not
+merged with the more general radical command space. Another reason is that
+accents deal a bit different with spacing and italic correction so even if we
+could merge, it would be more confusing in the end.
+
+{\bf Fences:} these come in pairs with optional middle ones. The reason for
+pairing is that they need to get the same size. That means that before we
+construct them the atom or molecule that they fence has to be analyzed. It also
+makes the result a construct of its own, although in \LUAMETATEX\ we can unpack
+that result so that it can be broken across lines. In practice that was never an
+issue because in a running text unscaled fences are used (just atoms with open
+and close classes assigned) but as soon as one goes to multi|-|line displays
+formulas things become more hairy. The related commands expect delimiters (the
+two part character definitions) but in the meantime are also happy with a single
+one because in the end \OPENTYPE\ math has all in one font.
+
+{\bf Radicals:} originally this only concerned roots but because they are
+basically wrappers we also use them for content that gets a delimiter above,
+below or both. In that sense the term radical can also be interpreted as \quote
+{extreme}, more than a carrot looking symbol. The related commands take one or
+more delimiters (or character) because we support left as well as right
+delimiters connected by a rule, so in the end radicals evolved into a construct
+with delimiters of all kind. So, the unique property of radicals is that the
+fences assume a cooperation between one or more glyphs and a rule. In \CONTEXT\
+we support actuarian hooks as radicals that are used for annuity expressions,
+otherwise the \UNICODE\ symbols is useless and the \MATHML\ construct complex.
+
+So, where accents take numbers as delimiter specification, fences, fractions and
+radicals take specific math quantities or just letters. This makes that we will
+not merge these into one scanner and handler even if they all use the same
+(large) noad to store and carry around their properties. Also, it has some charm
+to keep the original \TEX\ distinctions. After all, it's not like \UNICODE,
+\MATHML\ or \OPENTYPE\ math fonts have brought some new insights: in the end they
+all draw from \TEX\ and they way it's done there.
+
+\stopsection
+
+\startsection[title=Symbols]
+
+There are plenty of symbols in \UNICODE. When we try to get an idea how we ended
+up with that set we're surprised that not much seems to be known about it. There
+are references to \ISO\ standards, usage by specific organizations (like those
+dealing with patents), there are references to lists of publishers. In personal
+communications with people involved it becomes clear that the criterion that some
+symbols really has to be used somewhere doesn't apply to these math symbols.
+There are bizarre specimens that we cannot locate anywhere. They are often
+assigned the \quote {relation} property which for \TEX\ is a safe bet because
+binary and relations get similar spacing, but binary makes an exception when it
+sits at the front. The fact that relation spacing is used can even obscure the
+fact that some characters have zero width properties; the results just look
+somewhat bad and one can always blame the font or renderer and adding some thin
+spacing is accepted behavior. So one can make the argument that because \TEX\ was
+the main renderer of math, a safe bet was better than a confusing and
+unproven|-|by|-|usage assignment to some category.
+
+In \TEX\ some symbols have multiple names, even when they have the same class.
+This indicates the wish for meaning at one end but shape at the other, and once a
+name has been assigned it sticks. It would be interesting to know how
+mathematicians see formulas: if one puts \type {\bar}s around a variable does one
+see \quotation {bar x bar} or \quotation {the modulus of x}, and how is translation
+to audio to be performed?
+
+One important aspect of using any symbol in \TEX, or basically any typesetting
+system that deals with math, is that the spacing depends on the meaning. Now, in
+the perspective of \UNICODE\ meaning is somewhat diffuse. A Latin capital \quote
+{A} related to \quote {a} is not the same as a Greek capital \quote {A} that
+relates to \quote {\alpha}. So, from the shape one cannot beforehand deduce what is
+meant, but when copying it the \UNICODE\ will expose the meaning. This is not the
+case in math: although many symbols have one meaning only, there are also plenty
+that can mean different things and the (\TEX) math community has not been able to
+make a strong case for providing different slots. Maybe the reason was that there
+already was a tradition of using commands that then relate a shape to a class
+that then results in appropriate spacing. Maybe it is also assumed that an
+article or book starts by explaining what a specific symbol means in that
+particular context. But that doesn't help much for copying. It also doesn't help
+with direct \UNICODE\ input. The way out for this last problem is that in
+\CONTEXT\ we will add additional properties to characters that then can
+communicate the class and thereby control the spacing. Although we initially did
+that at the \LUA\ end we now use the lightweight dictionary feature of the
+engine: a property, group, slot model. The main reason is that we foresee that at
+some point we might have to add property based rendering to the engine, and this
+opens up that possibility. Ever since we started with \LUATEX\ and \MKIV\ we have
+used the character database (in \LUA\ format) to store most properties so that we
+have all in one place.
+
+For figuring out the properties we can look at how traditionally symbols got
+multiple commands associated, how \MATHML\ looks at it, what \UNICODE\ reveals and
+what we find in fonts. It is a bit of jungle out there so for sure we have to
+make decisions ourselves. We next turn to that exploration.
+
+\stopsection
+
+\startsection[title=Slashes]
+
+The definition on the \WIKIPEDIA\ page [1] of slashes is as follows:
+
+\startquotation
+ The slash is an oblique slanting line punctuation mark /. Once used to mark
+ periods and commas, the slash is now used to represent exclusive or inclusive
+ or, division and fractions, and as a date separator. It is called a solidus
+ in \UNICODE, is also known as an oblique stroke, and has several other
+ historical or technical names including oblique and virgule.
+\stopquotation
+
+The page then has a very detailed description on how slashes are used in text,
+mathematics, computing, currency, dates, numbering, linguistic transcriptions,
+line breaks, abbreviations, proofreading, fiction, libraries, addresses, poetry,
+music, sports, and text messages. It is a pretty good and detailed page which also
+gives a nice summary of usage in math.
+
+In mathematics, we use the slash (a forward leaning bar) for fractions, division,
+and quotient of set. Examples of fractions are $\vfrac {1} {2}$ but also
+$\percent$ sits in this category.
+
+\starttabulate[|T|l|l|]
+\NC U+0002F \NC \switchtobodyfont[stixtwo]$\utfchar{"0002F}$ \NC this is the official solidus \NC \NR % /
+\NC U+02044 \NC \switchtobodyfont[stixtwo]$\utfchar{"02044}$ \NC the mathematical fraction slash \NC \NR % ⁄
+\NC U+02215 \NC \switchtobodyfont[stixtwo]$\utfchar{"02215}$ \NC the mathematical division slash \NC \NR % ∕
+\NC U+02571 \NC \switchtobodyfont[stixtwo]$\utfchar{"02571}$ \NC a diagonal box drawing line \NC \NR % ╱
+\NC U+029F8 \NC \switchtobodyfont[stixtwo]$\utfchar{"029F8}$ \NC the mathematical big solidus \NC \NR % ⧸
+\NC U+0FF0F \NC \switchtobodyfont[stixtwo]$\utfchar{"0FF0F}$ \NC a full width solidus \NC \NR % /
+\NC U+1F67C \NC \switchtobodyfont[stixtwo]$\utfchar{"1F67C}$ \NC the very heavy solidus \NC \NR % 🙼
+\stoptabulate
+
+The \STIX\ fonts have the first five, the rest is not there, so we can safely
+assume that they are not used in math. That brings us to the question that, say
+that the other ones are used, how does the user access them? In the editor they
+often look pretty much the same. For \TEX ies the answer is easy: you use a
+command. But as we already mentioned, there we enter a real fuzzy area: these
+commands either describe a shape or they communicate a meaning, at least, in an
+ideal world. Sometimes wrapping in a macro helps, like \typ {$\vfrac {1} {2}$}.
+
+In the document that explains \UNICODE\ math there is a section \quotation
+{Fraction Slash and Other Diagonals}. Even if we limit ourselves to the forward
+leaning slashes it looks like we need to include
+exotic symbols, as the empty set symbol with an left arrow on top: \type
+{U+29B4} a circle with left pointing arrow on top, that doesn't show up in most
+math fonts but \STIX\ has it {\switchtobodyfont[stixtwo]{$⦴$}}. We quote:
+
+\startquotation
+ \type {U+2044 ⁄} \typ {FRACTION SLASH} is typically used to build up simple
+ skewed fractions in running text. It applies to immediately adjacent
+ sequences of decimal digits, that is, to spans of characters with the General
+ Category property value \type {Nd}. For example, \type {1⁄2} should be
+ displayed as \type {½}. In ordinary plain text, any character other than a
+ digit delimits the numerator or denominator. So \type {5 1⁄2} should be
+ displayed as \type {5½} since a space follows the \type {5}. In general
+ mathematical use, a more versatile method for layout of fractions is needed
+ (see, for example, Section 2.1 of [UnicodeMath]), however parsers of
+ mathematical texts should be prepared to handle \typ {FRACTION SLASH} when it
+ is received from other sources. \type {U+27CB}
+ \typ {MATHEMATICAL RISING DIAGONAL} and \type {U+27CD}
+ \typ {MATHEMATICAL FALLING DIAGONAL} are
+ mathematical symbols for specific uses, to be distinguished from the more
+ widely used solidi and reverse solidi operators as well as from
+ nonmathematical diagonals.
+\stopquotation
+
+In \TEX\ there is no parsing going on: we just get sequences of atoms and the
+inter atom spacing applies. Curly braced arguments are used to communicate units
+that needs to be treated a while. As side note: where for some scripts there are
+special characters that tell where something (state) starts and ends this is not
+available for math, which makes it impossible to mark a sequence of characters as
+being something math. The whole repertoire of pre|-|composed fractions and super-
+and subscripted \UNICODE\ symbols are not to be used in math.
+
+Most documents that somehow relate to or (partially) originate in \TEX\ can
+be rather fuzzy, so we can read here:
+
+\startquotation
+ \type {U+27CB} corresponds to the \LATEX\ entity \type {\diagup} and \type
+ {U+27CD} to \type {\diagdown}. Their glyphs are invariably drawn with 45° and
+ 135° slopes, respectively, instead of the more upright slants typical for the
+ solidi operators. The diagonals are also to be distinguished from the two box
+ drawing characters \type {U+2571} and \type {U+2572}. While in some fonts
+ those characters may be drawn with 45° and 135° slopes, respectively, they
+ are not intended to be used as mathematical symbols. One usage recorded for
+ \type {U+27CB} and \type {U+27CD} is in the notation for spaces of double
+ cosets.
+\stopquotation
+
+So, it is the angles that math users should translate into meaning which I guess
+is natural for them. From the above we cannot deduce if we should take them into
+account in a macro package.
+
+The \MATHML\ specification [3] keeps it abstract and talks about division without
+mentioning the rendering. In content \MATHML\ we have:
+
+\starttyping
+divide = element divide { CommonAtt, DefEncAtt, empty}
+\stoptyping
+
+and the suggested rendering (from an example) is a slash.
+
+In the chapter \quotation {Characters, Entities and Fonts} there is mentioning of:
+
+\startquotation
+ There is one more case where combining characters turn up naturally in
+ mathematical markup. Some relations have associated negations, such as \type
+ {U+226F} [\typ {NOT GREATER-THAN}] for the negation of U+003E [\typ
+ {GREATER-THAN SIGN}]. The glyph for U+226F [NOT GREATER-THAN] is usually just
+ that for U+003E [\typ {GREATER-THAN SIGN}] with a slash through it. Thus it
+ could also be expressed by \type {U+003E}|-|\type {U+0338} making use of the
+ combining slash \type {U+0338} [COMBINING LONG SOLIDUS OVERLAY]. That is true
+ of 25 other characters in common enough mathematical use to merit their own
+ \UNICODE\ code points. In the other direction there are 31 character entity
+ names listed in [\typ {Entities}] which are to be expressed using \type
+ {U+0338} [\typ {COMBINING LONG SOLIDUS OVERLAY}].
+\stopquotation
+
+A curious note is this:
+
+\startquotation
+ For special purposes, one may need a symbol which does not have a \UNICODE\
+ representation. In these cases one may use the \type {mglyph} element for
+ direct access to a glyph as an image, or (in some systems) from a font that
+ uses a non|-|\UNICODE\ encoding. All \MATHML\ token elements accept
+ characters in their content and also accept an \type {mglyph} there. Beware,
+ however, that use of \type {mglyph} to access a font is deprecated and the
+ mechanism may not work in all systems. The \type {mglyph} element should
+ always supply a useful alternative representation in its alt attribute.
+\stopquotation
+
+At some point we experimented with very precise positioned \HTML\ from \TEX\
+(read: \CONTEXT) and that worked very well: the rendering was exactly the same as
+\PDF\ but then suddenly it was no longer possible to access glyphs from fonts. The
+assumption had become that one should feed text into the font rendering machinery
+and use \OPENTYPE\ features to access specific shapes, which of course is a
+fragile approach (the libraries and logic keep evolving, and the most robust
+access is simply by index, or by glyph name if present, assuming that one uses
+the font that was meant to be used). So, how the \MATHML\ glyph element is
+supposed to work out well is not clear. Anyway, as we want nicely typeset math we
+don't care that much if features present in \LUAMETATEX\ and \CONTEXT\ are unique
+and cannot be reproduced otherwise.
+
+In \type {mathclass.txt} [4] which is \quotation {{\em not} formally part of the
+\UNICODE\ Character Database at this time} we see a classification:
+
+\starttabulate[|T|l|]
+\NC U+0002F \NC binary \NC \NR
+\NC U+02044 \NC binary \NC \NR
+\NC U+02215 \NC binary \NC \NR
+\NC U+02571 \NC not mentioned \NC \NR
+\NC U+029F8 \NC n-ary or large operator, often takes limits \NC \NR
+\NC U+0FF0F \NC not mentioned \NC \NR
+\NC U+1F67C \NC not mentioned \NC \NR
+\stoptabulate
+
+So, in the end we can focus on the four that are mentioned, and we will do that
+with the above in mind as well as what is common in the \TEX\ world. We will look
+at usage, classification (groups) and classes.
+
+% modern % ok, both the same
+% cambria % different, no extensible /
+% bonum % ok, both the same
+% pagella % ok, both the same
+% stixtwo % only / extensible, 2044 useless
+% lucida % both extensible, 2044 looks bad and more slope
+
+Unfortunately this sort of mess also results in a mess in fonts. For instance
+when we checked out the difference between \type {U+002F} and \type {U+2044} we
+found that in the fonts produced by the \TEX Gyre project both have proper
+dimensions (and look the same), so they can be used stand alone, but also as
+delimiters. In Cambria the dimensions are okay but only \type {U+2044} has
+extensible characters. In \CONTEXT\ we have defined \type {\slash} to use that slot but
+when you test Lucida and \STIX2 the results are disappointing: In Lucida the
+width of \type {U+2044} makes it unusable (it looks bad anyway), and in \STIX2 it
+is a bit wider so in the end it even becomes fuzzy what to recommend as fix:
+quarter width, half width or full width. Defining \type {\slash} as any of them
+gives at some point an issue so in the end we just patch the font in the goodie
+file: we make them the same and make sure they have extensible characters. After all,
+chances are slim that this will ever be fixed. In that respect a newer engine
+doesn't change the problem: we need to handle it in the macro package, but at
+least that can be done a bit more natural. \footnote {In principle, we can support
+the goodies in the generic font handler, but we think it makes no sense because it
+also relates to the way math is handled in general and supporting a wide range of
+different applications can only cripple the code, let along that agreeing on
+matters can be hard.}
+
+% \ctxlua{table.tocontext(characters.data[0x002F],"[0x002F]")}
+% \ctxlua{table.tocontext(characters.data[0x2044],"[0x2044]")}
+% \ctxlua{table.tocontext(characters.data[0x2215],"[0x2215]")}
+% \ctxlua{table.tocontext(characters.data[0x2571],"[0x2571]")}
+% \ctxlua{table.tocontext(characters.data[0x29F8],"[0x29F8]")}
+
+\stopsection
+
+\startsection[title=Bars]
+
+Again we start with the \WIKIPEDIA\ page, this time the one dedicated to bars
+[5]. The page starts with mathematics so that suggests that the (initial) author
+is familiar with usage in that field: if we cut and paste the itemized list we
+even get \TEX\ math (sort of). Examples of usage are: absolute value,
+cardinality, conditional probability, determinant, distance, divisibility,
+function evaluation, length, norm, order, restriction, set|-|builder notation,
+the Sheffer stroke in logic, subtraction, but also \quotation {A vertical bar can
+be used to separate variables from fixed parameters in a function, or in the
+notation for elliptic integrals}.
+
+Among the objectives of our exploration are grouping symbols in sets that
+represent related meanings and usage. Within these groups we can fine tune with
+classes but that is more geared at rendering. Although currently users enter
+specific usage of symbols with the same shape (or even \UNICODE) with commands we
+can imagine them entering the \quote {real} characters and in that case we need
+some automatic class assignment based on a group (or set of groups). The
+\WIKIPEDIA\ page mentions that in physics \quotation {The vertical bar is used in
+bra|–|ket notation in quantum physics}. It then goes on about usage in computing,
+phonetics and literature. This ordering is different from the slashes, but okay.
+
+The page then makes a distinction between solid and broken bars and there is some
+interesting history behind that, which relates to typewriters, terminals and
+printers in the perspective of distinction and indeed we noticed that on our
+keyboard the broken bar is still used, even if the rendering is solid. The
+page ends with the \UNICODE\ bars and entities. We mention most:
+
+\starttabulate[|T|l|l|]
+\NC U+007C \NC \switchtobodyfont[stixtwo]$\utfchar{"007C}$ \NC a single vertical line \NC \NR % |
+\NC U+00A6 \NC \switchtobodyfont[stixtwo]$\utfchar{"00A6}$ \NC a single broken line \NC \NR % ¦
+\NC U+2016 \NC \switchtobodyfont[stixtwo]$\utfchar{"2016}$ \NC a double vertical line (norms) \NC \NR % ‖
+\NC U+2223 \NC \switchtobodyfont[stixtwo]$\utfchar{"2223}$ \NC divides \NC \NR % ∣
+\NC U+2225 \NC \switchtobodyfont[stixtwo]$\utfchar{"2225}$ \NC parallel lines \NC \NR % ∥
+\NC U+2502 \NC \switchtobodyfont[stixtwo]$\utfchar{"2502}$ \NC a vertical box drawing line \NC \NR % │
+\NC U+FF5C \NC \switchtobodyfont[stixtwo]$\utfchar{"FF5C}$ \NC a fullwidth vertical line \NC \NR % |
+\stoptabulate
+
+Given the mentioned wide range of usage it will be clear bars that can be confusing
+and are pretty overloaded. We're not aware of broken bars being used in math, so
+we ignore these.
+
+The \UNICODE\ math draft talks of \quote {vertical lines} and distinguishes two
+series, delimiters:
+
+\starttabulate[|T|l|l|]
+\NC U+007C \NC \switchtobodyfont[stixtwo]$\utfchar{"007C}$ \NC single vertical lines \NC \NR
+\NC U+2016 \NC \switchtobodyfont[stixtwo]$\utfchar{"2016}$ \NC double vertical lines \NC \NR
+\NC U+2980 \NC \switchtobodyfont[stixtwo]$\utfchar{"2980}$ \NC triple vertical lines \NC \NR
+\stoptabulate
+
+and operators:
+
+\starttabulate[|T|l|l|]
+\NC U+2223 \NC \switchtobodyfont[stixtwo]$\utfchar{"2223}$ \NC divides (single line) \NC \NR
+\NC U+2225 \NC \switchtobodyfont[stixtwo]$\utfchar{"2225}$ \NC parallel (double lines) \NC \NR
+\NC U+2AF4 \NC \switchtobodyfont[stixtwo]$\utfchar{"2AF4}$ \NC binary relation (tripple lines) \NC \NR
+\NC U+2AFC \NC \switchtobodyfont[stixtwo]$\utfchar{"2AFC}$ \NC s large triplle operator \NC \NR
+\stoptabulate
+
+Watch the triples: these are not (yet) in the \WIKIPEDIA\ summary. Rightfully
+there is a remark that the official \UNICODE\ descriptions use \typ {BAR} and
+\typ {LINE} but \TEX ies can't complain about that, can they? After all, they
+also use these terms mixed.
+
+The delimiters sit at the edges but sometimes also in the middle. The operators
+are between other elements and the document states that they also should grow.
+And is it mentioned that spacing depends on usage. The large triple is an n-ary
+operator but as usual with math symbols the user (reader) has to guess what that
+actually means.
+
+It is actually unfortunate that the fences have no left, middle and right
+variant. Even if these render the same it would make life easier and consistency
+with other fences is also worth something. One wonders how it would have looked
+if accessibility demands had kicked in earlier. The \UNICODE\ \type
+{mathclass.txt} [4] provides:
+
+\starttabulate[|T|l|]
+\NC U+007C \NC fence (unpaired delimiter) \NC \NR
+\NC U+2016 \NC fence (unpaired delimiter) \NC \NR
+\NC U+2980 \NC fence (unpaired delimiter) \NC \NR
+\stoptabulate
+
+We assume that the unpaired qualification is actually an indication that usage as
+what in \TEX\ is called \quote {middle} is okay. The operators are classified as:
+
+\starttabulate[|T|l|]
+\NC U+2223 \NC relation \NC \NR
+\NC U+2225 \NC relation \NC \NR
+\NC U+2AF4 \NC binary \NC \NR
+\NC U+2AFC \NC large n-ary \NC \NR
+\stoptabulate
+
+% \ctxlua{table.tocontext(characters.data[0x007C],"[0x007C]")}
+% \ctxlua{table.tocontext(characters.data[0x00A6],"[0x00A6]")}
+% \ctxlua{table.tocontext(characters.data[0x2016],"[0x2016]")}
+% \ctxlua{table.tocontext(characters.data[0x2980],"[0x2980]")}
+% \ctxlua{table.tocontext(characters.data[0x2223],"[0x2223]")}
+% \ctxlua{table.tocontext(characters.data[0x2225],"[0x2225]")}
+% \ctxlua{table.tocontext(characters.data[0x2AF4],"[0x2AF4]")}
+% \ctxlua{table.tocontext(characters.data[0x2AFC],"[0x2AFC]")}
+
+The main problem with bars in \TEX\ is that there is no distinction between a
+left and right bar which makes it impossible to use them directly as fences. On
+can consider this to be an omission to \UNICODE\ math because shape rules over
+meaning. So anyway, this is something that a macro package has to deal with. If
+needed these can get a class on their own in which case we can define atom
+spacing rules that deal with them ending up left or right. In \UNICODE\ there are
+signals that deal with bidirectional text, so we see no reason why there shouldn't
+be similar provisions for math.
+
+\stopsection
+
+\startsection[title=Hyphens and Dashes]
+
+This section applies to text and math as both are riddled with horizontal lines:
+easy to scratch in wood, chisel in stone or draw on paper symbols. We limit
+ourselves to the straight ones, but similar observations can be made for curved
+ones.
+
+\WIKIPEDIA\ distinguishes hyphens, minus, and dashes so there are multiple pages
+dedicated to this. The page about minus mentions that there are three usages
+(somewhat rephrased):
+
+\startitemize[packed]
+ \startitem
+ It is used as subtraction operator and therefore a binary operator
+ that indicates the operation of subtraction.
+ \stopitem
+ \startitem
+ It can be function whose value for any real or complex argument is the
+ additive inverse of that argument.
+ \stopitem
+ \startitem
+ It can serve as a prefix of a numeric constant. When it is placed
+ immediately before an unsigned numeral, the combination names a negative
+ number, the additive inverse of the positive number that the numeral
+ would otherwise name.
+ \stopitem
+\stopitemize
+
+The functional variant is how content \MATHML\ sees it: you apply a minus
+operator to something, singular of multiple. We were surprised to see that there
+is a distinctive rendering suggested, something we have argued for at several
+occasions (mostly \TEX\ meetings):
+
+\startquotation
+ In many contexts, it does not matter whether the second or the third of these
+ usages is intended: \type {−5} is the same number. When it is important to
+ distinguish them, a raised minus sign \type {¯} is sometimes used for negative
+ constants, as in elementary education, the programming language \APL, and some
+ early graphing calculators.
+\stopquotation
+
+Unfortunately that distinction was not recognized by the \TEX\ community at large
+which (we guess) is why we don't see it in \UNICODE, which on the other hand has
+plenty dashes as we will see soon.
+
+The page mentions usage in indicating blood types and music, which is a nice
+detail. It also mentions usage in computing, including regular expressions and in
+physics and chemistry indicating charge. It lists these codes for minus symbols:
+
+\starttabulate[|Tl|l|]
+\NC U+002D \NC hyphen minus \NC \NR
+\NC U+2212 \NC minus \NC \NR
+\NC U+FE63 \NC small hyphen minus \NC \NR
+\NC U+FF0D \NC full width hyphen minus \NC \NR
+\stoptabulate
+
+The page also mentions the commercial minus \type {⁒} (see also [7]) and division
+sign \type {÷} (see also [8]) and we think these should be supported in math mode
+simply because they can be part of (even simple text style) formulas.
+
+The fact that we use the hyphen as minus and expect it to render as a wider dash
+like shape is something that related to math mode in \TEX\ speak. In text mode we
+expect it to be seen as hyphenation related indicator. We won't go into details
+about automated hyphenation and explicit hyphens in text mode but here are the
+hyphens as mentioned on the hyphen specific \WIKIPEDIA\ page:
+
+\starttabulate[|Tl|l|]
+\NC U+002D \NC hyphen minus \NC \NR
+\NC U+00AD \NC soft hyphen \NC \NR
+\NC U+2010 \NC hyphen \NC \NR
+\NC U+2011 \NC non breaking hyphen \NC \NR
+\stoptabulate
+
+You might wonder why we mention text variants here and one reason is that we
+actually might need to provide a catch for the last two: maybe when a user copies
+these from a document (when rendered at all) we need to treat them as the simple
+hyphen minus and just remap them to the math minus when in math mode. Below, we
+will discuss dashes, and although these are also meant for text, a reason for
+exploring these can be found in the fact that \TEX\ users like to decorate the
+content in unexpected ways and lines (or rules) fit into that. The \WIKIPEDIA\
+pages go into some details about the hyphens being used in compounds and there
+can be some confusion about whether to use endashes or hyphens for that. We're
+pretty sure that typesetting wars have been fought over that. Usage as pre- and
+suffixes definitely is worth noting (and we use them as such in this sentence).
+
+We leave out all the other usages and see what there is to tell about related
+symbols. The \WIKIPEDIA\ page about dashes is an extensive one. It starts out with
+the distinction between \unichar {figure dash} {2012}, \unichar {endash} {2013},
+\unichar {emdash} {2014} and \unichar {horizontal bar} {2015}. Of these a \TEX ie
+will for sure recognize the endash and emdash. The hyphen is not a dash but if
+you look at \TEX\ input that double or triple hyphens get ligatured into en- and
+emdashes! The only certainty one has is that the endash is often half the width
+of an emdash. Also, the width of the emdash is often the same as the font size.
+
+One reason why a language subsystem of a \TEX\ macro package is complex is that
+it has to deal with cultural aspects and the usage as well as spacing around all
+these dashes can differ. When trying to support that a macro writer soon finds
+out that one user of language~X can tell you the rules are done this way, and a
+while later you get a mail from another user who claims that in language~X the
+rules are done that way. Word processing and dominance of English probably adds
+to the confusion. The same is true for quotes, but math doesn't need these, so we
+skip them. Now wait, you will say: does math use these dashes? Users probably
+will mix them in but more important is that the width of these dashes also has
+associated skips: \type {\enspace} and \type {\emspace} or \type {\quad} and
+these one definitely see users mix into math.
+
+The figure dash has the same width as digits which makes them useful in tables. In
+the fonts that come with \TEX\ it is the reverse: the digits have the same width
+and that width matches the endash. There is no habit of using the figuredash, but
+we might need to change that. After all, we now have the fonts! We do need to
+deal with the figure dash because users might mix math and text in tables, and
+although you can find plenty of badly typeset by \TEX\ tables, this is no excuse
+for using a mix of minus and figure dash in inconsistent ways.
+
+The \WIKIPEDIA\ page mentions the usage of the endash: as connector, as compound
+hyphen, and as sentence interrupter. Now the one that needs some attention is the
+second one. In Dutch, we can combine words in many ways and for educational
+purposes adding a compound dash makes sense. However, because the weight of the
+hyphen and endash in \TEX\ fonts is rather incompatible, in \CONTEXT\ we use(d)
+fakes: two overlapping hyphens. Another complication is that one has to wrap that
+in a discretionary node in order to make the hyphenator happy, but that is now
+delegated to the engine that can be configured to see certain characters as valid
+hyphenation points. Although we support discretionaries in math this doesn't
+relate to dashes but to pluses and minuses and such. The engine supports explicit
+discretionaries but can also automatically repeat symbols that are set up as
+repeatable across lines. We're not sure if users actually use en- and emdashes in
+math mode, but one can occasionally run into examples (on the web) where special
+effects are achieved in curious ways. \footnote {The math stream doesn't go
+through the font handler although embedded \type {\hbox}es get that treatment.
+This means that two hyphens in a row are just two atoms and not get collapsed to
+an endash.}
+
+It is worth pointing out that \WIKIPEDIA\ discusses \quotation {Ranges of values}
+and this is something we need to investigate in the perspective of math! Strictly
+spoken that is a text thing, but \unknown\ Among the many observed and suggested
+patterns we note that among \TEX ies using the endash as itemize symbols is
+also popular.
+
+Usage of the emdash is related to the use of parenthesis or colons, so it is more
+a kind of punctuation. It can also be used as an interrupt and again it is a
+candidate for an itemize symbol. There is of course a \TEX\ thing there: lack of
+text symbols made for a rather mixed usage of math and text symbols in
+itemizations. For instance a dotted one uses the well visible math dot instead of
+the often hardly visible text dot that simply was not present in \TEX\ fonts, so
+our eyes got accustomed to the bolder ones. It is one of the reasons why a \TEX\
+macro package load a math font even when no math is used. Over the years in \TEX\
+math and text symbols have been mixed in various ways, also a side effect if the
+limited amount of characters in text fonts and the abundance of them in math
+mode, even if most are only accessible by name. We need to deal with that
+historic mix.
+
+The page rightfully mentions that \TEX\ has no horizontal bar, also known as
+\quote {quotation dash}, used for dialogues in some languages. We should make a
+note then that it might be good to see if we have to reconfigure the
+sub|-|sentence presets to match that expectation. The proposed hack {\red MPS:
+where?} for a missing symbol is somewhat curious:
+
+\starttyping
+x \hbox{---}\kern-.5em--- x
+\stoptyping
+
+\startbuffer[dash-example]
+\uleaders \hbox to 1.5em {---\hskip 0pt minus .5em---} \hskip.125em minus .125em \relax
+\stopbuffer
+
+Why not \type {\hbox {---\kern-.5em---}} or just \type {---\kern-.5em---} to get
+the same effect? This also assumes that the font collapses these three hyphens
+into a dash, then it backtracks the symbol width and does a second one.
+\footnote {Here is some food for thought: for this kind of usage one can argue
+that such a dash should have some stretch. In \LUAMETATEX\ and therefore
+\CONTEXT\ we can do this: \typeinlinebuffer [dash-example] and get: \dorecurse
+{30} {x \getbuffer [dash-example] x}. Boxed material can be stretched and be
+taken into account when creating paragraphs. It is no big deal to wrap that in a
+macro, say \type {\figuredashed}.} Anyway, where figure dashes are related to
+minuses we can probably ignore this super minus resembling horizontal bar.
+\footnote {We can actually issue a warning when it is used in math mode.}
+
+The \WIKIPEDIA\ page ends with a summary of all kind of dashes, including
+underscores, script specific symbols, accents (like macron), modifiers and curly
+ones. Here we only mention the ones that can end up in some source when one cuts
+and pastes. Doing that can result in missing characters (because not all fonts
+provides them) or a change in meaning (for as far as the symbols relates to an
+intention). We show some that fit into this discussion and also mention the
+\UNICODE\ description:
+
+\starttabulate[|T|lb{\ttx}|p|]
+\NC U+002D \NC HYPHEN-MINUS \NC the usual hyphen but also used as minus \NC \NR
+\NC U+005F \NC LOW LINE \NC aka underscore \NC \NR
+\NC U+00AD \NC SOFT HYPHEN \NC valid hyphenation point (invisible) \NC \NR
+\NC U+2010 \NC HYPHEN \NC the real hyphen but more work on a keyboard \NC \NR
+\NC U+2011 \NC NON-BREAKING HYPHEN \NC a hard hyphen, disables following hyphenation \NC \NR
+\NC U+2012 \NC FIGURE DASH \NC see discussion above \NC \NR
+\NC U+2013 \NC EN DASH \NC see discussion above \NC \NR
+\NC U+2014 \NC EM DASH \NC see discussion above \NC \NR
+\NC U+2015 \NC HORIZONTAL BAR \NC see discussion above \NC \NR
+\NC U+2043 \NC HYPHEN BULLET \NC used in itemized lists \NC \NR
+\NC U+207B \NC SUPERSCRIPT MINUS \NC combined with pre-superscripted characters \NC \NR
+\NC U+208B \NC SUBSCRIPT MINUS \NC combined with pre-subscripted characters \NC \NR
+\NC U+2212 \NC MINUS SIGN \NC the math minus (rendering of hyphen) \NC \NR
+\NC U+23AF \NC HORIZONTAL LINE EXTENSION \NC build long connected horizontal lines \NC \NR
+\NC U+23E4 \NC STRAIGHTNESS \NC represents line straightness in technical context \NC \NR
+\NC U+2500 \NC BOX DRAWINGS LIGHT HORIZONTAL \NC part of the box-drawing repertoire \NC \NR
+\NC U+2796 \NC HEAVY MINUS SIGN \NC a visual variant with no meaning \NC \NR
+\NC U+2E3A \NC TWO-EM DASH \NC a visual variant with no meaning \NC \NR
+\NC U+2E3B \NC THREE-EM DASH \NC a visual variant with no meaning \NC \NR
+\NC U+FE58 \NC SMALL EM DASH \NC a visual variant with no meaning \NC \NR
+\NC U+FE63 \NC SMALL HYPHEN-MINUS \NC a visual variant with no meaning \NC \NR
+\NC U+FF0D \NC FULLWIDTH HYPHEN-MINUS \NC a visual variant with no meaning \NC \NR
+\stoptabulate
+
+The \UNICODE\ math draft only mentions the hyphen: \footnote {When I copy this
+snippet into the document source there are \typ {START OF TEXT} symbols at the
+places where a hyphenation occurs, which is probably a side effect of a bad \type
+{TOUNICODE} entry in the \PDF\ file, but it is kind of interesting in this
+perspective as definitely a hyphen is rendered.}
+
+\startquotation
+ Minus sign. \type {U+2212} [or] \type{−} [known as] \typ {MINUS SIGN} is the
+ preferred representation of the unary and binary minus sign rather than the
+ \ASCII|-|derived \type {U+002D} [or] \type {-} [known as] \typ
+ {HYPHEN-MINUS}, because minus sign is unambiguous and because it is rendered
+ with a more desirable length, usually longer than a hyphen.
+\stopquotation
+
+and elsewhere we can read:
+
+\startquotation
+ The \ASCII\ hyphen minus \type {U+002D} [or] \type {-} is a weakly
+ mathematical character that may be used for the subtraction operator, but
+ \type {U+2212} [or] \type {−} [known as] \typ {MINUS SIGN} is preferred for
+ this purpose and looks better.
+\stopquotation
+
+We are not aware of the concept of weak mathematical characters, so we will not
+take that property too serious when we try to improve the rendering.
+
+This is basically it. There is no mentioning of classes (after all, traditional
+\TEX\ has no unary class) so it is assumed that the renderer does the right
+thing: interpreting the sequence of characters and apply spacing accordingly.
+There are users who like to see a unary minus being rendered differently, just as
+the minus that a student is supposed to key in a calculator and while the
+\WIKIPEDIA\ page mentions this explicitly, it is ignored here. Yes, having two
+distinctive slots for this would have been great. Maybe it is not seen as
+relevant enough by the community that would benefit most, but who knows what had
+happened it the \WIKIPEDIA\ page had been there before!
+
+The minus is mentioned in the somewhat curious section about how shapes should be
+positioned relative to the baseline, where the position of the minus relates to
+what in \TEX\ speak is the math axis. There is also some mentioning of non-mathematical use, like:
+
+\startquotation
+ The concept of mathematical use is deliberately kept broad; therefore the
+ Math property is also given to characters that are used as operators, but are
+ not part of standard mathematical notation, such as \type {U+2052} \typ
+ {COMMERCIAL MINUS}.
+\stopquotation
+
+There should be no confusion with the \typ {SET MINUS} which renders as a
+backslash, a \typ {(NEG\-ATED) MINUS TILDE} or \typ {(NEG\-ATED) SIMILAR MINUS
+SIMILAR} that look more like relations. {\red MPS: overfull hbox, and do you
+intend to hyphenate?}
+
+The \MATHML\ document recognizes the minus as being unary or binary. In content
+\MATHML\ it is easy: when applied to a single atom it is a unary. In presentation
+\MATHML\ minus is an operator that sits at the front of a row (unary) or in the
+middle (binary). Keep in mind that we are limited to \type {mn} for numbers,
+\type {mi} for alphabetic symbols and \type {mo} for operators, not to be
+confused with \TEX's math operators, because in \MATHML\ relations are also
+operators. One can wonder about a minus in \type {mn} elements.
+
+So to summarize: we definitely need to make sure that (whatever renders as)
+hyphens is dealt with in math as minus. We can wonder what to do with
+(especially) en- and emdashes and the other horizontal lines that actually might
+show up as (what we call) middle delimiters in mathematical constructs: if it's
+there, \TEX ies will use it! The lack of specific symbols for unary minus has to
+be compensated at the macro package level.
+
+% \ctxlua{table.tocontext(characters.data[0x002D],"[0x002D]")}
+% \ctxlua{table.tocontext(characters.data[0x2010],"[0x2010]")}
+% \ctxlua{table.tocontext(characters.data[0x2011],"[0x2011]")}
+% \ctxlua{table.tocontext(characters.data[0x2212],"[0x2212]")}
+% \ctxlua{table.tocontext(characters.data[0x2212],"[0x2213]")}
+% \ctxlua{table.tocontext(characters.data[0x2212],"[0x2214]")}
+% \ctxlua{table.tocontext(characters.data[0x2212],"[0x2215]")}
+% \ctxlua{table.tocontext(characters.data[0xFE63],"[0xFE63]")}
+% \ctxlua{table.tocontext(characters.data[0xFF0D],"[0xFF0D]")}
+
+% U+2043 HYPHEN BULLET
+% U+207B SUPERSCRIPT MINUS
+% U+208B SUBSCRIPT MINUS
+
+\stopsection
+
+\startsection[title=Pieces]
+
+In \UNICODE\ one can find all kind of constructors, for instance characters that
+find their origin in those character sets that had lines and corners for drawing
+on a terminal. It is therefore no surprise that there are also some constructors
+that relate to math. An example demonstrates this:
+
+\startbuffer[definition]
+\def\makeweird#1#2#3#4%
+ {\vcenter\bgroup
+ \offinterlineskip
+ \hbox{$\scriptscriptstyle\char"#1$}\par
+ \hbox{$\scriptscriptstyle\char"#2$}\par
+ \hbox{$\scriptscriptstyle\char"#3$}\par
+ \hbox{$\scriptscriptstyle\char"#4$}%
+ \egroup}
+
+\def\lwA{\mathopen {\makeweird{23A7}{23A8}{23A8}{23A9}}}
+\def\rwA{\mathclose{\makeweird{23AB}{23AC}{23AC}{23AD}}}
+\def\lwB{\mathopen {\makeweird{23A7}{23AC}{23AC}{23A9}}}
+\def\rwB{\mathclose{\makeweird{23AB}{23A8}{23A8}{23AD}}}
+\def\lwC{\mathopen {\makeweird{23A7}{23AC}{23A8}{23A9}}}
+\def\rwC{\mathclose{\makeweird{23AB}{23A8}{23AC}{23AD}}}
+\stopbuffer
+
+\startbuffer[demo]
+$\lwA x + 4 + \lwB x^2 + 4^2 + \lwC x^3 + 4^3 \rwC \rwB \rwA$
+\stopbuffer
+
+\typebuffer[definition,demo]
+
+This renders as:
+
+\startlinecorrection
+\getbuffer[definition]
+\scale[width=\textwidth]{\getbuffer[demo]}
+\stoplinecorrection
+
+So, we have official \UNICODE\ characters for constructing large fences. In the
+\UNICODE\ math documents there is some mentioning of this and interesting is that
+there are suggested compositions expressed in 2, 3, 5 etc. stacked \quote {lines}
+which makes one wonder how math is perceived (or supposed to be rendered). But
+what is really weird is that there are plenty of arrows but no snippets defined that
+can be used to create extended ones. Why vertical snippets and no horizontal
+ones? This is clearly an omission and the \TEX\ community did take care of this
+need. So, for horizontal arrows and alike one expects the font to handle it and
+for fences not?
+
+It is not only fences that have snippets, we also find them for integrals. But
+for vertical arrows they are lacking: that is completely up to the font. Now, for
+us that is fine, but again, for consistency they could have been there. It would
+make it possible to filter bits and pieces from fonts using official slots
+instead of private ones. So, to some extent we can best assume there is nothing
+like that and ignore whatever pieces are in \UNICODE\ anyway (like the braces in
+the example). One can even argue that because of this inconsistency a font
+designed can as well only use private slots and not provide snippets at all.
+
+So, how do we get out of this situation? Because no one cared getting it in
+\UNICODE, we can do as we like. Of course, we can define arrow fillers as has
+always been done in \TEX, but because in \LUAMETATEX\ we have a bit more in our
+toolkit, and because we want to support stretch fractions (where the rule is
+replaced by a horizontal delimiter) it was decided to define a tweak that deals
+with this: when the basic arrows have no horizontal parts defined, we just
+assemble them. For those arrows that have a hook or so at the other end, we use
+the space as extender. \footnote {Actually we no longer do that because the
+engine will center the arrow anyway when it's too short.} If we ever end up with
+proper snippets un \UNICODE\ then we also need adapted fonts, and then we can get
+rid of these hacks. That said: because all decent math fonts do have the three
+pairs or fences (brace, parenthesis, bracket) the vertical snippets are rather
+useless, unless one wants to construct assembled weird ones. This would be
+different for horizontal assemblies, because there is more variety in them.
+
+The official name for all related to characters that can stretch is \quote
+{delimiter}. In traditional \TEX\ one can define a command that becomes a
+character. In that case a family, class and slot is assigned. You can also
+directly access a character in which case one will assign these properties
+otherwise (no command is defined). The same is true for these delimiters.
+However, in traditional \TEX\ the larger character usually comes from a so called
+extension font and uses family~3). In \OPENTYPE\ fonts we have all in one font so
+there the large family, class, and slot are not used.
+
+An interesting side effect of the updated math machinery in \LUAMETATEX\ is that
+we no longer really need delimiter specifications when we use \OPENTYPE\ fonts.
+This is because in practice the only two classes that really matter are the open
+and close ones. There are basically two kinds of delimiters: fences and
+singulars. Fences need open and close and only bars have a dual character. So,
+when we don't define it as delimiter, the engine can still use that character and
+take its assigned class when used stand|-|alone, while in the case of fences
+these themselves are of class open and close. And, for instance a left brace can
+get class open because when used stand alone it is an unscaled left fence. In the
+rare case that one really need a different class we are using commands: some
+characters can be binary, ordinary or whatever so then commands relate a name to
+a class|-|character combination. Actually, in \CONTEXT\ we will switch to using
+dictionaries and field specific rendering instead, but that is a different story.
+We can illustrate the arrows with an example:
+
+\startbuffer
+$ x +
+ \left\downarrow a \uparrow \frac{1}{b} \downarrow c \right\uparrow
+= y $
+\stopbuffer
+
+\typebuffer
+
+The stand alone arrows are defines with class relation but when used as fences
+their spacing is driven by the fences themselves.
+
+\startlinecorrection
+\scale[width=\textwidth]{\showmakeup[mathglue]\mathspacingmode1\showglyphs\getbuffer}
+\stoplinecorrection
+
+This means that in \CONTEXT\ \LMTX\ we no longer have delimiter code definitions.
+Of course the engine has to be able to use math characters of any kind (by
+commands, direct or as \UTF) as delimiters, but that was not that hard to
+provide. It also simplifies the code we use for fencing as it can be less
+selective.
+
+Another interesting side effect of once again looking into these stretched
+characters is that the fraction mechanism that already was extended with skewed
+fractions, now supports any stretchable character as alternative for a fraction
+rule.
+
+\startbuffer
+$
+ p \leftarrowtext {a + b + c + d}{x + y} q
+ \quad
+ p \frac {a + b + c + d}{x + y} q
+$
+\stopbuffer
+
+\typebuffer
+
+Watch the difference in spacing: here the class of the used delimiter determines the
+spacing around the (pseudo) fraction:
+
+\startlinecorrection
+\scale[width=\textwidth]{\showmakeup[mathglue]\mathspacingmode1\showglyphs\getbuffer}
+\stoplinecorrection
+
+Again this simplifies some code because normally one ends up with stacking stuff
+using leaders in between.
+
+\stopsection
+
+\startsection[title=Accents]
+
+When we talk about accents, we refer to tiny symbols that anchor themselves onto
+base characters. We limit ourselves to the ones common in Latin scripts because
+they are the ones used in math. Accents in \UNICODE\ are somewhat special. In
+the past, when encoding vectors were limited, accents were entered as part of an
+input sequence and then anchored by the renderer. Nowadays often pre|-|composed
+characters are used. A very cheap way of anchoring is to have accents that just
+overlay, and in practice centering an accent over a base character works sort of
+okay. As an example of an accent we will use the hat:
+
+\starttabulate[|T|c|l|c|]
+\NC U+005E \NC x\char"005E x m\char"005E m\NC \tex {Hat} \NC \im{x \char"005E x + m\char"005E m} \NC \NR % 94
+\NC U+02C6 \NC x\char"02C6 x m\char"02C6 m\NC \tex {hat} \NC \im{x \char"02C6 x + m\char"02C6 m} \NC \NR % 710
+\NC U+0302 \NC x\char"0302 x m\char"0302 m\NC \tex {widehat} \NC \im{x \char"0302 x + m\char"0302 m} \NC \NR % 770
+\stoptabulate
+
+Normally the font handler will take care of anchoring \type {U+0302}, but it can
+only be done properly when there are anchors defined for what are called \quote
+{marks}: the official feature description is mark|-|to|-|base (or simply \type
+{mark}). The last column in the above table shows math and as we input a raw
+character we don't get proper anchoring: the zero width makes it overlap.
+
+% till here
+
+Now wait, you will say, but why does it actually overlap? The reason is that zero
+width is not actually zero width here! The glyph has a bounding box that goes
+into the negative horizontal direction and therefore, when such a shape gets
+injected into the output, the rendering in the viewer will move the left edge to
+the left. But because the \TEX\ engine only handles positive widths and because
+the width is explicitly part of a character specification anyway\footnote {The
+height and depth are not: these we derive from the bounding box.} we don't
+progress (advance) which is why the overlapping sort of works for the $x$ but
+less so for the $m$: in math mode we need to use these \type {\hat} and \type
+{\widehat} commands.
+
+The hat and widehat assignments were those of August 2022. In plain \TEX\ we see
+these definitions:
+
+\starttyping
+\def\hat {\mathaccent"705E }
+\def\widehat{\mathaccent"0362 }
+\stoptyping
+
+The \type {\mathaccent} primitive takes an integer that encodes the class, family,
+and slot in the 8 bit font encoding. Here we see that the hat comes from family
+0, the upright math font. The widehat comes from extensible family 3. These two
+are independently defined. When you want a hat that spans the nucleus, you need to
+use the widehat. In the math engine spanning actually means that we have a
+delimiter and normally that means: start with a basic shape, when that is too
+narrow, go to the extensible font and follow the chain with increasing sizes and
+when you run out of those apply an extensible recipe. The sequence and extensible
+are both optional and the important part is that we first look at what is called
+the small character and then to the large one(s).
+
+However, the \type {\mathaccent} primitives doesn't take a delimiter! It directly
+starts following a chain if the given character has it (and then the character
+itself is of course the first in that chain). And this is where the problems
+start when we move to \OPENTYPE\ and \UNICODE\ math.
+
+\starttabulate[|T|l|l|]
+\NC U+005E \NC Hat \NC some useless, often ugly large glyph \NC \NR % 94
+\NC U+02C6 \NC hat \NC it has width but no extensibles \NC \NR % 710
+\NC U+0302 \NC widehat \NC it has zero width and extensibles \NC \NR % 770
+\stoptabulate
+
+Now, if we define \type {\hat} as \type {U+02C6} we don't get the extensibles,
+and it basically is what was always done in \TEX\ macro packages following the
+plain suggestions. If we define \type {\widehat} we start out with a glyph that
+has likely zero width\footnote {Over the many years that \LUATEX\ evolved this
+was not guaranteed, for instance when wide (\UNICODE) fonts were constructed from
+traditional eight bit (\TEX\ encoded) fonts.} And, because \OPENTYPE\ starts with
+the base glyph and {\em then} uses a set of variants of eventually a recipe of
+parts, we suddenly have a different situation with \type {\mathaccent} than we
+normally have, where these are decoupled. Therefore, the definition of \type {\hat}
+and \type {\widehat} determines what an \OPENTYPE\ math engine will do, just as
+in regular \TEX, but we might need them to be defined differently.
+
+A solution would be to let \type {\mathaccent} (or \type {\Umathaccent}) directly
+go to the variants, but that is sort of weird. Because a zero width glyph doesn't
+match the criteria to span a nucleus it is likely to be skipped anyway, although
+there can be a case where the next in size overruns the width of the nucleus in
+which case the zero width one is used which itself is not that nice. We could
+actually derive the width from the boundingbox, but that would be a bit abnormal,
+and it makes no sense to burden the font machinery with that exception. Another
+approach we can follow is to just copy the extensibles from \type {U+0302} to
+\type {02C6} and use that one for \type {\hat} as well as \type {\widehat} and
+then make \type {\widehat} an alias to \type {\hat}. After, all, the main reason
+why we have two commands comes from the fact that \type {\mathaccent} doesn't
+take a delimiter but single character reference (encoded in an integer).
+
+Here is the whole list of accents:
+
+\starttabulate[||T||T|]
+\NC \tex{grave} \NC U+0060 \NC \tex{widegrave} \NC U+0300 \NC \NR
+\NC \tex{ddot} \NC U+00A8 \NC \tex{wideddot} \NC U+0308 \NC \NR
+\NC \tex{bar} \NC U+00AF \NC \tex{widebar} \NC U+0304 \NC \NR
+\NC \tex{acute} \NC U+00B4 \NC \tex{wideacute} \NC U+0301 \NC \NR
+\NC \tex{hat} \NC U+02C6 \NC \tex{widehat} \NC U+0302 \NC \NR
+\NC \tex{check} \NC U+02C7 \NC \tex{widecheck} \NC U+030C \NC \NR
+\NC \tex{breve} \NC U+02D8 \NC \tex{widebreve} \NC U+0306 \NC \NR
+\NC \tex{dot} \NC U+02D9 \NC \tex{widedot} \NC U+0307 \NC \NR
+\NC \tex{ring} \NC U+02DA \NC \tex{widering} \NC U+030A \NC \NR
+\NC \tex{tilde} \NC U+02DC \NC \tex{widetilde} \NC U+0303 \NC \NR
+\NC \tex{dddot} \NC U+20DB \NC \tex{widedddot} \NC U+20DB \NC \NR
+\stoptabulate
+
+The only accent that is an exception is the last one but is it really used? It
+anyway makes no real sense to assume that users will ever directly input the
+\UTF\ characters conforming the last column, so we can just go for the first one
+and use the extensibles from the second and see where we end up. Neither \MATHML\
+nor \TEX\ related specifications seem to cover this well, so we can just do what
+suits us best.
+
+\startbuffer
+\showglyphs
+\im {\widehat{a} + \widehat {aa}} =
+\im {\hat {a} + \hat {aa}} =
+\im {\hat {a} + \hat[stretch=yes]{aa}} =
+\setupmathaccent[top][stretch=yes]
+\im {\hat {a} + \hat {aa}}
+\stopbuffer
+
+Because all has to fit into the \CONTEXT\ user interface and because we also want
+to be backward compatible (command wise), we end up with something:
+
+\typebuffer
+
+that gives us:
+
+\startpacked \glyphscale = \numexpr2*\glyphscale\relax \getbuffer \stoppacked
+
+Now, one problem, is of course that users can enter these modifiers as \UTF\
+sequence in the input, just like they do with delimiters. Therefore we do support
+the following feature (which is under class control so disabled by default):
+
+\startbuffer
+\Umathcode "02C6 \mathaccentcode 0 "02C6
+\edef \HiHatA {\Uchar"02C6}
+\Umathchardef \HiHatB \mathaccentcode 0 "02C6
+
+$ \Uchar"02C6{x} + \HiHatA{xx} + \HiHatB{xx} = \widehat {xxxx} $
+\stopbuffer
+
+\typebuffer
+
+You get this:
+
+\start
+ \pushoverloadmode \getbuffer \popoverloadmode
+\stop
+
+The only cheat here is that normally accents come after the accentee, but we can
+live with that. After all, it's all about convenience.
+
+There is another aspect of accents that we need to mention here. The hat, tilde,
+and check are often used over not only single letters but also small expressions.
+So how come that fonts have only very few variants defined? We can imagine that
+in eight bit fonts the number of available slots plays a role but in \OPENTYPE\
+fonts that is not the case. It therefore can be considered an
+oversight that usage of these wide accents has not be communicated well to the
+font designers.
+
+\def\CrappyHack#1{\im{
+ #1{a} + #1{a+b} + #1{a+b+c} +
+ #1{a+b+c+d} + #1{a+b+c+d+e} + #1{a+b+c+d+e+f}
+}\par}
+
+\startpacked
+\CrappyHack\widehat
+\CrappyHack\widetilde
+\CrappyHack\widecheck
+\stoppacked
+
+The previous lines demonstrate that we can actually cheat a little for these
+three top accents: we can just scale the last variant horizontally. It was a few
+lines patch to \LUAMETATEX\ to make this automatic and triggered by setting the
+\type {extensible} field in a character table to \type {true} instead of a
+recipe. The ingredients to get this working were already there, and it works out
+quite well. The only complication was that the \type {flac} feature (that
+provides flat accents for cases where the nucleus is rather high) could interfere,
+but that was trivial to deal with in the code that does the goodies. \footnote
+{When we were testing fonts this got us by surprise when we tested Cambria that
+has these flat overloads for the tilde and check. Because supports this automatic
+(hidden from the user) one doesn't look into that direction when testing
+something.}
+
+When it comes to these delimiters that have no real solution in the font, we can
+consider delegating coming up with a glyph to the macro package at the time it is
+needed, and we can actually do that. However, this is mostly interesting for
+educational usage, where the amount of delimiters is predictable and limited.
+About a decade ago some mechanism was added to the \MKIV\ math machinery that
+support plugins so that we could use \METAFUN\ to generate (most noticeably)
+square root symbols the way we liked. \footnote {This was a fun project of Alan
+and Hans.} The main drawback is that mixing this in means matching to a font, and
+that is not always trivial. But it is this kind of trickery that makes working
+with \TEX\ fun. That said: what we are discussing here is more fundamental in the
+sense that we try to come up with generic engine solutions that just rely on the
+fonts. That way complex math with all reasonable symbols is also served.
+\footnote {These \METAFUN\ plugins are still possible, but we need to adapt some
+to \LMTX\ which will happen as we go.}
+
+Interestingly there are some arrows that act like accents. There are over- and
+under ones as well as combining (often zero width) accents. Fonts are not always
+consistent in how these extends (the wide ones). Often the combining accents are
+smaller and closer to the running text. Traditionally in \TEX\ fonts there are no
+extensible arrows: they are constructed from arrow heads, minus and equal signs
+with some negative spacing in between. One can therefore wonder is the smaller
+combining ones are appreciated by those who want stable math. It definitely means
+that we have to make choices. Even more interesting is that while \UNICODE\ has
+some means to construct braces from predictable \UNICODE\ slots. there is no way
+to do the same with arrows and (indeed) there are fonts out there with shaped
+arrows that demand different middle and end pieces. In fact, the same is true for
+rules that are not simple rectangles and radical extensions that are not flat
+rules either. In all these cases the usage patterns of accents and similar
+constructs has not really been fed back into the way \UNICODE\ and \OPENTYPE\
+fonts support math. \footnote {One can argue that this is not what \UNICODE\ is
+for but if so, then some other bits and pieces also make little sense.}
+
+\stopsection
+
+\startsection[title=Bullets]
+
+In \TEX\ usage bullets are a it special. Because fonts had a limited number of slots
+available, bullets in for instance itemized lists traditionally were taken from
+a math font. The bullet in Computer Modern has a comfortable size and is quite
+useful for that. Bullets in text fonts often were (are) relatively small so even when
+they were available they were not really used. The official \UNICODE\ slot for
+bullet is \type {U+2022} and in this font it shows up as \quote {•}. The \WIKIPEDIA\ page
+on bullets (typography) mentions:
+
+\startquotation
+ A variant, the bullet operator (\type {U+2219} ∙ \typ {BULLET OPERATOR}) is
+ used as a math symbol, akin to the dot operator. Specifically, in logic, $x •
+ y$ means logical conjunction. It is the same as saying \quotation {x and y}
+\stopquotation
+
+The page also mentions that \quotation {glyphs such as {\switchtobodyfont
+[stixtwo]$•$} and {\switchtobodyfont [stixtwo]$◦$}} have \quotation {reversed
+variants {\switchtobodyfont [stixtwo]$◘$} and {\switchtobodyfont [stixtwo]$◙$}}
+although we haven't see the reverse once in \TEX\ documents (yet), like these (we
+use \STIX2\ to show them):
+
+\starttabulate[|Tl|l|l|]
+\NC U+2022 \NC \switchtobodyfont[stixtwo]$•$ \NC BULLET \NC \NR
+\NC U+2023 \NC \switchtobodyfont[stixtwo]$‣$ \NC TRIANGULAR BULLET \NC \NR
+\NC U+2043 \NC \switchtobodyfont[stixtwo]$⁃$\NC HYPHEN BULLET \NC \NR
+\NC U+204C \NC \switchtobodyfont[stixtwo]$⁌$\NC LACK LEFTWARDS BULLET \NC \NR
+\NC U+204D \NC \switchtobodyfont[stixtwo]$⁍$\NC LACK RIGHTWARDS BULLET \NC \NR
+\NC U+2219 \NC \switchtobodyfont[stixtwo]$∙$ \NC BULLET OPERATOR (math) \NC \NR
+\NC U+25CB \NC \switchtobodyfont[stixtwo]$○$ \NC WHITE CIRCLE \NC \NR
+\NC U+25CF \NC \switchtobodyfont[stixtwo]$●$ \NC BLACK CIRCLE \NC \NR
+\NC U+25D8 \NC \switchtobodyfont[stixtwo]$◘$ \NC INVERSE BULLET \NC \NR
+\NC U+25E6 \NC \switchtobodyfont[stixtwo]$◦$ \NC WHITE BULLET \NC \NR
+\NC U+29BE \NC \switchtobodyfont[stixtwo]$⦾$ \NC CIRCLED WHITE BULLET \NC \NR
+\NC U+29BF \NC \switchtobodyfont[stixtwo]$⦿$ \NC CIRCLED BULLET \NC \NR
+\stoptabulate
+
+The reverse ones are not really reverse in \STIX2\ as they have bigger circles.
+There are a few more bullets mentioned but probably only because they have the
+word bullet in their description and they don't really look like bullets. Given
+the already discussed lack of granularity in some math symbols with multiple
+usage it is somewhat surprising that we have a math bullet. The weird looking
+left- and rightward bullets are kind of hard to distinguish. Let's hope that
+mathematicians don't discover these!
+
+This brings us to the more general way of looking at these bullets because among
+the popular math symbols used in text are also the triangles and (\TEX) math
+fonts came with. When we have a few commands for circular shapes like \typ
+{$\bullet \bigcirc \circ$} giving $\bullet \bigcirc \circ$ we have plenty of
+(black) triangles.
+
+For instance, we have \type {\triangledown} and \type {\bigtriangledown} and these
+have corresponding \UNICODE\ slots \type {U+25BD} and \type {U+25BF} but when
+you try these in for instance \STIX2, Pagella and Cambria you got:
+▽ + ▿, ▽ + ? and ? + ?, where the question mark indicates a missing character.
+
+It is for that reason that \type {\triangledown} and \type {\bigtriangledown} are
+both defined as using the large one. This test also demonstrated us that we
+didn't have to waste time looking up what \MATHML\ had to tell about it. A
+typeset version of that specification was never a visual highlight and missing
+glyphs only makes that worse. And, when fonts lack shapes no one uses them
+anyway.
+
+However, it makes sense to think a bit about how to deal with this properly, and
+we will likely add some checking to the goodie files for it, so that when we do
+have them, we use them. \footnote {Most practical is to add this information to
+the character database which is a bit of work}. But even then, most troublesome
+is that the size (and even positioning) of these symbols is rather inconsistent
+across math fonts, but because they are seldom used it doesn't make much sense to
+compensate for that (read: we just wait till users ask for it).
+
+% {\switchtobodyfont[stixtwo]$\char"25BD+\char"25BF$}% +\triangledown+\bigtriangledown$
+% {\switchtobodyfont[pagella]$\char"25BD+\char"25BF$}% +\triangledown+\bigtriangledown$
+% {\switchtobodyfont[cambria]$\char"25BD+\char"25BF$}% +\triangledown+\bigtriangledown$
+
+\stopsection
+
+\startsection[title=Punctuation]
+
+There are quite some punctuation symbols in \UNICODE\ but not for math where the
+main troublemakers are the period, comma, colon and semicolon. The first two can
+be used as separator in numbers, in which case we don't want any spacing, or they
+can be part of a (pseudo) sentence in a formula, or they can separate entries in
+a list (take coordinates).
+
+\starttyping
+1.1 + 1.2
+(1.1, 1.2)
+x + 1.1, x + 1.2
+\stoptyping
+
+When used as separator in a sentence, which is more likely in display math than
+in inline math, the spacing after it can be either regular (as in text) or wide.
+And the symbol can come from the math font or text (and these can actually look
+different). In \CONTEXT\ (also pre \LMTX) we have some special trickery at work
+for spacing comma's and periods but we leave that aside now. What should be noted
+is that out|-|of|-|the|-|box spaces are ignored when math is scanned so we cannot
+take that surrounding into account when dealing with spacing in the engine.
+
+Although the \UNICODE\ specification provides a classification of characters that
+includes punctuation in practice we need to deal with it ourselves. For instance,
+by default a period is not considered punctuation but a command and semi colon
+are, while a colon is a relation!
+
+Take for instance $f.$ (math italic f followed by a period). Italic correction
+and math glyphs have this special relationship and it also shows up in
+punctuation. Imagine that we have a sequence of characters, say $fx$. These are
+actually two ordinary atoms but in $f,$ we have an ordinary atom followed by a
+punctuation atom so here spacing is determined by how these classes are set up.
+But, given the shape if the $f$ we actually don't want italic correction here.
+
+\startbuffer
+$fx + f. +f, + f: + f; + a. +a, + a: + a; + x, +x, + x: + x;$%
+\stopbuffer
+
+\startlinecorrection
+\scale[width=\textwidth]{%
+ \getbuffer
+}
+\blank[halfline]
+\scale[width=\textwidth]{%
+ \showmakeup[mathglue]%
+ \mathspacingmode\plusone
+ \showfontitalics
+ \showfontkerns
+ \showglyphs
+ \getbuffer
+}
+\stoplinecorrection
+
+When you zoom in you can see the subtle spacing differences. We can compensate
+for the semi colon being a bit higher than the period by applying some kern,
+something that we can set up in the goodie file.
+
+Actually, if we assume that periods only occur in numbers we can make it
+punctuation and set it up for digit spacing but then commas etc also get done
+that way. A variant is to have two punctuation classes (or cheat and put the
+period in the digit class). No matter what we do, no help can be expected from
+documents mentioned: it's mostly a visual thing anyway.
+
+Let's end with the visual aspect: in most fonts the two colons \type {0x003A} and
+\type {0x2236} are different: one has more distance between the periods. Which
+one? Well, that depends on the font! Latin Modern has a cramped \type {0x2236}
+while \STIX2 has a cramped \type {0x003A}. Cambria has square dots for the
+{0x003A} and round ones slightly more cramped for \type {0x2236}. Lucida goes
+extreme: it has smaller dots far apart for \type {0x2236}. If the idea is that a
+reader should get from the shape what it's about one can wonder if texts get read
+the way the author intended. Of maybe shapes don't matter. Of course a macro
+package can obscure these inconsistencies by setting the math character code of
+\type {0x003A} to \type {0x2236} but that only obscures the fact that little
+attention has been paid: what one can consider bugs became features.
+
+\stopsection
+
+\startsection[title=Special ones]
+
+There are quite some characters that really depend on a math renderer. Examples
+are wide accents, fences, and arrows. Some constructs, like fractions use rules
+and these don't come from \UNICODE\ nor fonts. A mixed case is radicals: there
+is a \UNICODE\ point and fonts can provide larger variants. Normally one steps up
+a slightly slanted version but when things get large the radical becomes an
+extensible and therefore gets an upright shape. The engine is supposed to add a
+horizontal rule at the right location. Interesting is that there is no provision
+for a right end cap. The reason probably is that \TEX, being the major renderer,
+has no combined horizontal and vertical extenders and \OPENTYPE\ doesn't have
+that either. Some properties are driven by the fonts' math parameters which sort
+of makes the radical rendering a very restricted adventure: it is supposed to be
+used for roots only, either of not with a degree anchored in the right top area.
+It looks like that degree is not really to extend much beyond the left edge of
+the symbol.
+
+In \UNICODE\ there is an actuarian character \type {U+20E7} and support in fonts
+is not that good. We do support it because we ran into in \MATHML. However, it is
+a hack. The symbol as provided by fonts is rather useless.
+
+\startbuffer
+$ \sqrt {x + 1} + \annuity{x + 1} $
+\stopbuffer
+
+\typebuffer
+
+Let's see how it renders:
+
+\startlinecorrection
+\scale[width=.5\textwidth]{\getbuffer}
+\stoplinecorrection
+
+We take the dimensions of a radical as template and when we look at the bare
+glyphs we see this:
+
+\startlinecorrection
+\scale[height=2\lineheight]{$\char"221A \enspace \char"20E7$}
+\stoplinecorrection
+
+Basically we have a right actuarian character like we have a left radical. But In
+this case the rule will go left instead of right. This is implemented on top of
+radicals so and driven by \type {\Udelimited} that takes two delimiters and
+doesn't scan for a degree. For two-sided roots (with degree) we have \type
+{\Urooted}. And like normal radicals the delimited one adapts itself to the
+content:
+
+\startbuffer
+$ \sqrt {x + \frac{1}{x}} + \annuity {x + \frac{1}{x}} $
+\stopbuffer
+
+\typebuffer
+
+So we get:
+
+\startlinecorrection
+\scale[width=.5\textwidth]{\showstruts \getbuffer}
+\stoplinecorrection
+
+For the record: in \CONTEXT\ spacing is also driven by the struts and because we
+use the radicals renderer the gap and distance parameters also apply. It might
+look spacy, but keep in mind that we want radicals to look similar when we have
+more of them in line, and we can configure all. We have also enabled the feature
+that radicals at the same level are normalized in height and depth. Here are some
+variants:
+
+\startbuffer
+$ \lannuity {x + \frac{1}{x}} +
+ \rannuity {x + \frac{1}{x}} +
+ \lrannuity {x + \frac{1}{x}} $
+\stopbuffer
+
+\typebuffer
+
+This gives:
+
+\startlinecorrection
+\scale[width=.75\textwidth]{\getbuffer}
+\stoplinecorrection
+
+So we can have a mix of left, right and both end radical like symbols that
+encompass the nucleus. We're not aware of more such characters in \UNICODE\ but
+when they show up we are prepared. Only real usage can result in some parameters
+being fine|-|tuned.
+
+\stopsection
+
+% \startsection[title=Summary]
+%
+% Here we give a summary of some of the things that added on top of \UNICODE\ and
+% \OPENTYPE\ math in order to be able to properly render these more complex atoms
+% and molecules.
+%
+% \stopsection
+
+\startsection[title=Final words]
+
+This text was written in 2022 when we were working on math, extending the goodie
+files with new tweaks, checking support in fonts and updating manuals. But, as we
+moved forward, for instance with adapting \TYPEONE\ support of Antykwa and Iwona
+to the new possibilities again we had to go back in time and figure out why
+actually things were done in certain ways. And I have to admit that we had some
+good laughs and quite some fun on seeing how strange and inconsistent the assumed
+structured and logical \TEX\ ecosystem deals with math. A wrapup like is is never
+complete and we can keep adding to it so just consider it to be a momentary
+impression.
+
+Personally I have to admit that I've always overestimated what happened outside
+the \CONTEXT\ bubble, especially given the claims made. Consistency in \UNICODE\
+math is probably not as good as is could have been and the same is true for
+\OPENTYPE\ math support, but maybe I'm naive in expecting consistency and logic
+in math related work. The mere fact that Donald Knuth pays a lot of attention to
+the math in his writing doesn't automatically translate in all \TEX ies doing the
+same. I don't claim that \CONTEXT\ is doing better but I do hope that its users
+keep going for the best outcome.
+
+\stopsection
+
+\startsection[title=Resources]
+
+\starttyping
+[1] https://en.wikipedia.org/wiki/Slash_(punctuation)
+[2] http://www.unicode.org/reports/tr25
+[3] https://www.w3.org/TR/MathML3
+[4] https://www.unicode.org/Public/math/revision-15/MathClass-15.txt
+[5] https://en.wikipedia.org/wiki/Vertical_bar
+[6] https://en.wikipedia.org/wiki/Dash
+[7] https://en.wikipedia.org/wiki/Commercial_minus_sign
+[8] https://en.wikipedia.org/wiki/Division_sign
+[9] https://en.wikipedia.org/wiki/Bullet_(typography)
+\stoptyping
+
+\stopsection
+
+% After reading the \UNICODE\ report about math I don't feel too guilty when people
+% complain about the \CONTEXT\ manuals. It is a curious mix of discussing
+% organization of symbols, rendering, usage, structure, exchange, parsing,
+% confusion, etc. and it is clearly a mix of experiences with the web, word
+% processing and \TEX\ and as such not that useable because it is just not how
+% \TEX\ works with input and fonts and how users perceive matters. But it
+% definitely helps to get an idea why we ended up with the current situation: the
+% unification of math was more a combination of what was there and not a fresh
+% start. Maybe that is not really possible anyway. If we flash forward a couple of
+% pages it will all look the same to us as stone age chiseling in stone.
+
+\stopchapter
+
+\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
index bccab890a38..2d0e7c09499 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
@@ -29,6 +29,7 @@
\component musings-dontusetex
\component musings-speed
\component musings-texlive
+ \component musings-hownotto
\stopbodymatter
\stopproduct
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-dk.tex b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-dk.tex
index d1df3b8cc7d..bda07ecc9f2 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-dk.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-dk.tex
@@ -9,8 +9,8 @@
At the \CONTEXT\ 2021 meeting I mixed my \TEX\ talks with showing some of the
(upcoming) \LUAMETATEX\ source code. One evening we had a extension party where a
new unit was implemented, the \type {dk}. This event was triggered by a remark
-Hraban [Ramm] made on the participants list in advance of the meeting, where he pointed
-to a Wikipedia article from which we quote:
+Hraban [Ramm] made on the participants list in advance of the meeting, where he
+pointed to a Wikipedia article from which we quote:
\startquotation
In issue 33, Mad published a partial table of the \quotation {Potrzebie System of
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-fairphone.tex b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-fairphone.tex
new file mode 100644
index 00000000000..9d29e5b7bb7
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget-fairphone.tex
@@ -0,0 +1,58 @@
+% language=us runpath=texruns:manuals/ontarget
+
+\startcomponent ontarget-fairphone
+
+\environment ontarget-style
+
+\startchapter[title={\LMTX\ on a phone}]
+
+When my FairPhone~2 started to get issues (running hot and then rebooting) and
+some spare parts became hard to get, I moved on to a FairPhone~4. We're talking
+early 2022. The specifications of that little computer, which comes with a 5 year
+warrantee and long term support are quite okay: a 1080x2340 pixel display, a
+Qualcomm SM7225 Snapdragon 750G (Octa|-|core (2x2.2 GHz Kryo 570 & 6x1.8 GHz Kryo
+570), an Adreno 619 GPU, 8GB memory. an 256GB solid state disk, the usual
+phone gadgets like audio, camera, wireless, bluetooth and gps, and an
+USB Type-C 3.0 connector with support for OTG and DisplayPort.
+
+Why do these specification matter? One reason is that in the compile farm we
+generate binaries for ARM processors and this phone has a decent one. The fast
+cores are in the same league as an over|-|clocked RaspberryPi~4 that we use in
+the compile farm for generating 32~bit binaries; the 64~bit binaries are generated
+in a virtual machine on a Mac Mini. So, in 2023, when looking at that phone, I
+wondered if we could run \LMTX\ on it. I installed the UserLand \LINUX\ stub from
+the Android Playstore and got myself an Ubuntu headless installation. After
+downloading the \LMTX\ installer indeed I could install the distribution on the
+little machine.
+
+A next step was trying to connect the phone to the display on my desk and after
+getting the right USB|-|C cable from the local computer shop I managed to get a
+bit larger terminal although Android~12 seems not able to use the whole 4K
+screen. Putting it in developers mode made it possible to enable the Android
+desktop interface in an external monitor. A bluetooth keyboard and mouse
+completed the setup. Later I tried a \LINUX\ desktop but that was quite a
+disappointment so more research is needed there.
+
+A predictable next step was to see if I could compile the \LUAMETATEX\ source
+that is part of the installation. Installing \GCC\ and \CMAKE\ was easy and indeed
+compilation went pretty well after that.
+
+A quick performance test showed that making a format, which includes generating
+the file database, initially takes 10~seconds but less that 4~seconds once files
+are cached. Processing 1000 paragraphs from the \type {tufte} sample file is done
+with a reasonable 55~pages per second. I didn't test more complex documents but
+that might happen later, when the dock that I ordered has arrived, and when I
+have a decent display setup.
+
+Given the fact that I only use a handful of applications on the laptop one can
+wonder when the moment is there that a properly dockable phone can do the job. Of
+course a disadvantage is that batteries are too small so one needs to provide
+power, but one needs a monitor, keyboard and mouse anyway. Wear and tear of the
+\SSD\ can also be an issue but when storage is plenty that should work out all
+right. Of course it also assumes a stable operating system with one's favourite
+editing platform and viewer available.
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget.tex b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget.tex
index ba79a09bdbc..888a73f4198 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/ontarget/ontarget.tex
@@ -25,6 +25,9 @@
\component ontarget-alsomath
\component ontarget-ridofjit
\component ontarget-gettingridof
+ \component ontarget-registers
+ \component ontarget-fairphone
+ % \component ontarget-mathsizes
\stopbodymatter
\stopdocument
diff --git a/Master/texmf-dist/doc/man/man1/context.man1.pdf b/Master/texmf-dist/doc/man/man1/context.man1.pdf
index 97dbce8cc6a..15d28b40564 100644
--- a/Master/texmf-dist/doc/man/man1/context.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/context.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/luatools.1 b/Master/texmf-dist/doc/man/man1/luatools.1
deleted file mode 100644
index 58de54abfa2..00000000000
--- a/Master/texmf-dist/doc/man/man1/luatools.1
+++ /dev/null
@@ -1,78 +0,0 @@
-.TH "luatools" "1" "01-01-2023" "version 1.35" "ConTeXt TDS Management Tool (aka luatools)"
-.SH NAME
- luatools - ConTeXt TDS Management Tool (aka luatools)
-.SH SYNOPSIS
-.B luatools [
-.I OPTIONS ...
-.B ] [
-.I FILENAMES
-.B ]
-.SH DESCRIPTION
-.B ConTeXt TDS Management Tool (aka luatools)
-.SH OPTIONS
-.TP
-.B --generate
-generate file database
-.TP
-.B --variables
-show configuration variables
-.TP
-.B --configurations
-show configuration order
-.TP
-.B --expand-braces
-expand complex variable
-.TP
-.B --expand-path
-expand variable (resolve paths)
-.TP
-.B --expand-var
-expand variable (resolve references)
-.TP
-.B --show-path
-show path expansion of ...
-.TP
-.B --var-value
-report value of variable
-.TP
-.B --find-file
-report file location
-.TP
-.B --find-path
-report path of file
-.TP
-.B --make
-[or --ini] make luatex format
-.TP
-.B --run
-[or --fmt] run luatex format
-.TP
-.B --compile
-assemble and compile lua inifile
-.TP
-.B --verbose
-give a bit more info
-.TP
-.B --all
-show all found files
-.TP
-.B --format=str
-filter cf format specification (default 'tex', use 'any' for any match)
-.TP
-.B --pattern=str
-filter variables
-.TP
-.B --trackers=list
-enable given trackers
-.SH AUTHOR
-More information about ConTeXt and the tools that come with it can be found at:
-
-
-.B "maillist:"
-ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
-
-.B "webpage:"
-http://www.pragma-ade.nl / http://tex.aanhet.net
-
-.B "wiki:"
-http://contextgarden.net
diff --git a/Master/texmf-dist/doc/man/man1/luatools.man1.pdf b/Master/texmf-dist/doc/man/man1/luatools.man1.pdf
deleted file mode 100644
index 3090d7f2c1d..00000000000
--- a/Master/texmf-dist/doc/man/man1/luatools.man1.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf
index 483896a21e4..02fb444491f 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf
index 27339e653d5..8c21ce6b9ec 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf
index 64446e4fdef..32aa787d6a3 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf
index 884ee03b846..b6f32c15efa 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf
index 6992ba4e649..76d57b5f178 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf
index e6530d07331..2020dac401a 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf
index e36474e88bb..805b63c820f 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf
index 00a8e0ed0b0..e6d1a186400 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-dvi.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-dvi.man1.pdf
index 715362bc3f4..2be5a748d93 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-dvi.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-dvi.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf
index 6d4294eeac5..0ed71e68bfb 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-evohome.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-evohome.man1.pdf
index 15889ae502c..65e18a4219a 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-evohome.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-evohome.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf
index 1d199ad58a7..f12fc84c794 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf
index 4a380c961a6..937f70e2612 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf
index fb2c053748c..249e7d091cf 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf
index c68f75ffb2d..8f1364766ba 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf
index dc4d8414b79..0ddac1f7e24 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf
index 0801e7e42df..e003e758434 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf
index 37386185d12..92ea7abe9d5 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf
index a149d21b87b..4754c1ec0d2 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf
index b7c379e7a8b..f10dc7a6fa8 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-pdf.1 b/Master/texmf-dist/doc/man/man1/mtx-pdf.1
index 54fdb6d14f4..222261a8184 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-pdf.1
+++ b/Master/texmf-dist/doc/man/man1/mtx-pdf.1
@@ -25,6 +25,9 @@ show used fonts (--detail)
.TP
.B --object
show object"/>
+.TP
+.B --links
+show links"/>
.SH AUTHOR
More information about ConTeXt and the tools that come with it can be found at:
diff --git a/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf
index a358ce0f846..3f2e59b4d47 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf
index 9de34783c24..5603f1788d0 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf
index 4de34729fec..cc15dd3f4ed 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf
index 5f5ae5b5c6f..ec60838857d 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf
index 89687f7411c..f8f9fec81bd 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf
index cd3eac2b543..b5012931231 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-spell.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-spell.man1.pdf
index ab7e4216f8b..0ccdc4a80bd 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-spell.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-spell.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf
index fc96c69f6da..a701da1af97 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf
index 5cf1ac64c0b..845cdbf98b8 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf
index fd8f94ac7f3..d2f4d310ab5 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf
index b87dd5f597d..c6177b30ebe 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf
index 11c163e1d7a..b199828bb5c 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf
index d48a73900f2..4ac1a4495ae 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-vscode.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-vscode.man1.pdf
index 6e33b83d966..88c5e56723b 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-vscode.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-vscode.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf
index 12a0428ac76..0f7a07fe999 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf
index aa7d1a0123b..5e871aa578c 100644
--- a/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf b/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf
index 9e02089aba1..5b7e4e1a3db 100644
--- a/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/fonts/map/dvips/context/contnav.map b/Master/texmf-dist/fonts/map/dvips/context/contnav.map
deleted file mode 100644
index 942798c579f..00000000000
--- a/Master/texmf-dist/fonts/map/dvips/context/contnav.map
+++ /dev/null
@@ -1 +0,0 @@
-contnav ContextNavigation <contnav.pfb
diff --git a/Master/texmf-dist/fonts/map/luatex/context/demo-font.lum b/Master/texmf-dist/fonts/map/luatex/context/demo-font.lum
deleted file mode 100644
index 0beca031baa..00000000000
--- a/Master/texmf-dist/fonts/map/luatex/context/demo-font.lum
+++ /dev/null
@@ -1,70 +0,0 @@
-if not modules then modules = { } end modules ['demo-font.lum'] = {
- version = 1.001,
- comment = "companion to font-map.lua",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
---[[
-
- After some testing Taco and I decided that the lack of information
- with regards to unicode mapping of alternative shapes can best be
- handled by an auxiliary table. So, here is an example. This file
- gets its place in TDS in:
-
- <texroot>/fonts/map/luatex/context/demo-file.lum
-
- We recommend that you use a lowercase filename, just to prevent
- lookup errors. Font filenames are already such a mess.
-
- A test file, dedicated to Dohyun Kim is:
-
- \usemodule[fnt-20]
-
- \starttext
-
- \definefontfeature
- [otftracker-kozminprovi-regular]
- [mode=node,vrt2=yes,script=latn]
-
- \setvariables
- [otftracker]
- [font=kozminprovi-regular,
- sample=\char"3002]
-
- \stoptext
-
- In the resulting pdf file you will then find:
-
- begincmap
- /CIDSystemInfo
- << /Registry (TeX)
- /Ordering (FNUMTE-KozMinProVI-Regular)
- /Supplement 0
- >> def
- /CMapName /TeX-Identity-FNUMTE-KozMinProVI-Regular def
- /CMapType 2 def
- 1 begincodespacerange
- <0000> <FFFF>
- endcodespacerange
- 0 beginbfrange
- endbfrange
- 2 beginbfchar
- <027B> <3002>
- <1ED0> <3002>
- endbfchar
- endcmap
-
- Of course this assumes that the font used is the same as we
- have on our machines.
-
-]]--
-
-return {
- version = 1.00,
- fontname = "kozminprovi-regular.otf",
- tounicode = {
- ["Japan1.7888"] = 0x3002,
- },
-}
diff --git a/Master/texmf-dist/fonts/map/pdftex/context/original-context-symbol.map b/Master/texmf-dist/fonts/map/pdftex/context/original-context-symbol.map
deleted file mode 100644
index ace5cfe8e49..00000000000
--- a/Master/texmf-dist/fonts/map/pdftex/context/original-context-symbol.map
+++ /dev/null
@@ -1,3 +0,0 @@
-contnav ContextNavigation <contnav.pfb
-hans Hans-Regular <hans.pfb
-hans-sh Hans-sh-Regular <hans-sh.pfb
diff --git a/Master/texmf-dist/metapost/context/base/mpxl/mp-base.mpxl b/Master/texmf-dist/metapost/context/base/mpxl/mp-base.mpxl
index 9bba87d23b3..ba2012b7e9b 100644
--- a/Master/texmf-dist/metapost/context/base/mpxl/mp-base.mpxl
+++ b/Master/texmf-dist/metapost/context/base/mpxl/mp-base.mpxl
@@ -639,7 +639,9 @@ permanent interpath, solve, buildcycle, tolerance ;
%% units of measure
-mm := 2.83464 ;
+newinternal mm, pt, dd, bp, cm, pc, cc, in, dk, es, ts ;
+
+mm := 2.83464 ; % ibm odd/even rounding
pt := 0.99626 ;
dd := 1.06601 ; % 1.0660068107174
bp := 1 ;
@@ -648,6 +650,8 @@ pc := 11.95517 ;
cc := 12.79213 ;
in := 72 ;
dk := 6.41577 ; % 6.4157650704225 ;
+es := 71.13174 ; % ibm odd/even rounding
+ts := 7.11317 ;
immutable mm, pt, bp, cm, in ; % we don't protect (yet): dd, pc cc (used as locals)
diff --git a/Master/texmf-dist/metapost/context/base/mpxl/mp-xbox.mpxl b/Master/texmf-dist/metapost/context/base/mpxl/mp-xbox.mpxl
index 365bec515c5..bfc844d9ea5 100644
--- a/Master/texmf-dist/metapost/context/base/mpxl/mp-xbox.mpxl
+++ b/Master/texmf-dist/metapost/context/base/mpxl/mp-xbox.mpxl
@@ -10,10 +10,7 @@
% copyright : Public domain
% patched : Hans Hagen
%
-% The code is the same but I've added a boxes_ namespace for some so that we don't
-% clash with metafun.
-
-% The code is the same but I've added s boxes_ namespace for soem so that we don't
+% The code is the same but I've added s boxes_ namespace for somd so that we don't
% clash with metafun. Loading and initialization is now under metafun control.
if known metafun_loaded_xbox : endinput ; fi ;
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-context.lua b/Master/texmf-dist/scripts/context/lua/mtx-context.lua
index 014a7d4efe4..a5dfd5a7d79 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-context.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-context.lua
@@ -704,6 +704,8 @@ function scripts.context.run(ctxdata,filename)
--
a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil
--
+ local changed = { }
+ --
for i=1,#filelist do
--
local filename = filelist[i]
@@ -731,6 +733,10 @@ function scripts.context.run(ctxdata,filename)
-- local jobname = removesuffix(filename)
local ctxname = ctxdata and ctxdata.ctxname
--
+ if changed[jobname] == nil then
+ changed[jobname] = false
+ end
+ --
local analysis = preamble_analyze(filename)
--
if a_mkii or analysis.engine == 'pdftex' or analysis.engine == 'xetex' then
@@ -962,6 +968,7 @@ function scripts.context.run(ctxdata,filename)
if not multipass_forcedruns then
newhash = multipass_hashfiles(jobname)
if multipass_changed(oldhash,newhash) then
+ changed[jobname] = true
oldhash = newhash
else
break
@@ -1096,6 +1103,21 @@ function scripts.context.run(ctxdata,filename)
end
end
--
+ if #filelist > 1 then
+ local done = false
+ for k, v in sortedhash(changed) do
+ if v then
+ if not done then
+ report()
+ done = true
+ end
+ report("file %a was changed",k)
+ end
+ end
+ if done then
+ report()
+ end
+ end
end
function scripts.context.pipe() -- still used?
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-ctan.lua b/Master/texmf-dist/scripts/context/lua/mtx-ctan.lua
index 798a2da02f4..6de51caa3ce 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-ctan.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-ctan.lua
@@ -34,9 +34,9 @@ local helpinfo = [[
<flags>
<category name="basic">
<subcategory>
- <flag name="packages"><short>list available packages</short></flag>
- <flag name="topics"><short>list available topics</short></flag>
- <flag name="detail"><short>show details about package</short></flag>
+ <flag name="packages"><short>list available packages [--field=key|name|caption]</short></flag>
+ <flag name="topics"><short>list available topics [--field=key|name|details]</short></flag>
+ <flag name="details"><short>show details about package</short></flag>
<flag name="pattern" value="string"><short>use this pattern, otherwise first argument</short></flag>
</subcategory>
</category>
@@ -71,7 +71,7 @@ local shaped = characters and characters.shaped or lower
-- what is the url to fetch a zip
-- We cannot use the socket library because we don't compile that massive amount of
--- ssl code into lua(meta)tex. aybe some day one fo these small embedded libraries
+-- ssl code into lua(meta)tex. Maybe some day one fo these small embedded libraries
-- makes sense but there are so many changes in all that security stuff that it
-- defeats long term stability of the ecosystem anyway ... just like some of my old
-- devices suddenly are no longer accessible with modern browsers I expect it to
@@ -185,7 +185,7 @@ scripts.ctan.details = json and
-- report("key : %s",data.key or "-")
report("name : %s",data.name or "-")
report("caption : %s",data.caption or "-")
- report("path : %s",data.ctan.path or "-")
+ report("path : %s",data.ctan and data.ctan.path or "-")
report("")
end
end
@@ -207,7 +207,7 @@ or
scripts.ctan.packages = json and
- function(pattern)
+ function(pattern,field)
local data = validdata(fetched("packages"))
if data then
local found = {
@@ -216,9 +216,26 @@ scripts.ctan.packages = json and
}
pattern = checkedpattern(pattern)
for i=1,#data do
- local entry = data[i]
- if strfound(pattern,entry.caption) then
- found[#found+1] = { entry.key, entry.name, entry.caption }
+ local entry = data[i]
+ local key = entry.key
+ local name = entry.name
+ local caption = entry.caption
+ local where
+ if field == "name" then
+ where = name
+ elseif field == "caption" then
+ where = caption
+ elseif field == "key" then
+ where = key
+ end
+ if where then
+ if strfound(pattern,where) then
+ found[#found+1] = { key, name, caption }
+ end
+ else
+ if strfound(pattern,name) or strfound(pattern,caption) then
+ found[#found+1] = { key, name, caption }
+ end
end
end
showresult(found)
@@ -256,9 +273,27 @@ scripts.ctan.topics = json and
}
pattern = checkedpattern(pattern)
for i=1,#data do
- local entry = data[i]
- if strfound(pattern,entry.details) then
- found[#found+1] = { entry.key or entry.name, entry.details } -- inconsistency between json and xml
+ -- inconsistency between json and xml
+ local entry = data[i]
+ local key = entry.key
+ local name = entry.name
+ local details = entry.details
+ local where
+ if field == "name" then
+ where = name or key
+ elseif field == "details" then
+ where = details
+ elseif field == "key" then
+ where = key or name
+ end
+ if where then
+ if strfound(pattern,where) then
+ found[#found+1] = { key or name, details }
+ end
+ else
+ if strfound(pattern,name) or strfound(pattern,details) then
+ found[#found+1] = { key or name, details }
+ end
end
end
showresult(found)
@@ -292,9 +327,20 @@ local function whatever()
report("")
end
+-- scripts.ctan.packages(environment.argument("pattern") or environment.files[1])
+-- scripts.ctan.packages("font")
+-- scripts.ctan.details("tex")
+-- scripts.ctan.details("ipaex")
+
+-- scripts.ctan.packages("Półtawskiego")
+-- scripts.ctan.packages("Poltawskiego")
+
+-- scripts.ctan.topics("font")
+-- scripts.ctan.topics()
+
if environment.argument("packages") then
whatever()
- scripts.ctan.packages(environment.argument("pattern") or environment.files[1])
+ scripts.ctan.packages(environment.argument("pattern") or environment.files[1], environment.argument("field"))
elseif environment.argument("topics") then
whatever()
scripts.ctan.topics(environment.argument("pattern") or environment.files[1])
@@ -306,14 +352,3 @@ elseif environment.argument("exporthelp") then
else
application.help()
end
-
--- scripts.ctan.packages(environment.argument("pattern") or environment.files[1])
--- scripts.ctan.packages("font")
--- scripts.ctan.details("tex")
--- scripts.ctan.details("ipaex")
-
--- scripts.ctan.packages("Półtawskiego")
--- scripts.ctan.packages("Poltawskiego")
-
--- scripts.ctan.topics("font")
--- scripts.ctan.topics()
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
index 37107ea1e3f..746a010c8a2 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
@@ -358,9 +358,14 @@ local function list_specifications(t,info)
fontweight(entry.fontweight),
}
end
- table.insert(s,1,{"familyname","weight","style","width","variant","fontname","filename","subfont","fontweight"})
- table.insert(s,2,{"","","","","","","","",""})
- utilities.formatters.formatcolumns(s)
+ local h = {
+ {"familyname","weight","style","width","variant","fontname","filename","subfont","fontweight"},
+ {"","","","","","","","",""}
+ }
+ utilities.formatters.formatcolumns(s,false,h)
+ for k=1,#h do
+ write_nl(h[k])
+ end
for k=1,#s do
write_nl(s[k])
end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-install-tikz.lua b/Master/texmf-dist/scripts/context/lua/mtx-install-tikz.lua
new file mode 100644
index 00000000000..74a2922418a
--- /dev/null
+++ b/Master/texmf-dist/scripts/context/lua/mtx-install-tikz.lua
@@ -0,0 +1,162 @@
+if not modules then modules = { } end modules ['mtx-install-tikz'] = {
+ version = 1.234,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen",
+ copyright = "ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Installing tikz is a bit tricky because there are many packages involved and it's
+-- sort of impossible to derive from the names what to include in the installation.
+-- I tried to use the ctan scrips we ship but there is no way to reliably derive a
+-- set from the topics or packages using the web api (there are also some
+-- inconsistencies between the jkson and xml interfaces that will not be fixed). A
+-- wildcard pull of everything tikz/pgf is likely to fail or at least gives files we
+-- don't want and/or need, the solution is to be specific.
+--
+-- We use curl and not the built in socket library because all kind of ssl and
+-- redirection can kick in and who know how it evolves.
+--
+-- We use the context unzipper because we cannot be sure if unzip is present on the
+-- system. In many cases windows, linux and osx installations lack it by default.
+--
+-- This script has no help info etc as it's a rather dumb downloader. One can always
+-- do a better job than this suboptimal quick hack. Let me know if I forget to wipe
+-- something.
+--
+-- mtxrun --script install-tikz
+--
+-- It should be run in the tex root and will quit when there is no texmf-context
+-- path found. The modules path will be created when absent.
+
+local okay, curl = pcall(require,"libs-imp-curl")
+
+local fetched = curl and curl.fetch and function(str)
+ local data, message = curl.fetch {
+ url = str,
+ followlocation = true,
+ sslverifyhost = false,
+ sslverifypeer = false,
+ }
+ if not data then
+ report("some error: %s",message)
+ end
+ return data
+end or function(str)
+ -- So, no redirect to http, which means that we cannot use the built in socket
+ -- library. What if the client is happy with http?
+ local data = os.resultof("curl -sSL " .. str)
+ return data
+end
+
+local ctanurl = "https://mirrors.ctan.org/install"
+local tmpzipfile = "temp.zip"
+local checkdir = "texmf-context"
+local targetdir = "texmf-modules"
+
+local report = logs.reporter("install")
+
+scripts = scripts or { }
+scripts.ctan = scripts.ctan or { }
+
+function scripts.ctan.install(list)
+ if type(list) ~= "table"then
+ report("unknown specification")
+ end
+ local zips = list.zips
+ local wipes = list.wipes
+ if type(zips) ~= "table" or type(wipes) ~= "table" then
+ report("incomplete specification")
+ elseif not lfs.isdir(checkdir) then
+ report("unknown subdirectory %a",checkdir)
+ elseif not dir.mkdirs(targetdir) then
+ report("unable to create %a",targetdir)
+ elseif not lfs.chdir(targetdir) then
+ report("unable to go into %a",targetdir)
+ else
+ report("installing into %a",targetdir)
+ for i=1,#zips do
+ local where = ctanurl .. "/" .. zips[i]
+ local data = fetched(where)
+ if string.find(data,"^PK") then
+ io.savedata(tmpzipfile,data)
+ report("from %a",where)
+ report("into %a",targetdir)
+ utilities.zipfiles.unzipdir {
+ zipname = tmpzipfile,
+ path = ".",
+ verbose = "steps",
+ }
+ os.remove(tmpzipfile)
+ else
+ report("unknown %a",where)
+ end
+ end
+
+ local function wiper(wipes)
+ for i=1,#wipes do
+ local s = wipes[i]
+ if type(s) == "table" then
+ wiper(s)
+ elseif type(s) == "string" then
+ local t = dir.glob(s)
+ report("wiping %i files in %a",#t,s)
+ for i=1,#t do
+ os.remove(t[i])
+ end
+ end
+ end
+ end
+
+ wiper(wipes)
+
+ report("renewing file database")
+ resolvers.renewcache()
+ resolvers.load()
+ end
+end
+
+local function wipers(s)
+ return {
+ "tex/context/third/" ..s.. "/**",
+ "doc/context/third/" ..s.. "/**",
+ "source/context/third/" ..s.. "/**",
+
+ "tex/context/" ..s.. "/**",
+ "doc/context/" ..s.. "/**",
+ "source/context/" ..s.. "/**",
+
+ "scripts/" ..s.. "/**",
+ }
+end
+
+local defaults = {
+ "tex/latex/**",
+ "tex/plain/**",
+
+ "doc/latex/**",
+ "doc/plain/**",
+ "doc/generic/**",
+
+ "source/latex/**",
+ "source/plain/**",
+ "source/generic/**",
+}
+
+local lists = {
+ tikz = {
+ zips = {
+ "graphics/pgf/base/pgf.tds.zip",
+ "graphics/pgf/contrib/pgfplots.tds.zip",
+ "graphics/pgf/contrib/circuitikz.tds.zip",
+ },
+ wipes = {
+ wipers("pgf"),
+ wipers("pgfplots"),
+ wipers("circuitikz"),
+ defaults,
+ }
+ },
+}
+
+scripts.ctan.install(lists.tikz)
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-install.lua b/Master/texmf-dist/scripts/context/lua/mtx-install.lua
index 7efd8f5edee..4b590128245 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-install.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-install.lua
@@ -124,9 +124,9 @@ local platforms = {
--
["linux-armhf"] = "linux-armhf",
--
- ["openbsd"] = "openbsd7.2",
- ["openbsd-i386"] = "openbsd7.2",
- ["openbsd-amd64"] = "openbsd7.2-amd64",
+ ["openbsd"] = "openbsd7.3",
+ ["openbsd-i386"] = "openbsd7.3",
+ ["openbsd-amd64"] = "openbsd7.3-amd64",
--
["freebsd"] = "freebsd",
["freebsd-i386"] = "freebsd",
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-pdf.lua b/Master/texmf-dist/scripts/context/lua/mtx-pdf.lua
index 0ce17ec5b56..05973d2365d 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-pdf.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-pdf.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['mtx-pdf'] = {
local tonumber = tonumber
local format, gmatch, gsub, match, find = string.format, string.gmatch, string.gsub, string.match, string.find
local utfchar = utf.char
-local concat = table.concat
+local concat, insert, swapped = table.concat, table.insert, table.swapped
local setmetatableindex, sortedhash, sortedkeys = table.setmetatableindex, table.sortedhash, table.sortedkeys
local helpinfo = [[
@@ -28,6 +28,7 @@ local helpinfo = [[
<flag name="pretty"><short>replace newlines in metadata</short></flag>
<flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag>
<flag name="object"><short>show object"/></short></flag>
+ <flag name="links"><short>show links"/></short></flag>
</subcategory>
<subcategory>
<example><command>mtxrun --script pdf --info foo.pdf</command></example>
@@ -365,6 +366,110 @@ function scripts.pdf.object(filename,n)
end
end
+function scripts.pdf.links(filename,asked)
+ local pdffile = loadpdffile(filename)
+ if pdffile then
+
+ local pages = pdffile.pages
+ local nofpages = pdffile.nofpages
+
+ if asked and (asked < 1 or asked > nofpages) then
+ report("")
+ report("no page %i, last page %i",asked,nofpages)
+ report("")
+ return
+ end
+
+ local reverse = swapped(pages)
+
+ local function show(pagenumber)
+ local page = pages[pagenumber]
+ local annots = page.Annots
+ if annots then
+ report("")
+ report("annotations @ page %i",pagenumber)
+ report("")
+ for i=1,#annots do
+ local annot = annots[i]
+ if annot.Subtype == "Link" then
+ local A = annot.A
+ if A then
+ local S = A.S
+ local D = A.D
+ if S == "GoTo" then
+ if D then
+ local D1 = D[1]
+ local R1 = reverse[D1]
+ if tonumber(R1) then
+ report("intern, page % 4i",R1 or 0)
+ else
+ report("intern, name %s",tostring(D1))
+ end
+ end
+ elseif S == "GoToR" then
+ if D then
+ local F = A.F
+ if F then
+ local D1 = D[1]
+ if tonumber(D1) then
+ report("extern, page % 4i, file %s",D1 + 1,F)
+ else
+ report("extern, page % 4i, file %s, name %s",0,F,D[1])
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ if asked then
+ show(asked)
+ else
+ for pagenumber=1,nofpages do
+ show(pagenumber)
+ end
+ end
+
+ local destinations = pdffile.destinations
+ if destinations then
+ if asked then
+ report("")
+ report("destinations to page %i",asked)
+ report("")
+ for k, v in sortedhash(destinations) do
+ local D = v.D
+ if D then
+ local p = reverse[D[1]] or 0
+ if p == asked then
+ report(k)
+ end
+ end
+ end
+ else
+ report("")
+ report("destinations")
+ report("")
+ local list = setmetatableindex("table")
+ for k, v in sortedhash(destinations) do
+ local D = v.D
+ if D then
+ local p = reverse[D[1]]
+ report("tag %s, page % 4i",k,p)
+ insert(list[p],k)
+ end
+ end
+ for k, v in sortedhash(list) do
+ report("")
+ report("page %i, names % t",k,v)
+ end
+ end
+ end
+ end
+end
+
-- scripts.pdf.info("e:/tmp/oeps.pdf")
-- scripts.pdf.metadata("e:/tmp/oeps.pdf")
-- scripts.pdf.fonts("e:/tmp/oeps.pdf")
@@ -382,6 +487,8 @@ elseif environment.argument("fonts") then
scripts.pdf.fonts(filename)
elseif environment.argument("object") then
scripts.pdf.object(filename,tonumber(environment.argument("object")))
+elseif environment.argument("links") then
+ scripts.pdf.links(filename,tonumber(environment.argument("page")))
elseif environment.argument("exporthelp") then
application.export(environment.argument("exporthelp"),filename)
else
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-update.lua b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
index daf23eb0911..19e3e686581 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-update.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
@@ -178,9 +178,9 @@ update.platforms = {
--
["linux-armhf"] = "linux-armhf",
--
- ["openbsd"] = "openbsd7.2",
- ["openbsd-i386"] = "openbsd7.2",
- ["openbsd-amd64"] = "openbsd7.2-amd64",
+ ["openbsd"] = "openbsd7.3",
+ ["openbsd-i386"] = "openbsd7.3",
+ ["openbsd-amd64"] = "openbsd7.3-amd64",
--
["freebsd"] = "freebsd",
["freebsd-i386"] = "freebsd",
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index cd83189a40f..f8ef741105e 100644
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -8657,7 +8666,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 14071, stripped down to: 10417
+-- original size: 14107, stripped down to: 10453
if not modules then modules={} end modules ['util-sac']={
version=1.001,
@@ -9136,13 +9145,13 @@ if bit32 and not streams.tocardinal1 then
local extract=bit32.extract
local char=string.char
streams.tocardinal1=char
- function streams.tocardinal2(n) return char(extract(8,8),extract(0,8)) end
- function streams.tocardinal3(n) return char(extract(16,8),extract(8,8),extract(0,8)) end
- function streams.tocardinal4(n) return char(extract(24,8),extract(16,8),extract(8,8),extract(0,8)) end
+ function streams.tocardinal2(n) return char(extract(n,8,8),extract(n,0,8)) end
+ function streams.tocardinal3(n) return char(extract(n,16,8),extract(n,8,8),extract(n,0,8)) end
+ function streams.tocardinal4(n) return char(extract(n,24,8),extract(n,16,8),extract(n,8,8),extract(n,0,8)) end
streams.tocardinal1le=char
- function streams.tocardinal2le(n) return char(extract(0,8),extract(8,8)) end
- function streams.tocardinal3le(n) return char(extract(0,8),extract(8,8),extract(16,8)) end
- function streams.tocardinal4le(n) return char(extract(0,8),extract(8,8),extract(16,8),extract(24,8)) end
+ function streams.tocardinal2le(n) return char(extract(n,0,8),extract(n,8,8)) end
+ function streams.tocardinal3le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8)) end
+ function streams.tocardinal4le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8),extract(n,24,8)) end
end
if not streams.readcstring then
local readchar=streams.readchar
@@ -9338,7 +9347,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 25542, stripped down to: 16783
+-- original size: 25716, stripped down to: 16805
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9546,7 +9555,9 @@ function parsers.groupedsplitat(symbol,withaction)
if not pattern then
local symbols=S(symbol)
local separator=space^0*symbols*space^0
- local value=lbrace*C((nobrace+nestedbraces)^0)*rbrace+C((nestedbraces+(1-(space^0*(symbols+P(-1)))))^0)
+ local value=lbrace*C((nobrace+nestedbraces)^0)
+*(rbrace*(#symbols+P(-1)))
++C((nestedbraces+(1-(space^0*(symbols+P(-1)))))^0)
if withaction then
local withvalue=Carg(1)*value/function(f,s) return f(s) end
pattern=spaces*withvalue*(separator*withvalue)^0
@@ -9940,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9953,19 +9964,21 @@ 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 tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9987,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ 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
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -14760,7 +14803,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 21145, stripped down to: 13271
+-- original size: 21146, stripped down to: 13272
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15070,7 +15113,7 @@ local runners={
if trace then
report("resultof: %s",command)
end
- local handle=iopopen(command,"r")
+ local handle=iopopen(command,"rb")
if handle then
local result=handle:read("*all") or ""
handle:close()
@@ -16395,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17876,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19127,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19196,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21703,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22238,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22306,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24247,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24465,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -25806,7 +25851,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11691, stripped down to: 8350
+-- original size: 12056, stripped down to: 8398
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -26093,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.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-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035743
--- stripped bytes : 408144
+-- original bytes : 1037585
+-- stripped bytes : 408686
-- end library merge
diff --git a/Master/texmf-dist/scripts/context/lua/texlua.lua b/Master/texmf-dist/scripts/context/lua/texlua.lua
new file mode 100644
index 00000000000..5c0524a56e3
--- /dev/null
+++ b/Master/texmf-dist/scripts/context/lua/texlua.lua
@@ -0,0 +1,141 @@
+-- version = 1.000,
+-- comment = "companion to luametatex",
+-- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+-- copyright = "PRAGMA ADE / ConTeXt Development Team",
+-- license = "see context related readme files"
+
+-- If you copy or link 'luametatex' to 'texlua' and put this script in the same path
+-- we have a more pure Lua runner (as with luatex and texlua).
+
+-- todo: error trace
+-- todo: protect these locals
+
+local texlua_load = load
+local texlua_loadfile = loadfile
+local texlua_type = type
+local texlua_xpcall = xpcall
+local texlua_find = string.find
+local texlua_dump = string.dump
+local texlua_open = io.open
+local texlua_print = print
+local texlua_show = luac.print
+
+function texlua_inspect(v)
+ if texlua_type(v) == "function" then
+ local ok, str = texlua_xpcall(texlua_dump,function() end,v)
+ if ok then
+ v = str
+ end
+ end
+ if type(v) == "string" then
+ texlua_show(v,true)
+ else
+ texlua_print(v)
+ end
+end
+
+local function main_execute(str,loader)
+ if str and str ~= "" then
+ local str = loader(str)
+ if texlua_type(str) == "function" then
+ str()
+ end
+ end
+end
+
+local function main_compile(str,loader,out,strip)
+ if str and str ~= "" then
+ local str = loader(str)
+ if texlua_type(str) == "function" then
+ str = texlua_dump(str,strip)
+ if type(out) == "string" and out ~= "" then
+ local f = texlua_open(out,"wb")
+ if f then
+ f:write(str)
+ f:close()
+ end
+ elseif out == true then
+ texlua_inspect(str)
+ else
+ texlua_print(str)
+ end
+ end
+ end
+end
+
+local function main_help()
+ texlua_print("LuaMetaTeX in Lua mode:")
+ texlua_print("")
+ texlua_print("-o 'filename' output filename")
+ texlua_print("-e 'string' execute loaded string")
+ texlua_print("-f 'filename' execute loaded file")
+ texlua_print("-d 'string' dump bytecode of loaded string")
+ texlua_print("-c 'filename' dump bytecode of loaded file")
+ texlua_print("-i 'string' list bytecode of loaded string")
+ texlua_print("-l 'filename' list bytecode of loaded file")
+ texlua_print("-s strip byte code")
+ texlua_print(" 'filename' execute loaded file")
+end
+
+local function main()
+ local i = 1
+ local o = ""
+ local s = false
+ while true do
+ local option = arg[i] or ""
+ if option == "" then
+ if i == 1 then
+ main_help()
+ end
+ break
+ elseif option == "-e" then
+ i = i + 1
+ main_execute(arg[i],texlua_load)
+ o = ""
+ s = false
+ elseif option == "-f" then
+ i = i + 1
+ main_execute(arg[i],texlua_loadfile)
+ o = ""
+ s = false
+ elseif option == "-d" then
+ i = i + 1
+ main_compile(arg[i],texlua_load,o,s)
+ o = ""
+ s = false
+ elseif option == "-c" then
+ i = i + 1
+ main_compile(arg[i],texlua_loadfile,o,s)
+ o = ""
+ s = false
+ elseif option == "-i" then
+ i = i + 1
+ main_compile(arg[i],texlua_load,true)
+ o = ""
+ s = false
+ elseif option == "-l" then
+ i = i + 1
+ main_compile(arg[i],texlua_loadfile,true)
+ o = ""
+ s = false
+ elseif option == "-s" then
+ s = true
+ elseif option == "-o" then
+ i = i + 1
+ o = arg[i] or ""
+ if texlua_find(o,"^%-") then
+ help()
+ break
+ end
+ elseif not texlua_find(option,"^%-") then
+ main_execute(option,texlua_loadfile)
+ break
+ else
+ main_help()
+ break
+ end
+ i = i + 1
+ end
+end
+
+main()
diff --git a/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua b/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua
index 77f55964f8f..cf3ed87fcb9 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua
@@ -6,12 +6,9 @@ if not modules then modules = { } end modules ['anch-pos'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>We save positional information in the main utility table. Not only
-can we store much more information in <l n='lua'/> but it's also
-more efficient.</p>
---ldx]]--
-
+-- We save positional information in the main utility table. Not only can we store
+-- much more information in Lua but it's also more efficient.
+--
-- plus (extra) is obsolete but we will keep it for a while
--
-- maybe replace texsp by our own converter (stay at the lua end)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua
index b05c343e598..cd1a0c54916 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua
@@ -9,10 +9,8 @@ if not modules then modules = { } end modules ['attr-ini'] = {
local next, type = next, type
local osexit = os.exit
---[[ldx--
-<p>We start with a registration system for atributes so that we can use the
-symbolic names later on.</p>
---ldx]]--
+-- We start with a registration system for atributes so that we can use the symbolic
+-- names later on.
local nodes = nodes
local context = context
@@ -54,17 +52,13 @@ storage.register("attributes/list", list, "attributes.list")
-- end
-- end
---[[ldx--
-<p>We reserve this one as we really want it to be always set (faster).</p>
---ldx]]--
+-- We reserve this one as we really want it to be always set (faster).
names[0], numbers["fontdynamic"] = "fontdynamic", 0
---[[ldx--
-<p>private attributes are used by the system and public ones are for users. We use dedicated
-ranges of numbers for them. Of course a the <l n='context'/> end a private attribute can be
-accessible too, so a private attribute can have a public appearance.</p>
---ldx]]--
+-- Private attributes are used by the system and public ones are for users. We use
+-- dedicated ranges of numbers for them. Of course a the TeX end a private attribute
+-- can be accessible too, so a private attribute can have a public appearance.
sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or 15 -- very private
sharedstorage.attributes_last_public = sharedstorage.attributes_last_public or 1024 -- less private
diff --git a/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv b/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv
index 544558dcf3f..a784dd9d8c4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv
@@ -20,6 +20,7 @@
\unexpanded\def\definemarker [#1]{\defineattribute[\s!marker:#1]}
\unexpanded\def\setmarker [#1]#2[#3]{\dosetattribute{\s!marker:#1}{#3}}
\unexpanded\def\resetmarker [#1]{\dogetattribute{\s!marker:#1}}
- \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\numexpr \numexpr#2\relax}
+ \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\relax \numexpr\numexpr#2\relax}
+\unexpanded\def\marker #1{\numexpr\dogetattributeid{\s!marker:#1}\relax}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua b/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua
index baeb3d2f9af..b7e478004a7 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua
@@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['bibl-bib'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This is a prelude to integrated bibliography support. This file just loads
-bibtex files and converts them to xml so that the we access the content
-in a convenient way. Actually handling the data takes place elsewhere.</p>
---ldx]]--
+-- This is a prelude to integrated bibliography support. This file just loads bibtex
+-- files and converts them to xml so that the we access the content in a convenient
+-- way. Actually handling the data takes place elsewhere.
local lower, format, gsub, concat = string.lower, string.format, string.gsub, table.concat
local next = next
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
index 5e9d7d05a8b..1d4c130e918 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
@@ -67155,6 +67155,7 @@ characters.data={
description="MINUS SIGN",
direction="es",
linebreak="pr",
+ mathextensible="h",
mathgroup="binary arithmetic",
mathspec={
{
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
index db1b85cc5d1..627ba072c70 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
@@ -36,20 +36,16 @@ local trace_defining = false trackers.register("characters.defining", fu
local report_defining = logs.reporter("characters")
---[[ldx--
-<p>This module implements some methods and creates additional datastructured
-from the big character table that we use for all kind of purposes:
-<type>char-def.lua</type>.</p>
-
-<p>We assume that at this point <type>characters.data</type> is already
-loaded!</p>
---ldx]]--
-
+-- This module implements some methods and creates additional datastructured from
+-- the big character table that we use for all kind of purposes: 'char-def.lua'.
+--
+-- We assume that at this point 'characters.data' is already populated!
+--
-- todo: in 'char-def.lua' assume defaults:
--
--- directions = l
--- cjkwd = a
--- linebreak = al
+-- directions = l
+-- cjkwd = a
+-- linebreak = al
characters = characters or { }
local characters = characters
@@ -62,9 +58,7 @@ else
os.exit()
end
---[[ldx--
-Extending the table.
---ldx]]--
+-- Extending the table.
if context and CONTEXTLMTXMODE == 0 then
@@ -84,9 +78,7 @@ if context and CONTEXTLMTXMODE == 0 then
end
---[[ldx--
-<p>This converts a string (if given) into a number.</p>
---ldx]]--
+-- This converts a string (if given) into a number.
local pattern = (P("0x") + P("U+")) * ((R("09","AF")^1 * P(-1)) / function(s) return tonumber(s,16) end)
@@ -957,10 +949,8 @@ characters.bidi = allocate {
on = "Other Neutrals",
}
---[[ldx--
-<p>At this point we assume that the big data table is loaded. From this
-table we derive a few more.</p>
---ldx]]--
+-- At this point we assume that the big data table is loaded. From this table we
+-- derive a few more.
if not characters.fallbacks then
@@ -1037,10 +1027,8 @@ setmetatableindex(characters.textclasses,function(t,k)
return false
end)
---[[ldx--
-<p>Next comes a whole series of helper methods. These are (will be) part
-of the official <l n='api'/>.</p>
---ldx]]--
+-- Next comes a whole series of helper methods. These are (will be) part of the
+-- official API.
-- we could make them virtual: characters.contextnames[n]
@@ -1433,9 +1421,7 @@ function characters.lettered(str,spacing)
return concat(new)
end
---[[ldx--
-<p>Requesting lower and uppercase codes:</p>
---ldx]]--
+-- Requesting lower and uppercase codes:
function characters.uccode(n) return uccodes[n] end -- obsolete
function characters.lccode(n) return lccodes[n] end -- obsolete
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua b/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua
index 7f544b14784..09547d00540 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua
@@ -42,17 +42,14 @@ local trace_defining = false trackers.register("characters.defining", fu
local report_defining = logs.reporter("characters")
---[[ldx--
-<p>In order to deal with 8-bit output, we need to find a way to go from <l n='utf'/> to
-8-bit. This is handled in the <l n='luatex'/> engine itself.</p>
-
-<p>This leaves us problems with characters that are specific to <l n='tex'/> like
-<type>{}</type>, <type>$</type> and alike. We can remap some chars that tex input files
-are sensitive for to a private area (while writing to a utility file) and revert then
-to their original slot when we read in such a file. Instead of reverting, we can (when
-we resolve characters to glyphs) map them to their right glyph there. For this purpose
-we can use the private planes 0x0F0000 and 0x100000.</p>
---ldx]]--
+-- In order to deal with 8-bit output, we need to find a way to go from UTF to
+-- 8-bit. This is handled in the 32 bit engine itself. This leaves us problems with
+-- characters that are specific to TeX, like curly braces and dollars. We can remap
+-- some chars that tex input files are sensitive for to a private area (while
+-- writing to a utility file) and revert then to their original slot when we read in
+-- such a file. Instead of reverting, we can (when we resolve characters to glyphs)
+-- map them to their right glyph there. For this purpose we can use the private
+-- planes 0x0F0000 and 0x100000.
local low = allocate()
local high = allocate()
@@ -102,21 +99,6 @@ private.escape = utf.remapper(escapes) -- maybe: ,"dynamic"
private.replace = utf.remapper(low) -- maybe: ,"dynamic"
private.revert = utf.remapper(high) -- maybe: ,"dynamic"
---[[ldx--
-<p>We get a more efficient variant of this when we integrate
-replacements in collapser. This more or less renders the previous
-private code redundant. The following code is equivalent but the
-first snippet uses the relocated dollars.</p>
-
-<typing>
-[󰀤x󰀤] [$x$]
-</typing>
---ldx]]--
-
--- using the tree-lpeg-mapper would be nice but we also need to deal with end-of-string
--- cases: "\"\i" and don't want "\relax" to be seen as \r e lax" (for which we need to mess
--- with spaces
-
local accentmapping = allocate {
['"'] = { [""] = "¨",
A = "Ä", a = "ä",
@@ -452,10 +434,8 @@ implement { -- a waste of scanner but consistent
actions = texcharacters.defineaccents
}
---[[ldx--
-<p>Instead of using a <l n='tex'/> file to define the named glyphs, we
-use the table. After all, we have this information available anyway.</p>
---ldx]]--
+-- Instead of using a TeX file to define the named glyphs, we use the table. After
+-- all, we have this information available anyway.
function commands.makeactive(n,name) -- not used
contextsprint(ctxcatcodes,format("\\catcode%s=13\\unexpanded\\def %s{\\%s}",n,utfchar(n),name))
@@ -747,9 +727,7 @@ function characters.setactivecatcodes(cct)
tex.catcodetable = saved
end
---[[ldx--
-<p>Setting the lccodes is also done in a loop over the data table.</p>
---ldx]]--
+-- -- Setting the lccodes is also done in a loop over the data table.
-- function characters.setcodes() -- we could loop over csletters
-- if trace_defining then
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua b/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua
index e230370b5d9..f9cba36ca5c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua
@@ -6,21 +6,19 @@ if not modules then modules = { } end modules ['char-utf'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>When a sequence of <l n='utf'/> characters enters the application, it may be
-neccessary to collapse subsequences into their composed variant.</p>
-
-<p>This module implements methods for collapsing and expanding <l n='utf'/>
-sequences. We also provide means to deal with characters that are special to
-<l n='tex'/> as well as 8-bit characters that need to end up in special kinds
-of output (for instance <l n='pdf'/>).</p>
-
-<p>We implement these manipulations as filters. One can run multiple filters
-over a string.</p>
-
-<p>The old code has now been moved to char-obs.lua which we keep around for
-educational purposes.</p>
---ldx]]--
+-- When a sequence of UTF characters enters the application, it may be
+-- neccessary to collapse subsequences into their composed variant.
+--
+-- This module implements methods for collapsing and expanding UTF sequences. We
+-- also provide means to deal with characters that are special to TeX as well as
+-- 8-bit characters that need to end up in special kinds of output (for instance
+-- PDF).
+--
+-- We implement these manipulations as filters. One can run multiple filters over a
+-- string.
+--
+-- The old code has now been moved to char-obs.lua which we keep around for
+-- educational purposes.
local next, type = next, type
local gsub, find = string.gsub, string.find
@@ -55,10 +53,8 @@ characters.filters.utf = utffilters
local data = characters.data
---[[ldx--
-<p>It only makes sense to collapse at runtime, since we don't expect source code
-to depend on collapsing.</p>
---ldx]]--
+-- It only makes sense to collapse at runtime, since we don't expect source code to
+-- depend on collapsing.
-- for the moment, will be entries in char-def.lua .. this is just a subset that for
-- typographic (font) reasons we want to have split ... if we decompose all, we get
diff --git a/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua
index f7d10ffa272..06049807a69 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua
@@ -19,11 +19,9 @@ local cpatterns = patterns.context
chemistry = chemistry or { }
local chemistry = chemistry
---[[
-<p>The next code started out as adaptation of code from Wolfgang Schuster as
-posted on the mailing list. The current version supports nested braces and
-unbraced integers as scripts.</p>
-]]--
+-- The next code started out as adaptation of code from Wolfgang Schuster as posted
+-- on the mailing list. The current version supports nested braces and unbraced
+-- integers as scripts.
local moleculeparser = cpatterns.scripted
chemistry.moleculeparser = moleculeparser
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
index 9b5e705ca78..b7f1628622f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
@@ -455,11 +455,11 @@ end
if CONTEXTLMTXMODE > 0 then
- callback.register("show_lua_call", function(what, slot)
+ callbacks.register("show_lua_call", function(what, slot)
local name = namesofscanners[slot]
-- return name and formatters["%s: \\%s, slot: %i"](what,name,slot) or ""
return name and formatters["%s \\%s"](what,name) or ""
- end)
+ end, "provide lua call details")
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
index 22e4d4baeac..a3bc4164e7c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.03.10 12:15}
+\newcontextversion{2023.05.05 18:36}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
index 80d04bf9d5f..1ef4503ab17 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
@@ -13,7 +13,7 @@
%D There is some residual code in \MKIV\ that results from the transition to \LMTX\
%D but removeing it can have side effects due to oversights. There is no impact on
-%D performance to I leave at that.
+%D performance to I leave at that.
% Here is some timing (2015-04-01) luajittex format generation:
%
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.03.10 12:15}
+\edef\contextversion{2023.05.05 18:36}
%D Kind of special:
diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-con.lua b/Master/texmf-dist/tex/context/base/mkiv/core-con.lua
index f57eb6ef890..d3e108a7a3d 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/core-con.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/core-con.lua
@@ -8,13 +8,9 @@ if not modules then modules = { } end modules ['core-con'] = {
-- todo: split into lang-con.lua and core-con.lua
---[[ldx--
-<p>This module implements a bunch of conversions. Some are more
-efficient than their <l n='tex'/> counterpart, some are even
-slower but look nicer this way.</p>
-
-<p>Some code may move to a module in the language namespace.</p>
---ldx]]--
+-- This module implements a bunch of conversions. Some are more efficient than their
+-- TeX counterpart, some are even slower but look nicer this way. Some code may move
+-- to a module in the language namespace.
local floor = math.floor
local osdate, ostime, ostimezone = os.date, os.time, os.timezone
diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua b/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua
index b58a801d964..89521b1851f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua
@@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['core-dat'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This module provides a (multipass) container for arbitrary data. It
-replaces the twopass data mechanism.</p>
---ldx]]--
+-- This module provides a (multipass) container for arbitrary data. It replaces the
+-- twopass data mechanism.
local tonumber, tostring, type = tonumber, tostring, type
@@ -231,9 +229,7 @@ implement {
actions = datasetvariablefromjob
}
---[[ldx--
-<p>We also provide an efficient variant for page states.</p>
---ldx]]--
+-- We also provide an efficient variant for page states.
local collected = allocate()
local tobesaved = allocate()
@@ -250,13 +246,9 @@ local function initializer()
tobesaved = pagestates.tobesaved
end
-job.register('job.pagestates.collected', tobesaved, initializer, nil)
+job.register("job.pagestates.collected", tobesaved, initializer, nil)
-table.setmetatableindex(tobesaved, function(t,k)
- local v = { }
- t[k] = v
- return v
-end)
+table.setmetatableindex(tobesaved, "table")
local function setstate(settings)
local name = settings.name
diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-two.lua b/Master/texmf-dist/tex/context/base/mkiv/core-two.lua
index 3ab2112b9aa..da37a617067 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/core-two.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/core-two.lua
@@ -6,15 +6,14 @@ if not modules then modules = { } end modules ['core-two'] = {
license = "see context related readme files"
}
+-- This is actually one of the oldest MkIV files and basically a port of MkII but
+-- the old usage has long be phased out. Also, the public part is now handled by
+-- datasets which makes this a more private store.
+
local next = next
local remove, concat = table.remove, table.concat
local allocate = utilities.storage.allocate
---[[ldx--
-<p>We save multi-pass information in the main utility table. This is a
-bit of a mess because we support old and new methods.</p>
---ldx]]--
-
local collected = allocate()
local tobesaved = allocate()
diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua b/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua
index 887ef9a7536..e8a28c187ce 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua
@@ -6,16 +6,13 @@ if not modules then modules = { } end modules ['core-uti'] = {
license = "see context related readme files"
}
--- todo: keep track of changes here (hm, track access, and only true when
--- accessed and changed)
-
---[[ldx--
-<p>A utility file has always been part of <l n='context'/> and with
-the move to <l n='luatex'/> we also moved a lot of multi-pass info
-to a <l n='lua'/> table. Instead of loading a <l n='tex'/> based
-utility file under different setups, we now load a table once. This
-saves much runtime but at the cost of more memory usage.</p>
---ldx]]--
+-- A utility file has always been part of ConTeXt and with the move to LuaTeX we
+-- also moved a lot of multi-pass info to a Lua table. Instead of loading a TeX
+-- based utility file under different setups, we now load a table once. This saves
+-- much runtime but at the cost of more memory usage.
+--
+-- In the meantime the overhead is a bit more due to the amount of data being saved
+-- and more agressive compacting.
local math = math
local format, match = string.format, string.match
@@ -46,14 +43,9 @@ local job = job
job.version = 1.32
job.packversion = 1.02
--- some day we will implement loading of other jobs and then we need
--- job.jobs
-
---[[ldx--
-<p>Variables are saved using in the previously defined table and passed
-onto <l n='tex'/> using the following method. Of course one can also
-directly access the variable using a <l n='lua'/> call.</p>
---ldx]]--
+-- Variables are saved using in the previously defined table and passed onto TeX
+-- using the following method. Of course one can also directly access the variable
+-- using a Lua call.
local savelist, comment = { }, { }
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-con.lua b/Master/texmf-dist/tex/context/base/mkiv/data-con.lua
index 51e0ce85614..d7d3c7d4610 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-con.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-con.lua
@@ -13,19 +13,17 @@ local trace_cache = false trackers.register("resolvers.cache", functi
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--
-<p>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).</p>
-
-<p>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.</p>
-
-<p>Examples of usage can be found in the font related code. This code is not
-ideal but we need it in generic too so we compromise.</p>
---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. This code is not ideal
+-- but we need it in generic too so we compromise.
containers = containers or { }
local containers = containers
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-res.lua b/Master/texmf-dist/tex/context/base/mkiv/data-res.lua
index 8afc09b9792..11e67f78545 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-res.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-res.lua
@@ -135,16 +135,35 @@ local criticalvars = {
-- we also report weird ones, with weird being: (1) duplicate /texmf or (2) no /web2c in
-- the names.
+-- if environment.default_texmfcnf then
+-- resolvers.luacnfspec = "home:texmf/web2c;" .. environment.default_texmfcnf -- texlive + home: for taco etc
+-- else
+-- resolvers.luacnfspec = concat ( {
+-- "home:texmf/web2c",
+-- "selfautoparent:/texmf-local/web2c",
+-- "selfautoparent:/texmf-context/web2c",
+-- "selfautoparent:/texmf-dist/web2c",
+-- "selfautoparent:/texmf/web2c",
+-- }, ";")
+-- end
+
if environment.default_texmfcnf then
+ -- this will go away (but then also no more checking in mtxrun.lua itself)
resolvers.luacnfspec = "home:texmf/web2c;" .. environment.default_texmfcnf -- texlive + home: for taco etc
else
- resolvers.luacnfspec = concat ( {
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- }, ";")
+ local texroot = environment.texroot
+ resolvers.luacnfspec = "home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot .. "/texmf-context") then
+ -- we're okay and run the lean and mean installation
+ elseif texroot and isdir(texroot .. "/texmf-dist") then
+ -- we're in texlive where texmf-dist is leading
+ resolvers.luacnfspec = "home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype ~= "windows" and isdir("/etc/texmf/web2c") then
+ -- we have some linux distribution that does it its own way
+ resolvers.luacnfspec = "home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ -- we stick to the reference specification
+ end
end
local unset_variable = "unset"
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua
index 45de749b663..b2416330ff2 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua
@@ -12,14 +12,10 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local report_tar = logs.reporter("resolvers","tar")
---[[ldx--
-<p>We use a url syntax for accessing the tar file itself and file in it:</p>
-
-<typing>
-tar:///oeps.tar?name=bla/bla.tex
-tar:///oeps.tar?tree=tex/texmf-local
-</typing>
---ldx]]--
+-- We use a url syntax for accessing the tar file itself and file in it:
+--
+-- tar:///oeps.tar?name=bla/bla.tex
+-- tar:///oeps.tar?tree=tex/texmf-local
local resolvers = resolvers
local findfile = resolvers.findfile
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
index 1948f1ea596..21e0d1f4f18 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
@@ -6,20 +6,15 @@ if not modules then modules = { } end modules ['data-tmp'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>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.</p>
-
-</code>
-TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;.
-</code>
-
-<p>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.</p>
---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.
local next, type = next, type
local pcall, loadfile, collectgarbage = pcall, loadfile, collectgarbage
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua
index 1a9310f17fe..40f38c8555b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua
@@ -14,17 +14,13 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local report_zip = logs.reporter("resolvers","zip")
---[[ldx--
-<p>We use a url syntax for accessing the zip file itself and file in it:</p>
-
-<typing>
-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
-</typing>
---ldx]]--
+-- We use a url syntax for accessing the zip file itself and file in it:
+--
+-- 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
local resolvers = resolvers
local findfile = resolvers.findfile
diff --git a/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua
index 2a0271a9d80..01bedeeebe4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua
@@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['file-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>It's more convenient to manipulate filenames (paths) in <l n='lua'/> than in
-<l n='tex'/>. These methods have counterparts at the <l n='tex'/> end.</p>
---ldx]]--
-
+-- It's more convenient to manipulate filenames (paths) in Lua than in TeX. These
+-- methods have counterparts at the TeX end.
local implement = interfaces.implement
local setmacro = interfaces.setmacro
diff --git a/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua b/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua
index d392887ec18..ac9ad938a53 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua
@@ -6,17 +6,11 @@ if not modules then modules = { } end modules ['file-mod'] = {
license = "see context related readme files"
}
--- This module will be redone! For instance, the prefixes will move to data-*
--- as they arr sort of generic along with home:// etc/.
-
--- context is not defined yet! todo! (we need to load tupp-fil after cld)
--- todo: move startreadingfile to lua and push regime there
-
---[[ldx--
-<p>It's more convenient to manipulate filenames (paths) in
-<l n='lua'/> than in <l n='tex'/>. These methods have counterparts
-at the <l n='tex'/> side.</p>
---ldx]]--
+-- This module will be redone! For instance, the prefixes will move to data-* as
+-- they are sort of generic along with home:// etc/.
+--
+-- It is more convenient to manipulate filenames (paths) in Lua than in TeX. The
+-- methods below have counterparts at the TeX end.
local format, find, concat, tonumber = string.format, string.find, table.concat, tonumber
local sortedhash = table.sortedhash
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua b/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua
index 761016d3485..250c17e776e 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua
@@ -7,11 +7,9 @@ if not modules then modules = { } end modules ['font-afk'] = {
dataonly = true,
}
---[[ldx--
-<p>For ligatures, 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.</p>
---ldx]]--
+-- For ligatures, 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.
local allocate = utilities.storage.allocate
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-con.lua b/Master/texmf-dist/tex/context/base/mkiv/font-con.lua
index 066ea33ed2b..10f98ca1201 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-con.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-con.lua
@@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['font-con'] = {
license = "see context related readme files"
}
+-- Todo: Enable fixes from the lmt to here. Also in font-oto.lua wrt the changed
+-- assignments. (Around texlive 2024 in order not to disturb generic.)
+
-- some names of table entries will be changed (no _)
local next, tostring, tonumber, rawget = next, tostring, tonumber, rawget
@@ -22,11 +25,9 @@ local trace_scaling = false trackers.register("fonts.scaling", function(v)
local report_defining = logs.reporter("fonts","defining")
--- watch out: no negative depths and negative eights permitted in regular fonts
-
---[[ldx--
-<p>Here we only implement a few helper functions.</p>
---ldx]]--
+-- Watch out: no negative depths and negative heights are permitted in regular
+-- fonts. Also, the code in LMTX is a bit different. Here we only implement a
+-- few helper functions.
local fonts = fonts
local constructors = fonts.constructors or { }
@@ -59,11 +60,9 @@ constructors.designsizes = designsizes
local loadedfonts = allocate()
constructors.loadedfonts = loadedfonts
---[[ldx--
-<p>We need to normalize the scale factor (in scaled points). This has to
-do with the fact that <l n='tex'/> uses a negative multiple of 1000 as
-a signal for a font scaled based on the design size.</p>
---ldx]]--
+-- We need to normalize the scale factor (in scaled points). This has to do with the
+-- fact that TeX uses a negative multiple of 1000 as a signal for a font scaled
+-- based on the design size.
local factors = {
pt = 65536.0,
@@ -118,22 +117,18 @@ function constructors.getmathparameter(tfmdata,name)
end
end
---[[ldx--
-<p>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.)</p>
---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 hasitalics flag. Some more flags will be added in the
--- future.
-
---[[ldx--
-<p>The reason why the scaler was originally split, is that for a while we experimented
-with a helper function. However, in practice the <l n='api'/> calls are too slow to
-make this profitable and the <l n='lua'/> based variant was just faster. A days
-wasted day but an experience richer.</p>
---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.)
+--
+-- The scaler is only used for OTF and AFM and virtual fonts. If a virtual font has
+-- italic correction make sure to set the hasitalics flag. Some more flags will be
+-- added in the future.
+--
+-- The reason why the scaler was originally split, is that for a while we
+-- experimented with a helper function. However, in practice the API calls are too
+-- slow to make this profitable and the Lua based variant was just faster. A days
+-- wasted day but an experience richer.
function constructors.cleanuptable(tfmdata)
-- This no longer makes sense because the addition of font.getcopy and its
@@ -656,6 +651,14 @@ function constructors.scale(tfmdata,specification)
if changed then
local c = changed[unicode]
if c and c ~= unicode then
+ -- local cc = changed[c]
+ -- if cc then
+ -- while cc do
+ -- c = cc
+ -- cc = changed[c]
+ -- end
+ -- end
+ -- check not needed:
if c then
description = descriptions[c] or descriptions[unicode] or character
character = characters[c] or character
@@ -1093,9 +1096,7 @@ function constructors.finalize(tfmdata)
return tfmdata
end
---[[ldx--
-<p>A unique hash value is generated by:</p>
---ldx]]--
+-- A unique hash value is generated by:
local hashmethods = { }
constructors.hashmethods = hashmethods
@@ -1154,13 +1155,11 @@ hashmethods.normal = function(list)
end
end
---[[ldx--
-<p>In principle we can share tfm tables when we are in need 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 <l n='luatex'/>.</p>
---ldx]]--
+-- In principle we can share tfm tables when we are in need 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 LuaTeX.
function constructors.hashinstance(specification,force)
local hash = specification.hash
@@ -1516,10 +1515,7 @@ do
end
---[[ldx--
-<p>We need to check for default features. For this we provide
-a helper function.</p>
---ldx]]--
+-- We need to check for default features. For this we provide a helper function.
function constructors.checkedfeatures(what,features)
local defaults = handlers[what].features.defaults
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua
index 2c56b5613fc..f9ad475ac6f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua
@@ -528,26 +528,19 @@ do
end
---[[ldx--
-<p>So far we haven't really dealt with features (or whatever we want
-to pass along with the font definition. We distinguish the following
-situations:</p>
-situations:</p>
-
-<code>
-name:xetex like specs
-name@virtual font spec
-name*context specification
-</code>
---ldx]]--
-
--- 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)
+-- So far we haven't really dealt with features (or whatever we want to pass along
+-- with the font definition. We distinguish the following situations:
+--
+-- name:xetex like specs
+-- name@virtual font spec
+-- name*context 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.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
@@ -2385,10 +2378,8 @@ dimenfactors.em = nil
dimenfactors["%"] = nil
dimenfactors.pct = nil
---[[ldx--
-<p>Before a font is passed to <l n='tex'/> we scale it. Here we also need
-to scale virtual characters.</p>
---ldx]]--
+-- Before a font is passed to TeX we scale it. Here we also need to scale virtual
+-- characters.
do
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-def.lua b/Master/texmf-dist/tex/context/base/mkiv/font-def.lua
index b752b3258c4..01bced6d161 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-def.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-def.lua
@@ -24,10 +24,9 @@ trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading
local report_defining = logs.reporter("fonts","defining")
---[[ldx--
-<p>Here we deal with defining fonts. We do so by intercepting the
-default loader that only handles <l n='tfm'/>.</p>
---ldx]]--
+-- Here we deal with defining fonts. We do so by intercepting the default loader
+-- that only handles TFM files. Although, we started out that way but in the
+-- meantime we can hardly speak of TFM any more.
local fonts = fonts
local fontdata = fonts.hashes.identifiers
@@ -53,25 +52,18 @@ local designsizes = constructors.designsizes
local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
---[[ldx--
-<p>We hardly gain anything when we cache the final (pre scaled)
-<l n='tfm'/> 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.</p>
---ldx]]--
-
---[[ldx--
-<p>We can prefix a font specification by <type>name:</type> or
-<type>file:</type>. The first case will result in a lookup in the
-synonym table.</p>
-
-<typing>
-[ name: | file: ] identifier [ separator [ specification ] ]
-</typing>
-
-<p>The following function split the font specification into components
-and prepares a table that will move along as we proceed.</p>
---ldx]]--
+-- We hardly gain anything when we cache the final (pre scaled) TFM 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.
+--
+-- We can prefix a font specification by "name:" or "file:". The first case will
+-- result in a lookup in the synonym table.
+--
+-- [ name: | file: ] identifier [ separator [ specification ] ]
+--
+-- The following function split the font specification into components and prepares
+-- a table that will move along as we proceed.
-- beware, we discard additional specs
--
@@ -164,9 +156,7 @@ if context then
end
---[[ldx--
-<p>We can resolve the filename using the next function:</p>
---ldx]]--
+-- We can resolve the filename using the next function:
definers.resolvers = definers.resolvers or { }
local resolvers = definers.resolvers
@@ -258,23 +248,17 @@ function definers.resolve(specification)
return specification
end
---[[ldx--
-<p>The main read function either uses a forced reader (as determined by
-a lookup) or tries to resolve the name using the list of readers.</p>
-
-<p>We need to cache when possible. We do cache raw tfm data (from <l
-n='tfm'/>, <l n='afm'/> or <l n='otf'/>). After that we can cache based
-on specificstion (name) and size, that is, <l n='tex'/> only needs a number
-for an already loaded fonts. However, it may make sense to cache fonts
-before they're scaled as well (store <l n='tfm'/>'s with applied methods
-and features). However, there may be a relation between the size and
-features (esp in virtual fonts) so let's not do that now.</p>
-
-<p>Watch out, here we do load a font, but we don't prepare the
-specification yet.</p>
---ldx]]--
-
--- very experimental:
+-- The main read function either uses a forced reader (as determined by a lookup) or
+-- tries to resolve the name using the list of readers.
+--
+-- We need to cache when possible. We do cache raw tfm data (from TFM, AFM or OTF).
+-- After that we can cache based on specificstion (name) and size, that is, TeX only
+-- needs a number for an already loaded fonts. However, it may make sense to cache
+-- fonts before they're scaled as well (store TFM's with applied methods and
+-- features). However, there may be a relation between the size and features (esp in
+-- virtual fonts) so let's not do that now.
+--
+-- Watch out, here we do load a font, but we don't prepare the specification yet.
function definers.applypostprocessors(tfmdata)
local postprocessors = tfmdata.postprocessors
@@ -439,17 +423,13 @@ function constructors.readanddefine(name,size) -- no id -- maybe a dummy first
return fontdata[id], id
end
---[[ldx--
-<p>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).</p>
-
-In the previously defined reader (the one resulting in a <l n='tfm'/>
-table) we cached the (scaled) instances. Here we cache them again, but
-this time based on id. We could combine this in one cache but this does
-not gain much. By the way, passing id's back to in the callback was
-introduced later in the development.</p>
---ldx]]--
+-- So far the specifiers. Now comes the real definer. Here we cache based on id's.
+-- Here we also intercept the virtual font handler.
+--
+-- In the previously defined reader (the one resulting in a TFM table) we cached the
+-- (scaled) instances. Here we cache them again, but this time based on id. We could
+-- combine this in one cache but this does not gain much. By the way, passing id's
+-- back to in the callback was introduced later in the development.
function definers.registered(hash)
local id = internalized[hash]
@@ -522,9 +502,7 @@ function font.getfont(id)
return fontdata[id] -- otherwise issues
end
---[[ldx--
-<p>We overload the <l n='tfm'/> reader.</p>
---ldx]]--
+-- We overload the <l n='tfm'/> reader.
if not context then
callbacks.register('define_font', definers.read, "definition of fonts (tfmdata preparation)")
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua b/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua
index f2f0595ddfa..732bc890728 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua
@@ -16,10 +16,8 @@ local setmetatableindex = table.setmetatableindex
local allocate = utilities.storage.allocate
local mark = utilities.storage.mark
---[[ldx--
-<p>Because encodings are going to disappear, we don't bother defining
-them in tables. But we may do so some day, for consistency.</p>
---ldx]]--
+-- Because encodings are going to disappear, we don't bother defining them in
+-- tables. But we may do so some day, for consistency.
local report_encoding = logs.reporter("fonts","encoding")
@@ -43,24 +41,19 @@ function encodings.is_known(encoding)
return containers.is_valid(encodings.cache,encoding)
end
---[[ldx--
-<p>An encoding file looks like this:</p>
-
-<typing>
-/TeXnANSIEncoding [
-/.notdef
-/Euro
-...
-/ydieresis
-] def
-</typing>
-
-<p>Beware! The generic encoding files don't always apply to the ones that
-ship with fonts. This has to do with the fact that names follow (slightly)
-different standards. However, the fonts where this applies to (for instance
-Latin Modern or <l n='tex'> Gyre) come in OpenType variants too, so these
-will be used.</p>
---ldx]]--
+-- An encoding file looks like this:
+--
+-- /TeXnANSIEncoding [
+-- /.notdef
+-- /Euro
+-- ...
+-- /ydieresis
+-- ] def
+--
+-- Beware! The generic encoding files don't always apply to the ones that ship with
+-- fonts. This has to do with the fact that names follow (slightly) different
+-- standards. However, the fonts where this applies to (for instance Latin Modern or
+-- TeXGyre come in OpenType variants too, so these will be used.
local enccodes = characters.enccodes or { }
@@ -120,10 +113,7 @@ function encodings.load(filename)
return containers.write(encodings.cache, name, data)
end
---[[ldx--
-<p>There is no unicode encoding but for practical purposes we define
-one.</p>
---ldx]]--
+-- There is no unicode encoding but for practical purposes we define one.
-- maybe make this a function:
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua b/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua
index b6c9a430ddf..da04b50a864 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua
@@ -10,10 +10,6 @@ local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format
local utfbyte, utfchar = utf.byte, utf.char
local next = next
---[[ldx--
-<p>This is very experimental code!</p>
---ldx]]--
-
local trace_visualize = false trackers.register("fonts.composing.visualize", function(v) trace_visualize = v end)
local trace_define = false trackers.register("fonts.composing.define", function(v) trace_define = v end)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua b/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua
index b4b9a7b6943..87a1ae3aa2f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua
@@ -13,36 +13,31 @@ local otf = fonts.handlers.otf
local registerotffeature = otf.features.register
local addotffeature = otf.addfeature
--- tlig (we need numbers for some fonts so ...)
+-- We provide a few old and obsolete compatibility input features. We need numbers
+-- for some fonts so no names here. Do we also need them for afm fonts?
-local specification = {
+local tlig = {
type = "ligature",
order = { "tlig" },
prepend = true,
data = {
- -- endash = "hyphen hyphen",
- -- emdash = "hyphen hyphen hyphen",
- [0x2013] = { 0x002D, 0x002D },
- [0x2014] = { 0x002D, 0x002D, 0x002D },
- -- quotedblleft = "quoteleft quoteleft",
- -- quotedblright = "quoteright quoteright",
- -- quotedblleft = "grave grave",
- -- quotedblright = "quotesingle quotesingle",
- -- quotedblbase = "comma comma",
+ [0x2013] = { 0x002D, 0x002D },
+ [0x2014] = { 0x002D, 0x002D, 0x002D },
},
}
-addotffeature("tlig",specification)
-
-registerotffeature {
- -- this makes it a known feature (in tables)
- name = "tlig",
- description = "tex ligatures",
+local tquo = {
+ type = "ligature",
+ order = { "tquo" },
+ prepend = true,
+ data = {
+ [0x201C] = { 0x0060, 0x0060 },
+ [0x201D] = { 0x0027, 0x0027 },
+ [0x201E] = { 0x002C, 0x002C },
+ },
}
--- trep
-
-local specification = {
+local trep = {
type = "substitution",
order = { "trep" },
prepend = true,
@@ -53,13 +48,13 @@ local specification = {
},
}
-addotffeature("trep",specification)
+addotffeature("trep",trep) -- last
+addotffeature("tlig",tlig)
+addotffeature("tquo",tquo) -- first
-registerotffeature {
- -- this makes it a known feature (in tables)
- name = "trep",
- description = "tex replacements",
-}
+registerotffeature { name = "tlig", description = "tex ligatures" }
+registerotffeature { name = "tquo", description = "tex quotes" }
+registerotffeature { name = "trep", description = "tex replacements" }
-- some day this will be moved to font-imp-scripts.lua
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua
index 8bab6d90295..201cc69f48c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua
@@ -6,9 +6,7 @@ if not modules then modules = { } end modules ['font-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Not much is happening here.</p>
---ldx]]--
+-- Not much is happening here.
local allocate = utilities.storage.allocate
local sortedhash = table.sortedhash
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-log.lua b/Master/texmf-dist/tex/context/base/mkiv/font-log.lua
index 092b5a62ea9..96b5864fd52 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-log.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-log.lua
@@ -19,12 +19,9 @@ fonts.loggers = loggers
local usedfonts = utilities.storage.allocate()
----- loadedfonts = utilities.storage.allocate()
---[[ldx--
-<p>The following functions are used for reporting about the fonts
-used. The message itself is not that useful in regular runs but since
-we now have several readers it may be handy to know what reader is
-used for which font.</p>
---ldx]]--
+-- The following functions are used for reporting about the fonts used. The message
+-- itself is not that useful in regular runs but since we now have several readers
+-- it may be handy to know what reader is used for which font.
function loggers.onetimemessage(font,char,message,reporter)
local tfmdata = fonts.hashes.identifiers[font]
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua b/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua
index a7dcfd9b09b..1e39784d971 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua
@@ -7,11 +7,6 @@ if not modules then modules = { } end modules ['font-nod'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This is rather experimental. We need more control and some of this
-might become a runtime module instead. This module will be cleaned up!</p>
---ldx]]--
-
local utfchar = utf.char
local concat, fastcopy = table.concat, table.fastcopy
local match, rep = string.match, string.rep
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua
index 829f52ea043..25efc2a0467 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua
@@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-one'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Some code may look a bit obscure but this has to do with the fact that we also use
-this code for testing and much code evolved in the transition from <l n='tfm'/> to
-<l n='afm'/> to <l n='otf'/>.</p>
-
-<p>The following code still has traces of intermediate font support where we handles
-font encodings. Eventually font encoding went away but we kept some code around in
-other modules.</p>
-
-<p>This version implements a node mode approach so that users can also more easily
-add features.</p>
---ldx]]--
+-- Some code may look a bit obscure but this has to do with the fact that we also
+-- use this code for testing and much code evolved in the transition from TFM to AFM
+-- to OTF.
+--
+-- The following code still has traces of intermediate font support where we handles
+-- font encodings. Eventually font encoding went away but we kept some code around
+-- in other modules.
+--
+-- This version implements a node mode approach so that users can also more easily
+-- add features.
local fonts, logs, trackers, containers, resolvers = fonts, logs, trackers, containers, resolvers
@@ -71,15 +69,13 @@ local overloads = fonts.mappings.overloads
local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes
---[[ldx--
-<p>We cache files. Caching is taken care of in the loader. We cheat a bit by adding
-ligatures and kern information to the afm derived data. That way we can set them faster
-when defining a font.</p>
-
-<p>We still keep the loading two phased: first we load the data in a traditional
-fashion and later we transform it to sequences. Then we apply some methods also
-used in opentype fonts (like <t>tlig</t>).</p>
---ldx]]--
+-- We cache files. Caching is taken care of in the loader. We cheat a bit by adding
+-- ligatures and kern information to the afm derived data. That way we can set them
+-- faster when defining a font.
+--
+-- We still keep the loading two phased: first we load the data in a traditional
+-- fashion and later we transform it to sequences. Then we apply some methods also
+-- used in opentype fonts (like tlig).
function afm.load(filename)
filename = resolvers.findfile(filename,'afm') or ""
@@ -312,10 +308,8 @@ local function enhance_fix_names(data)
end
end
---[[ldx--
-<p>These helpers extend the basic table with extra ligatures, texligatures
-and extra kerns. This saves quite some lookups later.</p>
---ldx]]--
+-- These helpers extend the basic table with extra ligatures, texligatures and extra
+-- kerns. This saves quite some lookups later.
local addthem = function(rawdata,ligatures)
if ligatures then
@@ -349,17 +343,14 @@ local function enhance_add_ligatures(rawdata)
addthem(rawdata,afm.helpdata.ligatures)
end
---[[ldx--
-<p>We keep the extra kerns in separate kerning tables so that we can use
-them selectively.</p>
---ldx]]--
-
--- 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 keep the extra kerns in separate kerning tables so that we can use them
+-- selectively.
+--
+-- 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).
local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust here
local descriptions = rawdata.descriptions
@@ -440,9 +431,7 @@ local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust h
do_it_copy(afm.helpdata.rightkerned)
end
---[[ldx--
-<p>The copying routine looks messy (and is indeed a bit messy).</p>
---ldx]]--
+-- The copying routine looks messy (and is indeed a bit messy).
local function adddimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name
if data then
@@ -619,11 +608,9 @@ end
return nil
end
---[[ldx--
-<p>Originally we had features kind of hard coded for <l n='afm'/> files but since I
-expect to support more font formats, I decided to treat this fontformat like any
-other and handle features in a more configurable way.</p>
---ldx]]--
+-- Originally we had features kind of hard coded for AFM files but since I expect to
+-- support more font formats, I decided to treat this fontformat like any other and
+-- handle features in a more configurable way.
function afm.setfeatures(tfmdata,features)
local okay = constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm)
@@ -715,13 +702,10 @@ local function afmtotfm(specification)
end
end
---[[ldx--
-<p>As soon as we could intercept the <l n='tfm'/> reader, I implemented an
-<l n='afm'/> reader. Since traditional <l n='pdftex'/> could use <l n='opentype'/>
-fonts with <l n='afm'/> companions, the following method also could handle
-those cases, but now that we can handle <l n='opentype'/> directly we no longer
-need this features.</p>
---ldx]]--
+-- As soon as we could intercept the TFM reader, I implemented an AFM reader. Since
+-- traditional pdfTeX could use OpenType fonts with AFM companions, the following
+-- method also could handle those cases, but now that we can handle OpenType
+-- directly we no longer need this features.
local function read_from_afm(specification)
local tfmdata = afmtotfm(specification)
@@ -736,9 +720,7 @@ local function read_from_afm(specification)
return tfmdata
end
---[[ldx--
-<p>We have the usual two modes and related features initializers and processors.</p>
---ldx]]--
+-- We have the usual two modes and related features initializers and processors.
registerafmfeature {
name = "mode",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua
index 9e5a012bd5f..6234742a3d4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua
@@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-onr'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Some code may look a bit obscure but this has to do with the fact that we also use
-this code for testing and much code evolved in the transition from <l n='tfm'/> to
-<l n='afm'/> to <l n='otf'/>.</p>
-
-<p>The following code still has traces of intermediate font support where we handles
-font encodings. Eventually font encoding went away but we kept some code around in
-other modules.</p>
-
-<p>This version implements a node mode approach so that users can also more easily
-add features.</p>
---ldx]]--
+-- Some code may look a bit obscure but this has to do with the fact that we also
+-- use this code for testing and much code evolved in the transition from TFM to AFM
+-- to OTF.
+--
+-- The following code still has traces of intermediate font support where we handles
+-- font encodings. Eventually font encoding went away but we kept some code around
+-- in other modules.
+--
+-- This version implements a node mode approach so that users can also more easily
+-- add features.
local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers
@@ -44,12 +42,9 @@ afm.readers = readers
afm.version = 1.513 -- incrementing this number one up will force a re-cache
---[[ldx--
-<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
-and <l n='otf'/> reader.</p>
-<p>We use a new (unfinished) pfb loader but I see no differences between the old
-and new vectors (we actually had one bad vector with the old loader).</p>
---ldx]]--
+-- We start with the basic reader which we give a name similar to the built in TFM
+-- and OTF reader. We use a PFB loader but I see no differences between the old and
+-- new vectors (we actually had one bad vector with the old loader).
local get_indexes, get_shapes
@@ -305,11 +300,10 @@ do
end
---[[ldx--
-<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
-and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support
-more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p>
---ldx]]--
+-- We start with the basic reader which we give a name similar to the built in TFM
+-- and OTF reader. We only need data that is relevant for our use. We don't support
+-- more complex arrangements like multiple master (obsolete), direction specific
+-- kerning, etc.
local spacer = patterns.spacer
local whitespace = patterns.whitespace
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua
index a8f9f0047c2..160d0d0edb6 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua
@@ -54,10 +54,8 @@ local chardata = characters and characters.data
local otffeatures = fonts.constructors.features.otf
local registerotffeature = otffeatures.register
---[[ldx--
-<p>Analyzers run per script and/or language and are needed in order to
-process features right.</p>
---ldx]]--
+-- Analyzers run per script and/or language and are needed in order to process
+-- features right.
local setstate = nuts.setstate
local getstate = nuts.getstate
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua
index f83c3e8ec76..0787a203598 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua
@@ -786,7 +786,12 @@ local function addfeature(data,feature,specifications,prepareonly)
local list = askedsteps[i]
local coverage = nil
local format = nil
- if featuretype == "substitution" then
+if type(list) == "function" then
+ list = list(data,specification,list,i)
+end
+ if not list then
+ -- see ebgaramond hack
+ elseif featuretype == "substitution" then
-- see font-imp-tweaks: we directly pass a mapping so no checks done
category = "gsub"
coverage = (mapping and list) or prepare_substitution(list,featuretype,nocheck)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua
index 354ca59a78d..0825077b3f2 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.132 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.133 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.pngcache = containers.define("fonts", "png", otf.version, true)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua b/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua
index e8b92c07755..0689f4dfb5b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua
@@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['font-oto'] = { -- original tex
license = "see context related readme files"
}
+-- Todo: Enable fixes from the lmt to here. Also in font-con.lua wrt the changed
+-- assignments. (Around texlive 2024 in order not to disturb generic.)
+
local concat, unpack = table.concat, table.unpack
local insert, remove = 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
@@ -260,7 +263,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
for i=1,#steps do
for unicode, data in next, steps[i].coverage do
if unicode ~= data then
+-- if not changed[unicode] then
changed[unicode] = data
+-- end
end
if trace_singles then
report_substitution(feature,sequence,descriptions,unicode,data)
@@ -273,7 +278,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local replacement = data[alternate]
if replacement then
if unicode ~= replacement then
+-- if not changed[unicode] then
changed[unicode] = replacement
+-- end
end
if trace_alternatives then
report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal")
@@ -281,7 +288,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
elseif defaultalt == "first" then
replacement = data[1]
if unicode ~= replacement then
+-- if not changed[unicode] then
changed[unicode] = replacement
+-- end
end
if trace_alternatives then
report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
@@ -289,7 +298,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
elseif defaultalt == "last" then
replacement = data[#data]
if unicode ~= replacement then
+-- if not changed[unicode] then
changed[unicode] = replacement
+-- end
end
if trace_alternatives then
report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua
index 6d7c5fb2568..48f85c3658d 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua
@@ -7,92 +7,90 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences
license = "see context related readme files",
}
---[[ldx--
-<p>I need to check the description at the microsoft site ... it has been improved
-so maybe there are some interesting details there. Most below is based on old and
-incomplete documentation and involved quite a bit of guesswork (checking with the
-abstract uniscribe of those days. But changing things is tricky!</p>
-
-<p>This module is a bit more split up that I'd like but since we also want to test
-with plain <l n='tex'/> it has to be so. This module is part of <l n='context'/>
-and discussion about improvements and functionality mostly happens on the
-<l n='context'/> mailing list.</p>
-
-<p>The specification of OpenType is (or at least decades ago was) kind of vague.
-Apart from a lack of a proper free specifications there's also the problem that
-Microsoft and Adobe may have their own interpretation of how and in what order to
-apply features. In general the Microsoft website has more detailed specifications
-and is a better reference. There is also some information in the FontForge help
-files. In the end we rely most on the Microsoft specification.</p>
-
-<p>Because there is so much possible, fonts might contain bugs and/or be made to
-work with certain rederers. These may evolve over time which may have the side
-effect that suddenly fonts behave differently. We don't want to catch all font
-issues.</p>
-
-<p>After a lot of experiments (mostly by Taco, me and Idris) the first implementation
-was already quite useful. When it did most of what we wanted, a more optimized version
-evolved. Of course all errors are mine and of course the code can be improved. There
-are quite some optimizations going on here and processing speed is currently quite
-acceptable and has been improved over time. Many complex scripts are not yet supported
-yet, but I will look into them as soon as <l n='context'/> users ask for it.</p>
-
-<p>The specification leaves room for interpretation. In case of doubt the Microsoft
-implementation is the reference as it is the most complete one. As they deal with
-lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code and
-their suggestions help improve the code. I'm aware that not all border cases can be
-taken care of, unless we accept excessive runtime, and even then the interference
-with other mechanisms (like hyphenation) are not trivial.</p>
-
-<p>Especially discretionary handling has been improved much by Kai Eigner who uses complex
-(latin) fonts. The current implementation is a compromis between his patches and my code
-and in the meantime performance is quite ok. We cannot check all border cases without
-compromising speed but so far we're okay. Given good test cases we can probably improve
-it here and there. Especially chain lookups are non trivial with discretionaries but
-things got much better over time thanks to Kai.</p>
-
-<p>Glyphs are indexed not by unicode but in their own way. This is because there is no
-relationship with unicode at all, apart from the fact that a font might cover certain
-ranges of characters. One character can have multiple shapes. However, at the
-<l n='tex'/> end we use unicode so and all extra glyphs are mapped into a private
-space. This is needed because we need to access them and <l n='tex'/> has to include
-then in the output eventually.</p>
-
-<p>The initial data table is rather close to the open type specification and also not
-that different from the one produced by <l n='fontforge'/> but we uses hashes instead.
-In <l n='context'/> that table is packed (similar tables are shared) and cached on disk
-so that successive runs can use the optimized table (after loading the table is
-unpacked).</p>
-
-<p>This module is sparsely documented because it is has been a moving target. The
-table format of the reader changed a bit over time and we experiment a lot with
-different methods for supporting features. By now the structures are quite stable</p>
-
-<p>Incrementing the version number will force a re-cache. We jump the number by one
-when there's a fix in the reader or processing code that can result in different
-results.</p>
-
-<p>This code is also used outside context but in context it has to work with other
-mechanisms. Both put some constraints on the code here.</p>
-
---ldx]]--
-
--- Remark: We assume that cursives don't cross discretionaries which is okay because it
--- is only used in semitic scripts.
+-- I need to check the description at the microsoft site ... it has been improved so
+-- maybe there are some interesting details there. Most below is based on old and
+-- incomplete documentation and involved quite a bit of guesswork (checking with the
+-- abstract uniscribe of those days. But changing things is tricky!
+--
+-- This module is a bit more split up that I'd like but since we also want to test
+-- with plain TeX it has to be so. This module is part of ConTeXt and discussion
+-- about improvements and functionality mostly happens on the ConTeXt mailing list.
+--
+-- The specification of OpenType is (or at least decades ago was) kind of vague.
+-- Apart from a lack of a proper free specifications there's also the problem that
+-- Microsoft and Adobe may have their own interpretation of how and in what order to
+-- apply features. In general the Microsoft website has more detailed specifications
+-- and is a better reference. There is also some information in the FontForge help
+-- files. In the end we rely most on the Microsoft specification.
+--
+-- Because there is so much possible, fonts might contain bugs and/or be made to
+-- work with certain rederers. These may evolve over time which may have the side
+-- effect that suddenly fonts behave differently. We don't want to catch all font
+-- issues.
+--
+-- After a lot of experiments (mostly by Taco, me and Idris) the first
+-- implementation was already quite useful. When it did most of what we wanted, a
+-- more optimized version evolved. Of course all errors are mine and of course the
+-- code can be improved. There are quite some optimizations going on here and
+-- processing speed is currently quite acceptable and has been improved over time.
+-- Many complex scripts are not yet supported yet, but I will look into them as soon
+-- as ConTeXt users ask for it.
+--
+-- The specification leaves room for interpretation. In case of doubt the Microsoft
+-- implementation is the reference as it is the most complete one. As they deal with
+-- lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code
+-- and their suggestions help improve the code. I'm aware that not all border cases
+-- can be taken care of, unless we accept excessive runtime, and even then the
+-- interference with other mechanisms (like hyphenation) are not trivial.
+--
+-- Especially discretionary handling has been improved much by Kai Eigner who uses
+-- complex (latin) fonts. The current implementation is a compromis between his
+-- patches and my code and in the meantime performance is quite ok. We cannot check
+-- all border cases without compromising speed but so far we're okay. Given good
+-- test cases we can probably improve it here and there. Especially chain lookups
+-- are non trivial with discretionaries but things got much better over time thanks
+-- to Kai.
+--
+-- Glyphs are indexed not by unicode but in their own way. This is because there is
+-- no relationship with unicode at all, apart from the fact that a font might cover
+-- certain ranges of characters. One character can have multiple shapes. However, at
+-- the TeX end we use unicode so and all extra glyphs are mapped into a private
+-- space. This is needed because we need to access them and TeX has to include then
+-- in the output eventually.
+--
+-- The initial data table is rather close to the open type specification and also
+-- not that different from the one produced by Fontforge but we uses hashes instead.
+-- In ConTeXt that table is packed (similar tables are shared) and cached on disk so
+-- that successive runs can use the optimized table (after loading the table is
+-- unpacked).
+--
+-- This module is sparsely documented because it is has been a moving target. The
+-- table format of the reader changed a bit over time and we experiment a lot with
+-- different methods for supporting features. By now the structures are quite stable
+--
+-- Incrementing the version number will force a re-cache. We jump the number by one
+-- when there's a fix in the reader or processing code that can result in different
+-- results.
+--
+-- This code is also used outside ConTeXt but in ConTeXt it has to work with other
+-- mechanisms. Both put some constraints on the code here.
+--
+-- Remark: We assume that cursives don't cross discretionaries which is okay because
+-- it is only used in semitic scripts.
--
-- Remark: We assume that marks precede base characters.
--
--- Remark: When complex ligatures extend into discs nodes we can get side effects. Normally
--- this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}.
+-- Remark: When complex ligatures extend into discs nodes we can get side effects.
+-- Normally this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}.
--
-- Todo: check if we copy attributes to disc nodes if needed.
--
--- Todo: it would be nice if we could get rid of components. In other places we can use
--- the unicode properties. We can just keep a lua table.
+-- Todo: it would be nice if we could get rid of components. In other places we can
+-- use the unicode properties. We can just keep a lua table.
--
--- Remark: We do some disc juggling where we need to keep in mind that the pre, post and
--- replace fields can have prev pointers to a nesting node ... I wonder if that is still
--- needed.
+-- Remark: We do some disc juggling where we need to keep in mind that the pre, post
+-- and replace fields can have prev pointers to a nesting node ... I wonder if that
+-- is still needed.
--
-- Remark: This is not possible:
--
@@ -1038,10 +1036,8 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
end
end
---[[ldx--
-<p>We get hits on a mark, but we're not sure if the it has to be applied so
-we need to explicitly test for basechar, baselig and basemark entries.</p>
---ldx]]--
+-- We get hits on a mark, but we're not sure if the it has to be applied so we need
+-- to explicitly test for basechar, baselig and basemark entries.
function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,skiphash)
local markchar = getchar(start)
@@ -1236,10 +1232,8 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,sk
return head, start, false
end
---[[ldx--
-<p>I will implement multiple chain replacements once I run into a font that uses
-it. It's not that complex to handle.</p>
---ldx]]--
+-- I will implement multiple chain replacements once I run into a font that uses it.
+-- It's not that complex to handle.
local chainprocs = { }
@@ -1292,29 +1286,22 @@ end
chainprocs.reversesub = reversesub
---[[ldx--
-<p>This chain stuff is somewhat tricky since we can have a sequence of actions to be
-applied: single, alternate, multiple or ligature where ligature can be an invalid
-one in the sense that it will replace multiple by one but not neccessary one that
-looks like the combination (i.e. it is the counterpart of multiple then). For
-example, the following is valid:</p>
-
-<typing>
-<line>xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx</line>
-</typing>
-
-<p>Therefore we we don't really do the replacement here already unless we have the
-single lookup case. The efficiency of the replacements can be improved by deleting
-as less as needed but that would also make the code even more messy.</p>
---ldx]]--
-
---[[ldx--
-<p>Here we replace start by a single variant.</p>
---ldx]]--
-
--- To be done (example needed): what if > 1 steps
-
--- this is messy: do we need this disc checking also in alternates?
+-- This chain stuff is somewhat tricky since we can have a sequence of actions to be
+-- applied: single, alternate, multiple or ligature where ligature can be an invalid
+-- one in the sense that it will replace multiple by one but not neccessary one that
+-- looks like the combination (i.e. it is the counterpart of multiple then). For
+-- example, the following is valid:
+--
+-- xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx
+--
+-- Therefore we we don't really do the replacement here already unless we have the
+-- single lookup case. The efficiency of the replacements can be improved by
+-- deleting as less as needed but that would also make the code even more messy.
+--
+-- Here we replace start by a single variant.
+--
+-- To be done : what if > 1 steps (example needed)
+-- This is messy: do we need this disc checking also in alternates?
local function reportzerosteps(dataset,sequence)
logwarning("%s: no steps",cref(dataset,sequence))
@@ -1390,9 +1377,7 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r
return head, start, false
end
---[[ldx--
-<p>Here we replace start by new glyph. First we delete the rest of the match.</p>
---ldx]]--
+-- Here we replace start by new glyph. First we delete the rest of the match.
-- char_1 mark_1 -> char_x mark_1 (ignore marks)
-- char_1 mark_1 -> char_x
@@ -1444,9 +1429,7 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku
return head, start, false
end
---[[ldx--
-<p>Here we replace start by a sequence of new glyphs.</p>
---ldx]]--
+-- Here we replace start by a sequence of new glyphs.
function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
local mapping = currentlookup.mapping
@@ -1470,11 +1453,9 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup
return head, start, false
end
---[[ldx--
-<p>When we replace ligatures we use a helper that handles the marks. I might change
-this function (move code inline and handle the marks by a separate function). We
-assume rather stupid ligatures (no complex disc nodes).</p>
---ldx]]--
+-- When we replace ligatures we use a helper that handles the marks. I might change
+-- this function (move code inline and handle the marks by a separate function). We
+-- assume rather stupid ligatures (no complex disc nodes).
-- compare to handlers.gsub_ligature which is more complex ... why
@@ -2532,7 +2513,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
-- fonts can have many steps (each doing one check) or many contexts
-- todo: make a per-char cache so that we have small contexts (when we have a context
- -- n == 1 and otherwise it can be more so we can even distingish n == 1 or more)
+ -- n == 1 and otherwise it can be more so we can even distinguish n == 1 or more)
local nofcontexts = contexts.n -- #contexts
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua b/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua
index b3b514a16b7..b194a6ca936 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua
@@ -111,7 +111,7 @@ local whatsit_code = nodecodes.whatsit
local fontkern_code = kerncodes.fontkern
-local righttoleft_code = nodes.dirvalues.righttoleft
+local righttoleft_code = (tex.directioncodes and tex.directioncodes.righttoleft) or nodes.dirvalues.righttoleft -- LMTX
local userdefinedwhatsit_code = whatsitcodes.userdefined
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua
index e80d57f4146..9fba3d8d4a0 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua
@@ -56,10 +56,8 @@ local trace_rejections = false trackers.register("fonts.rejections", fu
local report_names = logs.reporter("fonts","names")
---[[ldx--
-<p>This module implements a name to filename resolver. Names are resolved
-using a table that has keys filtered from the font related files.</p>
---ldx]]--
+-- This module implements a name to filename resolver. Names are resolved using a
+-- table that has keys filtered from the font related files.
fonts = fonts or { } -- also used elsewhere
@@ -88,10 +86,6 @@ local autoreload = true
directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end)
directives.register("fonts.usesystemfonts", function(v) usesystemfonts = toboolean(v) end)
---[[ldx--
-<p>A few helpers.</p>
---ldx]]--
-
-- -- what to do with these -- --
--
-- thin -> thin
@@ -305,10 +299,8 @@ local function analyzespec(somename)
end
end
---[[ldx--
-<p>It would make sense to implement the filters in the related modules,
-but to keep the overview, we define them here.</p>
---ldx]]--
+-- It would make sense to implement the filters in the related modules, but to keep
+-- the overview, we define them here.
filters.afm = fonts.handlers.afm.readers.getinfo
filters.otf = fonts.handlers.otf.readers.getinfo
@@ -412,11 +404,9 @@ filters.ttc = filters.otf
-- end
-- end
---[[ldx--
-<p>The scanner loops over the filters using the information stored in
-the file databases. Watch how we check not only for the names, but also
-for combination with the weight of a font.</p>
---ldx]]--
+-- The scanner loops over the filters using the information stored in the file
+-- databases. Watch how we check not only for the names, but also for combination
+-- with the weight of a font.
filters.list = {
"otf", "ttf", "ttc", "afm", -- no longer dfont support (for now)
@@ -1402,11 +1392,8 @@ local function is_reloaded()
end
end
---[[ldx--
-<p>The resolver also checks if the cached names are loaded. Being clever
-here is for testing purposes only (it deals with names prefixed by an
-encoding name).</p>
---ldx]]--
+-- The resolver also checks if the cached names are loaded. Being clever here is for
+-- testing purposes only (it deals with names prefixed by an encoding name).
local function fuzzy(mapping,sorted,name,sub) -- no need for reverse sorted here
local condensed = gsub(name,"[^%a%d]","")
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua b/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua
index 945421a4219..81f94532b3b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua
@@ -50,21 +50,18 @@ constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua
fonts.formats.tfm = "type1" -- we need to have at least a value here
fonts.formats.ofm = "type1" -- we need to have at least a value here
---[[ldx--
-<p>The next function encapsulates the standard <l n='tfm'/> loader as
-supplied by <l n='luatex'/>.</p>
---ldx]]--
-
--- 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
-
--- ofm directive blocks local path search unless set; btw, in context we
--- don't support ofm files anyway as this format is obsolete
-
--- we need to deal with nested virtual fonts, but because we load in the
--- frontend we also need to make sure we don't nest too deep (esp when sizes
--- get large)
+-- The next function encapsulates the standard TFM loader as supplied by LuaTeX.
+--
+-- This might change: not scaling and then apply features and do scaling in the
+-- usual way with dummy descriptions but on the other hand. However, we no longer
+-- use TFM (except for the JMN math fonts) so why bother.
+--
+-- The ofm directive blocks a local path search unless set. Actually, in ConTeXt we
+-- never had to deal with OFM files anyway as this format is obsolete (there are
+-- hardly any fonts in that format that are of use).
+--
+-- We need to deal with nested virtual fonts, but because we load in the frontend we
+-- also need to make sure we don't nest too deep (esp when sizes get large)
--
-- (VTITLE Example of a recursion)
-- (MAPFONT D 0 (FONTNAME recurse)(FONTAT D 2))
@@ -72,7 +69,7 @@ supplied by <l n='luatex'/>.</p>
-- (CHARACTER C B (CHARWD D 2)(CHARHT D 2)(MAP (SETCHAR C A)))
-- (CHARACTER C C (CHARWD D 4)(CHARHT D 4)(MAP (SETCHAR C B)))
--
--- we added the same checks as below to the luatex engine
+-- We added the same checks as below to the LuaTeX engine.
function tfm.setfeatures(tfmdata,features)
local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua b/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua
index abc92ba5265..8935340787c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua
@@ -12,11 +12,9 @@ local cleanfilename = fonts.names.cleanfilename
local splitbase = file.splitbase
local lower = string.lower
---[[ldx--
-<p>We provide a simple treatment mechanism (mostly because I want to demonstrate
-something in a manual). It's one of the few places where an lfg file gets loaded
-outside the goodies manager.</p>
---ldx]]--
+-- We provide a simple treatment mechanism (mostly because I want to demonstrate
+-- something in a manual). It's one of the few places where an lfg file gets loaded
+-- outside the goodies manager.
local treatments = fonts.treatments or { }
fonts.treatments = treatments
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua b/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua
index c3071cac0b6..6142ddafd09 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua
@@ -6,9 +6,8 @@ if not modules then modules = { } end modules ['font-vir'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This is very experimental code! Not yet adapted to recent changes. This will change.</p>
---ldx]]--
+-- This is very experimental code! Not yet adapted to recent changes. This will
+-- change. Actually we moved on.
-- present in the backend but unspecified:
--
@@ -25,10 +24,8 @@ local constructors = fonts.constructors
local vf = constructors.handlers.vf
vf.version = 1.000 -- same as tfm
---[[ldx--
-<p>We overload the <l n='vf'/> reader.</p>
---ldx]]--
-
+-- -- We overload the VF reader.:
+--
-- general code / already frozen
--
-- function vf.find(name)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua
index df79adb61c3..33e79a5d48f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua
@@ -9,12 +9,14 @@ if not modules then modules = { } end modules ['good-ini'] = {
-- depends on ctx
local type, next = type, next
-local gmatch = string.gmatch
-local sortedhash, insert = table.sortedhash, table.insert
+local gmatch, find, topattern = string.gmatch, string.find, string.topattern
+local sortedhash, insert, contains = table.sortedhash, table.insert, table.contains
local fonts = fonts
-local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end)
+local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end)
+local trace_extensions = false trackers.register("fonts.goodies.extensions", function(v) trace_extensions = v end)
+
local report_goodies = logs.reporter("fonts","goodies")
local allocate = utilities.storage.allocate
@@ -324,15 +326,43 @@ end
local function setextensions(tfmdata)
local goodies = tfmdata.goodies
if goodies then
+ local shared = tfmdata.shared
+ local metadata = shared and shared.rawdata and shared.rawdata.metadata
for i=1,#goodies do
local g = goodies[i]
local e = g.extensions
if e then
- local goodie = g.name or "unknown"
+ local goodie = g.name or "unknown"
+ local fontname = metadata and metadata.fontname
+ if trace_extensions then
+ report_goodies("checking extensions for font %a",fontname or "unknown")
+ end
for i=1,#e do
- local name = "extension-" .. i
- -- report_goodies("adding extension %s from %s",name,goodie)
- otf.enhancers.addfeature(tfmdata.shared.rawdata,name,e[i])
+ local entry = e[i]
+ local fnames = entry.fonts
+ local tnames = type(fnames)
+ local valid = false
+ if not fontname then
+ valid = true
+ elseif tnames == "table" then
+ if fnames[fontname] then
+ valid = true
+ elseif #fnames > 0 and contains(fnames,fontname) then
+ valid = true
+ end
+ elseif tnames == "string" then
+ fnames = topattern(fnames)
+ valid = find(fontname,fnames) and true
+ else
+ valid = true
+ end
+ if valid then
+ local name = "extension-" .. i
+ if trace_extensions then
+ report_goodies("adding extension %a from %a for font %a",name,goodie,fontname or "unknown")
+ end
+ otf.enhancers.addfeature(tfmdata.shared.rawdata,name,entry)
+ end
end
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
index 3e24e4e2a12..3164068505d 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
@@ -21,7 +21,8 @@ local dir = dir
local lfs = lfs
local attributes = lfs.attributes
-local walkdir = lfs.dir
+----- walkdir = lfs.dir
+local scandir = lfs.dir
local isdir = lfs.isdir -- not robust, will be overloaded anyway
local isfile = lfs.isfile -- not robust, will be overloaded anyway
local currentdir = lfs.currentdir
@@ -69,6 +70,20 @@ else
end
+-- safeguard
+
+local isreadable = file.isreadable
+
+local walkdir = function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+
+lfs.walkdir = walkdir
+
-- handy
function dir.current()
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv b/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv
index 19f431ebf56..7ec4b722eb2 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv
@@ -273,7 +273,7 @@
[\s!hy]
[\c!spacing=\v!packed,
\c!leftsentence=\endash, % *sentences not confirmed
- \c!rightsentence=\endash,
+ \c!rightsentence=\endash,
\c!leftsubsentence=\endash,
\c!rightsubsentence=\endash,
\c!leftquote=\guilsingleleft,
@@ -781,7 +781,8 @@
\c!rightquote=\upperrightsingleninequote,
\c!leftquotation=\upperleftdoublesixquote,
\c!rightquotation=\upperrightdoubleninequote,
- \c!date={\v!year,\space,\v!month,\space,\v!day}]
+ \c!date={\v!day,\space,\v!month,\space,\v!year}]
+
\installlanguage[\s!pt-br][\c!default=\s!pt] % Brazil
\installlanguage[\s!es-es][\c!default=\s!es] % Spain
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
index cb8053fb69c..c41936dacb8 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
@@ -49,14 +49,14 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- nn Norwegian Hans Fredrik Nordhaug, ...
-- nl Dutch Hans Hagen
-- pl Polish Grzegorz Sapijaszko (2011)
--- pt Portuguese Pedro F. M. Mendonça
+-- pt Portuguese Pedro F. M. Mendonça; additions Joana Sophia Bogas Carneiro (2023)
-- ro Romanian Dan Seracu, ...
-- ru Russian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ...
-- sk Slovak Tomáš Hála (2012, 2022)
-- sl Slovenian Mojca Miklavec
-- sr Serbian Ivan Pešić (2020)
-- sr-latn Serbian Ivan Pešić (2020)
--- sv Swedish ...
+-- sv Swedish ...; additions Edith and Mikael Sundqvist (2023)
-- tk Turkish Tobias Burnus
-- tr Turkmen Nazar Annagurban
-- ua Ukrainian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ...
@@ -69,6 +69,11 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- thinspace == sixperemspace = 0x2006
-- print("!"..utf.char(0x2006).."!")
+-- Will be done when needed:
+-- (TH) editor|editors:mnem missing
+-- (HH) save memory at functions
+-- (MS) btx settings for sv
+
languages = languages or { }
local languages = languages
@@ -84,7 +89,7 @@ data.labels={
["be"]="У",
["bg"]="в",
["ca"]="En",
- ["cs"]={ "In", "V" },
+ ["cs"]="In",
["de"]="In",
["en"]="In",
["eo"]="En",
@@ -93,7 +98,7 @@ data.labels={
["fr"]="Dans",
["hy"]="Մեջ",
["mk"]="во",
- ["sk"]={ "In", "V" },
+ ["sk"]="In",
["sr"]="У",
["sr-latn"]="U",
},
@@ -113,6 +118,7 @@ data.labels={
["hy"]="Համար",
["mk"]="Број",
["nl"]="Nummer",
+ ["pt"]="Numero",
["sk"]="Číslo",
["sr"]="Број",
["sr-latn"]="Broj",
@@ -134,6 +140,7 @@ data.labels={
["hy"]="Ծավալ",
["mk"]="Том",
["nl"]="Deel",
+ ["pt"]="Volume",
["sk"]="Zväzok",
["sr"]="Том",
["sr-latn"]="Tom",
@@ -156,6 +163,7 @@ data.labels={
["it"]="e",
["mk"]="и",
["nl"]="en",
+ ["pt"]="e",
["sk"]="a",
["sr"]="и",
["sr-latn"]="i",
@@ -166,7 +174,7 @@ data.labels={
["be"]="Выданне",
["bg"]="издание",
["ca"]="Edició",
- ["cs"]="Vydání",
+ ["cs"]="vydání",
["de"]="Auflage",
["en"]="edition",
["eo"]="eldono",
@@ -179,17 +187,18 @@ data.labels={
["it"]="edizione",
["mk"]="издание",
["nl"]="editie",
- ["sk"]="Vydanie",
+ ["pt"]="edicao",
+ ["sk"]="vydanie",
["sr"]="издање",
["sr-latn"]="izdanje",
},
},
["editor"]={
["labels"]={
- ["be"]="Рэдактар",
+ ["be"]="реэдактар",
["bg"]="редактор",
- ["ca"]="Editor",
- ["cs"]={ "Editor", "Editorka" },
+ ["ca"]="editor",
+ ["cs"]="editor",
["de"]="Herausgeber",
["en"]="editor",
["eo"]="eldonisto",
@@ -200,17 +209,24 @@ data.labels={
["hy"]="խմբագիր",
["it"]="a cura di",
["mk"]="уредник",
- ["sk"]={ "Editor", "Editorka" },
+ ["pt"]="editor",
+ ["sk"]="editor",
["sr"]="уредник",
["sr-latn"]="urednik",
},
},
+ ["editor:f"]={
+ ["labels"]={
+ ["cs"]="editorka",
+ ["sk"]="editorka",
+ },
+ },
["editors"]={
["labels"]={
- ["be"]="Рэдактары",
+ ["be"]="рэдактары",
["bg"]="редактори",
- ["ca"]="Editors",
- ["cs"]="Editoři",
+ ["ca"]="editors",
+ ["cs"]="editoři",
["de"]="Herausgeber",
["en"]="editors",
["eo"]="eldonistoj",
@@ -220,21 +236,16 @@ data.labels={
["hy"]="խմբագիրներ",
["it"]="a cura di",
["mk"]="уредници",
- ["sk"]="Editori",
+ ["pt"]="editores",
+ ["sk"]="editori",
["sr"]="уредници",
["sr-latn"]="urednici",
},
},
["editors:f"]={
["labels"]={
- ["cs"]="Editorky",
- ["sk"]="Editorky",
- },
- },
- ["editors:m"]={
- ["labels"]={
- ["cs"]="Editoři",
- ["sk"]="Editori",
+ ["cs"]="editorky",
+ ["sk"]="editorky",
},
},
["in"]={
@@ -251,6 +262,7 @@ data.labels={
["fr"]="dans",
["hy"]="մեջ",
["mk"]="во",
+ ["pt"]="em",
["sk"]="v",
["sr"]="у",
["sr-latn"]="u",
@@ -274,6 +286,7 @@ data.labels={
["it"]="Tesi di laurea",
["mk"]="Магистерска дисертација",
["nl"]="Masterproef",
+ ["pt"]="Tese de mestrado",
["sk"]="Diplomová práca",
["sr"]="Мастер дисертација",
["sr-latn"]="Master disertacija",
@@ -295,6 +308,7 @@ data.labels={
["hy"]="համար",
["mk"]="број",
["nl"]="nummer",
+ ["pt"]="numero",
["sk"]="číslo",
["sr"]="број",
["sr-latn"]="broj",
@@ -314,6 +328,7 @@ data.labels={
["hy"]="-ից",
["mk"]="од",
["nl"]="van",
+ ["pt"]="de",
["sk"]="z",
["sr"]="од",
["sr-latn"]="od",
@@ -322,7 +337,7 @@ data.labels={
["others"]={
["labels"]={
["ca"]="et al.",
- ["cs"]={ "a~kol.", "et al."},
+ ["cs"]="a~kol.",
["de"]="et al.",
["en"]="et al.",
["eo"]="aliaj",
@@ -331,7 +346,8 @@ data.labels={
["fr"]="et al.",
["hy"]="եւ այլն",
["mk"]="и др.",
- ["sk"]={ "a~kol.", "et al."},
+ ["pt"]="etc",
+ ["sk"]="a~kol.",
["sr"]="и др.",
["sr-latn"]="i dr.",
},
@@ -350,6 +366,7 @@ data.labels={
["fr"]="p.",
["hy"]="էջ",
["mk"]="стр.",
+ ["pt"]="p",
["sk"]="s.",
["sr"]="стр.",
["sr-latn"]="str.",
@@ -372,6 +389,7 @@ data.labels={
["hy"]="էջեր",
["mk"]="страници",
["nl"]="paginas",
+ ["pt"]="paginas",
["sk"]="strany",
["sr"]="страницa",
["sr-latn"]="stranica",
@@ -394,6 +412,7 @@ data.labels={
["it"]="Brevetto",
["mk"]="Патент",
["nl"]="Octrooi",
+ ["pt"]="Patente",
["sk"]="Patent",
["sr"]="Патент",
["sr-latn"]="Patent",
@@ -416,6 +435,7 @@ data.labels={
["it"]="Tesi di dottorato",
["mk"]="Докторска дисертација",
["nl"]="Proefschrift",
+ ["pt"]="Tese de douturamento",
["sk"]="Dizertačná práca",
["sr"]="Докторска дисертација",
["sr-latn"]="Doktorska disertacija",
@@ -433,6 +453,7 @@ data.labels={
["fa"]="صص",
["hy"]="էջ",
["mk"]="стр.",
+ ["pt"]="pp",
["sk"]="s.",
["sr"]="стр.",
["sr-latn"]="str.",
@@ -456,6 +477,7 @@ data.labels={
["it"]="Relazione tecnica",
["mk"]="Технички извештај",
["nl"]="Technisch rapport",
+ ["pt"]="Reporte tecnico",
["sk"]="Technická zpráva",
["sr"]="Технички извештај",
["sr-latn"]="Tehnički izveštaj",
@@ -477,6 +499,7 @@ data.labels={
["hy"]="ծավալ",
["mk"]="том",
["nl"]="deel",
+ ["pt"]="volume",
["sk"]="zväzok",
["sr"]="том",
["sr-latn"]="tom",
@@ -499,6 +522,7 @@ data.labels={
["it"]="con",
["mk"]="со",
["nl"]="met",
+ ["pt"]="com",
["sk"]="s",
["sr"]="са",
["sr-latn"]="sa",
@@ -515,9 +539,11 @@ data.labels={
["es"]="Pr",
["hy"]="P",
["mk"]="P",
+ ["pt"]="Pr",
["sk"]="P",
["sr"]="P",
["sr-latn"]="P",
+ ["sv"]="Pr",
},
},
["arccos"]={
@@ -531,9 +557,11 @@ data.labels={
["hy"]="arccos",
["mk"]="arccos",
["pl"]="arc\\sixperemspace cos",
+ ["pt"]="arccos",
["sk"]="arccos",
["sr"]="arccos",
["sr-latn"]="arccos",
+ ["sv"]="arccos",
},
},
["arccosh"]={
@@ -547,9 +575,11 @@ data.labels={
["hy"]="arccosh",
["mk"]="arccosh",
["pl"]="arc\\sixperemspace cosh",
+ ["pt"]="arccosh",
["sk"]="arccosh",
["sr"]="arccosh",
["sr-latn"]="arccosh",
+ ["sv"]="arcosh",
},
},
["arccot"]={
@@ -563,9 +593,11 @@ data.labels={
["hy"]="arcctg",
["mk"]="arccotg",
["pl"]="arc\\sixperemspace ctg",
+ ["pt"]="arccot",
["sk"]="arccotg",
["sr"]="arcctg",
["sr-latn"]="arcctg",
+ ["sv"]="arccot",
},
},
["arcsin"]={
@@ -579,9 +611,11 @@ data.labels={
["hy"]="arcsin",
["mk"]="arcsin",
["pl"]="arc\\sixperemspace sin",
+ ["pt"]="arcsin",
["sk"]="arcsin",
["sr"]="arcsin",
["sr-latn"]="arcsin",
+ ["sv"]="arcsin",
},
},
["arcsinh"]={
@@ -595,9 +629,11 @@ data.labels={
["hy"]="arcsinh",
["mk"]="arcsinh",
["pl"]="arc\\sixperemspace sinh",
+ ["pt"]="arcsinh",
["sk"]="arcsinh",
["sr"]="arcsinh",
["sr-latn"]="arcsinh",
+ ["sv"]="arsinh",
},
},
["arctan"]={
@@ -611,9 +647,11 @@ data.labels={
["hy"]="arctan",
["mk"]="arctg",
["pl"]="arc\\sixperemspace tg",
+ ["pt"]="arctan",
["sk"]="arctg",
["sr"]="arctg",
["sr-latn"]="arctg",
+ ["sv"]="arctan",
},
},
["arctanh"]={
@@ -627,9 +665,11 @@ data.labels={
["hy"]="arctanh",
["mk"]="arctgh",
["pl"]="arc\\sixperemspace tgh",
+ ["pt"]="arctanh",
["sk"]="arctgh",
["sr"]="arctgh",
["sr-latn"]="arctgh",
+ ["sv"]="artanh",
},
},
["arg"]={
@@ -641,9 +681,11 @@ data.labels={
["es"]="arg",
["hy"]="arg",
["mk"]="arg",
+ ["pt"]="arg",
["sk"]="arg",
["sr"]="arg",
["sr-latn"]="arg",
+ ["sv"]="arg",
},
},
["cos"]={
@@ -655,9 +697,11 @@ data.labels={
["es"]="cos",
["hy"]="cos",
["mk"]="cos",
+ ["pt"]="cos",
["sk"]="cos",
["sr"]="cos",
["sr-latn"]="cos",
+ ["sv"]="cos",
},
},
["cosh"]={
@@ -669,9 +713,11 @@ data.labels={
["es"]="cosh",
["hy"]="cosh",
["mk"]="cosh",
+ ["pt"]="cosh",
["sk"]="cosh",
["sr"]="cosh",
["sr-latn"]="cosh",
+ ["sv"]="cosh",
},
},
["cot"]={
@@ -685,9 +731,11 @@ data.labels={
["hy"]="cot",
["mk"]="ctg",
["pl"]="ctg",
+ ["pt"]="cot",
["sk"]="cotg",
["sr"]="ctg",
["sr-latn"]="ctg",
+ ["sv"]="cot",
},
},
["coth"]={
@@ -699,9 +747,11 @@ data.labels={
["es"]="coth",
["hy"]="coth",
["mk"]="ctgh",
+ ["pt"]="coth",
["sk"]="cotgh",
["sr"]="ctgh",
["sr-latn"]="ctgh",
+ ["sv"]="coth",
},
},
["csc"]={
@@ -713,28 +763,13 @@ data.labels={
["es"]="csc",
["hy"]="csc",
["mk"]="cosec",
+ ["pt"]="csc",
["sk"]="cosec",
["sr"]="cosec",
["sr-latn"]="cosec",
+ ["sv"]="csc",
},
},
---[[ ["ctg"]={
- ["labels"]={
- ["ca"]="cot",
- ["cs"]="cotg",
- ["en"]="cot",
- ["eo"]="cotan",
- ["es"]="cot",
- ["hr"]="ctg",
- ["hy"]="cot",
- ["mk"]="ctg",
- ["pl"]="ctg",
- ["sk"]="cotg",
- ["sr"]="ctg",
- ["sr-latn"]="ctg",
- },
- },
---]]
["deg"]={
["labels"]={
["ca"]="gr",
@@ -744,9 +779,11 @@ data.labels={
["es"]="gr",
["hy"]="deg",
["mk"]="deg",
+ ["pt"]="deg",
["sk"]="deg",
["sr"]="deg",
["sr-latn"]="deg",
+ ["sv"]="deg",
},
},
["det"]={
@@ -757,9 +794,11 @@ data.labels={
["eo"]="det",
["es"]="det",
["hy"]="det",
+ ["pt"]="det",
["sk"]="det",
["sr"]="det",
["sr-latn"]="det",
+ ["sv"]="det",
},
},
["diff"]={
@@ -769,7 +808,9 @@ data.labels={
["en"]="d",
["eo"]="dif",
["hy"]="d",
+ ["pt"]="d",
["sk"]="d",
+ ["sv"]="d",
},
},
["dim"]={
@@ -781,9 +822,11 @@ data.labels={
["es"]="dim",
["hy"]="dim",
["mk"]="dim",
+ ["pt"]="dim",
["sk"]="dim",
["sr"]="dim",
["sr-latn"]="dim",
+ ["sv"]="dim",
},
},
["exp"]={
@@ -794,9 +837,11 @@ data.labels={
["eo"]="eksp",
["es"]="exp",
["hy"]="exp",
+ ["pt"]="exp",
["sk"]="exp",
["sr"]="exp",
["sr-latn"]="exp",
+ ["sv"]="exp",
},
},
["gcd"]={
@@ -811,9 +856,11 @@ data.labels={
["hy"]="ԱԸԲ",
["mk"]="НЗД",
["nl"]="ggd",
+ ["pt"]="gcd",
["sk"]="NSD",
["sr"]="НЗД",
["sr-latn"]="NZD",
+ ["sv"]="sgd",
},
},
["hom"]={
@@ -824,7 +871,9 @@ data.labels={
["eo"]="hom",
["es"]="hom",
["hy"]="հոմ",
+ ["pt"]="hom",
["sk"]="Hom",
+ ["sv"]="hom",
},
},
["inf"]={
@@ -836,9 +885,11 @@ data.labels={
["es"]="inf",
["hy"]="inf",
["mk"]="inf",
+ ["pt"]="inf",
["sk"]="inf",
["sr"]="inf",
["sr-latn"]="inf",
+ ["sv"]="inf",
},
},
["injlim"]={
@@ -849,9 +900,11 @@ data.labels={
["eo"]="",
["es"]="lím\\sixperemspace iny",
["hy"]="inj\\sixperemspace lim",
+ ["pt"]="inj\\sixperemspace lim",
["sk"]="inj\\sixperemspace lim",
["sr"]="inj\\sixperemspace lim",
["sr-latn"]="inj\\sixperemspace lim",
+ ["sv"]="inj\\sixperemspace lim",
},
},
["inv"]={
@@ -863,9 +916,11 @@ data.labels={
["es"]="inv",
["hy"]="inv",
["mk"]="inv",
+ ["pt"]="inv",
["sk"]="inv",
["sr"]="inv",
["sr-latn"]="inv",
+ ["sv"]="inv",
},
},
["ker"]={
@@ -876,9 +931,11 @@ data.labels={
["eo"]="",
["es"]="Ker",
["hy"]="ker",
+ ["pt"]="ker",
["sk"]="ker",
["sr"]="ker",
["sr-latn"]="ker",
+ ["sv"]="ker",
},
},
["lcm"]={
@@ -893,9 +950,11 @@ data.labels={
["hy"]="աըբ",
["mk"]="НЗС",
["nl"]="kgv",
+ ["pt"]="lcm",
["sk"]="NSN",
["sr"]="НЗС",
["sr-latn"]="NZS",
+ ["sv"]="lcm",
},
},
["lg"]={
@@ -909,9 +968,11 @@ data.labels={
["fr"]="log",
["hy"]="lg",
["mk"]="lg",
+ ["pt"]="lg",
["sk"]="log",
["sr"]="lg",
["sr-latn"]="lg",
+ ["sv"]="lg",
},
},
["lim"]={
@@ -923,9 +984,11 @@ data.labels={
["es"]="lím",
["hy"]="lim",
["mk"]="lim",
+ ["pt"]="lim",
["sk"]="lim",
["sr"]="lim",
["sr-latn"]="lim",
+ ["sv"]="lim",
},
},
["liminf"]={
@@ -937,9 +1000,11 @@ data.labels={
["es"]="lím\\sixperemspace inf",
["hy"]="lim\\sixperemspace infs",
["mk"]="lim\\sixperemspace inf",
+ ["pt"]="lim\\sixperemspace inf",
["sk"]="lim\\sixperemspace inf",
["sr"]="lim\\sixperemspace inf",
["sr-latn"]="lim\\sixperemspace inf",
+ ["sv"]="lim\\sixperemspace inf",
},
},
["limsup"]={
@@ -951,9 +1016,11 @@ data.labels={
["es"]="lím\\sixperemspace sup",
["hy"]="lim\\sixperemspace sup",
["mk"]="lim\\sixperemspace sup",
+ ["pt"]="lim\\sixperemspace sup",
["sk"]="lim\\sixperemspace sup",
["sr"]="lim\\sixperemspace sup",
["sr-latn"]="lim\\sixperemspace sup",
+ ["sv"]="lim\\sixperemspace sup",
},
},
["ln"]={
@@ -965,9 +1032,11 @@ data.labels={
["es"]="ln",
["hy"]="ln",
["mk"]="ln",
+ ["pt"]="ln",
["sk"]="ln",
["sr"]="ln",
["sr-latn"]="ln",
+ ["sv"]="ln",
},
},
["log"]={
@@ -979,9 +1048,11 @@ data.labels={
["es"]="log",
["hy"]="log",
["mk"]="log",
+ ["pt"]="log",
["sk"]="log",
["sr"]="log",
["sr-latn"]="log",
+ ["sv"]="log",
},
},
["max"]={
@@ -994,15 +1065,17 @@ data.labels={
["fi"]="max",
["hy"]="max",
["mk"]="max",
+ ["pt"]="max",
["sk"]="max",
["sr"]="max",
["sr-latn"]="max",
+ ["sv"]="max",
},
},
["median"]={
["labels"]={
+ ["comment"]=[[ cs+sk: \tilde won't work]],
["ca"]="mitjana",
- -- ["cs"]="\\tilde", -- won't work
["cs"]="Me",
["en"]="median",
["eo"]="mediano",
@@ -1010,10 +1083,11 @@ data.labels={
["fi"]="mediaani",
["fr"]="médiane",
["hy"]="միջին",
- -- ["sk"]="\\tilde", -- won't work
+ ["pt"]="median",
["sk"]="Med",
["sr"]="median",
["sr-latn"]="median",
+ ["sv"]="median",
},
},
["min"]={
@@ -1026,9 +1100,11 @@ data.labels={
["fi"]="min",
["hy"]="min",
["mk"]="min",
+ ["pt"]="min",
["sk"]="min",
["sr"]="min",
["sr-latn"]="min",
+ ["sv"]="min",
},
},
["mod"]={
@@ -1041,9 +1117,11 @@ data.labels={
["fi"]="mod",
["hy"]="mod",
["mk"]="mod",
+ ["pt"]="mod",
["sk"]="mod",
["sr"]="mod",
["sr-latn"]="mod",
+ ["sv"]="mod",
},
},
["projlim"]={
@@ -1054,9 +1132,11 @@ data.labels={
["eo"]="",
["es"]="lím\\sixperemspace proy",
["hy"]="proj\\sixperemspace lim",
+ ["pt"]="proj\\sixperemspace lim",
["sk"]="proj\\sixperemspace lim",
["sr"]="proj\\sixperemspace lim",
["sr-latn"]="proj\\sixperemspace lim",
+ ["sv"]="proj\\sixperemspace lim",
},
},
["sec"]={
@@ -1069,9 +1149,11 @@ data.labels={
["fi"]="sek",
["hy"]="sec",
["mk"]="sec",
+ ["pt"]="sec",
["sk"]="sec",
["sr"]="sec",
["sr-latn"]="sec",
+ ["sv"]="sec",
},
},
["sin"]={
@@ -1084,9 +1166,11 @@ data.labels={
["fi"]="sin",
["hy"]="sin",
["mk"]="sin",
+ ["pt"]="sen",
["sk"]="sin",
["sr"]="sin",
["sr-latn"]="sin",
+ ["sv"]="sin",
},
},
["sinh"]={
@@ -1098,9 +1182,11 @@ data.labels={
["es"]="senh",
["hy"]="sinh",
["mk"]="sinh",
+ ["pt"]="sinh",
["sk"]="sinh",
["sr"]="sinh",
["sr-latn"]="sinh",
+ ["sv"]="sinh",
},
},
["sup"]={
@@ -1111,9 +1197,11 @@ data.labels={
["es"]="sup",
["hy"]="sup",
["mk"]="sup",
+ ["pt"]="sup",
["sk"]="sup",
["sr"]="sup",
["sr-latn"]="sup",
+ ["sv"]="sup",
},
},
["tan"]={
@@ -1126,9 +1214,11 @@ data.labels={
["hy"]="tan",
["mk"]="tg",
["pl"]="tg",
+ ["pt"]="tan",
["sk"]="tg",
["sr"]="tg",
["sr-latn"]="tg",
+ ["sv"]="tan",
},
},
["tanh"]={
@@ -1139,9 +1229,11 @@ data.labels={
["es"]="tanh",
["hy"]="tanh",
["mk"]="tgh",
+ ["pt"]="tanh",
["sk"]="tgh",
["sr"]="tgh",
["sr-latn"]="tgh",
+ ["sv"]="tanh",
},
},
},
@@ -1172,13 +1264,13 @@ data.labels={
["nl"]=" en ",
["nn"]="",
["pl"]=" i ",
- ["pt"]="",
+ ["pt"]=" e ",
["ro"]="",
["ru"]="",
["sk"]=" a ",
["sl"]="",
["sr"]=" и ",
- ["sv"]="",
+ ["sv"]=" och ",
["tk"]="",
["tr"]="",
["ua"]="",
@@ -1190,18 +1282,18 @@ data.labels={
["labels"]={
["af"]="Bylae ",
["ar"]="ملحق ",
- ["be"]="Апендыцыт",
+ ["be"]="Апендыцыт ",
["ca"]="Apèndix ",
- ["cn"]="附录",
+ ["cn"]="附录 ",
["cs"]="Příloha ",
["da"]="Bilag ",
["de"]="Anhang ",
["en"]="Appendix ",
- ["eo"]="Anekso",
+ ["eo"]="Anekso ",
["es"]="Apéndice ",
["et"]="Lisa ",
["fa"]="پیوست ",
- ["fi"]="liite",
+ ["fi"]="Liite ",
["fr"]="Annexe ",
["gr"]="Παράρτημα ",
["hr"]="Dodatak ",
@@ -1217,14 +1309,14 @@ data.labels={
["nl"]="",
["nn"]="Tillegg ",
["pl"]="Dodatek ",
- ["pt"]="",
+ ["pt"]="Apendice ",
["ro"]="",
["ru"]="",
["sk"]="Príloha ",
["sl"]="Dodatek ",
["sr"]="Додатак ",
["sr-latn"]="Dodatak ",
- ["sv"]="",
+ ["sv"]="Bilaga ",
["tk"]="Goşmaça ",
["tr"]="",
["ua"]="",
@@ -1331,16 +1423,16 @@ data.labels={
["labels"]={
["af"]="",
["ar"]="في صفحة ",
- ["ca"]="a la pagina",
+ ["ca"]="a la pagina ",
["cs"]="na straně ",
["da"]="på side ",
["de"]="auf Seite ",
["en"]="at page ",
- ["eo"]="je paĝo",
+ ["eo"]="je paĝo ",
["es"]="en la página ",
["et"]="leheküljel ",
["fa"]="در صفحه ",
- ["fi"]="sivulla",
+ ["fi"]="sivulla ",
["fr"]="à la page ",
["gr"]="",
["hr"]="na stranici ",
@@ -1354,7 +1446,7 @@ data.labels={
["nl"]="op pagina ",
["nn"]="på side ",
["pl"]="na stronie ",
- ["pt"]="",
+ ["pt"]="na pagina",
["ro"]="",
["ru"]="на странице ",
["sk"]="na strane ",
@@ -1473,18 +1565,18 @@ data.labels={
["be"]="Глава ",
["bg"]="Eпизод ",
["ca"]="Capítol ",
- ["cn"]={ "第", "章" },
+ ["cn"]={ "第 ", " 章" },
["cs"]="Kapitola ",
["da"]="",
["de"]="Kapitel ",
["en"]="Chapter ",
- ["eo"]="Ĉapitro",
+ ["eo"]="Ĉapitro ",
["es"]="Capítulo ",
["et"]="Peatükk ",
["fa"]="فصل ",
["fi"]="luku",
["fr"]="Chapitre ",
- ["gr"]="Κεφάλαιο",
+ ["gr"]="Κεφάλαιο ",
["hr"]="Poglavlje ",
["hu"]={ "", " fejezet" },
["hy"]="Գլուխ ",
@@ -1498,15 +1590,15 @@ data.labels={
["nl"]="",
["nn"]="",
["pl"]="Rozdział ",
- ["pt"]="",
+ ["pt"]="Capitulo ",
["ro"]="",
["ru"]="",
["sk"]="Kapitola ",
["sl"]="Poglavje ",
["sr"]="Глава ",
["sr-latn"]="Glava ",
- ["sv"]="",
- ["tk"]="Bap",
+ ["sv"]="Kapitel ",
+ ["tk"]="Bap ",
["tr"]="",
["ua"]="",
["vi"]="Chương ",
@@ -1540,25 +1632,31 @@ data.labels={
["nl"]=" (vervolgd)",
["nn"]="",
["pl"]="",
- ["pt"]="",
+ ["pt"]=" (continua)",
["ro"]="",
["ru"]="",
["sk"]=" (pokračovanie)",
["sl"]="",
["sr"]=" (наставак)",
["sr-latn"]=" (nastavak)",
- ["sv"]="",
+ ["sv"]=" (forts.)",
["tk"]="",
["tr"]="",
["ua"]="",
["vi"]="",
},
},
+ ["day:genetiv"]={
+ ["labels"]={
+ ["cs"]="dne",
+ ["sk"]="dňa",
+ },
+ },
["day"]={
["labels"]={
["bg"]="ден",
["ca"]="dia",
- ["cs"]="den", -- {"den", "dne" }
+ ["cs"]="den",
["de"]="Tag",
["en"]="day",
["eo"]="tago",
@@ -1570,9 +1668,11 @@ data.labels={
["kr"]="일",
["mk"]="ден",
["nl"]="dag",
- ["sk"]="deň", -- {"deň", "dňa" }
+ ["pt"]="dia",
+ ["sk"]="deň",
["sr"]="дан",
["sr-latn"]="dan",
+ ["sv"]="dag",
},
},
["december"]={
@@ -1771,10 +1871,10 @@ data.labels={
["labels"]={
["af"]="Figuur ",
["ar"]="شكل ",
- ["be"]="Малюнак",
- ["bg"]="Фигура",
+ ["be"]="Малюнак ",
+ ["bg"]="Фигура ",
["ca"]="Figura ",
- ["cn"]="图",
+ ["cn"]="图 ",
["cs"]="Obrázek ",
["da"]="Figur ",
["de"]="Abbildung ",
@@ -1785,7 +1885,7 @@ data.labels={
["fa"]="شکل ",
["fi"]="Kuva ",
["fr"]="Figure ",
- ["gr"]="Σχήμα",
+ ["gr"]="Σχήμα ",
["hr"]="Slika ",
["hu"]={ "", " ábra" },
["hy"]="Նկար ",
@@ -1807,7 +1907,7 @@ data.labels={
["sr"]="Слика ",
["sr-latn"]="Slika ",
["sv"]="Figur ",
- ["tk"]="Surat",
+ ["tk"]="Surat ",
["tr"]="Şekil ",
["ua"]="Малюнок ",
["vi"]="Hình ",
@@ -1821,7 +1921,9 @@ data.labels={
["eo"]="sekvv",
["fr"]=hairspace .. "sqq",
["hy"]="ff.",
+ ["pt"]="seg",
["sk"]="násl.",
+ ["sv"]="ff.",
},
},
["following:singular"]={
@@ -1832,7 +1934,9 @@ data.labels={
["eo"]="sekv",
["fr"]=hairspace .. "sq",
["hy"]="f.",
+ ["pt"]="seg",
["sk"]="násl.",
+ ["sv"]="f.",
},
},
["followingpage"]={
@@ -1850,9 +1954,11 @@ data.labels={
["hy"]="Հաջորդ էջում",
["mk"]="на следната страница",
["nl"]="op een volgende bladzijde",
+ ["pt"]="pagina seguinte",
["sk"]="na nasledujúcej strane",
["sr"]="на следећој страници",
["sr-latn"]="na sledećoj stranici",
+ ["sv"]="på nästa sida",
},
},
["friday"]={
@@ -1925,21 +2031,21 @@ data.labels={
["be"]="Графіка ",
["bg"]="Графичен ",
["ca"]="Gràfica ",
- ["cn"]="插图",
+ ["cn"]="插图 ",
["cs"]="Graf ",
["da"]="Grafik ",
["de"]="Grafik ",
["en"]="Graphic ",
- ["eo"]="Grafiko",
+ ["eo"]="Grafiko ",
["es"]="Gráfico ",
["et"]="Pilt ",
["fa"]="طرح ",
["fi"]="Grafiikka ",
["fr"]="Illustration ",
- ["gr"]="Γραφικό",
+ ["gr"]="Γραφικό ",
["hr"]="Slika ",
["hu"]={ "", " kép" },
- ["hy"]="Գրաֆ",
+ ["hy"]="Գրաֆ ",
["it"]="Grafico ",
["ja"]="イラスト",
["la"]="Typus ",
@@ -1957,10 +2063,10 @@ data.labels={
["sr"]="График ",
["sr-latn"]="Grafik ",
["sv"]="Grafik ",
- ["tk"]="Grafik",
- ["tr"]="Grafik",
+ ["tk"]="Grafik ",
+ ["tr"]="Grafik ",
["ua"]="График ",
- ["vi"]="Đồ thị",
+ ["vi"]="Đồ thị ",
},
},
["hencefore"]={
@@ -1969,10 +2075,10 @@ data.labels={
["ar"]="كما وضحنا سابقا",
["be"]="гл. вышэй",
["bg"]="виж по-горе",
- ["ca"]="com es mostra dalt ",
+ ["ca"]="com es mostra dalt",
["cs"]="viz výše",
["da"]="se foroven",
- ["de"]="siehe oben", -- better "oben"?
+ ["de"]="siehe oben",
["en"]="as we show above",
["eo"]="laŭsupre",
["es"]="como se muestra arriba",
@@ -1993,7 +2099,7 @@ data.labels={
["nl"]="hierboven",
["nn"]="som vist over",
["pl"]="jak pokazano wyżej",
- ["pt"]="",
+ ["pt"]="como mostrado em cima",
["ro"]="",
["ru"]="см. выше",
["sk"]="pozri hore",
@@ -2016,7 +2122,7 @@ data.labels={
["ca"]="com es mostra baix",
["cs"]="viz níže",
["da"]="se forneden",
- ["de"]="siehe unten", -- better "nachstehend"?
+ ["de"]="siehe unten",
["en"]="as we show below",
["eo"]="laŭsube",
["es"]="como se muestra abajo",
@@ -2037,7 +2143,7 @@ data.labels={
["nl"]="hieronder",
["nn"]="som vist under",
["pl"]="jak pokazano niżej",
- ["pt"]="",
+ ["pt"]="como mostrado em baixo",
["ro"]="",
["ru"]="см. ниже",
["sk"]="pozri ďalej",
@@ -2058,20 +2164,20 @@ data.labels={
["be"]="Інтэрмецца ",
["bg"]="Интермецо ",
["ca"]="Intermedi ",
- ["cn"]="퉣",
+ ["cn"]="퉣 ",
["cs"]="Intermezzo ",
["da"]="Intermezzo ",
["de"]="Intermezzo ",
["en"]="Intermezzo ",
- ["eo"]="Intermezo",
+ ["eo"]="Intermezo ",
["es"]="Intermedio ",
["et"]="Vahemäng ",
["fi"]="Intermezzo ",
["fr"]="Intermède ",
- ["gr"]="Παύση",
+ ["gr"]="Παύση ",
["hr"]="Intermeco ",
["hu"]={ "", " intermezzo" },
- ["hy"]="Ինտերմեցո",
+ ["hy"]="Ինտերմեցո ",
["it"]="Intermezzo ",
["ja"]="間奏曲",
["kr"]="간주곡",
@@ -2090,10 +2196,10 @@ data.labels={
["sr"]="Дигресија ",
["sr-latn"]="Digresija ",
["sv"]="Intermezzo ",
- ["tk"]="Arakesme",
+ ["tk"]="Arakesme ",
["tr"]="",
["ua"]="Вставка ",
- ["vi"]="intermezzo",
+ ["vi"]="Intermezzo ",
},
},
["january"]={
@@ -2395,7 +2501,7 @@ data.labels={
["be"]="радок ",
["bg"]="ред ",
["ca"]="línia ",
- ["cn"]="行",
+ ["cn"]="行 ",
["cs"]="řádek ",
["da"]="linie ",
["de"]="Zeile ",
@@ -2406,7 +2512,7 @@ data.labels={
["fa"]="سطر ",
["fi"]="rivi ",
["fr"]="ligne ",
- ["gr"]="Γραμμή",
+ ["gr"]="Γραμμή ",
["hr"]="redak ",
["hu"]={ "", " sor" },
["hy"]="Տող ",
@@ -2428,7 +2534,7 @@ data.labels={
["sr"]="линија ",
["sr-latn"]="linija ",
["sv"]="rad ",
- ["tk"]="setir",
+ ["tk"]="setir ",
["tr"]="satır ",
["ua"]="рядок ",
["vi"]="dòng ",
@@ -2441,7 +2547,7 @@ data.labels={
["be"]="радкi ",
["bg"]="редове ",
["ca"]="línies ",
- ["cn"]="行",
+ ["cn"]="行 ",
["cs"]="řádky ",
["da"]="linier ",
["de"]="Zeilen ",
@@ -2452,7 +2558,7 @@ data.labels={
["fa"]="سطرهای ",
["fi"]="rivie ",
["fr"]="lignes ",
- ["gr"]="Γραμμές",
+ ["gr"]="Γραμμές ",
["hr"]="retci ",
["hu"]="sorok ",
["hy"]="Տողեր ",
@@ -2474,7 +2580,7 @@ data.labels={
["sr"]="линије ",
["sr-latn"]="linije ",
["sv"]="rader ",
- ["tk"]="setirler",
+ ["tk"]="setirler ",
["tr"]="satırlar ",
["ua"]="рядки ",
["vi"]="dòng ",
@@ -2742,6 +2848,7 @@ data.labels={
["be"]="месяц",
["bg"]="месец",
["ca"]="mes",
+ ["cs"]="měsíc",
["de"]="Monat",
["en"]="month",
["eo"]="monato",
@@ -2754,8 +2861,11 @@ data.labels={
["kr"]="월",
["mk"]="месец",
["nl"]="maand",
+ ["pt"]="mes",
+ ["sk"]="mesiac",
["sr"]="месец",
["sr-latn"]="mesec",
+ ["sv"]="månad",
},
},
["november"]={
@@ -2956,7 +3066,7 @@ data.labels={
["af"]="",
["ar"]="صفحة ",
["be"]="старонка ",
- ["bg"]="страна",
+ ["bg"]="страна ",
["ca"]="pagina ",
["cs"]="strana ",
["da"]="Side ",
@@ -2966,7 +3076,7 @@ data.labels={
["es"]="página ",
["et"]="lehekülg ",
["fa"]="صفحه ",
- ["fi"]="Sivu",
+ ["fi"]="Sivu ",
["fr"]="page ",
["gr"]="",
["hr"]="stranica ",
@@ -2981,7 +3091,7 @@ data.labels={
["nl"]="pagina ",
["nn"]="side ",
["pl"]="strona ",
- ["pt"]="",
+ ["pt"]="pagina ",
["ro"]="",
["ru"]="страница ",
["sk"]="strana ",
@@ -3002,7 +3112,7 @@ data.labels={
["be"]="Частка ",
["bg"]="Частка ",
["ca"]="Part ",
- ["cn"]={ "第", "部分" },
+ ["cn"]={ "第 ", " 部分" },
["cs"]="Část ",
["da"]="Del ",
["de"]="Teil ",
@@ -3013,7 +3123,7 @@ data.labels={
["fa"]="قسمت ",
["fi"]="Osa ",
["fr"]="Partie ",
- ["gr"]="Μέρος",
+ ["gr"]="Μέρος ",
["hr"]="Dio ",
["hu"]={ "", " rész" },
["hy"]="Մաս ",
@@ -3022,10 +3132,9 @@ data.labels={
["kr"]={ "제", "부" },
["la"]="Pars ",
["lt"]={ "", " dalis" },
- ["mk"]="Дел ",
["nb"]="Del ",
["nl"]="Deel ",
- ["nn"]="Del",
+ ["nn"]="Del ",
["pl"]="Część ",
["pt"]="Parte ",
["ro"]="Partea ",
@@ -3035,7 +3144,7 @@ data.labels={
["sr"]="Део ",
["sr-latn"]="Deo ",
["sv"]="Del ",
- ["tk"]="Bölüm",
+ ["tk"]="Bölüm ",
["tr"]="Cilt ",
["ua"]="Частина ",
["vi"]="Phần ",
@@ -3043,9 +3152,10 @@ data.labels={
},
["precedingpage"]={
["labels"]={
+ ["comment"]=[[ "auf der vorigen Seite" ok, but not "auf einer vorigen Seite" ]],
["ca"]="en una pagina anterior",
["cs"]="na předchozí straně",
- ["de"]="oben", -- "auf der vorigen Seite" ok, but not "auf einer vorigen Seite"
+ ["de"]="oben",
["en"]="on a preceding page",
["eo"]="sur antaŭa paĝo",
["es"]="en la pagina anterior",
@@ -3056,9 +3166,11 @@ data.labels={
["hy"]="նախորդ էջ",
["mk"]="на претходната страница",
["nl"]="op een voorgaande bladzijde",
+ ["pt"]="na seguinte pagina",
["sk"]="na predchádzajúcej strane",
["sr"]="на претходној страници",
["sr-latn"]="na prethodnoj stranici",
+ ["sv"]="på föregående sida",
},
},
["saturday"]={
@@ -3130,18 +3242,18 @@ data.labels={
["ar"]="فصل ",
["bg"]="Cекция ",
["ca"]="Secció ",
- ["cn"]={ "第", "节" },
+ ["cn"]={ "第 ", " 节" },
["cs"]="Sekce ",
["da"]="",
["de"]="Abschnitt ",
- ["en"]="Section",
+ ["en"]="Section ",
["eo"]="Sekcio ",
["es"]="Sección ",
["et"]="jaos ",
["fa"]="بخش ",
- ["fi"]="Osio",
+ ["fi"]="Osio ",
["fr"]="Section ",
- ["gr"]="Ενότητα",
+ ["gr"]="Ενότητα ",
["hr"]="Odjeljak ",
["hu"]="Fejezet ",
["hy"]="Բաժին ",
@@ -3162,7 +3274,7 @@ data.labels={
["sl"]="",
["sr"]="Одељак ",
["sr-latn"]="Odeljak ",
- ["sv"]="",
+ ["sv"]="Avsnitt",
["tk"]="",
["tr"]="",
["ua"]="",
@@ -3174,7 +3286,7 @@ data.labels={
["af"]="",
["ar"]="انظر ",
["be"]="гл. ",
- ["bg"]="погледни",
+ ["bg"]="погледни ",
["ca"]="vore ",
["cs"]="viz ",
["da"]="se ",
@@ -3184,7 +3296,7 @@ data.labels={
["es"]="ver: ",
["et"]="vaadake ",
["fa"]="نگاه کنید به ",
- ["fi"]="Katso",
+ ["fi"]="katso ",
["fr"]="cf. ",
["gr"]="",
["hr"]="vidi ",
@@ -3199,7 +3311,7 @@ data.labels={
["nl"]="zie ",
["nn"]="sjå ",
["pl"]="patrz ",
- ["pt"]="",
+ ["pt"]="ver ",
["ro"]="",
["ru"]="см. ",
["sk"]="pozri ",
@@ -3320,14 +3432,14 @@ data.labels={
["cs"]="Podsekce ",
["da"]="",
["de"]="Unterabschnitt ",
- ["en"]="Subsection",
+ ["en"]="Subsection ",
["eo"]="Subsekcio ",
["es"]="Subsección ",
["et"]="alajaotis ",
["fa"]="زیربخش ",
["fi"]="Alajakso",
["fr"]="Soussection ",
- ["gr"]="Υπόενότητα",
+ ["gr"]="Υπόενότητα ",
["hr"]="Pododjeljak ",
["hu"]="Alfejezet ",
["hy"]=" Ենթաբաժին ",
@@ -3340,14 +3452,14 @@ data.labels={
["nl"]="",
["nn"]="",
["pl"]="Podpodrozdział ",
- ["pt"]="",
+ ["pt"]="Subsecçao ",
["ro"]="",
["ru"]="",
["sk"]="Podsekcia ",
["sl"]="",
["sr"]="Пододељак ",
["sr-latn"]="Pododeljak ",
- ["sv"]="",
+ ["sv"]="Underavsnitt",
["tk"]="",
["tr"]="",
["ua"]="",
@@ -3365,12 +3477,12 @@ data.labels={
["cs"]="Podpodsekce ",
["da"]="",
["de"]="Unterunterabschnitt ",
- ["en"]="Subsubsection",
+ ["en"]="Subsubsection ",
["eo"]="Subsubsekcio ",
["es"]="Subsubsección ",
["et"]="alamjaotis ",
["fa"]="زیرزیربخش ",
- ["fi"]="Alakohta",
+ ["fi"]="Alakohta ",
["fr"]="Soussoussection ",
["gr"]="",
["hr"]="Podpododjeljak ",
@@ -3385,14 +3497,14 @@ data.labels={
["nl"]="",
["nn"]="",
["pl"]="",
- ["pt"]="",
+ ["pt"]="Subsubsecçao ",
["ro"]="",
["ru"]="",
["sk"]="Podpodsekcia ",
["sl"]="",
["sr"]="Подпододељак ",
["sr-latn"]="Podpododeljak ",
- ["sv"]="",
+ ["sv"]="Underunderavsnitt",
["tk"]="",
["tr"]="",
["ua"]="",
@@ -3409,13 +3521,13 @@ data.labels={
["cn"]="",
["cs"]="Podpodpodsekce ",
["da"]="",
- ["de"]="Unterunterunterabschnitt",
- ["en"]="Subsubsubsection",
+ ["de"]="Unterunterunterabschnitt ",
+ ["en"]="Subsubsubsection ",
["eo"]="Subsubsubsekcio ",
["es"]="Subsubsubsección ",
["et"]="",
["fa"]="زیرزیرزیربخش ",
- ["fi"]="Ala-alakohta",
+ ["fi"]="Ala-alakohta ",
["fr"]="Soussoussoussection ",
["gr"]="",
["hr"]="Podpodpododjeljak ",
@@ -3430,7 +3542,7 @@ data.labels={
["nl"]="",
["nn"]="",
["pl"]="",
- ["pt"]="",
+ ["pt"]="Subsubsubsecçao ",
["ro"]="",
["ru"]="",
["sk"]="Podpodpodsekcia ",
@@ -3513,7 +3625,7 @@ data.labels={
["be"]="Табліца ",
["bg"]="Таблица ",
["ca"]="Taula ",
- ["cn"]="表",
+ ["cn"]="表 ",
["cs"]="Tabulka ",
["da"]="Tabel ",
["de"]="Tabelle ",
@@ -3524,7 +3636,7 @@ data.labels={
["fa"]="جدول ",
["fi"]="Taulukko ",
["fr"]="Tableau ",
- ["gr"]="Πίνακας",
+ ["gr"]="Πίνακας ",
["hr"]="Tablica ",
["hu"]={ "", " táblázat" },
["hy"]="Աղյուսակ ",
@@ -3546,7 +3658,7 @@ data.labels={
["sr"]="Табела ",
["sr-latn"]="Tabela ",
["sv"]="Tabell ",
- ["tk"]="Tablisa",
+ ["tk"]="Tablisa ",
["tr"]="Tablo ",
["ua"]="Таблиця ",
["vi"]="Bảng ",
@@ -3758,9 +3870,11 @@ data.labels={
["kr"]="년",
["mk"]="година",
["nl"]="jaar",
+ ["pt"]="ano",
["sk"]="rok",
["sr"]="година",
["sr-latn"]="godina",
+ ["sv"]="år",
},
},
},
@@ -3773,7 +3887,7 @@ data.labels={
["bg"]="Съкращения",
["ca"]="Abreviacions",
["cn"]="缩略语",
- ["cs"]="Seznam zkratek", --"Zkratky"
+ ["cs"]="Seznam zkratek",
["da"]="Forkortelser",
["de"]="Abkürzungen",
["en"]="Abbreviations",
@@ -3800,7 +3914,7 @@ data.labels={
["pt"]="Abreviaturas",
["ro"]="Abrevieri",
["ru"]="Список сокращений",
- ["sk"]="Zoznam skratiek", -- "Skratky"
+ ["sk"]="Zoznam skratiek",
["sl"]="Kratice",
["sr"]="Скраћенице",
["sr-latn"]="Skraćenice",
@@ -3863,7 +3977,7 @@ data.labels={
["ar"]="الأشكال",
["be"]="Спіс ілюстрацый",
["ca"]="Figures",
- ["cn"]="图形",
+ ["cn"]="图",
["cs"]="Seznam obrázků",
["da"]="Figurer",
["de"]="Abbildungen",
@@ -4046,7 +4160,7 @@ data.labels={
["be"]="Лагатыпы",
["bg"]="Логотипи",
["ca"]="Logotips",
- ["cn"]="徽贬",
+ ["cn"]="徽标",
["cs"]="Loga",
["da"]="Logoer",
["de"]="Logos",
@@ -4112,14 +4226,14 @@ data.labels={
["nl"]="Literatuur",
["nn"]="",
["pl"]="Bibliografia",
- ["pt"]="",
+ ["pt"]="Referencias",
["ro"]="",
["ru"]="",
["sk"]="Literatúra",
["sl"]="Literatura",
["sr"]="Литература",
["sr-latn"]="Literatura",
- ["sv"]="",
+ ["sv"]="Litteraturförteckning",
["tk"]="",
["tr"]="",
["ua"]="",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua
index 7a8b7ca86c3..7cd666df567 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua
@@ -21,12 +21,10 @@ local v_after = variables.after
local is_letter = characters.is_letter
---[[
-<p>Hyphenating <l n='url'/>'s is somewhat tricky and a matter of taste. I did
-consider using a dedicated hyphenation pattern or dealing with it by node
-parsing, but the following solution suits as well. After all, we're mostly
-dealing with <l n='ascii'/> characters.</p>
-]]--
+-- Hyphenating URL's is somewhat tricky and a matter of taste. I did consider using
+-- a dedicated hyphenation pattern or dealing with it by node parsing, but the
+-- following solution suits as well. After all, we're mostly dealing with ASCII
+-- characters.
local urls = { }
languages.urls = urls
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua
index 94e9fc2714f..803a8860eb4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua
@@ -246,7 +246,8 @@ local function setupidentity()
addtoinfo("ConTeXt.Version",version)
addtoinfo("ConTeXt.Time",os.date("%Y-%m-%d %H:%M"))
addtoinfo("ConTeXt.Jobname",jobname)
- addtoinfo("ConTeXt.Url","www.pragma-ade.com")
+ -- addtoinfo("ConTeXt.Url","www.pragma-ade.com")
+ addtoinfo("ConTeXt.Url","github.com/contextgarden/context")
addtoinfo("ConTeXt.Support","contextgarden.net")
addtoinfo("TeX.Support","tug.org")
--
diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua
index 9fd55f3ecc0..9e35283c164 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua
@@ -12,20 +12,16 @@ local collectgarbage, type, next = collectgarbage, type, next
local round = math.round
local sortedhash, sortedkeys, tohash = table.sortedhash, table.sortedkeys, table.tohash
---[[ldx--
-<p>Callbacks are the real asset of <l n='luatex'/>. They permit you to hook
-your own code into the <l n='tex'/> engine. Here we implement a few handy
-auxiliary functions.</p>
---ldx]]--
+-- Callbacks are the real asset of LuaTeX. They permit you to hook your own code
+-- into the TeX engine. Here we implement a few handy auxiliary functions. Watch
+-- out, there are diferences between LuateX and LuaMetaTeX.
callbacks = callbacks or { }
local callbacks = callbacks
---[[ldx--
-<p>When you (temporarily) want to install a callback function, and after a
-while wants to revert to the original one, you can use the following two
-functions. This only works for non-frozen ones.</p>
---ldx]]--
+-- When you (temporarily) want to install a callback function, and after a while
+-- wants to revert to the original one, you can use the following two functions.
+-- This only works for non-frozen ones.
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
@@ -47,13 +43,12 @@ local list = callbacks.list
local permit_overloads = false
local block_overloads = false
---[[ldx--
-<p>By now most callbacks are frozen and most provide a way to plug in your own code. For instance
-all node list handlers provide before/after namespaces and the file handling code can be extended
-by adding schemes and if needed I can add more hooks. So there is no real need to overload a core
-callback function. It might be ok for quick and dirty testing but anyway you're on your own if
-you permanently overload callback functions.</p>
---ldx]]--
+-- By now most callbacks are frozen and most provide a way to plug in your own code.
+-- For instance all node list handlers provide before/after namespaces and the file
+-- handling code can be extended by adding schemes and if needed I can add more
+-- hooks. So there is no real need to overload a core callback function. It might be
+-- ok for quick and dirty testing but anyway you're on your own if you permanently
+-- overload callback functions.
-- This might become a configuration file only option when it gets abused too much.
@@ -279,65 +274,50 @@ end)
-- callbacks.freeze("read_.*_file","reading file")
-- callbacks.freeze("open_.*_file","opening file")
---[[ldx--
-<p>The simple case is to remove the callback:</p>
-
-<code>
-callbacks.push('linebreak_filter')
-... some actions ...
-callbacks.pop('linebreak_filter')
-</code>
-
-<p>Often, in such case, another callback or a macro call will pop
-the original.</p>
-
-<p>In practice one will install a new handler, like in:</p>
-
-<code>
-callbacks.push('linebreak_filter', function(...)
- return something_done(...)
-end)
-</code>
-
-<p>Even more interesting is:</p>
-
-<code>
-callbacks.push('linebreak_filter', function(...)
- callbacks.pop('linebreak_filter')
- return something_done(...)
-end)
-</code>
-
-<p>This does a one-shot.</p>
---ldx]]--
-
---[[ldx--
-<p>Callbacks may result in <l n='lua'/> doing some hard work
-which takes time and above all resourses. Sometimes it makes
-sense to disable or tune the garbage collector in order to
-keep the use of resources acceptable.</p>
-
-<p>At some point in the development we did some tests with counting
-nodes (in this case 121049).</p>
-
-<table>
-<tr><td>setstepmul</td><td>seconds</td><td>megabytes</td></tr>
-<tr><td>200</td><td>24.0</td><td>80.5</td></tr>
-<tr><td>175</td><td>21.0</td><td>78.2</td></tr>
-<tr><td>150</td><td>22.0</td><td>74.6</td></tr>
-<tr><td>160</td><td>22.0</td><td>74.6</td></tr>
-<tr><td>165</td><td>21.0</td><td>77.6</td></tr>
-<tr><td>125</td><td>21.5</td><td>89.2</td></tr>
-<tr><td>100</td><td>21.5</td><td>88.4</td></tr>
-</table>
-
-<p>The following code is kind of experimental. In the documents
-that describe the development of <l n='luatex'/> we report
-on speed tests. One observation is that it sometimes helps to
-restart the collector. Okay, experimental code has been removed,
-because messing aroudn with the gc is too unpredictable.</p>
---ldx]]--
-
+-- The simple case is to remove the callback:
+--
+-- callbacks.push('linebreak_filter')
+-- ... some actions ...
+-- callbacks.pop('linebreak_filter')
+--
+-- Often, in such case, another callback or a macro call will pop the original.
+--
+-- In practice one will install a new handler, like in:
+--
+-- callbacks.push('linebreak_filter', function(...)
+-- return something_done(...)
+-- end)
+--
+-- Even more interesting is:
+--
+-- callbacks.push('linebreak_filter', function(...)
+-- callbacks.pop('linebreak_filter')
+-- return something_done(...)
+-- end)
+--
+-- This does a one-shot.
+--
+-- Callbacks may result in Lua doing some hard work which takes time and above all
+-- resourses. Sometimes it makes sense to disable or tune the garbage collector in
+-- order to keep the use of resources acceptable.
+--
+-- At some point in the development we did some tests with counting nodes (in this
+-- case 121049).
+--
+-- setstepmul seconds megabytes
+-- 200 24.0 80.5
+-- 175 21.0 78.2
+-- 150 22.0 74.6
+-- 160 22.0 74.6
+-- 165 21.0 77.6
+-- 125 21.5 89.2
+-- 100 21.5 88.4
+--
+-- The following code is kind of experimental. In the documents that describe the
+-- development of LuaTeX we report on speed tests. One observation is that it
+-- sometimes helps to restart the collector. Okay, experimental code has been
+-- removed, because messing around with the gc is too unpredictable.
+--
-- For the moment we keep this here and not in util-gbc.lua or so.
utilities = utilities or { }
diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua
index fe97cf604b9..19172133227 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua
@@ -15,6 +15,11 @@ if not modules then modules = { } end modules ['luat-fmt'] = {
-- I'll strip the code here because something generic will never take of and we
-- moved on to luametatex anyway.
+-- Per 2023-04-25 we need to explicitly pass --socket and --shell-escape because
+-- other macro packages need these libraries to be disabled due to lack of control.
+-- So a quite drastic break of downward compatibility (context could not generate a
+-- format otherwise). Yet another reason to move on to luametatex.
+
local format = string.format
local concat = table.concat
local quoted = string.quoted
@@ -64,7 +69,7 @@ end
-- The silent option is for Taco. It's a bit of a hack because we cannot yet mess
-- with directives. In fact, I could probably clean up the maker a bit by now.
-local template = [[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
+local template = [[--ini %primaryflags% --socket --shell-escape --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers = {
primaryflags = "verbose", -- "flags"
@@ -225,7 +230,7 @@ function environment.make_format(formatname)
lfs.chdir(startupdir)
end
-local template = [[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
+local template = [[%primaryflags% --socket --shell-escape --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
local checkers = {
primaryflags = "verbose",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua
index dcca8cec7a8..83fe0713d66 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua
@@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luat-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>We cannot load anything yet. However what we will do us reserve a few tables.
-These can be used for runtime user data or third party modules and will not be
-cluttered by macro package code.</p>
---ldx]]--
+-- We cannot load anything yet. However what we will do us reserve a few tables.
+-- These can be used for runtime user data or third party modules and will not be
+-- cluttered by macro package code.
userdata = userdata or { } -- for users (e.g. functions etc)
thirddata = thirddata or { } -- only for third party modules
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua
index fc17371e58f..217f81c13f9 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua
@@ -110,11 +110,7 @@ function xml.processattributes(root,pattern,handle)
return collected
end
---[[ldx--
-<p>The following functions collect elements and texts.</p>
---ldx]]--
-
--- are these still needed -> lxml-cmp.lua
+-- The following functions collect elements and texts.
function xml.collect(root, pattern)
return xmlapplylpath(root,pattern)
@@ -153,9 +149,7 @@ function xml.collect_tags(root, pattern, nonamespace)
end
end
---[[ldx--
-<p>We've now arrived at the functions that manipulate the tree.</p>
---ldx]]--
+-- We've now arrived at the functions that manipulate the tree.
local no_root = { no_root = true }
@@ -780,9 +774,7 @@ function xml.remapname(root, pattern, newtg, newns, newrn)
end
end
---[[ldx--
-<p>Helper (for q2p).</p>
---ldx]]--
+-- Helper (for q2p).
function xml.cdatatotext(e)
local dt = e.dt
@@ -879,9 +871,7 @@ end
-- xml.addentitiesdoctype(x,"hexadecimal")
-- print(x)
---[[ldx--
-<p>Here are a few synonyms.</p>
---ldx]]--
+-- Here are a few synonyms:
xml.all = xml.each
xml.insert = xml.insertafter
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua
index df80a798533..1d6d058b64f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua
@@ -10,14 +10,10 @@ local next = next
local byte, format = string.byte, string.format
local setmetatableindex = table.setmetatableindex
---[[ldx--
-<p>We provide (at least here) two entity handlers. The more extensive
-resolver consults a hash first, tries to convert to <l n='utf'/> next,
-and finaly calls a handler when defines. When this all fails, the
-original entity is returned.</p>
-
-<p>We do things different now but it's still somewhat experimental</p>
---ldx]]--
+-- We provide (at least here) two entity handlers. The more extensive resolver
+-- consults a hash first, tries to convert to UTF next, and finaly calls a handler
+-- when defines. When this all fails, the original entity is returned. We do things
+-- different now but it's still somewhat experimental.
local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua
index 78a9fca2e0a..d242b07de92 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua
@@ -20,28 +20,21 @@ local formatters = string.formatters -- no need (yet) as paths are cached anyway
-- beware, this is not xpath ... e.g. position is different (currently) and
-- we have reverse-sibling as reversed preceding sibling
---[[ldx--
-<p>This module can be used stand alone but also inside <l n='mkiv'/> in
-which case it hooks into the tracker code. Therefore we provide a few
-functions that set the tracers. Here we overload a previously defined
-function.</p>
-<p>If I can get in the mood I will make a variant that is XSLT compliant
-but I wonder if it makes sense.</P>
---ldx]]--
-
---[[ldx--
-<p>Expecially the lpath code is experimental, we will support some of xpath, but
-only things that make sense for us; as compensation it is possible to hook in your
-own functions. Apart from preprocessing content for <l n='context'/> we also need
-this module for process management, like handling <l n='ctx'/> and <l n='rlx'/>
-files.</p>
-
-<typing>
-a/b/c /*/c
-a/b/c/first() a/b/c/last() a/b/c/index(n) a/b/c/index(-n)
-a/b/c/text() a/b/c/text(1) a/b/c/text(-1) a/b/c/text(n)
-</typing>
---ldx]]--
+-- This module can be used stand alone but also inside ConTeXt in which case it
+-- hooks into the tracker code. Therefore we provide a few functions that set the
+-- tracers. Here we overload a previously defined function.
+--
+-- If I can get in the mood I will make a variant that is XSLT compliant but I
+-- wonder if it makes sense.
+--
+-- Expecially the lpath code is experimental, we will support some of xpath, but
+-- only things that make sense for us; as compensation it is possible to hook in
+-- your own functions. Apart from preprocessing content for ConTeXt we also need
+-- this module for process management, like handling CTX and RLX files.
+--
+-- a/b/c /*/c
+-- a/b/c/first() a/b/c/last() a/b/c/index(n) a/b/c/index(-n)
+-- a/b/c/text() a/b/c/text(1) a/b/c/text(-1) a/b/c/text(n)
local trace_lpath = false
local trace_lparse = false
@@ -62,11 +55,9 @@ if trackers then
end)
end
---[[ldx--
-<p>We've now arrived at an interesting part: accessing the tree using a subset
-of <l n='xpath'/> and since we're not compatible we call it <l n='lpath'/>. We
-will explain more about its usage in other documents.</p>
---ldx]]--
+-- We've now arrived at an interesting part: accessing the tree using a subset of
+-- XPATH and since we're not compatible we call it LPATH. We will explain more about
+-- its usage in other documents.
local xml = xml
@@ -1273,9 +1264,8 @@ do
end
local applylpath = xml.applylpath
---[[ldx--
-<p>This is the main filter function. It returns whatever is asked for.</p>
---ldx]]--
+
+-- This is the main filter function. It returns whatever is asked for.
function xml.filter(root,pattern) -- no longer funny attribute handling here
return applylpath(root,pattern)
@@ -1525,21 +1515,16 @@ expressions.tag = function(e,n) -- only tg
end
end
---[[ldx--
-<p>Often using an iterators looks nicer in the code than passing handler
-functions. The <l n='lua'/> book describes how to use coroutines for that
-purpose (<url href='http://www.lua.org/pil/9.3.html'/>). This permits
-code like:</p>
-
-<typing>
-for r, d, k in xml.elements(xml.load('text.xml'),"title") do
- print(d[k]) -- old method
-end
-for e in xml.collected(xml.load('text.xml'),"title") do
- print(e) -- new one
-end
-</typing>
---ldx]]--
+-- Often using an iterators looks nicer in the code than passing handler functions.
+-- The LUA book describes how to use coroutines for that purpose
+-- 'href="http://www.lua.org/pil/9.3.html"'. This permits code like:
+--
+-- for r, d, k in xml.elements(xml.load('text.xml'),"title") do
+-- print(d[k]) -- old method
+-- end
+-- for e in xml.collected(xml.load('text.xml'),"title") do
+-- print(e) -- new one
+-- end
-- local wrap, yield = coroutine.wrap, coroutine.yield
-- local dummy = function() end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua
index 04ba7b35c6a..ea62550bbeb 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua
@@ -17,13 +17,10 @@ local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, l
lpegpatterns.xml = lpegpatterns.xml or { }
local xmlpatterns = lpegpatterns.xml
---[[ldx--
-<p>The following helper functions best belong to the <t>lxml-ini</t>
-module. Some are here because we need then in the <t>mk</t>
-document and other manuals, others came up when playing with
-this module. Since this module is also used in <l n='mtxrun'/> we've
-put them here instead of loading mode modules there then needed.</p>
---ldx]]--
+-- The following helper functions best belong to the 'lxml-ini' module. Some are
+-- here because we need then in the 'mk' document and other manuals, others came up
+-- when playing with this module. Since this module is also used in 'mtxrun' we've
+-- put them here instead of loading mode modules there then needed.
local function xmlgsub(t,old,new) -- will be replaced
local dt = t.dt
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua
index e18362bd8cd..a06b5906540 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua
@@ -18,13 +18,12 @@ local trace_entities = false trackers.register("xml.entities", function(v) trac
local report_xml = logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end
---[[ldx--
-<p>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
-parent access; a first version used different trickery but was less optimized to we
-went this route. First we had a find based parser, now we have an <l n='lpeg'/> based one.
-The find based parser can be found in l-xml-edu.lua along with other older code.</p>
---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
+-- parent access; a first version used different trickery but was less optimized to
+-- we went this route. First we had a find based parser, now we have an LPEG based
+-- one. The find based parser can be found in l-xml-edu.lua along with other older
+-- code.
if lpeg.setmaxstack then lpeg.setmaxstack(1000) end -- deeply nested xml files
@@ -42,26 +41,19 @@ local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local P, S, R, C, V, C, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.C, lpeg.Cs
local formatters = string.formatters
---[[ldx--
-<p>First a hack to enable namespace resolving. A namespace is characterized by
-a <l n='url'/>. The following function associates a namespace prefix with a
-pattern. We use <l n='lpeg'/>, which in this case is more than twice as fast as a
-find based solution where we loop over an array of patterns. Less code and
-much cleaner.</p>
---ldx]]--
+-- First a hack to enable namespace resolving. A namespace is characterized by a
+-- URL. The following function associates a namespace prefix with a pattern. We use
+-- LPEG, which in this case is more than twice as fast as a find based solution
+-- where we loop over an array of patterns. Less code and much cleaner.
do -- begin of namespace closure (we ran out of locals)
xml.xmlns = xml.xmlns or { }
---[[ldx--
-<p>The next function associates a namespace prefix with an <l n='url'/>. This
-normally happens independent of parsing.</p>
-
-<typing>
-xml.registerns("mml","mathml")
-</typing>
---ldx]]--
+-- The next function associates a namespace prefix with an URL. This normally
+-- happens independent of parsing.
+--
+-- xml.registerns("mml","mathml")
local check = P(false)
local parse = check
@@ -71,15 +63,11 @@ function xml.registerns(namespace, pattern) -- pattern can be an lpeg
parse = P { P(check) + 1 * V(1) }
end
---[[ldx--
-<p>The next function also registers a namespace, but this time we map a
-given namespace prefix onto a registered one, using the given
-<l n='url'/>. This used for attributes like <t>xmlns:m</t>.</p>
-
-<typing>
-xml.checkns("m","http://www.w3.org/mathml")
-</typing>
---ldx]]--
+-- The next function also registers a namespace, but this time we map a given
+-- namespace prefix onto a registered one, using the given URL. This used for
+-- attributes like 'xmlns:m'.
+--
+-- xml.checkns("m","http://www.w3.org/mathml")
function xml.checkns(namespace,url)
local ns = lpegmatch(parse,lower(url))
@@ -88,68 +76,54 @@ function xml.checkns(namespace,url)
end
end
---[[ldx--
-<p>Next we provide a way to turn an <l n='url'/> into a registered
-namespace. This used for the <t>xmlns</t> attribute.</p>
-
-<typing>
-resolvedns = xml.resolvens("http://www.w3.org/mathml")
-</typing>
-
-This returns <t>mml</t>.
---ldx]]--
+-- Next we provide a way to turn an URL into a registered namespace. This used for
+-- the 'xmlns' attribute.
+--
+-- resolvedns = xml.resolvens("http://www.w3.org/mathml")
+--
+-- This returns MATHML.
function xml.resolvens(url)
return lpegmatch(parse,lower(url)) or ""
end
---[[ldx--
-<p>A namespace in an element can be remapped onto the registered
-one efficiently by using the <t>xml.xmlns</t> table.</p>
---ldx]]--
+-- A namespace in an element can be remapped onto the registered one efficiently by
+-- using the 'xml.xmlns' table.
end -- end of namespace closure
---[[ldx--
-<p>This version uses <l n='lpeg'/>. We follow the same approach as before, stack and top and
-such. This version is about twice as fast which is mostly due to the fact that
-we don't have to prepare the stream for cdata, doctype etc etc. This variant is
-is dedicated to Luigi Scarso, who challenged me with 40 megabyte <l n='xml'/> files that
-took 12.5 seconds to load (1.5 for file io and the rest for tree building). With
-the <l n='lpeg'/> implementation we got that down to less 7.3 seconds. Loading the 14
-<l n='context'/> interface definition files (2.6 meg) went down from 1.05 seconds to 0.55.</p>
-
-<p>Next comes the parser. The rather messy doctype definition comes in many
-disguises so it is no surprice that later on have to dedicate quite some
-<l n='lpeg'/> code to it.</p>
-
-<typing>
-<!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] >
-<!DOCTYPE Something PUBLIC "... ..." "..." >
-<!DOCTYPE Something SYSTEM "... ..." [ ... ] >
-<!DOCTYPE Something SYSTEM "... ..." >
-<!DOCTYPE Something [ ... ] >
-<!DOCTYPE Something >
-</typing>
-
-<p>The code may look a bit complex but this is mostly due to the fact that we
-resolve namespaces and attach metatables. There is only one public function:</p>
-
-<typing>
-local x = xml.convert(somestring)
-</typing>
-
-<p>An optional second boolean argument tells this function not to create a root
-element.</p>
-
-<p>Valid entities are:</p>
-
-<typing>
-<!ENTITY xxxx SYSTEM "yyyy" NDATA zzzz>
-<!ENTITY xxxx PUBLIC "yyyy" >
-<!ENTITY xxxx "yyyy" >
-</typing>
---ldx]]--
+-- This version uses LPEG. We follow the same approach as before, stack and top and
+-- such. This version is about twice as fast which is mostly due to the fact that we
+-- don't have to prepare the stream for cdata, doctype etc etc. This variant is is
+-- dedicated to Luigi Scarso, who challenged me with 40 megabyte XML files that took
+-- 12.5 seconds to load (1.5 for file io and the rest for tree building). With the
+-- LPEG implementation we got that down to less 7.3 seconds. Loading the 14 ConTeXt
+-- interface definition files (2.6 meg) went down from 1.05 seconds to 0.55.
+--
+-- Next comes the parser. The rather messy doctype definition comes in many
+-- disguises so it is no surprice that later on have to dedicate quite some LPEG
+-- code to it.
+--
+-- <!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] >
+-- <!DOCTYPE Something PUBLIC "... ..." "..." >
+-- <!DOCTYPE Something SYSTEM "... ..." [ ... ] >
+-- <!DOCTYPE Something SYSTEM "... ..." >
+-- <!DOCTYPE Something [ ... ] >
+-- <!DOCTYPE Something >
+--
+-- The code may look a bit complex but this is mostly due to the fact that we
+-- resolve namespaces and attach metatables. There is only one public function:
+--
+-- local x = xml.convert(somestring)
+--
+-- An optional second boolean argument tells this function not to create a root
+-- element.
+--
+-- Valid entities are:
+--
+-- <!ENTITY xxxx SYSTEM "yyyy" NDATA zzzz>
+-- <!ENTITY xxxx PUBLIC "yyyy" >
+-- <!ENTITY xxxx "yyyy" >
-- not just one big nested table capture (lpeg overflow)
@@ -1332,10 +1306,8 @@ function xml.inheritedconvert(data,xmldata,cleanup) -- xmldata is parent
return xc
end
---[[ldx--
-<p>Packaging data in an xml like table is done with the following
-function. Maybe it will go away (when not used).</p>
---ldx]]--
+-- Packaging data in an xml like table is done with the following function. Maybe it
+-- will go away (when not used).
function xml.is_valid(root)
return root and root.dt and root.dt[1] and type(root.dt[1]) == "table" and not root.dt[1].er
@@ -1354,11 +1326,8 @@ end
xml.errorhandler = report_xml
---[[ldx--
-<p>We cannot load an <l n='lpeg'/> from a filehandle so we need to load
-the whole file first. The function accepts a string representing
-a filename or a file handle.</p>
---ldx]]--
+-- We cannot load an LPEG from a filehandle so we need to load the whole file first.
+-- The function accepts a string representing a filename or a file handle.
function xml.load(filename,settings)
local data = ""
@@ -1382,10 +1351,8 @@ function xml.load(filename,settings)
end
end
---[[ldx--
-<p>When we inject new elements, we need to convert strings to
-valid trees, which is what the next function does.</p>
---ldx]]--
+-- When we inject new elements, we need to convert strings to valid trees, which is
+-- what the next function does.
local no_root = { no_root = true }
@@ -1398,11 +1365,9 @@ function xml.toxml(data)
end
end
---[[ldx--
-<p>For copying a tree we use a dedicated function instead of the
-generic table copier. Since we know what we're dealing with we
-can speed up things a bit. The second argument is not to be used!</p>
---ldx]]--
+-- For copying a tree we use a dedicated function instead of the generic table
+-- copier. Since we know what we're dealing with we can speed up things a bit. The
+-- second argument is not to be used!
-- local function copy(old)
-- if old then
@@ -1466,13 +1431,10 @@ end
xml.copy = copy
---[[ldx--
-<p>In <l n='context'/> serializing the tree or parts of the tree is a major
-actitivity which is why the following function is pretty optimized resulting
-in a few more lines of code than needed. The variant that uses the formatting
-function for all components is about 15% slower than the concatinating
-alternative.</p>
---ldx]]--
+-- In ConTeXt serializing the tree or parts of the tree is a major actitivity which
+-- is why the following function is pretty optimized resulting in a few more lines
+-- of code than needed. The variant that uses the formatting function for all
+-- components is about 15% slower than the concatinating alternative.
-- todo: add <?xml version='1.0' standalone='yes'?> when not present
@@ -1490,10 +1452,8 @@ function xml.checkbom(root) -- can be made faster
end
end
---[[ldx--
-<p>At the cost of some 25% runtime overhead you can first convert the tree to a string
-and then handle the lot.</p>
---ldx]]--
+-- At the cost of some 25% runtime overhead you can first convert the tree to a
+-- string and then handle the lot.
-- new experimental reorganized serialize
@@ -1711,21 +1671,18 @@ newhandlers {
}
}
---[[ldx--
-<p>How you deal with saving data depends on your preferences. For a 40 MB database
-file the timing on a 2.3 Core Duo are as follows (time in seconds):</p>
-
-<lines>
-1.3 : load data from file to string
-6.1 : convert string into tree
-5.3 : saving in file using xmlsave
-6.8 : converting to string using xml.tostring
-3.6 : saving converted string in file
-</lines>
-<p>Beware, these were timing with the old routine but measurements will not be that
-much different I guess.</p>
---ldx]]--
+-- How you deal with saving data depends on your preferences. For a 40 MB database
+-- file the timing on a 2.3 Core Duo are as follows (time in seconds):
+--
+-- 1.3 : load data from file to string
+-- 6.1 : convert string into tree
+-- 5.3 : saving in file using xmlsave
+-- 6.8 : converting to string using xml.tostring
+-- 3.6 : saving converted string in file
+--
+-- Beware, these were timing with the old routine but measurements will not be that
+-- much different I guess.
-- maybe this will move to lxml-xml
@@ -1827,10 +1784,8 @@ xml.newhandlers = newhandlers
xml.serialize = serialize
xml.tostring = xmltostring
---[[ldx--
-<p>The next function operated on the content only and needs a handle function
-that accepts a string.</p>
---ldx]]--
+-- The next function operated on the content only and needs a handle function that
+-- accepts a string.
local function xmlstring(e,handle)
if not handle or (e.special and e.tg ~= "@rt@") then
@@ -1849,9 +1804,7 @@ end
xml.string = xmlstring
---[[ldx--
-<p>A few helpers:</p>
---ldx]]--
+-- A few helpers:
--~ xmlsetproperty(root,"settings",settings)
@@ -1899,11 +1852,9 @@ function xml.name(root)
end
end
---[[ldx--
-<p>The next helper erases an element but keeps the table as it is,
-and since empty strings are not serialized (effectively) it does
-not harm. Copying the table would take more time. Usage:</p>
---ldx]]--
+-- The next helper erases an element but keeps the table as it is, and since empty
+-- strings are not serialized (effectively) it does not harm. Copying the table
+-- would take more time.
function xml.erase(dt,k)
if dt then
@@ -1915,13 +1866,9 @@ function xml.erase(dt,k)
end
end
---[[ldx--
-<p>The next helper assigns a tree (or string). Usage:</p>
-
-<typing>
-dt[k] = xml.assign(root) or xml.assign(dt,k,root)
-</typing>
---ldx]]--
+-- The next helper assigns a tree (or string). Usage:
+--
+-- dt[k] = xml.assign(root) or xml.assign(dt,k,root)
function xml.assign(dt,k,root)
if dt and k then
@@ -1932,15 +1879,10 @@ function xml.assign(dt,k,root)
end
end
--- the following helpers may move
-
---[[ldx--
-<p>The next helper assigns a tree (or string). Usage:</p>
-<typing>
-xml.tocdata(e)
-xml.tocdata(e,"error")
-</typing>
---ldx]]--
+-- The next helper assigns a tree (or string). Usage:
+--
+-- xml.tocdata(e)
+-- xml.tocdata(e,"error")
function xml.tocdata(e,wrapper) -- a few more in the aux module
local whatever = type(e) == "table" and xmltostring(e.dt) or e or ""
diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv b/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv
index 901f075d348..14da40a4a7c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv
@@ -47,6 +47,9 @@
\definemathcommand [deg] [nolop] {\mfunctionlabeltext{deg}}
\definemathcommand [det] [limop] {\mfunctionlabeltext{det}}
\definemathcommand [dim] [nolop] {\mfunctionlabeltext{dim}}
+%definemathcommand [erf] [nolop] {\mfunctionlabeltext{erf}}
+%definemathcommand [erfc] [nolop] {\mfunctionlabeltext{erfc}}
+%definemathcommand [erfi] [nolop] {\mfunctionlabeltext{erfi}}
\definemathcommand [exp] [nolop] {\mfunctionlabeltext{exp}}
\definemathcommand [gcd] [limop] {\mfunctionlabeltext{gcd}}
\definemathcommand [hom] [nolop] {\mfunctionlabeltext{hom}}
diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-map.lua b/Master/texmf-dist/tex/context/base/mkiv/math-map.lua
index 5f93b43fc6c..153dde85291 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/math-map.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/math-map.lua
@@ -7,31 +7,13 @@ if not modules then modules = { } end modules ['math-map'] = {
license = "see context related readme files"
}
--- todo: make sparse .. if self
-
---[[ldx--
-<p>Remapping mathematics alphabets.</p>
---ldx]]--
-
--- oldstyle: not really mathematics but happened to be part of
--- the mathematics fonts in cmr
---
--- persian: we will also provide mappers for other
--- scripts
-
--- todo: alphabets namespace
--- maybe: script/scriptscript dynamic,
-
--- superscripped primes get unscripted !
-
--- to be looked into once the fonts are ready (will become font
--- goodie):
---
--- (U+2202,U+1D715) : upright
--- (U+2202,U+1D715) : italic
--- (U+2202,U+1D715) : upright
---
--- plus add them to the regular vectors below so that they honor \it etc
+-- persian: we will also provide mappers for other scripts
+-- todo : alphabets namespace
+-- maybe : script/scriptscript dynamic,
+-- check : (U+2202,U+1D715) : upright
+-- (U+2202,U+1D715) : italic
+-- (U+2202,U+1D715) : upright
+-- add them to the regular vectors below so that they honor \it etc
local type, next = type, next
local merged, sortedhash = table.merged, table.sortedhash
diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua b/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua
index 5fe9738a218..be1402cdf6f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua
@@ -620,8 +620,10 @@ setmetatableindex(reverse, function(t,name)
end
local m = mathencodings[name]
local r = { }
- for u, i in next, m do
- r[i] = u
+ if type(m) == "table" then
+ for u, i in next, m do
+ r[i] = u
+ end
end
reverse[name] = r
return r
@@ -714,8 +716,9 @@ function vfmath.define(specification,set,goodies)
local start = (trace_virtual or trace_timings) and os.clock()
local okset = { }
local n = 0
- for s=1,#set do
- local ss = set[s]
+ local setlist = set.recipe or set
+ for s=1,#setlist do
+ local ss = setlist[s]
local ssname = ss.name
if add_optional and ss.optional then
if trace_virtual then
diff --git a/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua b/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua
index ddbbd9a523c..aa388b0ca3b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua
@@ -13,15 +13,18 @@ local format, load, type = string.format, load, type
local context = context
local metapost = metapost
-metapost.metafun = metapost.metafun or { }
-local metafun = metapost.metafun
+local metafun = metapost.metafun or { }
+metapost.metafun = metafun
function metafun.topath(t,connector)
context("(")
if #t > 0 then
+ if not connector then
+ connector = ".."
+ end
for i=1,#t do
if i > 1 then
- context(connector or "..")
+ context(connector)
end
local ti = t[i]
if type(ti) == "string" then
@@ -39,12 +42,15 @@ end
function metafun.interpolate(f,b,e,s,c)
local done = false
context("(")
- for i=b,e,(e-b)/s do
- local d = load(format("return function(x) return %s end",f))
- if d then
- d = d()
+ local d = load(format("return function(x) return %s end",f))
+ if d then
+ d = d()
+ if not c then
+ c = "..."
+ end
+ for i=b,e,(e-b)/s do
if done then
- context(c or "...")
+ context(c)
else
done = true
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua
index 51c88eb2237..39a7095053c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua
@@ -54,8 +54,18 @@ local function validftype(ftype)
end
end
+local remapped = {
+ -- We don't yet have an interface for adding more here but when needed
+ -- there will be one.
+ ["hatching.mp"] = "mp-remapped-hatching.mp",
+ ["boxes.mp"] = "mp-remapped-boxes.mp",
+ ["hatching"] = "mp-remapped-hatching.mp",
+ ["boxes"] = "mp-remapped-boxes.mp",
+}
+
finders.file = function(specification,name,mode,ftype)
- return resolvers.findfile(name,validftype(ftype))
+ local usedname = remapped[name] or name
+ return resolvers.findfile(usedname,validftype(ftype))
end
local function i_finder(name,mode,ftype) -- fake message for mpost.map and metafun.mpvi
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua
index 602d6f36c0d..82426668fab 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua
@@ -6,28 +6,12 @@ if not modules then modules = { } end modules ['mlib-run'] = {
license = "see context related readme files",
}
--- cmyk -> done, native
--- spot -> done, but needs reworking (simpler)
--- multitone ->
--- shade -> partly done, todo: cm
--- figure -> done
--- hyperlink -> low priority, easy
-
--- new * run
--- or
--- new * execute^1 * finish
-
--- a*[b,c] == b + a * (c-b)
-
---[[ldx--
-<p>The directional helpers and pen analysis are more or less translated from the
-<l n='c'/> code. It really helps that Taco know that source so well. Taco and I spent
-quite some time on speeding up the <l n='lua'/> and <l n='c'/> code. There is not
-much to gain, especially if one keeps in mind that when integrated in <l n='tex'/>
-only a part of the time is spent in <l n='metapost'/>. Of course an integrated
-approach is way faster than an external <l n='metapost'/> and processing time
-nears zero.</p>
---ldx]]--
+-- The directional helpers and pen analysis are more or less translated from the C
+-- code. It really helps that Taco know that source so well. Taco and I spent quite
+-- some time on speeding up the Lua and C code. There is not much to gain,
+-- especially if one keeps in mind that when integrated in TeX only a part of the
+-- time is spent in MetaPost. Of course an integrated approach is way faster than an
+-- external MetaPost and processing time nears zero.
local type, tostring, tonumber, next = type, tostring, tonumber, next
local find, striplines = string.find, utilities.strings.striplines
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua
index 686fbfb7aba..69655ee3884 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua
@@ -146,7 +146,7 @@ return {
"startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes",
"doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes",
"startenvironment", "stopenvironment", "environment",
- "startcomponent", "stopcomponent", "component",
+ "startcomponent", "stopcomponent", "component", "startlocalcomponent", "stoplocalcomponent",
"startproduct", "stopproduct", "product",
"startproject", "stopproject", "project",
"starttext", "stoptext", "startnotext", "stopnotext",
@@ -259,11 +259,11 @@ return {
"globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode",
"booleanmodevalue",
--
- "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif",
+ "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newfloat",
"newlanguage", "newfamily", "newfam", "newhelp", -- not used
--
- "newinteger", "newdimension", "newgluespec", "newmugluespec",
- "aliasinteger", "aliasdimension",
+ "newinteger", "newdimension", "newgluespec", "newmugluespec", "newposit",
+ "aliasinteger", "aliasdimension", "aliasposit",
--
"then",
"begcsname",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua
index 008bcbb9fbf..cfa8215170f 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua
@@ -127,7 +127,7 @@ return {
--
"red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background",
--
- "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk",
+ "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk", "es", "ts",
--
"triplet", "quadruplet", "totransform", "bymatrix", "closedcurve", "closedlines",
--
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua
index 72da8971821..37779ec57cd 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua
@@ -99,6 +99,7 @@ return {
"Umathcode",
"Umathconnectoroverlapmin",
"Umathdegreevariant",
+ "Umathdelimiterextendmargin",
"Umathdelimiterovervariant",
"Umathdelimiterpercent",
"Umathdelimitershortfall",
@@ -318,6 +319,7 @@ return {
"currentmarks",
"dbox",
"defcsname",
+ "deferred",
"detokenized",
"dimensiondef",
"dimexpression",
@@ -333,6 +335,7 @@ return {
"etoks",
"etoksapp",
"etokspre",
+ "eufactor",
"everybeforepar",
"everymathatom",
"everytab",
@@ -349,7 +352,11 @@ return {
"explicitdiscretionary",
"explicithyphenpenalty",
"firstvalidlanguage",
+ "float",
+ "floatdef",
+ "floatexpr",
"flushmarks",
+ "fontcharba",
"fontcharta",
"fontid",
"fontmathcontrol",
@@ -399,6 +406,7 @@ return {
"hyphenationmin",
"hyphenationmode",
"ifabsdim",
+ "ifabsfloat",
"ifabsnum",
"ifarguments",
"ifboolean",
@@ -414,6 +422,7 @@ return {
"ifdimval",
"ifempty",
"ifflags",
+ "iffloat",
"ifhaschar",
"ifhastok",
"ifhastoks",
@@ -429,6 +438,7 @@ return {
"ifrelax",
"iftok",
"ifzerodim",
+ "ifzerofloat",
"ifzeronum",
"ignorearguments",
"ignoredepthcriterium",
@@ -556,7 +566,9 @@ return {
"maththreshold",
"mathunderline",
"meaningasis",
+ "meaningful",
"meaningfull",
+ "meaningles",
"meaningless",
"mugluespecdef",
"mutable",
@@ -588,6 +600,7 @@ return {
"pardirection",
"permanent",
"pettymuskip",
+ "positdef",
"postexhyphenchar",
"posthyphenchar",
"postinlinepenalty",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua
index ef7d4afed2d..ea726ff3d26 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua
@@ -6,50 +6,38 @@ if not modules then modules = { } end modules ['node-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Most of the code that had accumulated here is now separated in modules.</p>
---ldx]]--
-
--- I need to clean up this module as it's a bit of a mess now. The latest luatex
--- has most tables but we have a few more in luametatex. Also, some are different
--- between these engines. We started out with hardcoded tables, that then ended
--- up as comments and are now gone (as they differ per engine anyway).
+-- Most of the code that had accumulated here is now separated in modules.
local next, type, tostring = next, type, tostring
local gsub = string.gsub
local concat, remove = table.concat, table.remove
local sortedhash, sortedkeys, swapped = table.sortedhash, table.sortedkeys, table.swapped
---[[ldx--
-<p>Access to nodes is what gives <l n='luatex'/> its power. Here we implement a
-few helper functions. These functions are rather optimized.</p>
---ldx]]--
-
---[[ldx--
-<p>When manipulating node lists in <l n='context'/>, we will remove nodes and
-insert new ones. While node access was implemented, we did quite some experiments
-in order to find out if manipulating nodes in <l n='lua'/> was feasible from the
-perspective of performance.</p>
-
-<p>First of all, we noticed that the bottleneck is more with excessive callbacks
-(some gets called very often) and the conversion from and to <l n='tex'/>'s
-datastructures. However, at the <l n='lua'/> end, we found that inserting and
-deleting nodes in a table could become a bottleneck.</p>
-
-<p>This resulted in two special situations in passing nodes back to <l n='tex'/>:
-a table entry with value <type>false</type> is ignored, and when instead of a
-table <type>true</type> is returned, the original table is used.</p>
-
-<p>Insertion is handled (at least in <l n='context'/> as follows. When we need to
-insert a node at a certain position, we change the node at that position by a
-dummy node, tagged <type>inline</type> which itself has_attribute the original
-node and one or more new nodes. Before we pass back the list we collapse the
-list. Of course collapsing could be built into the <l n='tex'/> engine, but this
-is a not so natural extension.</p>
-
-<p>When we collapse (something that we only do when really needed), we also
-ignore the empty nodes. [This is obsolete!]</p>
---ldx]]--
+-- Access to nodes is what gives LuaTeX its power. Here we implement a few helper
+-- functions. These functions are rather optimized.
+--
+-- When manipulating node lists in ConTeXt, we will remove nodes and insert new
+-- ones. While node access was implemented, we did quite some experiments in order
+-- to find out if manipulating nodes in Lua was feasible from the perspective of
+-- performance.
+--
+-- First of all, we noticed that the bottleneck is more with excessive callbacks
+-- (some gets called very often) and the conversion from and to TeX's
+-- datastructures. However, at the Lua end, we found that inserting and deleting
+-- nodes in a table could become a bottleneck.
+--
+-- This resulted in two special situations in passing nodes back to TeX: a table
+-- entry with value 'false' is ignored, and when instead of a table 'true' is
+-- returned, the original table is used.
+--
+-- Insertion is handled (at least in ConTeXt as follows. When we need to insert a
+-- node at a certain position, we change the node at that position by a dummy node,
+-- tagged 'inline' which itself has_attribute the original node and one or more new
+-- nodes. Before we pass back the list we collapse the list. Of course collapsing
+-- could be built into the TeX engine, but this is a not so natural extension.
+
+-- When we collapse (something that we only do when really needed), we also ignore
+-- the empty nodes. [This is obsolete!]
-- local gf = node.direct.getfield
-- local n = table.setmetatableindex("number")
diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua
index 5c669f9da0e..f2c6e97e989 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua
@@ -9,11 +9,6 @@ if not modules then modules = { } end modules ['node-res'] = {
local type, next = type, next
local gmatch, format = string.gmatch, string.format
---[[ldx--
-<p>The next function is not that much needed but in <l n='context'/> we use
-for debugging <l n='luatex'/> node management.</p>
---ldx]]--
-
local nodes, node = nodes, node
local report_nodes = logs.reporter("nodes","housekeeping")
diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua b/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua
index 67435f1c78f..20e354392f8 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua
@@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['node-tra'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This is rather experimental. We need more control and some of this
-might become a runtime module instead. This module will be cleaned up!</p>
---ldx]]--
+-- Some of the code here might become a runtime module instead. This old module will
+-- be cleaned up anyway!
local next = next
local utfchar = utf.char
diff --git a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
index 445085776f3..dda82874912 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
@@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['pack-obj'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>We save object references in the main utility table. jobobjects are
-reusable components.</p>
---ldx]]--
+-- We save object references in the main utility table; job objects are reusable
+-- components.
local context = context
local codeinjections = backends.codeinjections
diff --git a/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua b/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua
index 98117867c91..20db028ec50 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua
@@ -7,10 +7,6 @@ if not modules then modules = { } end modules ['pack-rul'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>An explanation is given in the history document <t>mk</t>.</p>
---ldx]]--
-
-- we need to be careful with display math as it uses shifts
-- \framed[align={lohi,middle}]{$x$}
diff --git a/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua b/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua
index 91803e4fdcd..fa9f3f308a0 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua
@@ -452,7 +452,7 @@ local short_units = { -- I'm not sure about casing
s = "second",
g = "gram",
n = "newton",
- v = "volt",
+ V = "volt",
t = "tonne",
l = "liter",
-- w = "watt",
@@ -460,6 +460,12 @@ local short_units = { -- I'm not sure about casing
-- a = "ampere",
A = "ampere",
+ Ω = "ohm",
+
+-- C = "coulomb", -- needs checking with (c)enti
+-- K = "kelvin", -- needs checking with (k)ilo
+-- N = "newton", -- needs checking with (n)ewton
+
min = "minute",
[utfchar(0x2103)] = "celsius",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua
index 64aaaf4603e..2e5f07f05a5 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua
@@ -11,12 +11,6 @@ if not modules then modules = { } end modules ['publ-dat'] = {
-- todo: dataset = datasets[dataset] => current = datasets[dataset]
-- todo: maybe split this file
---[[ldx--
-<p>This is a prelude to integrated bibliography support. This file just loads
-bibtex files and converts them to xml so that the we access the content
-in a convenient way. Actually handling the data takes place elsewhere.</p>
---ldx]]--
-
if not characters then
dofile(resolvers.findfile("char-utf.lua"))
dofile(resolvers.findfile("char-tex.lua"))
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua
index 65dee0717f1..6e0520e10f4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua
@@ -95,14 +95,11 @@ categories.article = {
"year",
"subtitle", "type", "file",
"journal", "volume", "number", "pages",
- "doi", "note",
+ "doi", "issn", "note",
-- APA ignores this:
--
-- "month",
--
- -- fields defined in jabref but presently ignored:
- --
- -- "issn",
},
}
@@ -120,7 +117,7 @@ categories.magazine = {
"subtitle", "type", "file",
"number",
"month", "day",
- "doi", "note",
+ "doi", "issn", "note",
},
}
@@ -142,7 +139,7 @@ categories.periodical = {
"subtitle", "file",
"series", "volume", "number", "month",
"organization",
- "doi", "note",
+ "doi", "issn", "note",
},
}
@@ -157,7 +154,7 @@ categories.standard = {
"author",
"year",
"title", "subtitle",
- "doi", "note",
+ "doi", "isbn", "note",
},
optional = {
"withauthor", "translator",
@@ -181,7 +178,7 @@ categories.book = {
"subtitle", "type", "file",
"editionset", "series",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
"abstract",
},
}
@@ -208,7 +205,7 @@ categories.inbook = {
"editionset", "series",
"month",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -236,7 +233,7 @@ categories.incollection = {
-- APA ignores this: "chapter",
"month",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -257,7 +254,7 @@ categories.booklet = {
"year", "month",
"subtitle", "type", "file",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -281,7 +278,7 @@ categories.proceedings = {
"editionset", "series",
"month",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -296,7 +293,7 @@ categories.inproceedings = {
"month",
"edition", "series",
"address", "organization",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -320,7 +317,7 @@ categories.thesis = {
"subtitle", "file",
"month",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -338,7 +335,7 @@ categories.mastersthesis = {
"subtitle", "file",
"month",
"address",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
categories.phdthesis = categories.mastersthesis
@@ -365,7 +362,7 @@ categories.techreport = {
"subtitle", "file",
"editionset",
"month",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -387,7 +384,7 @@ categories.manual = {
"address",
"subtitle", "file",
"editionset", "month", "year",
- "doi", "note",
+ "doi", "isbn", "note",
-- "abstract",
},
}
@@ -515,7 +512,7 @@ categories.misc = {
"title", "subtitle", "file",
"year", "month",
"howpublished",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
@@ -533,7 +530,7 @@ categories.other = {
optional = {
"withauthor", "translator",
"subtitle", "file",
- "doi", "note",
+ "doi", "isbn", "note",
},
}
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi
index b4ac74258bb..b8038bd960b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -113,6 +113,14 @@
[apa:\s!list]
\definebtx
+ [apa:\s!list:isbn]
+ [apa:\s!list]
+
+\definebtx
+ [apa:\s!list:issn]
+ [apa:\s!list]
+
+\definebtx
[apa:\s!list:\s!page]
[apa:\s!list]
[\c!separator:2={\btxcomma},
@@ -521,6 +529,14 @@
[apa:\s!cite:url]
\definebtx
+ [apa:\s!cite:isbn]
+ [apa:\s!cite]
+
+\definebtx
+ [apa:\s!cite:issn]
+ [apa:\s!cite]
+
+\definebtx
[apa:\s!cite:num]
[apa:\s!cite]
[\c!left={[},
@@ -879,6 +895,11 @@
\endgroup
% which namespace?
%\doif{\btxparameter{translate}}\v!yes {
+ %
+ % An option is unnecessary because the translated title
+ % only gets placed if the user includes a title:xx field
+ % for the entry - not standard for bibtex...
+ %
\texdefinition{btx:apa:translated-title}{#title}
%}
\btxstopstyleandcolor
@@ -1140,7 +1161,12 @@
}
\btxdoif {edition} {
\texdefinition{btx:apa:leftparenthesis-or-comma}
- \btxflush{edition}
+ % the edition= field is often language-dependent
+ % (i.e. second, 2nd, revised, etc.)
+ % so we handle an optional edition:xx= field:
+ \btxdoifelse {edition:\mainbtxlanguage}
+ {\btxflush{edition:\mainbtxlanguage}}
+ {\btxflush{edition}}
\btxspace
\btxlabeltext{apa:edition}
}
@@ -1309,6 +1335,14 @@
\btxspace
\texdefinition{btx:apa:doi}
}
+ \btxdoif {issn} {
+ \btxspace
+ issn\colon\btxflush{issn}
+ }
+ \btxdoif {isbn} {
+ \btxspace
+ isbn\colon\btxflush{isbn}
+ }
\texdefinition{btx:apa:note}
\removeunwantedspaces
\stoptexdefinition
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi
index e16279222a6..f6f118ada79 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi
@@ -807,6 +807,7 @@
\stoptexdefinition
\starttexdefinition mutable protected btx:aps:doi-url #text
+ % no: \texdefinition {btx:format:goto} because different test
\ifconditional\btxinteractive
\btxdoifelse {doi} {
\goto {#text} [url(http://dx.doi.org/\btxflush{doi})]
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi
index 315d686129d..152891d88a0 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi
@@ -887,11 +887,11 @@
\setmode{btx:chicago:title-placed}
% we make the title active, opening "file"
\btxdoifelse {file} {
- \texdefinition{btx:format:inject}
- {url(file:\btxflush{file})}
- {
- \texdefinition{btx:chicago:composed-title}{title}
- }
+ \texdefinition{btx:format:goto} {
+ url(file:\btxflush{file})
+ } {
+ \texdefinition{btx:chicago:composed-title}{title}
+ }
} {
\texdefinition{btx:chicago:composed-title}{title}
}
@@ -1049,8 +1049,7 @@
\starttexdefinition mutable protected btx:chicago:authoryear
% we make the authoryear active, pointing to the citation
- \texdefinition{btx:format:inject}
- {internal(\currentbtxinternal)}
+ \texdefinition{btx:format:gotointernal}
{
\doifelsesetups{chicago:list:sameauthor} {
\btxdoifelsesameasprevious {author} {
@@ -1256,15 +1255,11 @@
\starttexdefinition mutable protected btx:chicago:url
\begingroup
\setbreakpoints[doi]
- \ifconditional\btxinteractive
- \goto {
- \hyphenatedurl{\btxflush{url}}
- } [
- url(\btxflush{url})
- ]
- \else
+ \texdefinition {btx:format:goto} {
+ url(\btxflush{url})
+ } {
\hyphenatedurl{\btxflush{url}}
- \fi
+ }
\endgroup
\stoptexdefinition
@@ -1273,15 +1268,11 @@
\starttexdefinition mutable protected btx:chicago:doi
\begingroup
\setbreakpoints[doi]
- \ifconditional\btxinteractive
- \goto {
- \hyphenatedurl{doi:\btxflush{doi}}
- } [
- url(http://dx.doi.org/\btxflush{doi})
- ]
- \else
+ \texdefinition {btx:format:goto} {
+ url(http://dx.doi.org/\btxflush{doi})
+ } {
\hyphenatedurl{doi:\btxflush{doi}}
- \fi
+ }
\endgroup
\stoptexdefinition
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi
index c9afdbf42dc..5336c146ef9 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi
@@ -14,19 +14,9 @@
\unprotect
\starttexdefinition mutable protected btx:cite:inject #content
- \ifconditional\btxinteractive
- \ifx\currentbtxinternal\empty
- #content
- \else
- \goto {
- #content
- } [
- \s!internal(\currentbtxinternal)
- ]
- \fi
- \else
+ \texdefinition{btx:format:gotointernal} {
#content
- \fi
+ }
\stoptexdefinition
\starttexdefinition mutable protected btx:cite:checkconcat
@@ -252,33 +242,27 @@
\startsetups btx:cite:url
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
- \else\ifconditional\btxinteractive
- \goto {
+ \else
+ \texdefinition {btx:format:goto} {
+ url(\currentbtxfirst)
+ } {
\btxcitereference
\hyphenatedurl{\currentbtxfirst}
- } [
- url(\currentbtxfirst)
- ]
- \else
- \btxcitereference
- \hyphenatedurl{\currentbtxfirst}
- \fi\fi
+ }
+ \fi
\stopsetups
\startsetups btx:cite:doi
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
- \else\ifconditional\btxinteractive
- \goto {
+ \else
+ \texdefinition {btx:format:goto} {
+ url(http://dx.doi.org/\currentbtxfirst)
+ } {
\btxcitereference
\hyphenatedurl{doi:\currentbtxfirst}
- } [
- url(http://dx.doi.org/\currentbtxfirst)
- ]
- \else
- \btxcitereference
- \hyphenatedurl{doi:\currentbtxfirst}
- \fi\fi
+ }
+ \fi
\stopsetups
\protect
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi
index 1e9f8ea9bb1..4b6e8d6ae46 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi
@@ -27,36 +27,50 @@
\btxfield{short}
\stopxmlsetups
-\starttexdefinition mutable protected btx:format:inject #link #content
+\starttexdefinition mutable protected btx:format:gotointernal #content
\ifx\currentbtxinternal\empty
#content
+ \else\ifnum\currentbtxinternal=\zerocount
+ #content
\else\ifconditional\btxinteractive
+ \goto {#content} [\s!internal(\currentbtxinternal)]
+ \else
+ #content
+ \fi\fi\fi
+\stoptexdefinition
+
+\starttexdefinition mutable protected btx:format:goto #link #content
+ \ifconditional\btxinteractive
\goto {#content} [#link]
\else
#content
- \fi\fi
+ \fi
\stoptexdefinition
\startxmlsetups btx:format:doi
\edef\currentbtxfielddoi{\btxfield{doi}}
\ifx\currentbtxfielddoi\empty
{\tttf no-doi}
- \else\ifconditional\btxinteractive
- \goto{\hyphenatedurl{\currentbtxfielddoi}}[url(http://dx.doi.org/\currentbtxfielddoi)]
\else
- \hyphenatedurl{\currentbtxfielddoi}
- \fi\fi
+ \texdefinition {btx:format:goto} {
+ url(http://dx.doi.org/\currentbtxfielddoi)
+ } {
+ \hyphenatedurl{\currentbtxfielddoi}
+ }
+ \fi
\stopxmlsetups
\startxmlsetups btx:format:url
\edef\currentbtxfieldurl{\btxfield{url}}
\ifx\currentbtxfieldurl\empty
{\tttf no-url}
- \else\ifconditional\btxinteractive
- \goto{\hyphenatedurl{\currentbtxfieldurl}}[url(\currentbtxfieldurl)]
\else
- \hyphenatedurl{\currentbtxfieldurl}
- \fi\fi
+ \texdefinition {btx:format:goto} {
+ url(\currentbtxfieldurl)
+ } {
+ \hyphenatedurl{\currentbtxfieldurl}
+ }
+ \fi
\stopxmlsetups
\startxmlsetups btx:format:year
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi
index eec63e515c6..5b4331eed46 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi
@@ -14,19 +14,9 @@
\unprotect
\starttexdefinition mutable protected btx:list:inject:text #content
- \ifconditional\btxinteractivetext
- \ifx\currentbtxinternal\empty
- #content
- \else
- \goto {
- #content
- } [
- \s!internal(\currentbtxinternal)
- ]
- \fi
- \else
+ \texdefinition{btx:format:gotointernal} {
#content
- \fi
+ }
\stoptexdefinition
\startsetups \s!btx:\s!list:text
@@ -40,19 +30,9 @@
\stopsetups
\starttexdefinition mutable protected btx:list:inject:number #content
- \ifconditional\btxinteractivenumber
- \ifx\currentbtxinternal\empty
- #content
- \else
- \goto {
- #content
- } [
- \s!internal(\currentbtxinternal)
- ]
- \fi
- \else
+ \texdefinition{btx:format:gotointernal} {
#content
- \fi
+ }
\stoptexdefinition
\starttexdefinition mutable protected btx:list:helpers:concat
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi
index 5bcfe6ea355..feec4f107a9 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi
@@ -25,6 +25,17 @@
\fastsetup{\s!btx:\s!list:\s!page:concat}
\fastsetup{\s!btx:\currentbtxspecification:\s!list:page-or-pages}
\ifconditional\btxinteractivepage
+ \ifx\currentbtxfirstinternal\empty
+ \donefalse
+ \else\ifnum\currentbtxfirstinternal=\zerocount
+ \donefalse
+ \else
+ \donetrue
+ \fi\fi
+ \else
+ \donefalse
+ \fi
+ \ifdone
\goto {
\currentbtxfirstpage
} [
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua
index dac0ab441d0..a7d1a6bb5a6 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua
@@ -296,7 +296,8 @@ do
local checksum = nil
local username = file.addsuffix(file.robustname(formatters["%s-btx-%s"](prefix,name)),"lua")
if userdata and next(userdata) then
- if job.passes.first then
+ if environment.currentrun == 1 then
+ -- if job.passes.first then
local newdata = serialize(userdata)
checksum = md5.HEX(newdata)
io.savedata(username,newdata)
@@ -1803,10 +1804,14 @@ do
-- todo: names = { "btx" }
+ local function collectresult(rendering)
+ return structures.lists.filter(rendering.specifications) or { }
+ end
+
methods[v_force] = function (dataset,rendering,keyword)
-- only for checking, can have duplicates, todo: collapse page numbers, although
-- we then also needs deferred writes
- local result = structures.lists.filter(rendering.specifications) or { }
+ local result = collectresult(rendering)
local list = rendering.list
local current = datasets[dataset]
local luadata = current.luadata
@@ -1831,7 +1836,7 @@ do
-- global : if tag and not alldone[tag] and done[tag] ~= section then ...
methods[v_local] = function(dataset,rendering,keyword)
- local result = structures.lists.filter(rendering.specifications) or { }
+ local result = collectresult(rendering)
local section = sections.currentid()
local list = rendering.list
local repeated = rendering.repeated == v_yes
@@ -1903,7 +1908,7 @@ do
if not dataset then
return
end
- local rendering = renderings[dataset]
+ local rendering = renderings[dataset]
if not rendering then
return
end
@@ -1919,6 +1924,7 @@ do
rendering.repeated = specification.repeated or v_no
rendering.group = specification.group or ""
rendering.specifications = specification
+ rendering.collected = false
local filtermethod = methods[method]
if not filtermethod then
report_list("invalid method %a",method or "")
@@ -1932,6 +1938,16 @@ do
else
keyword = nil
end
+ local filename = specification.filename
+ if filename and filename ~= "" then
+ local utilitydata = job.loadother(filename)
+ local lists = utilitydata and utilitydata.structures.lists
+ if lists then
+ rendering.collected = lists.collected
+ else
+ return
+ end
+ end
filtermethod(dataset,rendering,keyword)
local list = rendering.list
if list and filter ~= "" then
@@ -2094,15 +2110,20 @@ do
flush()
end
local nofranges = #ranges
+local interactive = not rendering.collected
for i=1,nofranges do
local r = ranges[i]
ctx_btxsetconcat(concatstate(i,nofranges))
local first = r[1]
local last = r[2]
+if interactive then
ctx_btxsetfirstinternal(first[2].internal)
+end
ctx_btxsetfirstpage(first[1])
if last then
+if interactive then
ctx_btxsetlastinternal(last[2].internal)
+end
ctx_btxsetlastpage(last[1])
end
if trace_details then
@@ -2261,14 +2282,16 @@ do
local list = rendering.list
local li = list[i]
if li then
- local data = datasets[dataset]
- local luadata = data.luadata
- local details = data.details
- local tag = li[1]
- local listindex = li[2]
- local n = li[3]
- local entry = luadata[tag]
- local detail = details[tag]
+ local data = datasets[dataset]
+ local luadata = data.luadata
+ local details = data.details
+ local tag = li[1]
+ local listindex = li[2]
+ local n = li[3]
+ local entry = luadata[tag]
+ local detail = details[tag]
+ --
+ local interactive = not rendering.collected
--
ctx_btxstartlistentry()
ctx_btxsetcurrentlistentry(i) -- redundant
@@ -2282,6 +2305,7 @@ do
ctx_btxsettag(tag)
ctx_btxsetnumber(n)
--
+if interactive then
local citation = citetolist[n]
if citation then
local references = citation.references
@@ -2291,6 +2315,7 @@ do
ctx_btxsetinternal(internal)
end
end
+end
end
--
if language then
@@ -2384,6 +2409,7 @@ do
{ "ignored" },
{ "group" },
{ "filter" },
+ { "filename" },
}
}
}
@@ -2805,6 +2831,7 @@ do
-- we refer to a previous list entry
bl = entry.internal
end
+ -- no check for external (yet)
ctx_btxsetinternal(bl and bl > 0 and bl or "")
end
local language = entry.language
@@ -3255,7 +3282,7 @@ do
ctx_btxsettag(tag)
ctx_btxsetbacklink(currentcitation)
local bl = listtocite[currentcitation]
- ctx_btxsetinternal(bl and bl.references.internal or "")
+-- ctx_btxsetinternal(bl and bl.references.internal or "")
if first then
ctx_btxsetfirst(first[key] or "") -- f_missing(first.tag))
local suffix = entry.suffix
diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv
index 6e34d3ab5e5..fafefa78188 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv
@@ -342,7 +342,7 @@
\newtoks\t_btx_cmd
\newbox \b_btx_cmd
-\t_btx_cmd{\global\setbox\b_btx_cmd\hpack{\clf_btxcmdstring}}
+\t_btx_cmd{\global\setbox\b_btx_cmd\hbox{\clf_btxcmdstring}} % no \hpack, otherwise prerolling --- doesn't work
\let\btxcmd\btxcommand
@@ -1143,7 +1143,7 @@
{\the\t_btx_reference_inject
\strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { }
[\s!btx]%
- [\c!type=\s!btx]% \c!location=\v!none
+ [\c!type=\s!btx,\c!location=\v!here]%
[\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi%
\s!btxref=\currentbtxtag,%
%\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi%
diff --git a/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua
index 2a3b2caafa5..460d97d5e60 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua
@@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['regi-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Regimes take care of converting the input characters into
-<l n='utf'/> sequences. The conversion tables are loaded at
-runtime.</p>
---ldx]]--
+-- Regimes take care of converting the input characters into UTF sequences. The
+-- conversion tables are loaded at runtime.
-- Todo: use regi-imp*.lua instead
@@ -30,9 +27,7 @@ local sequencers = utilities.sequencers
local textlineactions = resolvers.openers.helpers.textlineactions
local setmetatableindex = table.setmetatableindex
---[[ldx--
-<p>We will hook regime handling code into the input methods.</p>
---ldx]]--
+-- We will hook regime handling code into the input methods.
local trace_translating = false trackers.register("regimes.translating", function(v) trace_translating = v end)
diff --git a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua
index 046b7864f8b..85645787109 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua
@@ -183,7 +183,7 @@ implement {
}
implement {
- name = "doiffieldsetelse",
+ name = "doifelsefieldset",
arguments = "string",
actions = function(name)
ctx_doifelse(codeinjections.validfieldset(name))
diff --git a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi
index 6c0e97a9af0..ac5d28e9e35 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi
+++ b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi
@@ -275,7 +275,7 @@
%D A few testing macros:
-\def\doifelsefieldbody #tag{\clf_doifelsefield{#tag}}
+\def\doifelsefieldbody #tag{\clf_doifelsefieldset{#tag}}
\def\doifelsefieldcategory#tag{\clf_doifelsefieldcategory{#tag}}
\let\doiffieldbodyelse \doifelsefieldbody
diff --git a/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua
index 98f516c22a8..a375d705751 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua
@@ -6,49 +6,45 @@ if not modules then modules = { } end modules ['sort-ini'] = {
license = "see context related readme files"
}
--- 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.
-
---[[<p>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.</p>
-
-<p>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.</p>
-
-<p>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.</p>
-
-<p>Todo: decomposition with specific order of accents, this is
-relatively easy to do.</p>
-
-<p>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.</p>
-
-<p>Todo: I ran into the Unicode Collation document and noticed that
-there are some similarities (like the weights) but using that method
-would still demand extra code for language specifics. One option is
-to use the allkeys.txt file for the uc vectors but then we would also
-use the collapsed key (sq, code is now commented). In fact, we could
-just hook those into the replacer code that we reun beforehand.</p>
-
-<p>In the future index entries will become more clever, i.e. they will
-have language etc properties that then can be used.</p>
-]]--
+-- 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.
+--
+-- 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.
+--
+-- Todo: I ran into the Unicode Collation document and noticed that there are some
+-- similarities (like the weights) but using that method would still demand extra
+-- code for language specifics. One option is to use the allkeys.txt file for the uc
+-- vectors but then we would also use the collapsed key (sq, code is now commented).
+-- In fact, we could just hook those into the replacer code that we reun beforehand.
+--
+-- In the future index entries will become more clever, i.e. they will have language
+-- etc properties that then can be used.
local gsub, find, rep, sub, sort, concat, tohash, format = string.gsub, string.find, string.rep, string.sub, table.sort, table.concat, table.tohash, string.format
local utfbyte, utfchar, utfcharacters = utf.byte, utf.char, utf.characters
diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
index c073662c578..d4b423224f5 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
+++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
index 5bced88ec0d..ee377dae779 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
+++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua b/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua
index 6a11fa8d3c6..f0ea8546a2e 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua
@@ -20,10 +20,9 @@ local implement = interfaces.implement
local formatters = string.formatters
---[[ldx--
-<p>For raw 8 bit characters, the offset is 0x110000 (bottom of plane 18) at
-the top of <l n='luatex'/>'s char range but outside the unicode range.</p>
---ldx]]--
+-- For raw 8 bit characters, the offset is 0x110000 (bottom of plane 18) at the top
+-- of LuaTeX's char range but outside the unicode range. This is no longer the case
+-- in LuaMetaTeX.
function converters.hexstringtonumber(n) tonumber(n,16) end
function converters.octstringtonumber(n) tonumber(n, 8) end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv
index ae1978eb6d7..5f226958bcf 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv
@@ -253,6 +253,9 @@
\let\newfam\newfamily
+\let\newinteger \newcount % just in case
+\let\newdimension\newdimen % just in case
+
\firstvalidlanguage\plusone
% Watch out, for the moment we disable the check for already being defined
diff --git a/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv b/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv
index 2ed104adf38..8b6afb9563e 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv
@@ -1551,7 +1551,8 @@
\fi}
\def\tabl_tabulate_vrule_reset_indeed
- {\dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step
+ {\gletcsname\??tabulatevrule0\endcsname\undefined
+ \dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step
\global\c_tabl_tabulate_max_vrulecolumn\zerocount}
\def\tabl_tabulate_vrule_reset_step % undefined or relax
diff --git a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv
index 12abf0cb85f..0fdb9cca650 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv
@@ -18,9 +18,6 @@
\registerctxluafile{toks-scn}{}
\registerctxluafile{cldf-scn}{}
\registerctxluafile{cldf-stp}{}
-
-\ifcase \contextlmtxmode \else
- \registerctxluafile{cldf-lmt}{}
-\fi
+%registerctxluafile{cldf-lmt}{}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua b/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua
index a531a76d671..56522e1e782 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua
@@ -6,7 +6,8 @@ if not modules then modules = { } end modules ['trac-lmx'] = {
license = "see context related readme files"
}
--- this one will be adpated to the latest helpers
+-- This one will be adpated to the latest helpers. It might even become a
+-- module instead.
local type, tostring, rawget, loadstring, pcall = type, tostring, rawget, loadstring, pcall
local format, sub, gsub = string.format, string.sub, string.gsub
diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua
index 614defeb687..2f00fa038ec 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua
@@ -599,23 +599,23 @@ local function resolve_weak(list,size,start,limit,orderbefore,orderafter)
else -- only more efficient when we have es/cs
local runner = start + 2
if runner <= limit then
- local before = list[start]
- local entry = list[start + 1]
- local after = list[runner]
+ local before = list[start]
+ local current = list[start + 1]
+ local after = list[runner]
while after do
- local direction = entry.direction
+ local direction = current.direction
if direction == "es" then
if before.direction == "en" and after.direction == "en" then
- entry.direction = "en"
+ current.direction = "en"
end
elseif direction == "cs" then
local prevdirection = before.direction
if prevdirection == "en" then
if after.direction == "en" then
- entry.direction = "en"
+ current.direction = "en"
end
elseif prevdirection == "an" and after.direction == "an" then
- entry.direction = "an"
+ current.direction = "an"
end
end
before = current
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua b/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua
index bb9eca96688..6462f3e4920 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua
@@ -6,14 +6,10 @@ if not modules then modules = { } end modules ['util-dim'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Internally <l n='luatex'/> work with scaled point, which are
-represented by integers. However, in practice, at east at the
-<l n='tex'/> 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.</p>
---ldx]]--
+-- Internally LuaTeX work with scaled point, which are represented by integers.
+-- However, in practice, at east at the TeX 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.
local format, match, gsub, type, setmetatable = string.format, string.match, string.gsub, type, setmetatable
local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.match
@@ -45,7 +41,9 @@ local dimenfactors = allocate {
["dd"] = ( 1157/ 1238)/65536,
["cc"] = ( 1157/14856)/65536,
-- ["nd"] = (20320/21681)/65536,
- -- ["nc"] = ( 5080/65043)/65536
+ -- ["nc"] = ( 5080/65043)/65536,
+ ["es"] = ( 9176/ 129)/65536,
+ ["ts"] = ( 4588/ 645)/65536,
}
-- print(table.serialize(dimenfactors))
@@ -86,10 +84,8 @@ local dimenfactors = allocate {
-- ["sp"]=1,
-- }
---[[ldx--
-<p>A conversion function that takes a number, unit (string) and optional
-format (string) is implemented using this table.</p>
---ldx]]--
+-- A conversion function that takes a number, unit (string) and optional format
+-- (string) is implemented using this table.
local f_none = formatters["%s%s"]
local f_true = formatters["%0.5F%s"]
@@ -110,9 +106,7 @@ local function numbertodimen(n,unit,fmt) -- will be redefined later !
end
end
---[[ldx--
-<p>We collect a bunch of converters in the <type>number</type> namespace.</p>
---ldx]]--
+-- We collect a bunch of converters in the 'number' namespace.
number.maxdimen = 1073741823
number.todimen = numbertodimen
@@ -122,7 +116,7 @@ function number.topoints (n,fmt) return numbertodimen(n,"pt",fmt) end
function number.toinches (n,fmt) return numbertodimen(n,"in",fmt) end
function number.tocentimeters (n,fmt) return numbertodimen(n,"cm",fmt) end
function number.tomillimeters (n,fmt) return numbertodimen(n,"mm",fmt) end
-function number.toscaledpoints(n,fmt) return numbertodimen(n,"sp",fmt) end
+-------- number.toscaledpoints(n,fmt) return numbertodimen(n,"sp",fmt) end
function number.toscaledpoints(n) return n .. "sp" end
function number.tobasepoints (n,fmt) return numbertodimen(n,"bp",fmt) end
function number.topicas (n,fmt) return numbertodimen(n "pc",fmt) end
@@ -130,14 +124,13 @@ function number.todidots (n,fmt) return numbertodimen(n,"dd",fmt) end
function number.tociceros (n,fmt) return numbertodimen(n,"cc",fmt) end
-------- number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end
-------- number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end
+function number.toediths (n,fmt) return numbertodimen(n,"es",fmt) end
+function number.totoves (n,fmt) return numbertodimen(n,"ts",fmt) end
---[[ldx--
-<p>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 <l n='lpeg'/>. We capture
-a number and optionally a unit. When no unit is given a constant
-capture takes place.</p>
---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 LPEG. We capture a number and optionally a unit. When no
+-- unit is given a constant capture takes place.
local amount = (S("+-")^0 * R("09")^0 * P(".")^0 * R("09")^0) + Cc("0")
local unit = R("az")^1 + P("%")
@@ -152,21 +145,16 @@ function number.splitdimen(str)
return lpegmatch(splitter,str)
end
---[[ldx--
-<p>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.</p>
---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.
setmetatableindex(dimenfactors, function(t,s)
-- error("wrong dimension: " .. (s or "?")) -- better a message
return false
end)
---[[ldx--
-<p>We redefine the following function later on, so we comment it
-here (which saves us bytecodes.</p>
---ldx]]--
+-- We redefine the following function later on, so we comment it here (which saves
+-- us bytecodes.
-- function string.todimen(str)
-- if type(str) == "number" then
@@ -182,44 +170,38 @@ here (which saves us bytecodes.</p>
local stringtodimen -- assigned later (commenting saves bytecode)
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 unit = P("pt") + P("cm") + P("mm") + P("sp") + P("bp")
+ + P("es") + P("ts") + P("pc") + P("dd") + P("cc")
+ + P("in")
+ -- + P("nd") + P("nc")
local validdimen = amount * unit
lpeg.patterns.validdimen = validdimen
---[[ldx--
-<p>This converter accepts calls like:</p>
-
-<typing>
-string.todimen("10")
-string.todimen(".10")
-string.todimen("10.0")
-string.todimen("10.0pt")
-string.todimen("10pt")
-string.todimen("10.0pt")
-</typing>
-
-<p>With this in place, we can now implement a proper datatype for dimensions, one
-that permits us to do this:</p>
-
-<typing>
-s = dimen "10pt" + dimen "20pt" + dimen "200pt"
- - dimen "100sp" / 10 + "20pt" + "0pt"
-</typing>
-
-<p>We create a local metatable for this new type:</p>
---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")
+--
+-- 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:
local dimensions = { }
---[[ldx--
-<p>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. This function is redefined later.</p>
---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. This function is redefined later.
-- function dimen(a)
-- if a then
@@ -241,11 +223,9 @@ see why. This function is redefined later.</p>
-- end
-- end
---[[ldx--
-<p>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.</p>
---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.
function dimensions.__add(a, b)
local ta, tb = type(a), type(b)
@@ -281,20 +261,16 @@ function dimensions.__unm(a)
return setmetatable({ - a }, dimensions)
end
---[[ldx--
-<p>It makes no sense to implement the power and modulo function but
-the next two do make sense because they permits is code like:</p>
-
-<typing>
-local a, b = dimen "10pt", dimen "11pt"
-...
-if a > b then
- ...
-end
-</typing>
---ldx]]--
-
--- makes no sense: dimensions.__pow and dimensions.__mod
+-- 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
+--
+-- This also makes no sense: dimensions.__pow and dimensions.__mod.
function dimensions.__lt(a, b)
return a[1] < b[1]
@@ -304,24 +280,17 @@ function dimensions.__eq(a, b)
return a[1] == b[1]
end
---[[ldx--
-<p>We also need to provide a function for conversion to string (so that
-we can print dimensions). We print them as points, just like <l n='tex'/>.</p>
---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 TeX.
function dimensions.__tostring(a)
return a[1]/65536 .. "pt" -- instead of todimen(a[1])
end
---[[ldx--
-<p>Since it does not take much code, we also provide a way to access
-a few accessors</p>
-
-<typing>
-print(dimen().pt)
-print(dimen().sp)
-</typing>
---ldx]]--
+-- Since it does not take much code, we also provide a way to access a few accessors
+--
+-- print(dimen().pt)
+-- print(dimen().sp)
function dimensions.__index(tab,key)
local d = dimenfactors[key]
@@ -332,41 +301,34 @@ function dimensions.__index(tab,key)
return 1/d
end
---[[ldx--
-<p>In the converter from string to dimension we support functions as
-factors. This is because in <l n='tex'/> we have a few more units:
-<type>ex</type> and <type>em</type>. 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.</p>
---ldx]]--
-
- dimenfactors["ex"] = 4 * 1/65536 -- 4pt
- dimenfactors["em"] = 10 * 1/65536 -- 10pt
--- dimenfactors["%"] = 4 * 1/65536 -- 400pt/100
-
---[[ldx--
-<p>The previous code is rather efficient (also thanks to <l n='lpeg'/>) but we
-can speed it up by caching converted dimensions. On my machine (2008) the following
-loop takes about 25.5 seconds.</p>
-
-<typing>
-for i=1,1000000 do
- local s = dimen "10pt" + dimen "20pt" + dimen "200pt"
- - dimen "100sp" / 10 + "20pt" + "0pt"
-end
-</typing>
-
-<p>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.</p>
-
-<p>We redefine two previous defined functions that can benefit from
-this:</p>
---ldx]]--
+-- In the converter from string to dimension we support functions as factors. This
+-- is because in TeX 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.
+
+ dimenfactors["ex"] = 4 /65536 -- 4pt
+ dimenfactors["em"] = 10 /65536 -- 10pt
+-- dimenfactors["%"] = 4 /65536 -- 400pt/100
+ dimenfactors["eu"] = (9176/129)/65536 -- 1es
+
+-- The previous code is rather efficient (also thanks to LPEG) 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:
local known = { } setmetatable(known, { __mode = "v" })
@@ -436,14 +398,10 @@ function number.toscaled(d)
return format("%0.5f",d/0x10000) -- 2^16
end
---[[ldx--
-<p>In a similar fashion we can define a glue datatype. In that case we
-probably use a hash instead of a one-element table.</p>
---ldx]]--
-
---[[ldx--
-<p>Goodie:s</p>
---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.
+--
+-- A goodie:
function number.percent(n,d) -- will be cleaned up once luatex 0.30 is out
d = d or texget("hsize")
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua b/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua
index fe80c64201e..4da4ef985cc 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua
@@ -11,7 +11,7 @@ utilities.formatters = utilities.formatters or { }
local formatters = utilities.formatters
local concat, format = table.concat, string.format
-local tostring, type = tostring, type
+local tostring, type, unpack = tostring, type, unpack
local strip = string.strip
local lpegmatch = lpeg.match
@@ -21,12 +21,15 @@ function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result > 0 then
- between = between or " "
- local widths, numbers = { }, { }
- local first = result[1]
- local n = #first
+ local widths = { }
+ local numbers = { }
+ local templates = { }
+ local first = result[1]
+ local n = #first
+ between = between or " "
+ --
for i=1,n do
widths[i] = 0
end
@@ -35,13 +38,6 @@ function formatters.formatcolumns(result,between)
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
if tj == "number" then
numbers[j] = true
rj = tostring(rj)
@@ -55,29 +51,59 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h = header[i]
+ for j=1,n do
+ local hj = tostring(h[j])
+ h[j] = hj
+ local w = #hj
+ if w > widths[j] then
+ widths[j] = w
+ end
+ 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
+ templates[i] = "%s" .. between
+ else
+ templates[i] = "% " .. w .. "i" .. between
end
else
if w > 80 then
- widths[i] = "%s" .. between
- elseif w > 0 then
- widths[i] = "%-" .. w .. "s" .. between
+ templates[i] = "%s" .. between
+ elseif w > 0 then
+ templates[i] = "%-" .. w .. "s" .. between
else
- widths[i] = "%s"
+ templates[i] = "%s"
end
end
end
- local template = strip(concat(widths))
+ local template = strip(concat(templates))
for i=1,#result do
local str = format(template,unpack(result[i]))
result[i] = strip(str)
end
+ if header then
+ for i=1,n do
+ local w = widths[i]
+ if w > 80 then
+ templates[i] = "%s" .. between
+ elseif w > 0 then
+ templates[i] = "%-" .. w .. "s" .. between
+ else
+ templates[i] = "%s"
+ end
+ end
+ local template = strip(concat(templates))
+ for i=1,#header do
+ local str = format(template,unpack(header[i]))
+ header[i] = strip(str)
+ end
+ end
end
- return result
+ return result, header
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua
index 635b610e072..d7b7087a5ec 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua
@@ -264,8 +264,13 @@ function parsers.groupedsplitat(symbol,withaction)
if not pattern then
local symbols = S(symbol)
local separator = space^0 * symbols * space^0
- local value = lbrace * C((nobrace + nestedbraces)^0) * rbrace
- + C((nestedbraces + (1-(space^0*(symbols+P(-1)))))^0)
+ local value =
+ lbrace
+ * C((nobrace + nestedbraces)^0)
+ -- * rbrace
+ * (rbrace * (#symbols + P(-1))) -- new per 2023-03-11
+ +
+ C((nestedbraces + (1-(space^0*(symbols+P(-1)))))^0)
if withaction then
local withvalue = Carg(1) * value / function(f,s) return f(s) end
pattern = spaces * withvalue * (separator*withvalue)^0
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua
index 36daef81673..9d2e8356da3 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua
@@ -551,14 +551,14 @@ if bit32 and not streams.tocardinal1 then
local char = string.char
streams.tocardinal1 = char
- function streams.tocardinal2(n) return char(extract( 8,8),extract( 0,8)) end
- function streams.tocardinal3(n) return char(extract(16,8),extract( 8,8),extract(0,8)) end
- function streams.tocardinal4(n) return char(extract(24,8),extract(16,8),extract(8,8),extract(0,8)) end
+ function streams.tocardinal2(n) return char(extract(n, 8,8),extract(n, 0,8)) end
+ function streams.tocardinal3(n) return char(extract(n,16,8),extract(n, 8,8),extract(n,0,8)) end
+ function streams.tocardinal4(n) return char(extract(n,24,8),extract(n,16,8),extract(n,8,8),extract(n,0,8)) end
streams.tocardinal1le = char
- function streams.tocardinal2le(n) return char(extract(0,8),extract(8,8)) end
- function streams.tocardinal3le(n) return char(extract(0,8),extract(8,8),extract(16,8)) end
- function streams.tocardinal4le(n) return char(extract(0,8),extract(8,8),extract(16,8),extract(24,8)) end
+ function streams.tocardinal2le(n) return char(extract(n,0,8),extract(n,8,8)) end
+ function streams.tocardinal3le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8)) end
+ function streams.tocardinal4le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8),extract(n,24,8)) end
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
index 066ca30237e..65f6703ae36 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
@@ -394,7 +394,7 @@ local runners = {
if trace then
report("resultof: %s",command)
end
- local handle = iopopen(command,"r") -- already has flush
+ local handle = iopopen(command,"rb") -- already has flush
if handle then
local result = handle:read("*all") or ""
handle:close()
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua b/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua
index 35839f2302c..49952dd98d5 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua
@@ -6,15 +6,13 @@ if not modules then modules = { } end modules ['util-seq'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Here we implement a mechanism for chaining the special functions
-that we use in <l n="context"> 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.</p>
---ldx]]--
-
+-- Here we implement a mechanism for chaining the special functions that we use in
+-- ConteXt 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.
+--
-- todo: delayed: i.e. we register them in the right order already but delay usage
-
+--
-- todo: protect groups (as in tasks)
local gsub, gmatch = string.gsub, string.gmatch
diff --git a/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl b/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl
index d480b221483..e1ab5662c90 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl
@@ -32,6 +32,11 @@
linecolor=\namedboxanchorcontentparameter{#1}{\c!rulecolor},
#2}
+\mutable\lettonothing\boxanchorone
+\mutable\lettonothing\boxanchortwo
+\mutable\lettonothing\boxanchorposone
+\mutable\lettonothing\boxanchorpostwo
+
\tolerant\permanent\protected\def\connectboxanchors[#1]#*[#2]#*[#3]#*[#4]#*#:#5#6%
{\begingroup
%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt
new file mode 100644
index 00000000000..d04408fb970
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt
@@ -0,0 +1,134 @@
+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 attributes, nodes, backends, utilities = attributes, nodes, backends, utilities
+local tex = tex
+
+local states = attributes.states
+local enableaction = nodes.tasks.enableaction
+local nodeinjections = backends.nodeinjections
+local texsetattribute = tex.setattribute
+local allocate = utilities.storage.allocate
+local setmetatableindex = table.setmetatableindex
+local formatters = string.formatters
+
+local interfaces = interfaces
+local implement = interfaces.implement
+
+local variables = interfaces.variables
+local v_normal = variables.normal
+
+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
+
+local data = effects.data
+local registered = effects.registered
+local values = effects.values
+
+local f_stamp = formatters["%s:%s:%s"]
+
+storage.register("attributes/effects/registered", registered, "attributes.effects.registered")
+storage.register("attributes/effects/values", values, "attributes.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(specification)
+ local alternative, stretch, rulethickness
+ if specification then
+ alternative = specification.alternative or v_normal
+ stretch = specification.stretch or 0
+ rulethickness = specification.rulethickness or 0
+ else
+ alternative = v_normal
+ stretch = 0
+ rulethickness = 0
+ end
+ local stamp = f_stamp(alternative,stretch,rulethickness)
+ local n = registered[stamp]
+ if not n then
+ n = #values + 1
+ values[n] = { alternative, stretch, rulethickness }
+ registered[stamp] = n
+ end
+ return n
+end
+
+local enabled = false
+
+local function enable()
+ if not enabled then
+ enableaction("shipouts","attributes.effects.handler")
+ enabled = true
+ end
+end
+
+effects.register = register
+effects.enable = enable
+
+-- interface
+
+implement {
+ name = "seteffect",
+ actions = function(specification)
+ if not enabled then
+ enable()
+ end
+ texsetattribute(a_effect,register(specification))
+ end,
+ arguments = {
+ {
+ { "alternative", "string" },
+ { "stretch", "integer" },
+ { "rulethickness", "dimen" }
+ }
+ }
+}
+
+implement {
+ name = "reseteffect",
+ actions = function()
+ if enabled then
+ texsetattribute(a_effect,register())
+ end
+ end
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl
index 42aadf9a278..5a50ab60cdc 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Attribute Macros / Effects}
-\registerctxluafile{attr-eff}{}
+\registerctxluafile{attr-eff}{autosuffix}
\unprotect
@@ -22,7 +22,7 @@
\installcommandhandler \??effect {effect} \??effect
\setupeffect
- [\c!method=\v!none,
+ [\c!method=\v!none, % should become command or define or so
\c!stretch=\zerocount,
\c!rulethickness=\zeropoint,
\c!alternative=\v!normal]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt
index 8b2ec89119b..32fc36cdd87 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt
@@ -10,10 +10,8 @@ local next, type = next, type
local osexit = os.exit
local sortedhash = table.sortedhash
---[[ldx--
-<p>We start with a registration system for atributes so that we can use the
-symbolic names later on.</p>
---ldx]]--
+-- We start with a registration system for atributes so that we can use the symbolic
+-- names later on.
local nodes = nodes
local context = context
@@ -71,17 +69,13 @@ trackers.register("attributes.values", function(v) trace_values = v end)
-- end
-- end
---[[ldx--
-<p>We reserve this one as we really want it to be always set (faster).</p>
---ldx]]--
+-- We reserve this one as we really want it to be always set (faster).
names[0], numbers["fontdynamic"] = "fontdynamic", 0
---[[ldx--
-<p>private attributes are used by the system and public ones are for users. We use dedicated
-ranges of numbers for them. Of course a the <l n='context'/> end a private attribute can be
-accessible too, so a private attribute can have a public appearance.</p>
---ldx]]--
+-- Private attributes are used by the system and public ones are for users. We use
+-- dedicated ranges of numbers for them. Of course a the TeX end a private attribute
+-- can be accessible too, so a private attribute can have a public appearance.
sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or 15 -- very private
sharedstorage.attributes_last_public = sharedstorage.attributes_last_public or 1024 -- less private
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt
new file mode 100644
index 00000000000..10550d93504
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt
@@ -0,0 +1,40 @@
+if not modules then modules = { } end modules ['attr-mkr'] = {
+ version = 1.001,
+ comment = "companion to attr-mkr.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local markers = nodes.markers or { }
+nodes.markers = markers
+
+local cache = { }
+local numbers = attributes.numbers
+local a_unknown = attributes.private("marker:unknown")
+
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+local setattr = nuts.setattr
+local getattr = nuts.getattr
+
+table.setmetatableindex(cache,function(t,k)
+ local k = "marker:" .. k
+ local v = numbers[k] or a_unknown
+ t[k] = v
+ return v
+end)
+
+function markers.get(n,name)
+ local a = cache[name]
+ if a then
+ getattr(tonut(n),a)
+ end
+end
+
+function markers.set(n,name,v)
+ local a = cache[name]
+ if a then
+ setattr(tonut(n),a,v)
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl
index 2209af24157..24e0a23193c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl
@@ -15,11 +15,12 @@
\unprotect
-\registerctxluafile{attr-mkr}{}
+\registerctxluafile{attr-mkr}{autosuffix}
\permanent \protected\def\definemarker [#1]{\defineattribute[\s!marker:#1]}
\permanent\tolerant\protected\def\setmarker [#1]#*[#2]{\dosetattribute{\s!marker:#1}{#2}}
\permanent \protected\def\resetmarker [#1]{\dogetattribute{\s!marker:#1}}
-\permanent \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\numexpr \numexpr#2\relax}
+\permanent \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\relax \numexpr#2\relax}
+\permanent \protected\def\marker #1{\numexpr\dogetattributeid{\s!marker:#1}\relax}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt
new file mode 100644
index 00000000000..4739b736d82
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt
@@ -0,0 +1,104 @@
+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, utilities, logs, backends = attributes, nodes, utilities, logs, backends
+local commands, context, interfaces = commands, context, interfaces
+local tex = tex
+
+local states = attributes.states
+local enableaction = nodes.tasks.enableaction
+local nodeinjections = backends.nodeinjections
+local texsetattribute = 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")
+
+local v_none = interfaces.variables.none
+
+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 -- v_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()
+ enableaction("shipouts","attributes.negatives.handler")
+end
+
+negatives.register = register
+negatives.enable = enable
+
+-- interface
+
+local enabled = false
+
+function negatives.set(stamp)
+ if not enabled then
+ enable()
+ enabled = true
+ end
+ texsetattribute(a_negative,register(stamp))
+end
+
+interfaces.implement {
+ name = "setnegative",
+ actions = negatives.set,
+ arguments = "argument",
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl
index c849e6bf6db..869ac0b2e55 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl
@@ -13,16 +13,19 @@
\writestatus{loading}{ConTeXt Attribute Macros / Negation}
-\registerctxluafile{attr-neg}{}
+\registerctxluafile{attr-neg}{autosuffix}
\unprotect
+%D This feature is kind of useless because only \ACROBAT\ seems to support it and
+%D even rather complete mupdf based viewers seem to ignore it.
+
% positive and negative are preregistered
-\permanent\protected\def\startnegative{\clf_setnegative{\v!negative}}
-\permanent\protected\def\stopnegative {\clf_setnegative{\v!positive}}
+\permanent\protected\def\startnegative{\clf_setnegative\v!negative}
+\permanent\protected\def\stopnegative {\clf_setnegative\v!positive}
-\permanent\protected\def\startpositive{\clf_setnegative{\v!positive}}
-\permanent\protected\def\stoppositive {\clf_setnegative{\v!negative}}
+\permanent\protected\def\startpositive{\clf_setnegative\v!positive}
+\permanent\protected\def\stoppositive {\clf_setnegative\v!negative}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl
index d8c4da04060..4a473b47691 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl
@@ -236,8 +236,10 @@
%\letcsname\Uchar"FFFF\Uchar\expandafter`\string#1\endcsname\m_active
\letcsname\csactive#1\endcsname\m_active}
+\mutable\integerdef\c_active_char_code\zerocount
+
\permanent\protected\def\pushactivecharcode{\afterassignment\syst_active_push\integerdef\c_active_char_code}
-\permanent\protected\def\popactivecharcode {\afterassignment\syst_active_pop\integerdef \c_active_char_code}
+\permanent\protected\def\popactivecharcode {\afterassignment\syst_active_pop \integerdef\c_active_char_code}
\permanent\protected\def\syst_active_push
{\expandafter\let\expandafter\m_active\csname\csactive\Uchar\c_active_char_code\endcsname
diff --git a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
index 0e0297381bf..0ac297d599b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
@@ -23,6 +23,8 @@ local mark = utilities.storage.mark
local context = context
local commands = commands
+if not characters then require("char-ini") require("char-utf") end
+
local characters = characters
local texcharacters = { }
characters.tex = texcharacters
@@ -44,17 +46,14 @@ local trace_defining = false trackers.register("characters.defining", fu
local report_defining = logs.reporter("characters")
---[[ldx--
-<p>In order to deal with 8-bit output, we need to find a way to go from <l n='utf'/> to
-8-bit. This is handled in the <l n='luatex'/> engine itself.</p>
-
-<p>This leaves us problems with characters that are specific to <l n='tex'/> like
-<type>{}</type>, <type>$</type> and alike. We can remap some chars that tex input files
-are sensitive for to a private area (while writing to a utility file) and revert then
-to their original slot when we read in such a file. Instead of reverting, we can (when
-we resolve characters to glyphs) map them to their right glyph there. For this purpose
-we can use the private planes 0x0F0000 and 0x100000.</p>
---ldx]]--
+-- In order to deal with 8-bit output, we need to find a way to go from UTF to
+-- 8-bit. This is handled in the 32 bit engine itself. This leaves us problems with
+-- characters that are specific to TeX, like curly braces and dollars. We can remap
+-- some chars that tex input files are sensitive for to a private area (while
+-- writing to a utility file) and revert then to their original slot when we read in
+-- such a file. Instead of reverting, we can (when we resolve characters to glyphs)
+-- map them to their right glyph there. For this purpose we can use the private
+-- planes 0x0F0000 and 0x100000.
local low = allocate()
local high = allocate()
@@ -104,21 +103,6 @@ private.escape = utf.remapper(escapes) -- maybe: ,"dynamic"
private.replace = utf.remapper(low) -- maybe: ,"dynamic"
private.revert = utf.remapper(high) -- maybe: ,"dynamic"
---[[ldx--
-<p>We get a more efficient variant of this when we integrate
-replacements in collapser. This more or less renders the previous
-private code redundant. The following code is equivalent but the
-first snippet uses the relocated dollars.</p>
-
-<typing>
-[󰀤x󰀤] [$x$]
-</typing>
---ldx]]--
-
--- using the tree-lpeg-mapper would be nice but we also need to deal with end-of-string
--- cases: "\"\i" and don't want "\relax" to be seen as \r e lax" (for which we need to mess
--- with spaces
-
local accentmapping = allocate {
['"'] = { [""] = "¨",
A = "Ä", a = "ä",
@@ -286,12 +270,12 @@ local commandmapping = allocate {
texcharacters.commandmapping = commandmapping
-local ligaturemapping = allocate {
- ["''"] = "”",
- ["``"] = "“",
- ["--"] = "–",
- ["---"] = "—",
-}
+-- local ligaturemapping = allocate {
+-- ["''"] = "”",
+-- ["``"] = "“",
+-- ["--"] = "–",
+-- ["---"] = "—",
+-- }
-- Older accent handling code can be found in char-def.lua but in the meantime
-- we moved on. First the one with commands:
@@ -319,9 +303,9 @@ local function toutfpattern()
hash["{\\"..k.."}"] = v
hash["{\\"..k.." }"] = v
end
- for k, v in next, ligaturemapping do
- hash[k] = v
- end
+ -- for k, v in next, ligaturemapping do
+ -- hash[k] = v
+ -- end
untex = utfchartabletopattern(hash) / hash
end
return untex
@@ -374,9 +358,9 @@ local function toutfpattern()
for k, v in next, commandmapping do
hash[k] = v
end
- for k, v in next, ligaturemapping do
- hash[k] = v
- end
+ -- for k, v in next, ligaturemapping do
+ -- hash[k] = v
+ -- end
untex = utfchartabletopattern(hash) / hash
end
return untex
@@ -401,7 +385,7 @@ if not interfaces then return end
local implement = interfaces.implement
-local pattern
+local pattern1, pattern2
local verbosemarks = characters.verbosemarks
@@ -418,6 +402,7 @@ else
["grave"] = utfchar(0x300),
["acute"] = utfchar(0x301),
["circumflex"] = utfchar(0x302),
+ ["circumflex"] = utfchar(0x302),
["tilde"] = utfchar(0x303),
["macron"] = utfchar(0x304), ["line"] = utfchar(0x304),
["overline"] = utfchar(0x305),
@@ -442,6 +427,7 @@ else
["macron below"] = utfchar(0x331), ["line below"] = utfchar(0x331),
["hook below"] = utfchar(0x1FA9D),
+
}
characters.verbosemarks = verbosemarks
@@ -452,48 +438,68 @@ else
end
-local function prepare()
- pattern = Cs((utfchartabletopattern(verbosemarks) / verbosemarks + lpegpatterns.space/"" + lpegpatterns.utf8character)^0)
- return pattern
+local function prepare1()
+ pattern1 = Cs(
+ (
+P("\\")/"" * (utfchartabletopattern(commandmapping) / commandmapping) * (P(" ")/"")
++ utfchartabletopattern(verbosemarks) / verbosemarks
+ + lpegpatterns.space/""
+ + lpegpatterns.utf8character
+ )^0
+ )
+ return pattern1
+end
+
+local function prepare2()
+ local back = {
+ ["ı"] = "i",
+ ["ȷ"] = "j",
+ }
+ pattern2 = Cs(
+ (
+ utfchartabletopattern(back) / back
+ + lpegpatterns.utf8character
+ )^0
+ )
+ return pattern2
end
local hash = table.setmetatableindex(function(t,k)
- local f = ""
- k = lpegmatch(pattern or prepare(),k) or k
+ local f = k
+ k = lpegmatch(pattern1 or prepare1(),k) or k
+ k = lpegmatch(pattern2 or prepare2(),k) or k
local v = collapse(k) or k -- char specials
--- print("collapse",k,v)
if k ~= v then
goto DONE
end
v = combine(k) or k -- with specials
--- print("combine",k,v)
if k ~= v then
goto DONE
end
v = commandmapping[k] or k
--- print("command",k,v)
if k ~= v then
- f = "\\"
+ f = "\\" .. f
goto DONE
end
v = textoutf(k) or k
--- print("utf",k,v)
if k ~= v then
- f = "\\"
+ f = "\\" .. f
goto DONE
end
::DONE::
- report_defining("instead of old school '%s%s' you can input the utf sequence %s",f,k,v)
+ report_defining("instead of old school '%s' you can input the utf sequence %s",f,v)
t[k] = v
return v
end)
implement {
name = "chr",
- arguments = "argument",
+ -- arguments = "argument", -- not here
+ arguments = "string",
public = true,
actions = function(str)
- context(hash[str]) -- expandable
+ local hsh = hash[str]
+ context(hsh) -- expandable
end
}
@@ -556,10 +562,8 @@ implement { -- a waste of scanner but consistent
actions = texcharacters.defineaccents
}
---[[ldx--
-<p>Instead of using a <l n='tex'/> file to define the named glyphs, we
-use the table. After all, we have this information available anyway.</p>
---ldx]]--
+-- Instead of using a TeX file to define the named glyphs, we use the table. After
+-- all, we have this information available anyway.
local function to_number(s)
local n = tonumber(s)
@@ -854,10 +858,6 @@ function characters.setactivecatcodes(cct)
tex.catcodetable = saved
end
---[[ldx--
-<p>Setting the lccodes is also done in a loop over the data table.</p>
---ldx]]--
-
implement {
name = "chardescription",
arguments = "integer",
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl
index 0c5788bb291..b9620ff1c0a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl
@@ -1,5 +1,5 @@
%D \module
-%D [ file=cldf-int,
+%D [ file=cldf-ini,
%D version=2019.01.01,
%D title=\CONTEXT\ Data Macros,
%D subtitle=Integer,
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt b/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt
index aba3dacdaa5..1eb80ac602b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt
@@ -1008,6 +1008,7 @@ do
return integer_code, code[n]
else
local v = scaninteger(true)
+ -- local v = scancardinal(true)
-- if isglobal(what) then
if what and (tonumber(what) & global_code) then
setsparse(code,"global",n,v)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt
new file mode 100644
index 00000000000..9378b01be8c
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt
@@ -0,0 +1,187 @@
+if not modules then modules = { } end modules ['cldf-pos'] = {
+ version = 1.001,
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- https://cse512-19s.github.io/FP-Well-Rounded/
+
+local tostring, load, type, tonumber = tostring, load, type, tonumber
+local lpegmatch = lpeg.match
+local context = context
+
+local setmetatableindex = table.setmetatableindex
+
+local implement = interfaces.implement
+
+local fromposit = posit.fromposit
+local toposit = posit.toposit
+local posittonumber = posit.tonumber
+
+local values = tokens.values
+local boolean_code = values.boolean
+local float_code = values.float
+
+local scanners = tokens.scanners
+local scanposit = scanners.posit
+local scanfloat = scanners.float
+local scaninteger = scanners.integer
+local scancsname = scanners.csname
+
+do -- these are only for testing and might go to a module eventually
+
+ local codes = tex.codes
+
+ local global_code = tex.flagcodes.global
+
+ local savelua = token.savelua
+ ----- isdefined = token.isdefined
+
+ local newsparse = sparse.new
+ local setsparse = sparse.set
+ ----- wipesparse = sparse.wipe
+ local restoresparse = sparse.restore
+
+ local registerfunction = context.functions.register
+
+ implement {
+ name = "positunumdef",
+ public = true,
+ untraced = true,
+ protected = true,
+ actions = function(what)
+ local name = scancsname(true)
+ local code = newsparse()
+ local restore = registerfunction(function() restoresparse(code) end)
+ implement {
+ name = name,
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function(what)
+ local n = scaninteger()
+ if what == "value" then
+ local v = fromposit(code[n])
+ -- return float_code, v
+ context("%.99g",v)
+ else
+ local v = toposit(scanfloat())
+ if what and (tonumber(what) & global_code) then
+ setsparse(code,"global",n,v)
+ else
+ savelua(restore,true) -- only once
+ setsparse(code,n,v)
+ end
+ end
+ end,
+ }
+ codes[name] = code
+ end,
+ }
+
+ do
+
+ local p_number = lpeg.patterns.number
+ local p = lpeg.Cs(
+ lpeg.Cc("local new = new ; return ")
+ * (
+ lpeg.C(p_number) / function(s)
+ return "new(" .. s .. ")"
+ end
+ + lpeg.P(1)
+ )^0
+ )
+
+ local t = setmetatableindex({ new = posit.new }, posit)
+
+ local function calculate(s)
+ local new = lpegmatch(p,s)
+ new = load(new,nil,nil,t)
+ if new then
+ new = new()
+ if new then
+ return new
+ end
+ end
+ return old
+ end
+
+ implement {
+ name = "positunum",
+ public = true,
+ arguments = "string",
+ actions = function(s)
+ local r = calculate(s)
+ local t = type(r)
+ if t == "boolean" then
+ context(tostring(r))
+ elseif t == "string" then
+ context(r)
+ else
+ context("%N",posittonumber(r))
+ end
+ end
+ }
+
+ implement {
+ name = "ifpositunum",
+ public = true,
+ usage = "condition",
+ arguments = "string",
+ actions = function(s)
+ return boolean_code, calculate(s) and true or false
+ end,
+ }
+
+ end
+
+end
+
+do
+
+ local xsin = xmath.sin local xasin = xmath.asin local xsinh = xmath.sinh local xasinh = xmath.asinh
+ local xcos = xmath.cos local xacos = xmath.acos local xcosh = xmath.cosh local xacosh = xmath.acosh
+ local xtan = xmath.tan local xatan = xmath.atan local xtanh = xmath.tanh local xatanh = xmath.atanh
+
+ local xsqrt = xmath.sqrt
+ local xlog = xmath.log
+ local xexp = xmath.exp
+ local xpow = xmath.pow
+ local xceil = xmath.ceil
+ local xfloor = xmath.floor
+ local xround = xmath.round
+ local xabs = xmath.fabs
+ local xmod = xmath.fmod
+ local xrem = xmath.remainder
+ local xrad = xmath.rad
+ local xdeg = xmath.deg
+ local xatan2 = xmath.atan2
+
+ implement { name = "pfsin", public = true, usage = "value", actions = function() return float_code, xsin (scanposit(true)) end }
+ implement { name = "pfcos", public = true, usage = "value", actions = function() return float_code, xcos (scanposit(true)) end }
+ implement { name = "pftan", public = true, usage = "value", actions = function() return float_code, xtan (scanposit(true)) end }
+ implement { name = "pfasin", public = true, usage = "value", actions = function() return float_code, xasin (scanposit(true)) end }
+ implement { name = "pfacos", public = true, usage = "value", actions = function() return float_code, xacos (scanposit(true)) end }
+ implement { name = "pfatan", public = true, usage = "value", actions = function() return float_code, xatan (scanposit(true)) end }
+ implement { name = "pfsinh", public = true, usage = "value", actions = function() return float_code, xsinh (scanposit(true)) end }
+ implement { name = "pfcosh", public = true, usage = "value", actions = function() return float_code, xcosh (scanposit(true)) end }
+ implement { name = "pftanh", public = true, usage = "value", actions = function() return float_code, xtanh (scanposit(true)) end }
+ implement { name = "pfasinh", public = true, usage = "value", actions = function() return float_code, xasinh(scanposit(true)) end }
+ implement { name = "pfacosh", public = true, usage = "value", actions = function() return float_code, xacosh(scanposit(true)) end }
+ implement { name = "pfatanh", public = true, usage = "value", actions = function() return float_code, xatanh(scanposit(true)) end }
+ implement { name = "pfsqrt", public = true, usage = "value", actions = function() return float_code, xsqrt (scanposit(true)) end }
+ implement { name = "pflog", public = true, usage = "value", actions = function() return float_code, xlog (scanposit(true)) end }
+ implement { name = "pfexp", public = true, usage = "value", actions = function() return float_code, xexp (scanposit(true)) end }
+ implement { name = "pfceil", public = true, usage = "value", actions = function() return float_code, xceil (scanposit(true)) end }
+ implement { name = "pffloor", public = true, usage = "value", actions = function() return float_code, xfloor(scanposit(true)) end }
+ implement { name = "pfround", public = true, usage = "value", actions = function() return float_code, xround(scanposit(true)) end }
+ implement { name = "pfabs", public = true, usage = "value", actions = function() return float_code, xabs (scanposit(true)) end }
+ implement { name = "pfrad", public = true, usage = "value", actions = function() return float_code, xrad (scanposit(true)) end }
+ implement { name = "pfdeg", public = true, usage = "value", actions = function() return float_code, xdeg (scanposit(true)) end }
+ implement { name = "pfatantwo", public = true, usage = "value", actions = function() return float_code, xatan2(scanposit(true),scanposit(true)) end }
+ implement { name = "pfpow", public = true, usage = "value", actions = function() return float_code, xpow (scanposit(true),scanposit(true)) end }
+ implement { name = "pfmod", public = true, usage = "value", actions = function() return float_code, xmod (scanposit(true),scanposit(true)) end }
+ implement { name = "pfrem", public = true, usage = "value", actions = function() return float_code, xrem (scanposit(true),scanposit(true)) end }
+
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl
new file mode 100644
index 00000000000..fb419d07061
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl
@@ -0,0 +1,36 @@
+%D \module
+%D [ file=cldf-pos,
+%D version=2023.04.21,
+%D title=\CONTEXT\ Data Macros,
+%D subtitle=Posit,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%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 Posit Numbers / Initialization}
+
+\registerctxluafile{cldf-pos}{autosuffix}
+
+\newposit\pfpi \pfpi 3.1415926535897932384626433832795028841971
+\newposit\pftwopi \pftwopi \floatexpr \pfpi * 2 \relax
+
+% \newfloat\fooA
+%
+% \scratchdimen=123.456pt\relax [\type{dim:} \the\scratchdimen==123.456pt]\par
+% \fooA =123.456\relax [\type{pos:} \the\fooA ==123.456] \par
+% \fooA =\scratchdimen\relax [\type{pos:} \the\fooA ==123.456] \par
+% \scratchdimen=\fooA\relax [\type{dim:} \the\scratchdimen==123.456pt]\par
+% \scratchdimen\dimexpr\fooA+10pt\relax[\type{dim:} \the\scratchdimen==133.456pt]\par
+%
+% \fooA\pfsin \pfpi [\the\fooA]\par
+% \fooA\pfcos \pfpi [\the\fooA]\par
+% \fooA\pfsqrt\pfpi [\the\fooA]\par
+% \fooA\pfexp \pfpi [\the\fooA]\par
+% \fooA\pflog \pfpi [\the\fooA]\par
+% \fooA\pfpow \pfpi 2 [\the\fooA]\par
+
+\endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
index ef7c4071708..030a373aa14 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.03.10 12:15}
+\newcontextversion{2023.05.05 18:36}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/Master/texmf-dist/tex/context/base/mkxl/context.mkxl b/Master/texmf-dist/tex/context/base/mkxl/context.mkxl
index cfea2b9ba29..4cfa730914c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/context.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2023.03.10 12:15}
+\immutable\edef\contextversion{2023.05.05 18:36}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -104,6 +104,7 @@
\loadmkxlfile{luat-ini}
\loadmkxlfile{toks-scn}
+\loadmkxlfile{cldf-pos}
\loadmkxlfile{syst-aux}
\loadmkxlfile{syst-lua}
@@ -162,7 +163,7 @@
\loadmkxlfile{node-fin}
\loadmkxlfile{node-mig}
-%loadmkxlfile{node-pag}
+\loadmkxlfile{node-pag}
\loadmkxlfile{driv-ini} % after node-ini (ext)
@@ -215,8 +216,9 @@
\loadmkxlfile{unic-ini}
-\loadmkxlfile{core-two}
+%loadmkxlfile{core-two} % retired, not in testsuite, not on garden, not in styles
\loadmkxlfile{core-dat}
+\loadmkxlfile{core-pag}
\loadmkxlfile{colo-ini}
\loadmkxlfile{colo-nod}
@@ -647,30 +649,26 @@
% we will definitely freeze mkiv and then use lmt files for futher development
% of lmtx. We also no longer use the macro feature to replace 5.3 compatible
% function calls by native 5.4 features as lmt files assume 5.4 anyway. This
-% makes format generation a little faster (not that it's that slow). It might \
+% makes format generation a little faster (not that it's that slow). It might
% take a while before we dealt with all of them because I'll also clean them
-% up a bit when doing.
+% up a bit when doing. Some will probably always be shared, like char-def.lua.
%
-% % luat-bas.mkxl l-macro-imp-optimize % this will go away
-
-% c:/data/develop/context/sources/attr-eff.lua
-% c:/data/develop/context/sources/attr-mkr.lua
-% c:/data/develop/context/sources/attr-neg.lua
-
-% c:/data/develop/context/sources/buff-imp-default.lua
-% c:/data/develop/context/sources/buff-imp-escaped.lua
-% c:/data/develop/context/sources/buff-imp-lua.lua
-% c:/data/develop/context/sources/buff-imp-mp.lua
-% c:/data/develop/context/sources/buff-imp-nested.lua
-% c:/data/develop/context/sources/buff-imp-parsed-xml.lua
-% c:/data/develop/context/sources/buff-imp-tex.lua
-% c:/data/develop/context/sources/buff-imp-xml.lua
+% % luat-bas.mkxl l-macro-imp-optimize % this is no longer used
% c:/data/develop/context/sources/buff-par.lua
% c:/data/develop/context/sources/buff-ver.lua
+%
+% c:/data/develop/context/sources/buff-imp-default.lua % shared
+% c:/data/develop/context/sources/buff-imp-escaped.lua % shared
+% c:/data/develop/context/sources/buff-imp-lua.lua % shared
+% c:/data/develop/context/sources/buff-imp-mp.lua % shared
+% c:/data/develop/context/sources/buff-imp-nested.lua % shared
+% c:/data/develop/context/sources/buff-imp-parsed-xml.lua % shared
+% c:/data/develop/context/sources/buff-imp-tex.lua % shared
+% c:/data/develop/context/sources/buff-imp-xml.lua % shared
% c:/data/develop/context/sources/char-cjk.lua
-% c:/data/develop/context/sources/char-def.lua
+% c:/data/develop/context/sources/char-def.lua % shared data file, a real big one
% c:/data/develop/context/sources/char-enc.lua
% c:/data/develop/context/sources/char-ent.lua
% c:/data/develop/context/sources/char-fio.lua
@@ -684,7 +682,7 @@
% c:/data/develop/context/sources/cldf-com.lua
% c:/data/develop/context/sources/cldf-ini.lua
-% c:/data/develop/context/sources/cldf-prs.lua % use in chemistry
+% c:/data/develop/context/sources/cldf-prs.lua % used in chemistry
% c:/data/develop/context/sources/cldf-scn.lua
% c:/data/develop/context/sources/cldf-stp.lua
% c:/data/develop/context/sources/cldf-ver.lua
@@ -694,8 +692,6 @@
% c:/data/develop/context/sources/core-con.lua
% c:/data/develop/context/sources/core-ctx.lua
-% c:/data/develop/context/sources/core-dat.lua
-% c:/data/develop/context/sources/core-two.lua
% data...
@@ -704,7 +700,7 @@
% c:/data/develop/context/sources/file-res.lua
% c:/data/develop/context/sources/font-afk.lua
-% c:/data/develop/context/sources/font-agl.lua
+% c:/data/develop/context/sources/font-agl.lua % shared data file
% c:/data/develop/context/sources/font-aux.lua
% c:/data/develop/context/sources/font-cid.lua
% c:/data/develop/context/sources/font-enc.lua
@@ -728,16 +724,16 @@
% c:/data/develop/context/sources/font-trt.lua
% c:/data/develop/context/sources/font-web.lua % proof of concept, never used
-% c:/data/develop/context/sources/font-imp-combining.lua % shared, like typescript
-% c:/data/develop/context/sources/font-imp-dimensions.lua % idem
-% c:/data/develop/context/sources/font-imp-italics.lua % idem
-% c:/data/develop/context/sources/font-imp-notused.lua % idem
-% c:/data/develop/context/sources/font-imp-properties.lua % idem
-% c:/data/develop/context/sources/font-imp-reorder.lua % idem
-% c:/data/develop/context/sources/font-imp-spacekerns.lua % idem
-% c:/data/develop/context/sources/font-imp-tex.lua % idem
-% c:/data/develop/context/sources/font-imp-tweaks.lua % idem
-% c:/data/develop/context/sources/font-imp-unicode.lua % idem
+% c:/data/develop/context/sources/font-imp-combining.lua % shared
+% c:/data/develop/context/sources/font-imp-dimensions.lua % shared
+% c:/data/develop/context/sources/font-imp-italics.lua % shared
+% c:/data/develop/context/sources/font-imp-notused.lua % shared
+% c:/data/develop/context/sources/font-imp-properties.lua % shared
+% c:/data/develop/context/sources/font-imp-reorder.lua % shared
+% c:/data/develop/context/sources/font-imp-spacekerns.lua % shared
+% c:/data/develop/context/sources/font-imp-tex.lua % shared
+% c:/data/develop/context/sources/font-imp-tweaks.lua % shared
+% c:/data/develop/context/sources/font-imp-unicode.lua % shared
% c:/data/develop/context/sources/good-ctx.lua
% c:/data/develop/context/sources/good-ini.lua
@@ -753,26 +749,26 @@
% c:/data/develop/context/sources/java-ini.lua
-% c:/data/develop/context/sources/lang-cnt.lua
-% c:/data/develop/context/sources/lang-def.lua % these are data files
-% c:/data/develop/context/sources/lang-txt.lua % these are data files
+% c:/data/develop/context/sources/lang-cnt.lua % shared data file
+% c:/data/develop/context/sources/lang-def.lua % shared data file
+% c:/data/develop/context/sources/lang-txt.lua % shared data file
% c:/data/develop/context/sources/lang-wrd.lua
% c:/data/develop/context/sources/luat-exe.lua
% c:/data/develop/context/sources/luat-iop.lua
% c:/data/develop/context/sources/luat-mac.lua % will become lmt
-% c:/data/develop/context/sources/lxml-aux.lua
-% c:/data/develop/context/sources/lxml-css.lua
-% c:/data/develop/context/sources/lxml-dir.lua
-% c:/data/develop/context/sources/lxml-ent.lua
-% c:/data/develop/context/sources/lxml-ini.lua
-% c:/data/develop/context/sources/lxml-lpt.lua
-% c:/data/develop/context/sources/lxml-mis.lua
-% c:/data/develop/context/sources/lxml-sor.lua
-% c:/data/develop/context/sources/lxml-tab.lua
-% c:/data/develop/context/sources/lxml-tex.lua
-% c:/data/develop/context/sources/lxml-xml.lua
+% c:/data/develop/context/sources/lxml-aux.lua % the xml interfcace is rather stable
+% c:/data/develop/context/sources/lxml-css.lua % and is also provided/used in lua so
+% c:/data/develop/context/sources/lxml-dir.lua % might as well share these because they
+% c:/data/develop/context/sources/lxml-ent.lua % are unlikely to change
+% c:/data/develop/context/sources/lxml-ini.lua %
+% c:/data/develop/context/sources/lxml-lpt.lua %
+% c:/data/develop/context/sources/lxml-mis.lua %
+% c:/data/develop/context/sources/lxml-sor.lua %
+% c:/data/develop/context/sources/lxml-tab.lua %
+% c:/data/develop/context/sources/lxml-tex.lua %
+% c:/data/develop/context/sources/lxml-xml.lua %
% c:/data/develop/context/sources/meta-blb.lua
% c:/data/develop/context/sources/meta-fun.lua
@@ -791,19 +787,17 @@
% c:/data/develop/context/sources/page-mix.lua
% c:/data/develop/context/sources/page-pst.lua
-% c:/data/develop/context/sources/phys-dim.lua
-
% c:/data/develop/context/sources/publ-aut.lua % shared
-% c:/data/develop/context/sources/publ-dat.lua
-% c:/data/develop/context/sources/publ-fnd.lua
-% c:/data/develop/context/sources/publ-inc.lua
-% c:/data/develop/context/sources/publ-ini.lua
-% c:/data/develop/context/sources/publ-jrn.lua
-% c:/data/develop/context/sources/publ-oth.lua
-% c:/data/develop/context/sources/publ-reg.lua
-% c:/data/develop/context/sources/publ-sor.lua
-% c:/data/develop/context/sources/publ-tra.lua
-% c:/data/develop/context/sources/publ-usr.lua
+% c:/data/develop/context/sources/publ-dat.lua % shared
+% c:/data/develop/context/sources/publ-fnd.lua % shared
+% c:/data/develop/context/sources/publ-inc.lua % shared
+% c:/data/develop/context/sources/publ-ini.lua % shared
+% c:/data/develop/context/sources/publ-jrn.lua % shared
+% c:/data/develop/context/sources/publ-oth.lua % shared
+% c:/data/develop/context/sources/publ-reg.lua % shared
+% c:/data/develop/context/sources/publ-sor.lua % shared
+% c:/data/develop/context/sources/publ-tra.lua % shared
+% c:/data/develop/context/sources/publ-usr.lua % shared
% c:/data/develop/context/sources/scrn-but.lua
% c:/data/develop/context/sources/scrn-fld.lua
@@ -834,8 +828,3 @@
% c:/data/develop/context/sources/trac-lmx.lua
% c:/data/develop/context/sources/trac-par.lua
% c:/data/develop/context/sources/trac-tex.lua
-
-% c:/data/develop/context/sources/typo-cln.lua -- wrong name for what it does
-% c:/data/develop/context/sources/typo-dha.lua
-
-% c:/data/develop/context/sources/unic-ini.lua
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt
new file mode 100644
index 00000000000..fd8aa0fb64a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt
@@ -0,0 +1,225 @@
+if not modules then modules = { } end modules ['core-dat'] = {
+ version = 1.001,
+ comment = "companion to core-dat.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This module provides a (multipass) container for arbitrary data. It replaces the
+-- twopass data mechanism.
+
+local tonumber, tostring, type = tonumber, tostring, type
+
+local context = context
+
+local trace_datasets = false trackers.register("job.datasets" , function(v) trace_datasets = v end)
+
+local report_dataset = logs.reporter("dataset")
+
+local allocate = utilities.storage.allocate
+local settings_to_hash = utilities.parsers.settings_to_hash
+
+local texgetcount = tex.getcount
+local texsetcount = tex.setcount
+
+local v_yes = interfaces.variables.yes
+
+local new_latelua = nodes.pool.latelua
+
+local implement = interfaces.implement
+
+local c_realpageno = tex.iscount("realpageno")
+
+local collected = allocate()
+local tobesaved = allocate()
+
+local datasets = {
+ collected = collected,
+ tobesaved = tobesaved,
+}
+
+job.datasets = datasets
+
+local function initializer()
+ collected = datasets.collected
+ tobesaved = datasets.tobesaved
+end
+
+job.register('job.datasets.collected', tobesaved, initializer, nil)
+
+local sets = { }
+
+table.setmetatableindex(tobesaved, function(t,k)
+ local v = { }
+ t[k] = v
+ return v
+end)
+
+table.setmetatableindex(sets, function(t,k)
+ local v = {
+ index = 0,
+ order = 0,
+ }
+ t[k] = v
+ return v
+end)
+
+local function setdata(settings)
+ local name = settings.name
+ local tag = settings.tag
+ local data = settings.data
+ local list = tobesaved[name]
+ if settings.convert and type(data) == "string" then
+ data = settings_to_hash(data)
+ end
+ if type(data) ~= "table" then
+ data = { data = data }
+ end
+ if not tag then
+ tag = #list + 1
+ else
+ tag = tonumber(tag) or tag -- autonumber saves keys
+ end
+ list[tag] = data
+ if settings.delay == v_yes then
+ local set = sets[name]
+ local index = set.index + 1
+ set.index = index
+ data.index = index
+ data.order = index
+ data.realpage = texgetcount(c_realpageno)
+ if trace_datasets then
+ report_dataset("action %a, name %a, tag %a, index %a","assign delayed",name,tag,index)
+ end
+ elseif trace_datasets then
+ report_dataset("action %a, name %a, tag %a","assign immediate",name,tag)
+ end
+ return name, tag, data
+end
+
+datasets.setdata = setdata
+
+function datasets.extend(name,tag)
+ if type(name) == "table" then
+ name, tag = name.name, name.tag
+ end
+ local set = sets[name]
+ local order = set.order + 1
+ local realpage = texgetcount(c_realpageno)
+ set.order = order
+ local t = tobesaved[name][tag]
+ t.realpage = realpage
+ t.order = order
+ if trace_datasets then
+ report_dataset("action %a, name %a, tag %a, page %a, index %a","flush by order",name,tag,t.index or 0,order,realpage)
+ end
+end
+
+function datasets.getdata(name,tag,key,default)
+ local t = collected[name]
+ if t == nil then
+ if trace_datasets then
+ report_dataset("error: unknown dataset, name %a",name)
+ end
+ elseif type(t) ~= "table" then
+ return t
+ else
+ t = t[tag] or t[tonumber(tag)]
+ if not t then
+ if trace_datasets then
+ report_dataset("error: unknown dataset, name %a, tag %a",name,tag)
+ end
+ elseif key then
+ return t[key] or default
+ else
+ return t
+ end
+ end
+ return default
+end
+
+local function setdataset(settings)
+ settings.convert = true
+ local name, tag = setdata(settings)
+ if settings.delay ~= v_yes then
+ --
+ else
+ context(new_latelua { action = job.datasets.extend, name = name, tag = tag })
+ end
+end
+
+local cache = table.setmetatableindex(function(t,k)
+ local v = table.load(k..".tuc")
+ if v then
+ v = v.job
+ if v then
+ v = v.datasets
+ if v then
+ v = v.collected
+ end
+ end
+ end
+ if not v then
+ v = { }
+ if trace_datasets then
+ report_dataset("error: unknown dataset job %a",k)
+ end
+ end
+ t[k] = v
+ return v
+end)
+
+local function datasetvariable(name,tag,key,cache)
+ local t = (cache or collected)[name]
+ if t == nil then
+ if trace_datasets then
+ report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name) -- no tag
+ end
+ elseif type(t) ~= "table" then
+ context(tostring(t))
+ else
+ t = t and (t[tag] or t[tonumber(tag)])
+ if not t then
+ if trace_datasets then
+ report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag)
+ end
+ elseif type(t) == "table" then
+ local s = t[key]
+ if type(s) ~= "table" then
+ context(tostring(s))
+ elseif trace_datasets then
+ report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag)
+ end
+ end
+ end
+end
+
+local function datasetvariablefromjob(jobnname,name,tag,key)
+ datasetvariable(name,tag,key,cache[jobnname])
+end
+
+implement {
+ name = "setdataset",
+ actions = setdataset,
+ arguments = {
+ {
+ { "name" },
+ { "tag" },
+ { "delay" },
+ { "data" },
+ }
+ }
+}
+
+implement {
+ name = "datasetvariable",
+ actions = datasetvariable,
+ arguments = "3 strings",
+}
+
+implement {
+ name = "datasetvariablefromjob",
+ arguments = { "string", "string", "string", "string" },
+ actions = datasetvariablefromjob
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl
index ab40d874c1a..6d7d1bd14ae 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl
@@ -1,6 +1,6 @@
%D \module
%D [ file=core-dat,
-%D version=20122.04.17, % replaces core-two from 1997.03.31,
+%D version=2021.04.17, % replaces core-two from 1997.03.31,
%D title=\CONTEXT\ Core Macros,
%D subtitle=Multipass Datasets,
%D author=Hans Hagen,
@@ -42,7 +42,7 @@
\unprotect
-\registerctxluafile{core-dat}{}
+\registerctxluafile{core-dat}{autosuffix}
\installcorenamespace{dataset}
@@ -78,50 +78,4 @@
\expandafter\clf_datasetvariable
\fi}
-\installcorenamespace{pagestate}
-\installcorenamespace{pagestatecounter}
-
-\installcommandhandler \??pagestate {pagestate} \??pagestate
-
-\def\syst_pagestates_allocate
- {\expandafter\newinteger\csname\??pagestatecounter\currentpagestate\endcsname}
-
-\appendtoks
- \syst_pagestates_allocate
-\to \everydefinepagestate
-
-\setuppagestate
- [\c!delay=\v!yes]
-
-\permanent\tolerant\protected\def\setpagestate[#1]#*[#2]%
- {\begingroup
- \edef\currentpagestate{#1}%
- \ifcsname\??pagestatecounter\currentpagestate\endcsname
- \scratchcounter\lastnamedcs
- \advanceby\scratchcounter\plusone
- \else
- \scratchcounter\plusone
- \syst_pagestates_allocate
- \fi
- \global\csname\??pagestatecounter\currentpagestate\endcsname\scratchcounter
- \clf_setpagestate
- name {\currentpagestate}%
- tag {\ifparameter#2\or#2\else\number\scratchcounter\fi}%
- delay {\pagestateparameter\c!delay}%
- \relax
- \endgroup}
-
-\permanent\protected\def\autosetpagestate#1%
- {\setpagestate[#1]\relax}
-
-\permanent\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname}
-
-\permanent\def\pagestaterealpage #1#2{\clf_pagestaterealpage {#1}{#2}}
-\permanent\def\setpagestaterealpageno#1#2{\clf_setpagestaterealpageno{#1}{#2}}
-\permanent\def\pagestaterealpageorder#1#2{\clf_pagestaterealpageorder{#1}#2\relax}
-
-\permanent\def\autopagestaterealpage #1{\clf_pagestaterealpage {#1}{\number\autopagestatenumber{#1}}}
-\permanent\def\setautopagestaterealpageno#1{\clf_setpagestaterealpageno{#1}{\number\autopagestatenumber{#1}}}
-\permanent\def\autopagestaterealpageorder#1{\clf_pagestaterealpageorder{#1}\numexpr\autopagestatenumber{#1}\relax}
-
\protect
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt
new file mode 100644
index 00000000000..219171d424e
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt
@@ -0,0 +1,160 @@
+if not modules then modules = { } end modules ['core-dat'] = {
+ version = 1.001,
+ comment = "companion to core-dat.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This module provides a (multipass) container for arbitrary data. It replaces the
+-- twopass data mechanism.
+
+local tonumber = tonumber
+
+local context = context
+local ctx_latelua = context.latelua
+
+local trace_pagestates = false trackers.register("job.pagestates", function(v) trace_pagestates = v end)
+
+local report_pagestate = logs.reporter("pagestate")
+
+local allocate = utilities.storage.allocate
+
+local texgetcount = tex.getcount
+local texsetcount = tex.setcount
+
+local new_latelua = nodes.pool.latelua
+
+local implement = interfaces.implement
+local getnamespace = interfaces.getnamespace
+
+local c_realpageno = tex.iscount("realpageno")
+local c_realpagestateno = tex.iscount("realpagestateno")
+
+local collected = allocate()
+local tobesaved = allocate()
+
+local pagestates = {
+ collected = collected,
+ tobesaved = tobesaved,
+}
+
+job.pagestates = pagestates
+
+local function initializer()
+ collected = pagestates.collected
+ tobesaved = pagestates.tobesaved
+end
+
+job.register("job.pagestates.collected", tobesaved, initializer, nil)
+
+table.setmetatableindex(tobesaved, "table")
+
+local function setstate(settings)
+ local name = settings.name
+ local tag = settings.tag
+ local list = tobesaved[name]
+ if not tag then
+ tag = #list + 1
+ else
+ tag = tonumber(tag) or tag -- autonumber saves keys
+ end
+ local realpage = texgetcount(c_realpageno)
+ local data = realpage
+ list[tag] = data
+ if trace_pagestates then
+ report_pagestate("action %a, name %a, tag %a, preset %a","set",name,tag,realpage)
+ end
+ return name, tag, data
+end
+
+local function extend(name,tag)
+ local realpage = texgetcount(c_realpageno)
+ if trace_pagestates then
+ report_pagestate("action %a, name %a, tag %a, preset %a","synchronize",name,tag,realpage)
+ end
+ tobesaved[name][tag] = realpage
+end
+
+local function realpage(name,tag,default)
+ local t = collected[name]
+ if t then
+ t = t[tag] or t[tonumber(tag)]
+ if t then
+ return tonumber(t or default)
+ elseif trace_pagestates then
+ report_pagestate("error: unknown dataset, name %a, tag %a",name,tag)
+ end
+ elseif trace_pagestates then
+ report_pagestate("error: unknown dataset, name %a, tag %a",name) -- nil
+ end
+ return default
+end
+
+local function realpageorder(name,tag)
+ local t = collected[name]
+ if t then
+ local p = t[tag]
+ if p then
+ local n = 1
+ for i=tag-1,1,-1 do
+ if t[i] == p then
+ n = n +1
+ end
+ end
+ return n
+ end
+ end
+ return 0
+end
+
+pagestates.setstate = setstate
+pagestates.extend = extend
+pagestates.realpage = realpage
+pagestates.realpageorder = realpageorder
+
+function pagestates.countervalue(name)
+ return name and texgetcount(getnamespace("pagestatecounter") .. name) or 0
+end
+
+local function setpagestate(settings)
+ local name, tag = setstate(settings)
+ -- context(new_latelua(function() extend(name,tag) end))
+ ctx_latelua(function() extend(name,tag) end)
+end
+
+local function setpagestaterealpageno(name,tag)
+ local t = collected[name]
+ t = t and (t[tag] or t[tonumber(tag)])
+ texsetcount("realpagestateno",t or texgetcount(c_realpageno))
+end
+
+implement {
+ name = "setpagestate",
+ actions = setpagestate,
+ arguments = {
+ {
+ { "name" },
+ { "tag" },
+ { "delay" },
+ }
+ }
+}
+
+implement {
+ name = "pagestaterealpage",
+ actions = { realpage, context },
+ arguments = "2 strings",
+}
+
+implement {
+ name = "setpagestaterealpageno",
+ actions = setpagestaterealpageno,
+ arguments = "2 strings",
+}
+
+implement {
+ name = "pagestaterealpageorder",
+ actions = { realpageorder, context },
+ arguments = { "string", "integer" }
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl
new file mode 100644
index 00000000000..43b398b16cb
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl
@@ -0,0 +1,68 @@
+%D \module
+%D [ file=core-pag,
+%D version=2023.03.23, % moved from core-dat
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Multipass Pagestate,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Multipass Pagestate}
+
+\unprotect
+
+\newinteger\realpagestateno
+
+\registerctxluafile{core-pag}{autosuffix}
+
+\installcorenamespace{pagestate}
+\installcorenamespace{pagestatecounter}
+
+\installcommandhandler \??pagestate {pagestate} \??pagestate
+
+\def\syst_pagestates_allocate
+ {\expandafter\newinteger\csname\??pagestatecounter\currentpagestate\endcsname}
+
+\appendtoks
+ \syst_pagestates_allocate
+\to \everydefinepagestate
+
+\setuppagestate
+ [\c!delay=\v!yes]
+
+\permanent\tolerant\protected\def\setpagestate[#1]#*[#2]%
+ {\begingroup
+ \edef\currentpagestate{#1}%
+ \ifcsname\??pagestatecounter\currentpagestate\endcsname
+ \scratchcounter\lastnamedcs
+ \advanceby\scratchcounter\plusone
+ \else
+ \scratchcounter\plusone
+ \syst_pagestates_allocate
+ \fi
+ \global\csname\??pagestatecounter\currentpagestate\endcsname\scratchcounter
+ \clf_setpagestate
+ name {\currentpagestate}%
+ tag {\ifparameter#2\or#2\else\number\scratchcounter\fi}%
+ delay {\pagestateparameter\c!delay}%
+ \relax
+ \endgroup}
+
+\permanent\protected\def\autosetpagestate#1%
+ {\setpagestate[#1]\relax}
+
+\permanent\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname}
+
+\permanent\def\pagestaterealpage #1#2{\clf_pagestaterealpage {#1}{#2}}
+\permanent\def\setpagestaterealpageno#1#2{\clf_setpagestaterealpageno{#1}{#2}}
+\permanent\def\pagestaterealpageorder#1#2{\clf_pagestaterealpageorder{#1}#2\relax}
+
+\permanent\def\autopagestaterealpage #1{\clf_pagestaterealpage {#1}{\number\autopagestatenumber{#1}}}
+\permanent\def\setautopagestaterealpageno#1{\clf_setpagestaterealpageno{#1}{\number\autopagestatenumber{#1}}}
+\permanent\def\autopagestaterealpageorder#1{\clf_pagestaterealpageorder{#1}\numexpr\autopagestatenumber{#1}\relax}
+
+\protect
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt
new file mode 100644
index 00000000000..7ea42374ee9
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt
@@ -0,0 +1,210 @@
+if not modules then modules = { } end modules ['core-two'] = {
+ version = 1.001,
+ comment = "companion to core-two.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is actually one of the oldest MkIV files and basically a port of MkII but
+-- the old usage has long be phased out. Also, the public part is now handled by
+-- datasets which makes this a more private store.
+
+-- local next = next
+-- local remove, concat = table.remove, table.concat
+
+local allocate = utilities.storage.allocate
+
+local collected = allocate()
+local tobesaved = allocate()
+
+local jobpasses = {
+ collected = collected,
+ tobesaved = tobesaved,
+}
+
+job.passes = jobpasses
+
+local function initializer()
+ collected = jobpasses.collected
+ tobesaved = jobpasses.tobesaved
+end
+
+job.register('job.passes.collected', tobesaved, initializer, nil)
+
+function jobpasses.getcollected(id)
+ return collected[id] or { }
+end
+
+function jobpasses.gettobesaved(id)
+ local t = tobesaved[id]
+ if not t then
+ t = { }
+ tobesaved[id] = t
+ end
+ return t
+end
+
+-- local function define(id)
+-- local p = tobesaved[id]
+-- if not p then
+-- p = { }
+-- tobesaved[id] = p
+-- end
+-- return p
+-- end
+--
+-- local function save(id,str,index)
+-- local jti = define(id)
+-- if index then
+-- jti[index] = str
+-- else
+-- jti[#jti+1] = str
+-- end
+-- end
+--
+-- local function savetagged(id,tag,str)
+-- local jti = define(id)
+-- jti[tag] = str
+-- end
+--
+-- local function getdata(id,index,default)
+-- local jti = collected[id]
+-- local value = jti and jti[index]
+-- return value ~= "" and value or default or ""
+-- end
+--
+-- local function getfield(id,index,tag,default)
+-- local jti = collected[id]
+-- jti = jti and jti[index]
+-- local value = jti and jti[tag]
+-- return value ~= "" and value or default or ""
+-- end
+--
+-- local function getcollected(id)
+-- return collected[id] or { }
+-- end
+--
+-- local function gettobesaved(id)
+-- return define(id)
+-- end
+--
+-- local function get(id)
+-- local jti = collected[id]
+-- if jti and #jti > 0 then
+-- return remove(jti,1)
+-- end
+-- end
+--
+-- local function first(id)
+-- local jti = collected[id]
+-- return jti and jti[1]
+-- end
+--
+-- local function last(id)
+-- local jti = collected[id]
+-- return jti and jti[#jti]
+-- end
+--
+-- local function find(id,n)
+-- local jti = collected[id]
+-- return jti and jti[n] or nil
+-- end
+--
+-- local function count(id)
+-- local jti = collected[id]
+-- return jti and #jti or 0
+-- end
+--
+-- local function list(id)
+-- local jti = collected[id]
+-- if jti then
+-- return concat(jti,',')
+-- end
+-- end
+--
+-- local function inlist(id,str)
+-- local jti = collected[id]
+-- if jti then
+-- for _, v in next, jti do
+-- if v == str then
+-- return true
+-- end
+-- end
+-- end
+-- return false
+-- end
+--
+-- local check = first
+--
+-- jobpasses.define = define
+-- jobpasses.save = save
+-- jobpasses.savetagged = savetagged
+-- jobpasses.getdata = getdata
+-- jobpasses.getfield = getfield
+-- jobpasses.getcollected = getcollected
+-- jobpasses.gettobesaved = gettobesaved
+-- jobpasses.get = get
+-- jobpasses.first = first
+-- jobpasses.last = last
+-- jobpasses.find = find
+-- jobpasses.list = list
+-- jobpasses.count = count
+-- jobpasses.check = check
+-- jobpasses.inlist = inlist
+--
+-- -- interface
+--
+-- local implement = interfaces.implement
+--
+-- implement { name = "gettwopassdata", actions = { get, context }, arguments = "string" }
+-- implement { name = "getfirsttwopassdata",actions = { first, context }, arguments = "string" }
+-- implement { name = "getlasttwopassdata", actions = { last, context }, arguments = "string" }
+-- implement { name = "findtwopassdata", actions = { find, context }, arguments = "2 strings" }
+-- implement { name = "gettwopassdatalist", actions = { list, context }, arguments = "string" }
+-- implement { name = "counttwopassdata", actions = { count, context }, arguments = "string" }
+-- implement { name = "checktwopassdata", actions = { check, context }, arguments = "string" }
+--
+-- implement {
+-- name = "definetwopasslist",
+-- actions = define,
+-- arguments = "string"
+-- }
+--
+-- implement {
+-- name = "savetwopassdata",
+-- actions = save,
+-- arguments = "2 strings",
+-- }
+--
+-- implement {
+-- name = "savetaggedtwopassdata",
+-- actions = savetagged,
+-- arguments = "3 strings",
+-- }
+--
+-- implement {
+-- name = "doifelseintwopassdata",
+-- actions = { inlist, commands.doifelse },
+-- arguments = "2 strings",
+-- }
+--
+-- -- local ctx_latelua = context.latelua
+--
+-- -- implement {
+-- -- name = "lazysavetwopassdata",
+-- -- arguments = "3 strings",
+-- -- public = true,
+-- -- actions = function(a,b,c)
+-- -- ctx_latelua(function() save(a,c) end)
+-- -- end,
+-- -- }
+--
+-- -- implement {
+-- -- name = "lazysavetaggedtwopassdata",
+-- -- arguments = "3 strings",
+-- -- public = true,
+-- -- actions = function(a,b,c)
+-- -- ctx_latelua(function() savetagged(a,b,c) end)
+-- -- end,
+-- -- }
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl
index 38f03c7c45b..10a7eec9ead 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl
@@ -1,6 +1,6 @@
%D \module
%D [ file=core-two, % moved from core-uti
-%D version=1997.03.31,
+%D version=1997.03.31, % stripped down 2023-03-21
%D title=\CONTEXT\ Core Macros,
%D subtitle=Two Pass Data,
%D author=Hans Hagen,
@@ -11,102 +11,110 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\writestatus{loading}{ConTeXt Core Macros / Two Pass Data}
+%D The public interface is replaced by datasets and two pass data is now private
+%D to the engine. For the moment we keep some commands commented. The unused
+%D (second) argument is an inheritance from \MKII. If needed we can bring back
+%D a compatible interface.
-%D This is a rather old mechanism which has not changed much over time, apart from
-%D adding a few more selectors. This code used to be part of \type {core-uti}. The
-%D following examples demonstrate the interface.
-%D
-%D \startbuffer
-%D \definetwopasslist{test-1}
-%D
-%D \gettwopassdatalist{test-1} [\twopassdatalist=]
-%D \checktwopassdata {test-1} [\twopassdata=]
-%D \checktwopassdata {test-1} [\twopassdata=]
-%D \gettwopassdata {test-1} [\twopassdata=]
-%D \gettwopassdata {test-1} [\twopassdata=]
-%D
-%D \definetwopasslist{test-2}
-%D
-%D \lazysavetwopassdata{test-2}{1}{x}
-%D \lazysavetwopassdata{test-2}{2}{y}
-%D \lazysavetwopassdata{test-2}{3}{z}
-%D
-%D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z]
-%D \checktwopassdata {test-2} [\twopassdata=x]
-%D \checktwopassdata {test-2} [\twopassdata=x]
-%D \gettwopassdata {test-2} [\twopassdata=x]
-%D \gettwopassdata {test-2} [\twopassdata=y]
-%D \gettwopassdata {test-2} [\twopassdata=z]
-%D \gettwopassdata {test-2} [\twopassdata=]
-%D
-%D \definetwopasslist{test-3}
-%D
-%D \lazysavetaggedtwopassdata{test-3}{1}{x}{a}
-%D \lazysavetaggedtwopassdata{test-3}{2}{y}{b}
-%D \lazysavetaggedtwopassdata{test-3}{3}{z}{c}
-%D
-%D \findtwopassdata{test-3}{x} [\twopassdata=a]
-%D \findtwopassdata{test-3}{y} [\twopassdata=b]
-%D \findtwopassdata{test-3}{z} [\twopassdata=c]
-%D \findtwopassdata{test-3}{w} [\twopassdata=]
-%D
-%D \definetwopasslist{test-4}
-%D
-%D \lazysavetwopassdata{test-4}{1}{A}
-%D \lazysavetwopassdata{test-4}{2}{B}
-%D \lazysavetwopassdata{test-4}{3}{C}
-%D
-%D \getfirsttwopassdata{test-4} [\twopassdata=A]
-%D \getlasttwopassdata {test-4} [\twopassdata=C]
-%D \getfirsttwopassdata{test-4} [\twopassdata=A]
-%D \getlasttwopassdata {test-4} [\twopassdata=C]
-%D \getfromtwopassdata {test-4}{1} [\twopassdata=A]
-%D \getfromtwopassdata {test-4}{3} [\twopassdata=C]
-%D \getfromtwopassdata {test-4}{2} [\twopassdata=B]
-%D \stopbuffer
-%D
-%D \getbuffer \typebuffer
+\writestatus{loading}{ConTeXt Core Macros / Two Pass Data}
\unprotect
-\registerctxluafile{core-two}{}
-
-\permanent\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\clf_savetwopassdata{#1}{#3}}}
-\permanent\def \lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata("#1","#3")}}}
-\permanent\let \savetwopassdata \lazysavetwopassdata
-\permanent\def \savetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\clf_savetaggedtwopassdata{#1}{#3}{#4}}}
-\permanent\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata("#1",'#3',"#4")}}}
-
-% temp hack: needs a proper \starteverytimeluacode
-
-\setfalse\twopassdatafound
-
-\mutable\lettonothing\twopassdata
-\mutable\lettonothing\twopassdatalist
-
-\mutable\let\noftwopassitems\!!zeropoint
-
-\def\syst_twopass_check % can be delegated to lua once obsolete is gone
- {\ifempty\twopassdata
- \setfalse\twopassdatafound
- \else
- \settrue\twopassdatafound
- \fi}
-
-\permanent\protected\def\definetwopasslist #1{\clf_definetwopasslist{#1}}
-\permanent\protected\def\gettwopassdata #1{\edef\twopassdata {\clf_gettwopassdata {#1}}\syst_twopass_check}
-\permanent\protected\def\checktwopassdata #1{\edef\twopassdata {\clf_checktwopassdata {#1}}\syst_twopass_check}
-\permanent\protected\def\findtwopassdata #1#2{\edef\twopassdata {\clf_findtwopassdata {#1}{#2}}\syst_twopass_check}
-\permanent\protected\def\getfirsttwopassdata #1{\edef\twopassdata {\clf_getfirsttwopassdata {#1}}\syst_twopass_check}
-\permanent\protected\def\getlasttwopassdata #1{\edef\twopassdata {\clf_getlasttwopassdata {#1}}%
- \edef\noftwopassitems{\clf_counttwopassdata {#1}}\syst_twopass_check}
-\permanent\protected\def\getnamedtwopassdatalist#1#2{\edef #1{\clf_gettwopassdatalist {#2}}}
-\permanent\protected\def\gettwopassdatalist #1{\edef\twopassdatalist{\clf_gettwopassdatalist {#1}}}
-
-\permanent\protected\def\doifelseintwopassdata #1#2{\clf_doifelseintwopassdata{#1}{#2}}
+\registerctxluafile{core-two}{autosuffix}
-\aliased\let\doifintwopassdataelse\doifelseintwopassdata
-\aliased\let\getfromtwopassdata \findtwopassdata
+% %D This is a rather old mechanism which has not changed much over time, apart from
+% %D adding a few more selectors. This code used to be part of \type {core-uti}. The
+% %D following examples demonstrate the interface.
+% %D
+% %D \startbuffer
+% %D \definetwopasslist{test-1}
+% %D
+% %D \gettwopassdatalist{test-1} [\twopassdatalist=]
+% %D \checktwopassdata {test-1} [\twopassdata=]
+% %D \checktwopassdata {test-1} [\twopassdata=]
+% %D \gettwopassdata {test-1} [\twopassdata=]
+% %D \gettwopassdata {test-1} [\twopassdata=]
+% %D
+% %D \definetwopasslist{test-2}
+% %D
+% %D \lazysavetwopassdata{test-2}{1}{x}
+% %D \lazysavetwopassdata{test-2}{2}{y}
+% %D \lazysavetwopassdata{test-2}{3}{z}
+% %D
+% %D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z]
+% %D \checktwopassdata {test-2} [\twopassdata=x]
+% %D \checktwopassdata {test-2} [\twopassdata=x]
+% %D \gettwopassdata {test-2} [\twopassdata=x]
+% %D \gettwopassdata {test-2} [\twopassdata=y]
+% %D \gettwopassdata {test-2} [\twopassdata=z]
+% %D \gettwopassdata {test-2} [\twopassdata=]
+% %D
+% %D \definetwopasslist{test-3}
+% %D
+% %D \lazysavetaggedtwopassdata{test-3}{1}{x}{a}
+% %D \lazysavetaggedtwopassdata{test-3}{2}{y}{b}
+% %D \lazysavetaggedtwopassdata{test-3}{3}{z}{c}
+% %D
+% %D \findtwopassdata{test-3}{x} [\twopassdata=a]
+% %D \findtwopassdata{test-3}{y} [\twopassdata=b]
+% %D \findtwopassdata{test-3}{z} [\twopassdata=c]
+% %D \findtwopassdata{test-3}{w} [\twopassdata=]
+% %D
+% %D \definetwopasslist{test-4}
+% %D
+% %D \lazysavetwopassdata{test-4}{1}{A}
+% %D \lazysavetwopassdata{test-4}{2}{B}
+% %D \lazysavetwopassdata{test-4}{3}{C}
+% %D
+% %D \getfirsttwopassdata{test-4} [\twopassdata=A]
+% %D \getlasttwopassdata {test-4} [\twopassdata=C]
+% %D \getfirsttwopassdata{test-4} [\twopassdata=A]
+% %D \getlasttwopassdata {test-4} [\twopassdata=C]
+% %D \getfromtwopassdata {test-4}{1} [\twopassdata=A]
+% %D \getfromtwopassdata {test-4}{3} [\twopassdata=C]
+% %D \getfromtwopassdata {test-4}{2} [\twopassdata=B]
+% %D \stopbuffer
+% %D
+% %D \getbuffer \typebuffer
+%
+% %D The next code can be simplified (read: defined at the \LUA\ end) but we never use this
+% %D mechanism which has been replaced by datasets so it's not worth the effort.
+%
+% \permanent\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\clf_savetwopassdata{#1}{#3}}}
+% \permanent\def \lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata("#1","#3")}}}
+% \permanent\let \savetwopassdata \lazysavetwopassdata
+% \permanent\def \savetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\clf_savetaggedtwopassdata{#1}{#3}{#4}}}
+% \permanent\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata("#1","#3","#4")}}}
+%
+% % temp hack: needs a proper \starteverytimeluacode
+%
+% \setfalse\twopassdatafound
+%
+% \mutable\lettonothing\twopassdata
+% \mutable\lettonothing\twopassdatalist
+%
+% \mutable\let\noftwopassitems\!!zeropoint
+%
+% \def\syst_twopass_check % can be delegated to lua once obsolete is gone
+% {\ifempty\twopassdata
+% \setfalse\twopassdatafound
+% \else
+% \settrue\twopassdatafound
+% \fi}
+%
+% \permanent\protected\def\definetwopasslist #1{\clf_definetwopasslist{#1}}
+% \permanent\protected\def\gettwopassdata #1{\edef\twopassdata {\clf_gettwopassdata {#1}}\syst_twopass_check}
+% \permanent\protected\def\checktwopassdata #1{\edef\twopassdata {\clf_checktwopassdata {#1}}\syst_twopass_check}
+% \permanent\protected\def\findtwopassdata #1#2{\edef\twopassdata {\clf_findtwopassdata {#1}{#2}}\syst_twopass_check}
+% \permanent\protected\def\getfirsttwopassdata #1{\edef\twopassdata {\clf_getfirsttwopassdata {#1}}\syst_twopass_check}
+% \permanent\protected\def\getlasttwopassdata #1{\edef\twopassdata {\clf_getlasttwopassdata {#1}}%
+% \edef\noftwopassitems{\clf_counttwopassdata {#1}}\syst_twopass_check}
+% \permanent\protected\def\getnamedtwopassdatalist#1#2{\edef #1{\clf_gettwopassdatalist {#2}}}
+% \permanent\protected\def\gettwopassdatalist #1{\edef\twopassdatalist{\clf_gettwopassdatalist {#1}}}
+%
+% \permanent\protected\def\doifelseintwopassdata #1#2{\clf_doifelseintwopassdata{#1}{#2}}
+%
+% \aliased\let\doifintwopassdataelse\doifelseintwopassdata
+% \aliased\let\getfromtwopassdata \findtwopassdata
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
index 966428b36b1..dbfa82ed7d1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
@@ -6,16 +6,13 @@ if not modules then modules = { } end modules ['core-uti'] = {
license = "see context related readme files"
}
--- todo: keep track of changes here (hm, track access, and only true when
--- accessed and changed)
-
---[[ldx--
-<p>A utility file has always been part of <l n='context'/> and with
-the move to <l n='luatex'/> we also moved a lot of multi-pass info
-to a <l n='lua'/> table. Instead of loading a <l n='tex'/> based
-utility file under different setups, we now load a table once. This
-saves much runtime but at the cost of more memory usage.</p>
---ldx]]--
+-- A utility file has always been part of ConTeXt and with the move to LuaTeX we
+-- also moved a lot of multi-pass info to a Lua table. Instead of loading a TeX
+-- based utility file under different setups, we now load a table once. This saves
+-- much runtime but at the cost of more memory usage.
+--
+-- In the meantime the overhead is a bit more due to the amount of data being saved
+-- and more agressive compacting.
local math = math
local next, type, tostring, tonumber, setmetatable, load = next, type, tostring, tonumber, setmetatable, load
@@ -46,14 +43,9 @@ local job = job
job.version = 1.33
job.packversion = 1.02
--- some day we will implement loading of other jobs and then we need
--- job.jobs
-
---[[ldx--
-<p>Variables are saved using in the previously defined table and passed
-onto <l n='tex'/> using the following method. Of course one can also
-directly access the variable using a <l n='lua'/> call.</p>
---ldx]]--
+-- Variables are saved using in the previously defined table and passed onto TeX
+-- using the following method. Of course one can also directly access the variable
+-- using a Lua call.
local savelist, comment = { }, { }
@@ -382,13 +374,18 @@ function job.load(filename)
end
function job.loadother(filename)
- statistics.starttiming(loadedfiles)
+ local jobname = environment.jobname
+ if filename == jobname then
+ return
+ end
filename = file.addsuffix(filename,"tuc")
local unpacked = othercache[filename]
if not unpacked then
- -- so we can register the same name twice(in loading order)
+ -- so we can register the same name twice (in loading order) ... needs checking if we want this
+ statistics.starttiming(loadedfiles)
local utilitydata = load(filename)
if utilitydata then
+ report_passes("integrating list %a into %a",filename,jobname)
local jobpacker = utilitydata.job.packed
unpacknumberdata(jobpacker.index)
unpacked = { }
@@ -403,14 +400,15 @@ function job.loadother(filename)
end
unpacked.job.packed = nil -- nicer in inspecting
othercache[filename] = unpacked
- --
+ --
+ utilitydata.components, utilitydata.namestack = collectstructure(utilitydata.job.structure.collected)
+ --
structures.lists .integrate(utilitydata)
structures.registers .integrate(utilitydata)
structures.references.integrate(utilitydata)
- --
end
+ statistics.stoptiming(loadedfiles)
end
- statistics.stoptiming(loadedfiles)
return unpacked
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt b/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt
new file mode 100644
index 00000000000..36f89040c99
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt
@@ -0,0 +1,312 @@
+if not modules then modules = { } end modules ['data-sch'] = {
+ 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 load, tonumber, require = load, tonumber, require
+local gsub, format = string.gsub, string.format
+local savedata = io.savedata
+local sortedhash, concat = table.sortedhash, table.concat
+local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders
+local addsuffix, suffix, splitbase = file.addsuffix, file.suffix, file.splitbase
+local md5hex = md5.hex
+local removefile, renamefile, fileexists = os.remove, os.rename, io.exists
+
+-- todo: more locals
+
+local trace_schemes = false trackers.register("resolvers.schemes",function(v) trace_schemes = v end)
+local report_schemes = logs.reporter("resolvers","schemes")
+
+local http = require("socket.http")
+local ltn12 = require("ltn12")
+
+if mbox then mbox = nil end -- useless and even bugged (helper overwrites lib)
+
+local resolvers = resolvers
+local schemes = resolvers.schemes or { }
+resolvers.schemes = schemes
+
+local cleaners = { }
+schemes.cleaners = cleaners
+
+local threshold = 24 * 60 * 60
+local inmemory = false
+local uselibrary = false
+
+directives.register("schemes.threshold", function(v) threshold = tonumber(v) or threshold end)
+directives.register("schemes.inmemory", function(v) inmemory = v end)
+directives.register("schemes.uselibrary", function(v) uselibrary = v end)
+
+function cleaners.none(specification)
+ return specification.original
+end
+
+-- function cleaners.strip(specification)
+-- -- todo: only keep suffix periods, so after the last
+-- return (gsub(specification.original,"[^%a%d%.]+","-")) -- so we keep periods
+-- end
+
+function cleaners.strip(specification) -- keep suffixes
+ local path, name = splitbase(specification.original)
+ if path == "" then
+ return (gsub(name,"[^%a%d%.]+","-"))
+ else
+ return (gsub((gsub(path,"%.","-") .. "-" .. name),"[^%a%d%.]+","-"))
+ end
+end
+
+function cleaners.md5(specification)
+ return addsuffix(md5hex(specification.original),suffix(specification.path))
+end
+
+local cleaner = cleaners.strip
+
+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 %a to %a",specification.original,hash)
+ end
+ return hash
+end
+
+local cached = { }
+local loaded = { }
+local reused = { }
+local thresholds = { }
+local handlers = { }
+
+local function fetcher(report)
+ if uselibrary then
+ local curl = require("curl") or require("libs-imp-curl") -- we have curl preloaded
+ local fetch = curl and curl.fetch
+ if fetch then
+ return function(str)
+ local data, message = fetch {
+ url = str,
+ followlocation = true,
+ sslverifyhost = false,
+ sslverifypeer = false,
+ }
+ if not data then
+ report("some error: %s",message)
+ end
+ return data
+ end
+ end
+ end
+end
+
+local runner = sandbox.registerrunner {
+ name = "to file curl resolver",
+ method = "execute",
+ program = "curl",
+ template = '--silent --insecure --create-dirs --output "%cachename%" "%original%"',
+ internal = function(specification)
+ local fetch = fetcher(specification.reporter)
+ return fetch and function(name,program,template,checkers,defaults,variables,reporter,finalized)
+ local data = fetch(variables.original)
+ savedata(variables.cachename,data or "")
+ end
+ end,
+ checkers = {
+ cachename = "cache",
+ original = "url",
+ }
+}
+
+local memrunner = sandbox.registerrunner {
+ name = "in memory curl resolver",
+ method = "resultof",
+ program = "curl",
+ template = '--silent --insecure "%original%"',
+ internal = function(specification)
+ local fetch = fetcher(specification.reporter)
+ return fetch and function(name,program,template,checkers,defaults,variables,reporter,finalized)
+ return fetch(variables.original) or ""
+ end
+ end,
+ checkers = {
+ original = "url",
+ }
+}
+
+local function fetch(specification)
+ local original = specification.original
+ local scheme = specification.scheme
+ local cleanname = schemes.cleanname(specification)
+ if inmemory then
+ statistics.starttiming(schemes)
+ local cachename = resolvers.savers.virtualname(cleanname)
+ local handler = handlers[scheme]
+ -- if handler and not uselibrary then
+ if handler then -- internal sockets are twice as fast as library
+ if trace_schemes then
+ report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in")
+ end
+ logs.flush()
+ handler(specification,cachename)
+ else
+ if trace_schemes then
+ report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl")
+ end
+ logs.flush()
+ local result = memrunner {
+ original = original,
+ }
+ resolvers.savers.directvirtual(cachename,result,true) -- persistent
+ end
+ loaded[scheme] = loaded[scheme] + 1
+ statistics.stoptiming(schemes)
+ return cachename
+ else
+ local cachename = caches.setfirstwritablefile(cleanname,"schemes")
+ if not cached[original] or threshold == 0 then
+ statistics.starttiming(schemes)
+ if threshold == 0 or not fileexists(cachename) or (os.difftime(os.time(),lfs.attributes(cachename).modification) > (thresholds[protocol] or threshold)) then
+ -- removefile(cachename)
+ cached[original] = cachename
+ local handler = handlers[scheme]
+ if handler then
+ if trace_schemes then
+ report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in")
+ end
+ logs.flush()
+ handler(specification,cachename)
+ else
+ if trace_schemes then
+ report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl")
+ end
+ logs.flush()
+ runner {
+ original = original,
+ cachename = cachename,
+ }
+ end
+ end
+ if fileexists(cachename) then
+ cached[original] = cachename
+ if trace_schemes then
+ report_schemes("using cached %a, protocol %a, cachename %a",original,scheme,cachename)
+ end
+ else
+ cached[original] = ""
+ if trace_schemes then
+ report_schemes("using missing %a, protocol %a",original,scheme)
+ end
+ end
+ loaded[scheme] = loaded[scheme] + 1
+ statistics.stoptiming(schemes)
+ else
+ if trace_schemes then
+ report_schemes("reusing %a, protocol %a",original,scheme)
+ end
+ reused[scheme] = reused[scheme] + 1
+ end
+ return cached[original]
+ end
+end
+
+local function finder(specification,filetype)
+ return resolvers.methodhandler("finders",fetch(specification),filetype)
+end
+
+local opener = openers.file
+local loader = loaders.file
+
+local function install(scheme,handler,newthreshold)
+ handlers [scheme] = handler
+ loaded [scheme] = 0
+ reused [scheme] = 0
+ finders [scheme] = finder
+ openers [scheme] = opener
+ loaders [scheme] = loader
+ thresholds[scheme] = newthreshold or threshold
+end
+
+schemes.install = install
+
+local function http_handler(specification,cachename)
+ if inmemory then
+ local result = { }
+ local status, message = http.request {
+ url = specification.original,
+ sink = ltn12.sink.table(result)
+ }
+ resolvers.savers.directvirtual(cachename,concat(result),true) -- persistent
+ else
+ local tempname = cachename .. ".tmp"
+ local handle = io.open(tempname,"wb")
+ local status, message = http.request {
+ url = specification.original,
+ sink = ltn12.sink.file(handle)
+ }
+ if not status then
+ removefile(tempname)
+ else
+ removefile(cachename)
+ renamefile(tempname,cachename)
+ end
+ end
+ return cachename
+end
+
+install('http',http_handler)
+install('https') -- see pod
+install('ftp')
+
+statistics.register("scheme handling time", function()
+ local l, r, nl, nr = { }, { }, 0, 0
+ for k, v in sortedhash(loaded) do
+ if v > 0 then
+ nl = nl + 1
+ l[nl] = k .. ":" .. v
+ end
+ end
+ for k, v in sortedhash(reused) do
+ if v > 0 then
+ nr = nr + 1
+ r[nr] = k .. ":" .. v
+ end
+ end
+ local n = nl + nr
+ if n > 0 then
+ if nl == 0 then l = { "none" } end
+ if nr == 0 then r = { "none" } end
+ return format("%s seconds, %s processed, threshold %s seconds, loaded: %s, reused: %s",
+ statistics.elapsedtime(schemes), n, threshold, concat(l," "), concat(l," "))
+ else
+ return nil
+ end
+end)
+
+-- We provide a few more helpers:
+
+----- http = require("socket.http")
+local httprequest = http.request
+local toquery = url.toquery
+
+local function fetchstring(url,data)
+ local q = data and toquery(data)
+ if q then
+ url = url .. "?" .. q
+ end
+ local reply = httprequest(url)
+ return reply -- just one argument
+end
+
+schemes.fetchstring = fetchstring
+
+function schemes.fetchtable(url,data)
+ local reply = fetchstring(url,data)
+ if reply then
+ local s = load("return " .. reply)
+ if s then
+ return s()
+ end
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt b/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt
index b78211fc9a7..75a8c68c02e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt
@@ -20,26 +20,42 @@ local savers = resolvers.savers
local cleaners = resolvers.cleaners
local data = { }
+local keep = { }
local n = 0 -- hm, number can be query
local f_virtual_n = formatters["virtual://%s.%s"]
local f_virtual_y = formatters["virtual://%s-%s.%s"]
-function savers.virtual(specification,content,suffix)
+local function virtualname(specification,suffix)
n = n + 1 -- one number for all namespaces
local path = type(specification) == "table" and specification.path or specification
if type(path) ~= "string" or path == "" then
path = "virtualfile"
end
- local filename = suffix and f_virtual_y(path,n,suffix) or f_virtual_n(path,n)
+ return suffix and f_virtual_y(path,n,suffix) or f_virtual_n(path,n)
+end
+
+local function directvirtual(filename,content,persistent)
+ if not content then
+ content = ""
+ end
if trace_virtual then
- report_virtual("saver: file %a saved",filename)
+ report_virtual("saver: file %a saved, size %i",filename,#content)
end
- data[filename] = content
+ data[filename] = content or ""
+ keep[filename] = persistent
return filename
end
+function savers.virtual(specification,content,suffix)
+ return directvirtual(virtualname(specification,suffix),content)
+end
+
+savers.virtualname = virtualname
+savers.directvirtual = directvirtual
+
function cleaners.virtual(filename)
data[filename] = nil
+ keep[filename] = nil
end
local finders = resolvers.finders
@@ -94,7 +110,10 @@ function loaders.virtual(specification)
if trace_virtual then
report_virtual("loader: file %a loaded",original)
end
- data[original] = nil
+ if not keep[original] then
+ data[original] = nil
+ keep[original] = nil
+ end
return true, d, #d
end
if trace_virtual then
diff --git a/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt b/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt
index 09928f303eb..0048f4bb868 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt
@@ -69,11 +69,11 @@ local parameters = fonthashes.parameters
local nodecodes = nodes.nodecodes
local whatsitcodes = nodes.whatsitcodes
local gluecodes = nodes.gluecodes
-local dirvalues = nodes.dirvalues
local subtypes = nodes.subtypes
-local lefttoright_code = dirvalues.lefttoright
-local righttoleft_code = dirvalues.righttoleft
+local directioncodes = tex.directioncodes
+local lefttoright_code = directioncodes.lefttoright
+local righttoleft_code = directioncodes.righttoleft
local glyph_code = nodecodes.glyph
local kern_code = nodecodes.kern
@@ -1804,7 +1804,7 @@ do
literal = showdetails,
}
- callback.register("show_whatsit",function(n,what,l,tlp,l1,l2)
+ callbacks.register("show_whatsit",function(n,what,l,tlp,l1,l2)
local s = nodes.whatsitcodes[n.subtype]
if what == 1 then
return s or "unknown"
@@ -1815,12 +1815,10 @@ do
w(n,l,tlp,l1,l2)
end
end
- end)
+ end,"provide whatsit details")
- local names = attributes.names
+ local names = attributes.names -- we show the name and number
- callback.register("get_attribute",function(k,v)
- return attributes.names[k], nil -- we show the name and number
- end)
+ callbacks.register("get_attribute",function(k,v) return attributes.names[k], nil end,"provide verbose attrbute name")
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt b/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt
index 0542228aace..df381f35f4f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt
@@ -40,10 +40,10 @@ local dirdimensions = nuts.dirdimensions
local nodecodes = nodes.nodecodes
local whatsitcodes = nodes.whatsitcodes
-local dirvalues = nodes.dirvalues
-local lefttoright_code = dirvalues.lefttoright
-local righttoleft_code = dirvalues.righttoleft
+local directioncodes = tex.directioncodes
+local lefttoright_code = directioncodes.lefttoright
+local righttoleft_code = directioncodes.righttoleft
local glyph_code = nodecodes.glyph
local kern_code = nodecodes.kern
diff --git a/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl
index 3d87ee7765c..dfe534f32b8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl
@@ -74,6 +74,17 @@
\immutable\letcsname\??accents\endcsname\empty
%D Because now have this (\type {\chr} issues a one|-|time warning):
+%D
+%D \stopbuffer
+%D \chr {e acute}
+%D \chr {i circumflex}
+%D \^{i} \^i \^{\i}
+%D \^{a} \"{a}
+%D \withcircumflex{a}
+%D \withdiaeresis{a}
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
\permanent\protected\def\dodefinecombine#1#2%
{\ifcsname\string#1\endcsname\else
diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt b/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt
index e117b914e0b..c3906468b24 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt
@@ -13,7 +13,7 @@ local next, rawget, tostring, tonumber = next, rawget, tostring, tonumber
local gsub, match, gmatch, ind = string.gsub, string.match, string.gmatch, string.find
local insert, remove, concat, unique, imerged = table.insert, table.remove, table.concat, table.unique, table.imerged
local validstring, formatters = string.valid, string.formatters
-local sortedhash = table.sortedhash
+local sortedhash, copytable = table.sortedhash, table.copy
local setmetatableindex, setmetatablenewindex = table.setmetatableindex, table.setmetatablenewindex
local commands = commands
@@ -24,10 +24,12 @@ local ctx_doifelse = commands.doifelse
local implement = interfaces.implement
-local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end)
+local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end)
+local trace_structure = false trackers.register("system.structure", function(v) trace_structure = v end)
local report = logs.reporter("system")
local report_jobfiles = logs.reporter("system", "jobfiles")
+local report_structure = logs.reporter("system", "structure")
local report_functions = logs.reporter("system", "functions")
local texsetcount = tex.setcount
@@ -69,6 +71,12 @@ local v_product = variables.product
local v_component = variables.component
local v_yes = variables.yes
+local v_local = variables["local"]
+local v_global = variables["global"]
+
+local e_start = elements.start
+local e_stop = elements.stop
+
-- main code .. there is some overlap .. here we have loc://
local function findctxfile(name) -- loc ? any ?
@@ -402,7 +410,7 @@ local c_textlevel = tex.iscount("textlevel")
local function dummyfunction() end
local function startstoperror()
- report("invalid \\%s%s ... \\%s%s structure",elements.start,v_text,elements.stop,v_text)
+ report("invalid \\%s%s ... \\%s%s structure",e_start,v_text,e_stop,v_text)
startstoperror = dummyfunction
end
@@ -528,6 +536,10 @@ local tree = { type = "text", name = "", branches = { } }
local treestack = { }
local top = tree.branches
local root = tree
+local namestack = { }
+local namelist = { }
+local namehash = { }
+local nametop = false
local project_stack = { }
local product_stack = { }
@@ -550,6 +562,15 @@ local function pushtree(what,name)
top = t
end
+local function pushcurrent(what,name)
+ if what == v_product or what == v_component or what == v_text then
+ insert(namestack,name)
+ nametop = copytable(namestack)
+ namelist[#namelist+1] = nametop
+ insert(namehash,#namelist)
+ end
+end
+
local function poptree()
top = remove(treestack)
if #top[#top].branches == 0 then
@@ -557,6 +578,13 @@ local function poptree()
end
end
+local function popcurrent(what)
+ if what == v_product or what == v_component then
+ remove(namestack)
+ remove(namehash)
+ end
+end
+
do
local function log_tree(report,top,depth)
@@ -600,22 +628,75 @@ job.structure = jobstructure
jobstructure.collected = jobstructure.collected or { }
jobstructure.tobesaved = root
jobstructure.components = { }
+jobstructure.namestack = { }
-local function initialize()
- local function collect(root,result)
+function collectstructure(collected)
+ local namestack = { }
+ local n = 0
+ local function collect(root,result,stack)
local branches = root.branches
if branches then
+ local s = copytable(stack)
+ local m = #s + 1
for i=1,#branches do
local branch = branches[i]
- if branch.type == "component" then
+ local what = branch.type
+ if what == v_component then
result[#result+1] = branch.name
end
- collect(branch,result)
+ s[m] = branch.name
+ if what == v_product or what == v_component then
+ n = n + 1
+ namestack[n] = copytable(s)
+ end
+ collect(branch,result,s)
end
end
return result
end
- jobstructure.components = collect(jobstructure.collected,{})
+ local components = collect(collected,{},{})
+-- inspect(namestack)
+ return components, namestack
+end
+
+local function initialize()
+ jobstructure.components, jobstructure.namestack = collectstructure(jobstructure.collected)
+end
+
+function jobresolvers.collectstructure(collected)
+ return collectstructure(collected or jobstructure.collected)
+end
+
+do
+ local reported = { }
+
+ function jobresolvers.currentstructure()
+-- inspect(namehash)
+ local n = namehash[#namehash]
+ if trace_structure and not reported[n] then
+ local namestack = jobstructure.namestack
+ local new = namelist [n]
+ local old = namestack[n]
+ new = new and concat(new," ") or ""
+ old = old and concat(old," ") or ""
+ if old == new then
+ report_structure("%02i : %a",n,old)
+ else
+ report_structure("%02i : %a <> %a",n,old,new)
+ end
+ reported[n] = true
+ end
+ return n, namelist[n]
+ end
+
+end
+
+function jobresolvers.namelist(n,utilitydata)
+ if utilitydata then
+ return utilitydata.namestack[n]
+ else
+ return namelist[n] or jobstructure.namestack[n]
+ end
end
job.register('job.structure.collected',root,initialize)
@@ -836,36 +917,32 @@ implement { name = "usecomponent", public = true, protected = true, actions =
-- [v_environment] = context.stopenvironmentindeed,
-- }
-local start = {
- [v_project] = "startprojectindeed",
- [v_product] = "startproductindeed",
- [v_component] = "startcomponentindeed",
- [v_environment] = "startenvironmentindeed",
-}
+-- local start = {
+-- [v_project] = "startprojectindeed",
+-- [v_product] = "startproductindeed",
+-- [v_component] = "startcomponentindeed",
+-- [v_environment] = "startenvironmentindeed",
+-- }
-local stop = {
- [v_project] = "stopprojectindeed",
- [v_product] = "stopproductindeed",
- [v_component] = "stopcomponentindeed",
- [v_environment] = "stopenvironmentindeed",
-}
+-- local stop = {
+-- [v_project] = "stopprojectindeed",
+-- [v_product] = "stopproductindeed",
+-- [v_component] = "stopcomponentindeed",
+-- [v_environment] = "stopenvironmentindeed",
+-- }
-local function gotonextlevel(what,name) -- todo: something with suffix name
+local function gotonextlevel(what,how,name) -- todo: something with suffix name
insert(stacks[what],name)
insert(typestack,currenttype)
currenttype = what
pushtree(what,name)
- if start[what] then
- -- start[what]()
- token.expandmacro(start[what])
- end
+ pushcurrent(what,name)
+ token.expandmacro(e_start..":"..what..":"..how)
end
-local function gotopreviouslevel(what)
- if stop[what] then
- token.expandmacro(stop[what])
- -- stop[what]() -- not immediate
- end
+local function gotopreviouslevel(what,how)
+ token.expandmacro(e_stop..":"..what..":"..how)
+ popcurrent(what)
poptree()
currenttype = remove(typestack) or v_text
remove(stacks[what]) -- not currenttype ... weak recovery
@@ -881,20 +958,22 @@ local function autoname()
return name
end
-implement { name = "startproject", public = true, protected = true, actions = function() gotonextlevel(v_project, autoname()) end }
-implement { name = "startproduct", public = true, protected = true, actions = function() gotonextlevel(v_product, autoname()) end }
-implement { name = "startcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, autoname()) end }
-implement { name = "startenvironment", public = true, protected = true, actions = function() gotonextlevel(v_environment,autoname()) end }
-
-implement { name = "stopproject", public = true, protected = true, actions = function() gotopreviouslevel(v_project ) end }
-implement { name = "stopproduct", public = true, protected = true, actions = function() gotopreviouslevel(v_product ) end }
-implement { name = "stopcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component ) end }
-implement { name = "stopenvironment", public = true, protected = true, actions = function() gotopreviouslevel(v_environment) end }
-
-implement { name = "currentproject", public = true, actions = function() context(topofstack(v_project )) end }
-implement { name = "currentproduct", public = true, actions = function() context(topofstack(v_product )) end }
-implement { name = "currentcomponent", public = true, actions = function() context(topofstack(v_component )) end }
-implement { name = "currentenvironment", public = true, actions = function() context(topofstack(v_environment)) end }
+implement { name = "startproject", public = true, protected = true, actions = function() gotonextlevel(v_project, v_global, autoname()) end }
+implement { name = "startproduct", public = true, protected = true, actions = function() gotonextlevel(v_product, v_global, autoname()) end }
+implement { name = "startcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, v_global, autoname()) end }
+implement { name = "startlocalcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, v_local, autoname()) end }
+implement { name = "startenvironment", public = true, protected = true, actions = function() gotonextlevel(v_environment, v_global, autoname()) end }
+
+implement { name = "stopproject", public = true, protected = true, actions = function() gotopreviouslevel(v_project, v_global) end }
+implement { name = "stopproduct", public = true, protected = true, actions = function() gotopreviouslevel(v_product, v_global) end }
+implement { name = "stopcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component, v_global) end }
+implement { name = "stoplocalcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component, v_local ) end }
+implement { name = "stopenvironment", public = true, protected = true, actions = function() gotopreviouslevel(v_environment, v_global) end }
+
+implement { name = "currentproject", public = true, actions = function() context(topofstack(v_project )) end }
+implement { name = "currentproduct", public = true, actions = function() context(topofstack(v_product )) end }
+implement { name = "currentcomponent", public = true, actions = function() context(topofstack(v_component )) end }
+implement { name = "currentenvironment", public = true, actions = function() context(topofstack(v_environment)) end }
-- -- -- this will move -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx b/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx
index 76b679bd683..1c57a832dfb 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx
@@ -184,43 +184,54 @@
\newsystemmode\v!component
\newsystemmode\v!environment
-\permanent\protected\def\startprojectindeed
+\permanent\protected\defcsname\e!start:\v!project:\v!global\endcsname
{%starttext
\pushsystemmode\v!project
\setsystemmode\v!project}
-\permanent\protected\def\stopprojectindeed
+\permanent\protected\defcsname\e!stop:\v!project:\v!global\endcsname
{\popsystemmode\v!project
%stoptext
\endinput}
-\permanent\protected\def\startproductindeed
+\permanent\protected\defcsname\e!start:\v!product:\v!global\endcsname
{\starttext
\pushsystemmode\v!product
\setsystemmode\v!product}
-\permanent\protected\def\stopproductindeed
+\permanent\protected\defcsname\e!stop:\v!product:\v!global\endcsname
{\popsystemmode\v!product
\stoptext
\endinput}
-\permanent\protected\def\startcomponentindeed
+\permanent\protected\defcsname\e!start:\v!component:\v!global\endcsname
{\starttext
\pushreferenceprefix\currentcomponent
\pushsystemmode\v!component
\setsystemmode\v!component}
-\permanent\protected\def\stopcomponentindeed
+\permanent\protected\defcsname\e!stop:\v!component:\v!global\endcsname
{\popsystemmode\v!component
\popreferenceprefix
\stoptext
\endinput}
-\permanent\protected\def\startenvironmentindeed
+\permanent\protected\defcsname\e!start:\v!component:\v!local\endcsname
+ {\starttext
+ \pushreferenceprefix\currentcomponent
+ \pushsystemmode\v!component
+ \setsystemmode\v!component}
+
+\permanent\protected\defcsname\e!stop:\v!component:\v!local\endcsname
+ {\popsystemmode\v!component
+ \popreferenceprefix
+ \stoptext}
+
+\permanent\protected\defcsname\e!start:\v!environment:\v!global\endcsname
{\pushsystemmode\v!environment
\setsystemmode\v!environment}
-\permanent\protected\def\stopenvironmentindeed
+\permanent\protected\defcsname\e!stop:\v!environment:\v!global\endcsname
{\popsystemmode\v!environment
\endinput}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt b/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt
index d10abf53385..567387a3ac2 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt
@@ -6,17 +6,11 @@ if not modules then modules = { } end modules ['file-mod'] = {
license = "see context related readme files"
}
--- This module will be redone! For instance, the prefixes will move to data-*
--- as they arr sort of generic along with home:// etc/.
-
--- context is not defined yet! todo! (we need to load tupp-fil after cld)
--- todo: move startreadingfile to lua and push regime there
-
---[[ldx--
-<p>It's more convenient to manipulate filenames (paths) in
-<l n='lua'/> than in <l n='tex'/>. These methods have counterparts
-at the <l n='tex'/> side.</p>
---ldx]]--
+-- This module will be redone! For instance, the prefixes will move to data-* as
+-- they are sort of generic along with home:// etc/.
+--
+-- It is more convenient to manipulate filenames (paths) in Lua than in TeX. The
+-- methods below have counterparts at the TeX end.
local format, find, concat, tonumber = string.format, string.find, table.concat, tonumber
local sortedhash = table.sortedhash
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt
index 05a3611ccd2..e70e9083d1d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt
@@ -487,7 +487,7 @@ do
local cache = table.setmetatableindex("table")
- callback.register("missing_character", function(n,f,c)
+ callbacks.register("missing_character", function(n,f,c)
local cached = cache[f]
local found = cached[c]
if found == nil then
@@ -530,7 +530,7 @@ do
n.font = found[1]
n.scale = found[2]
end
- end)
+ end,"report details about a missing character")
function definers.registerfallbackfont(style,list)
local l = fallbacks[style]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt
index 073af7d2ec8..599641e2c01 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt
@@ -22,11 +22,9 @@ local trace_scaling = false trackers.register("fonts.scaling", function(v)
local report_defining = logs.reporter("fonts","defining")
--- watch out: no negative depths and negative eights permitted in regular fonts
-
---[[ldx--
-<p>Here we only implement a few helper functions.</p>
---ldx]]--
+-- Watch out: no negative depths and negative heights are permitted in regular
+-- fonts. Also, the code in LMTX is a bit different. Here we only implement a
+-- few helper functions.
local fonts = fonts
local constructors = fonts.constructors or { }
@@ -53,11 +51,9 @@ constructors.loadedfonts = loadedfonts
----- scalecommands = fonts.helpers.scalecommands
---[[ldx--
-<p>We need to normalize the scale factor (in scaled points). This has to
-do with the fact that <l n='tex'/> uses a negative multiple of 1000 as
-a signal for a font scaled based on the design size.</p>
---ldx]]--
+-- We need to normalize the scale factor (in scaled points). This has to do with the
+-- fact that TeX uses a negative multiple of 1000 as a signal for a font scaled
+-- based on the design size.
local factors = {
pt = 65536.0,
@@ -112,33 +108,29 @@ function constructors.getmathparameter(tfmdata,name)
end
end
---[[ldx--
-<p>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.)</p>
---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 hasitalics flag. Some more flags will be added in the
--- future.
-
---[[ldx--
-<p>The reason why the scaler was originally split, is that for a while we experimented
-with a helper function. However, in practice the <l n='api'/> calls are too slow to
-make this profitable and the <l n='lua'/> based variant was just faster. A days
-wasted day but an experience richer.</p>
---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.)
+--
+-- The scaler is only used for OTF and AFM and virtual fonts. If a virtual font has
+-- italic correction make sure to set the hasitalics flag. Some more flags will be
+-- added in the future.
+--
+-- The reason why the scaler was originally split, is that for a while we
+-- experimented with a helper function. However, in practice the API calls are too
+-- slow to make this profitable and the Lua based variant was just faster. A days
+-- wasted day but an experience richer.
-- 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
+--
+-- We have target.name = metricfile and target.fullname = RealName and
+-- target.filename = diskfilename when collapsing fonts. LuaTeX looks at both
+-- target.name and target.fullname because TTC files can have multiple subfonts.
function constructors.calculatescale(tfmdata,scaledpoints)
-- implemented in font-ctx.lmt
@@ -597,6 +589,14 @@ function constructors.scale(tfmdata,specification)
if changed then
local c = changed[unicode]
if c and c ~= unicode then
+ local cc = changed[c]
+ if cc then
+ while cc do
+ c = cc
+ cc = changed[c]
+ end
+ end
+ -- check not needed:
if c then
description = descriptions[c] or descriptions[unicode] or character
character = characters[c] or character
@@ -1008,9 +1008,7 @@ function constructors.finalize(tfmdata)
return tfmdata
end
---[[ldx--
-<p>A unique hash value is generated by:</p>
---ldx]]--
+-- A unique hash value is generated by:
local hashmethods = { }
constructors.hashmethods = hashmethods
@@ -1069,13 +1067,11 @@ hashmethods.normal = function(list)
end
end
---[[ldx--
-<p>In principle we can share tfm tables when we are in need 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 <l n='luatex'/>.</p>
---ldx]]--
+-- In principle we can share tfm tables when we are in need 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 LuaTeX.
function constructors.hashinstance(specification,force)
-- implemented in font-ctx.lmt
@@ -1407,10 +1403,7 @@ do
end
---[[ldx--
-<p>We need to check for default features. For this we provide
-a helper function.</p>
---ldx]]--
+-- We need to check for default features. For this we provide a helper function.
function constructors.checkedfeatures(what,features)
local defaults = handlers[what].features.defaults
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt
index 23c676e4ee5..113cade52d4 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt
@@ -529,19 +529,13 @@ do
end
---[[ldx--
-<p>So far we haven't really dealt with features (or whatever we want
-to pass along with the font definition. We distinguish the following
-situations:</p>
-situations:</p>
-
-<code>
-name:xetex like specs
-name@virtual font spec
-name*context specification
-</code>
---ldx]]--
-
+-- So far we haven't really dealt with features (or whatever we want to pass along
+-- with the font definition. We distinguish the following situations:
+--
+-- name:xetex like specs
+-- name@virtual font spec
+-- name*context 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.parameters.factor
-- or 1" after all, we need to work with copies anyway and scaling needs to be done
@@ -1383,25 +1377,35 @@ do -- else too many locals
local characters = tfmdata.characters
local parameters = tfmdata.parameters
local properties = tfmdata.properties
- -- we use char0 as signal; cf the spec pdf can handle this (no char in slot)
- characters[0] = nil
- tfmdata.original = specification.specification
- local id = definefont(tfmdata,properties.id)
- csnames[id] = specification.cs
- properties.id = id -- already set
- definers.register(tfmdata,id) -- to be sure, normally already done
- texdefinefont(global,cs,id)
- -- texdefinefont(cs,id,global and "global")
- constructors.finalize(tfmdata)
- if trace_defining then
- report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a",
- name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-")
+ if characters then
+ -- we use char0 as signal; cf the spec pdf can handle this (no char in slot)
+ characters[0] = nil
+ tfmdata.original = specification.specification
+ local id = definefont(tfmdata,properties.id)
+ csnames[id] = specification.cs
+ properties.id = id -- already set
+ definers.register(tfmdata,id) -- to be sure, normally already done
+ texdefinefont(global,cs,id)
+ -- texdefinefont(cs,id,global and "global")
+ constructors.finalize(tfmdata)
+ if trace_defining then
+ report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a",
+ name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-")
+ end
+ -- resolved (when designsize is used):
+ local size = round(tfmdata.parameters.size or 655360)
+ setmacro("somefontsize",size.."sp")
+ texsetcount(c_scaledfontsize,size)
+ lastfontid = id
+ else
+ -- case 1: same as **
+ local nice = nice_cs(cs)
+ if not reported[name][nice] then
+ report_defining("unable to define %a as %a",name,nice)
+ end
+ lastfontid = -1
+ texsetcount(c_scaledfontsize,0)
end
- -- resolved (when designsize is used):
- local size = round(tfmdata.parameters.size or 655360)
- setmacro("somefontsize",size.."sp")
- texsetcount(c_scaledfontsize,size)
- lastfontid = id
elseif tfmtype == "number" then
if trace_defining then
report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a",
@@ -1417,6 +1421,7 @@ do -- else too many locals
texsetcount(c_scaledfontsize,size)
lastfontid = tfmdata
else
+ -- case 2: same as **
local nice = nice_cs(cs)
if not reported[name][nice] then
report_defining("unable to define %a as %a",name,nice)
@@ -1592,7 +1597,7 @@ do -- else too many locals
return (define { name = name, size = size } or 0)
end
- callbacks.register('define_font', read, "definition of fonts (tfmdata preparation)")
+ callbacks.register("define_font",read,"define and/or load a font")
-- here
@@ -2258,10 +2263,8 @@ dimenfactors.em = nil
dimenfactors["%"] = nil
dimenfactors.pct = nil
---[[ldx--
-<p>Before a font is passed to <l n='tex'/> we scale it. Here we also need
-to scale virtual characters.</p>
---ldx]]--
+-- Before a font is passed to TeX we scale it. Here we also need to scale virtual
+-- characters.
do
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt
index 6afeeb47405..ea6b2d0c039 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt
@@ -24,10 +24,9 @@ trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading
local report_defining = logs.reporter("fonts","defining")
---[[ldx--
-<p>Here we deal with defining fonts. We do so by intercepting the
-default loader that only handles <l n='tfm'/>.</p>
---ldx]]--
+-- Here we deal with defining fonts. We do so by intercepting the default loader
+-- that only handles TFM files. Although, we started out that way but in the
+-- meantime we can hardly speak of TFM any more.
local nextfont = font.nextid
@@ -55,25 +54,18 @@ local designsizes = constructors.designsizes
local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
---[[ldx--
-<p>We hardly gain anything when we cache the final (pre scaled)
-<l n='tfm'/> 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.</p>
---ldx]]--
-
---[[ldx--
-<p>We can prefix a font specification by <type>name:</type> or
-<type>file:</type>. The first case will result in a lookup in the
-synonym table.</p>
-
-<typing>
-[ name: | file: ] identifier [ separator [ specification ] ]
-</typing>
-
-<p>The following function split the font specification into components
-and prepares a table that will move along as we proceed.</p>
---ldx]]--
+-- We hardly gain anything when we cache the final (pre scaled) TFM 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.
+--
+-- We can prefix a font specification by "name:" or "file:". The first case will
+-- result in a lookup in the synonym table.
+--
+-- [ name: | file: ] identifier [ separator [ specification ] ]
+--
+-- The following function split the font specification into components and prepares
+-- a table that will move along as we proceed.
-- beware, we discard additional specs
--
@@ -166,9 +158,7 @@ do
end
---[[ldx--
-<p>We can resolve the filename using the next function:</p>
---ldx]]--
+-- We can resolve the filename using the next function:
definers.resolvers = definers.resolvers or { }
local resolvers = definers.resolvers
@@ -261,23 +251,17 @@ function definers.resolve(specification)
return specification
end
---[[ldx--
-<p>The main read function either uses a forced reader (as determined by
-a lookup) or tries to resolve the name using the list of readers.</p>
-
-<p>We need to cache when possible. We do cache raw tfm data (from <l
-n='tfm'/>, <l n='afm'/> or <l n='otf'/>). After that we can cache based
-on specificstion (name) and size, that is, <l n='tex'/> only needs a number
-for an already loaded fonts. However, it may make sense to cache fonts
-before they're scaled as well (store <l n='tfm'/>'s with applied methods
-and features). However, there may be a relation between the size and
-features (esp in virtual fonts) so let's not do that now.</p>
-
-<p>Watch out, here we do load a font, but we don't prepare the
-specification yet.</p>
---ldx]]--
-
--- very experimental:
+-- The main read function either uses a forced reader (as determined by a lookup) or
+-- tries to resolve the name using the list of readers.
+--
+-- We need to cache when possible. We do cache raw tfm data (from TFM, AFM or OTF).
+-- After that we can cache based on specificstion (name) and size, that is, TeX only
+-- needs a number for an already loaded fonts. However, it may make sense to cache
+-- fonts before they're scaled as well (store TFM's with applied methods and
+-- features). However, there may be a relation between the size and features (esp in
+-- virtual fonts) so let's not do that now.
+--
+-- Watch out, here we do load a font, but we don't prepare the specification yet.
function definers.applypostprocessors(tfmdata)
local postprocessors = tfmdata.postprocessors
@@ -431,17 +415,13 @@ function constructors.readanddefine(name,size) -- no id -- maybe a dummy first
return fontdata[id], id
end
---[[ldx--
-<p>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).</p>
-
-In the previously defined reader (the one resulting in a <l n='tfm'/>
-table) we cached the (scaled) instances. Here we cache them again, but
-this time based on id. We could combine this in one cache but this does
-not gain much. By the way, passing id's back to in the callback was
-introduced later in the development.</p>
---ldx]]--
+-- So far the specifiers. Now comes the real definer. Here we cache based on id's.
+-- Here we also intercept the virtual font handler.
+--
+-- In the previously defined reader (the one resulting in a TFM table) we cached the
+-- (scaled) instances. Here we cache them again, but this time based on id. We could
+-- combine this in one cache but this does not gain much. By the way, passing id's
+-- back to in the callback was introduced later in the development.
function definers.registered(hash)
local id = internalized[hash]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt
index bdc5265aeaa..09f20b42cb3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt
@@ -10,10 +10,6 @@ local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format
local utfbyte, utfchar = utf.byte, utf.char
local next = next
---[[ldx--
-<p>This is very experimental code!</p>
---ldx]]--
-
local trace_visualize = false trackers.register("fonts.composing.visualize", function(v) trace_visualize = v end)
local trace_define = false trackers.register("fonts.composing.define", function(v) trace_define = v end)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx
index 79535ea112d..89ec2f5c433 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx
@@ -104,6 +104,11 @@
{\letcsname\??fontfile\fontclass\m_font_name\endcsname\m_font_file
\normalexpanded{\font_basics_define_font_synonym_yes_opt[#spec]}}
+\let\p_features \undefined
+\let\p_fallbacks \undefined
+\let\p_goodies \undefined
+\let\p_designsize\undefined
+
\protected\def\font_basics_define_font_synonym_nop_opt[#specification]%
{\let\p_features \undefined
\let\p_fallbacks \undefined
@@ -294,7 +299,7 @@
% pre-expansion.
\def\font_helpers_update_font_class_parameters
- {\edef\m_font_class_direction {\begincsname\??fontclass\fontclass\fontstyle\s!direction \endcsname}%
+ {%edef\m_font_class_direction {\begincsname\??fontclass\fontclass\fontstyle\s!direction \endcsname}%
\edef\m_font_class_features {\begincsname\??fontclass\fontclass\fontstyle\s!features \endcsname}%
\edef\m_font_class_fallbacks {\begincsname\??fontclass\fontclass\fontstyle\s!fallbacks \endcsname}%
\edef\m_font_class_goodies {\begincsname\??fontclass\fontclass\fontstyle\s!goodies \endcsname}%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt
index bc68fa83d4c..dcec8594eab 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt
@@ -6,10 +6,6 @@ if not modules then modules = { } end modules ['font-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Not much is happening here.</p>
---ldx]]--
-
local sortedhash, setmetatableindex = table.sortedhash, table.setmetatableindex
local allocate = utilities.storage.allocate
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx
index 6efae2ae10b..ea727bde4dc 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx
@@ -755,6 +755,16 @@
\immutable\dimensiondef\d_font_default_size 10pt
+%lettonothing\m_font_class_direction % no longer used
+\lettonothing\m_font_class_features
+\lettonothing\m_font_class_fallbacks
+\lettonothing\m_font_class_goodies
+
+\lettonothing\m_font_direction
+\lettonothing\m_font_features
+\lettonothing\m_font_fallbacks
+\lettonothing\m_font_goodies
+
\protected\def\font_helpers_low_level_define
{\ifconditional\c_font_compact
\expandafter\font_helpers_low_level_define_compact
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx
index 6caf1daf8df..9214a8b5232 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx
@@ -52,7 +52,7 @@
\registerctxluafile{font-oti}{} % otf initialization
\registerctxluafile{font-ott}{} % otf tables (first)
\registerctxluafile{font-otl}{autosuffix}
-\registerctxluafile{font-oto}{}
+\registerctxluafile{font-oto}{autosuffix}
\registerctxluafile{font-otj}{autosuffix}
\registerctxluafile{font-oup}{}
\registerctxluafile{font-ota}{autosuffix}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx
index 76f6f87b973..a93174e3799 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx
@@ -337,15 +337,17 @@
%D 0 while in rl mode 0 is a copy of 1. There is no real overhead involved in this.
%D This also permits different font definitions for normal and mixed.
-\lettonothing\m_font_class_direction
-\lettonothing\m_font_class_features
-\lettonothing\m_font_class_fallbacks
-\lettonothing\m_font_class_goodies
-
-\lettonothing\m_font_direction
-\lettonothing\m_font_features
-\lettonothing\m_font_fallbacks
-\lettonothing\m_font_goodies
+% moved to ini
+%
+% \lettonothing\m_font_class_direction
+% \lettonothing\m_font_class_features
+% \lettonothing\m_font_class_fallbacks
+% \lettonothing\m_font_class_goodies
+%
+% \lettonothing\m_font_direction
+% \lettonothing\m_font_features
+% \lettonothing\m_font_fallbacks
+% \lettonothing\m_font_goodies
\appendtoks
\font_helpers_set_math_family\c_font_fam_mr\s!mr
@@ -531,7 +533,12 @@
\else
\c_math_m_scaled\numericscale#1\relax
\fi
- \scaledmathstyle\c_math_m_scaled
+ \scaledmathstyle
+ \ifnum\glyphscale=\plusthousand
+ \c_math_m_scaled
+ \else
+ \numexpr(\c_math_m_scaled*\glyphscale)/\plusthousand\relax
+ \fi
\fi}
%D This is nasty, as the engine only stores the last set family parameters (per style) which
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt
index 453f611927a..71694dcca84 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt
@@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-one'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Some code may look a bit obscure but this has to do with the fact that we also use
-this code for testing and much code evolved in the transition from <l n='tfm'/> to
-<l n='afm'/> to <l n='otf'/>.</p>
-
-<p>The following code still has traces of intermediate font support where we handles
-font encodings. Eventually font encoding went away but we kept some code around in
-other modules.</p>
-
-<p>This version implements a node mode approach so that users can also more easily
-add features.</p>
---ldx]]--
+-- Some code may look a bit obscure but this has to do with the fact that we also
+-- use this code for testing and much code evolved in the transition from TFM to AFM
+-- to OTF.
+--
+-- The following code still has traces of intermediate font support where we handles
+-- font encodings. Eventually font encoding went away but we kept some code around
+-- in other modules.
+--
+-- This version implements a node mode approach so that users can also more easily
+-- add features.
local fonts, logs, trackers, containers, resolvers = fonts, logs, trackers, containers, resolvers
@@ -71,15 +69,13 @@ local overloads = fonts.mappings.overloads
local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes
---[[ldx--
-<p>We cache files. Caching is taken care of in the loader. We cheat a bit by adding
-ligatures and kern information to the afm derived data. That way we can set them faster
-when defining a font.</p>
-
-<p>We still keep the loading two phased: first we load the data in a traditional
-fashion and later we transform it to sequences. Then we apply some methods also
-used in opentype fonts (like <t>tlig</t>).</p>
---ldx]]--
+-- We cache files. Caching is taken care of in the loader. We cheat a bit by adding
+-- ligatures and kern information to the afm derived data. That way we can set them
+-- faster when defining a font.
+--
+-- We still keep the loading two phased: first we load the data in a traditional
+-- fashion and later we transform it to sequences. Then we apply some methods also
+-- used in opentype fonts (like tlig).
function afm.load(filename)
filename = resolvers.findfile(filename,'afm') or ""
@@ -312,10 +308,8 @@ local function enhance_fix_names(data)
end
end
---[[ldx--
-<p>These helpers extend the basic table with extra ligatures, texligatures
-and extra kerns. This saves quite some lookups later.</p>
---ldx]]--
+-- These helpers extend the basic table with extra ligatures, texligatures and extra
+-- kerns. This saves quite some lookups later.
local addthem = function(rawdata,ligatures)
if ligatures then
@@ -349,17 +343,14 @@ local function enhance_add_ligatures(rawdata)
addthem(rawdata,afm.helpdata.ligatures)
end
---[[ldx--
-<p>We keep the extra kerns in separate kerning tables so that we can use
-them selectively.</p>
---ldx]]--
-
--- 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 keep the extra kerns in separate kerning tables so that we can use them
+-- selectively.
+--
+-- 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).
local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust here
local descriptions = rawdata.descriptions
@@ -440,9 +431,7 @@ local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust h
do_it_copy(afm.helpdata.rightkerned)
end
---[[ldx--
-<p>The copying routine looks messy (and is indeed a bit messy).</p>
---ldx]]--
+-- The copying routine looks messy (and is indeed a bit messy).
local function adddimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name
if data then
@@ -619,11 +608,9 @@ end
return nil
end
---[[ldx--
-<p>Originally we had features kind of hard coded for <l n='afm'/> files but since I
-expect to support more font formats, I decided to treat this fontformat like any
-other and handle features in a more configurable way.</p>
---ldx]]--
+-- Originally we had features kind of hard coded for AFM files but since I expect to
+-- support more font formats, I decided to treat this fontformat like any other and
+-- handle features in a more configurable way.
function afm.setfeatures(tfmdata,features)
local okay = constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm)
@@ -715,13 +702,10 @@ local function afmtotfm(specification)
end
end
---[[ldx--
-<p>As soon as we could intercept the <l n='tfm'/> reader, I implemented an
-<l n='afm'/> reader. Since traditional <l n='pdftex'/> could use <l n='opentype'/>
-fonts with <l n='afm'/> companions, the following method also could handle
-those cases, but now that we can handle <l n='opentype'/> directly we no longer
-need this features.</p>
---ldx]]--
+-- As soon as we could intercept the TFM reader, I implemented an AFM reader. Since
+-- traditional pdfTeX could use OpenType fonts with AFM companions, the following
+-- method also could handle those cases, but now that we can handle OpenType
+-- directly we no longer need this features.
local function read_from_afm(specification)
local tfmdata = afmtotfm(specification)
@@ -736,9 +720,7 @@ local function read_from_afm(specification)
return tfmdata
end
---[[ldx--
-<p>We have the usual two modes and related features initializers and processors.</p>
---ldx]]--
+-- We have the usual two modes and related features initializers and processors.
registerafmfeature {
name = "mode",
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt
index d28c247df63..04f9d3bb2c8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt
@@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-onr'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Some code may look a bit obscure but this has to do with the fact that we also use
-this code for testing and much code evolved in the transition from <l n='tfm'/> to
-<l n='afm'/> to <l n='otf'/>.</p>
-
-<p>The following code still has traces of intermediate font support where we handles
-font encodings. Eventually font encoding went away but we kept some code around in
-other modules.</p>
-
-<p>This version implements a node mode approach so that users can also more easily
-add features.</p>
---ldx]]--
+-- Some code may look a bit obscure but this has to do with the fact that we also
+-- use this code for testing and much code evolved in the transition from TFM to AFM
+-- to OTF.
+--
+-- The following code still has traces of intermediate font support where we handles
+-- font encodings. Eventually font encoding went away but we kept some code around
+-- in other modules.
+--
+-- This version implements a node mode approach so that users can also more easily
+-- add features.
local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers
@@ -49,12 +47,9 @@ pfb.version = 1.002
local readers = afm.readers or { }
afm.readers = readers
---[[ldx--
-<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
-and <l n='otf'/> reader.</p>
-<p>We use a new (unfinished) pfb loader but I see no differences between the old
-and new vectors (we actually had one bad vector with the old loader).</p>
---ldx]]--
+-- We start with the basic reader which we give a name similar to the built in TFM
+-- and OTF reader. We use a PFB loader but I see no differences between the old and
+-- new vectors (we actually had one bad vector with the old loader).
local get_indexes, get_shapes
@@ -71,7 +66,7 @@ do
-- local plain = bxor(cipher,rshift(r,8))
local plain = (cipher ~ ((r >> 8) & 0xFFFFFFFF))
-- r = ((cipher + r) * c1 + c2) % 65536
- r = ((cipher + r) * c1 + c2) % 0x10000
+ r = ((cipher + r) * c1 + c2) % 0x10000
return char(plain)
end
@@ -366,11 +361,10 @@ do
end
---[[ldx--
-<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
-and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support
-more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p>
---ldx]]--
+-- We start with the basic reader which we give a name similar to the built in TFM
+-- and OTF reader. We only need data that is relevant for our use. We don't support
+-- more complex arrangements like multiple master (obsolete), direction specific
+-- kerning, etc.
local spacer = patterns.spacer
local whitespace = patterns.whitespace
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt
index 157270ef18d..6e81307418b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt
@@ -56,10 +56,8 @@ local chardata = characters and characters.data
local otffeatures = fonts.constructors.features.otf
local registerotffeature = otffeatures.register
---[[ldx--
-<p>Analyzers run per script and/or language and are needed in order to
-process features right.</p>
---ldx]]--
+-- Analyzers run per script and/or language and are needed in order to process
+-- features right.
local setstate = nuts.setstate
local getstate = nuts.getstate
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt
new file mode 100644
index 00000000000..f2269627311
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt
@@ -0,0 +1,556 @@
+if not modules then modules = { } end modules ['font-oto'] = { -- original tex
+ 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 concat, unpack = table.concat, table.unpack
+local insert, remove = 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 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 fonts = fonts
+local otf = fonts.handlers.otf
+
+local otffeatures = otf.features
+local registerotffeature = otffeatures.register
+
+otf.defaultbasealternate = "none" -- first last
+
+local getprivate = fonts.constructors.getprivate
+
+local wildcard = "*"
+local default = "dflt"
+
+local formatters = string.formatters
+local f_unicode = formatters["%U"]
+local f_uniname = formatters["%U (%s)"]
+local f_unilist = formatters["% t (% t)"]
+
+local function gref(descriptions,n)
+ if type(n) == "number" then
+ local name = descriptions[n].name
+ if name then
+ return f_uniname(n,name)
+ else
+ return f_unicode(n)
+ end
+ elseif n then
+ local num = { }
+ local nam = { }
+ local j = 0
+ for i=1,#n do
+ local ni = n[i]
+ if tonumber(ni) then -- first is likely a key
+ j = j + 1
+ local di = descriptions[ni]
+ num[j] = f_unicode(ni)
+ nam[j] = di and di.name or "-"
+ end
+ end
+ return f_unilist(num,nam)
+ else
+ return "<error in base mode tracing>"
+ end
+end
+
+local function cref(feature,sequence)
+ return formatters["feature %a, type %a, (chain) lookup %a"](feature,sequence.type,sequence.name)
+end
+
+local function report_substitution(feature,sequence,descriptions,unicode,substitution)
+ if unicode == substitution then
+ report_prepare("%s: base substitution %s maps onto itself",
+ cref(feature,sequence),
+ gref(descriptions,unicode))
+ else
+ report_prepare("%s: base substitution %s => %S",
+ cref(feature,sequence),
+ gref(descriptions,unicode),
+ gref(descriptions,substitution))
+ end
+end
+
+local function report_alternate(feature,sequence,descriptions,unicode,replacement,value,comment)
+ if unicode == replacement then
+ report_prepare("%s: base alternate %s maps onto itself",
+ cref(feature,sequence),
+ gref(descriptions,unicode))
+ else
+ report_prepare("%s: base alternate %s => %s (%S => %S)",
+ cref(feature,sequence),
+ gref(descriptions,unicode),
+ replacement and gref(descriptions,replacement),
+ value,
+ comment)
+ end
+end
+
+local function report_ligature(feature,sequence,descriptions,unicode,ligature)
+ report_prepare("%s: base ligature %s => %S",
+ cref(feature,sequence),
+ gref(descriptions,ligature),
+ gref(descriptions,unicode))
+end
+
+local function report_kern(feature,sequence,descriptions,unicode,otherunicode,value)
+ report_prepare("%s: base kern %s + %s => %S",
+ cref(feature,sequence),
+ gref(descriptions,unicode),
+ gref(descriptions,otherunicode),
+ value)
+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 or properties.name) .. "-" .. base
+ -- report_prepare("fullname base hash '%a, featureset %a",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. We can have changed[first] or changed[second] but it quickly becomes
+-- messy if we need to take that into account.
+
+local function makefake(tfmdata,name,present)
+ local private = getprivate(tfmdata)
+ local character = { intermediate = true, ligatures = { } }
+ tfmdata.resources.unicodes[name] = private
+ tfmdata.characters[private] = character
+ tfmdata.descriptions[private] = { name = name }
+ present[name] = private
+ return character
+end
+
+local function make_1(present,tree,name)
+ if tonumber(tree) then
+ present[name] = v
+ else
+ for k, v in next, tree do
+ if k == "ligature" then
+ present[name] = v
+ else
+ make_1(present,v,name .. "_" .. k)
+ end
+ end
+ end
+end
+
+local function make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
+ local character = characters[preceding]
+ if not character then
+ if trace_baseinit then
+ report_prepare("weird ligature in lookup %a, current %C, preceding %C",sequence.name,v,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[name]
+ if not d then
+ done[name] = { "dummy", v }
+ else
+ d[#d+1] = v
+ end
+ end
+end
+
+local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done)
+ if tonumber(tree) then
+ make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,tree)
+ else
+ for k, v in next, tree do
+ if k == "ligature" then
+ make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
+ else
+ local code = present[name] or unicode
+ local name = name .. "_" .. k
+ make_2(present,tfmdata,characters,v,name,code,k,done)
+ end
+ 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 ligatures = { }
+ local alternate = tonumber(value) or true and 1
+ local defaultalt = otf.defaultbasealternate
+ local trace_singles = trace_baseinit and trace_singles
+ local trace_alternatives = trace_baseinit and trace_alternatives
+ local trace_ligatures = trace_baseinit and trace_ligatures
+
+ -- A chain of changes is handled in font-con which is cleaner because
+ -- we can have shared changes and such.
+
+ if not changed then
+ changed = { }
+ tfmdata.changed = changed
+ end
+
+ for i=1,#lookuplist do
+ local sequence = lookuplist[i]
+ local steps = sequence.steps
+ local kind = sequence.type
+ if kind == "gsub_single" then
+ for i=1,#steps do
+ for unicode, data in next, steps[i].coverage do
+ if unicode ~= data and not changed[unicode] then
+ changed[unicode] = data
+ end
+ if trace_singles then
+ report_substitution(feature,sequence,descriptions,unicode,data)
+ end
+ end
+ end
+ elseif kind == "gsub_alternate" then
+ for i=1,#steps do
+ for unicode, data in next, steps[i].coverage do
+ local replacement = data[alternate]
+ if replacement then
+ if unicode ~= replacement and not changed[unicode] then
+ changed[unicode] = replacement
+ end
+ if trace_alternatives then
+ report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal")
+ end
+ elseif defaultalt == "first" then
+ replacement = data[1]
+ if unicode ~= replacement and not changed[unicode] then
+ changed[unicode] = replacement
+ end
+ if trace_alternatives then
+ report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
+ end
+ elseif defaultalt == "last" then
+ replacement = data[#data]
+ if unicode ~= replacement and not changed[unicode] then
+ changed[unicode] = replacement
+ end
+ if trace_alternatives then
+ report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
+ end
+ else
+ if trace_alternatives then
+ report_alternate(feature,sequence,descriptions,unicode,replacement,value,"unknown")
+ end
+ end
+ end
+ end
+ elseif kind == "gsub_ligature" then
+ for i=1,#steps do
+ for unicode, data in next, steps[i].coverage do
+ ligatures[#ligatures+1] = { unicode, data, "" } -- lookupname }
+ if trace_ligatures then
+ report_ligature(feature,sequence,descriptions,unicode,data)
+ end
+ end
+ 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 = ligature[1]
+ local tree = ligature[2]
+ make_1(present,tree,"ctx_"..unicode)
+ end
+
+ for i=1,nofligatures do
+ local ligature = ligatures[i]
+ local unicode = ligature[1]
+ local tree = ligature[2]
+ local lookupname = ligature[3]
+ make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,sequence)
+ end
+
+ end
+
+end
+
+local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist)
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local resources = tfmdata.resources
+ local properties = tfmdata.properties
+ local traceindeed = trace_baseinit and trace_kerns
+ -- check out this sharedkerns trickery
+ for i=1,#lookuplist do
+ local sequence = lookuplist[i]
+ local steps = sequence.steps
+ local kind = sequence.type
+ local format = sequence.format
+ if kind == "gpos_pair" then
+ for i=1,#steps do
+ local step = steps[i]
+ local format = step.format
+ if format == "kern" or format == "move" then
+ for unicode, data in next, steps[i].coverage 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_kern(feature,sequence,descriptions,unicode,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
+ else
+ for unicode, data in next, steps[i].coverage do
+ local character = characters[unicode]
+ local kerns = character.kerns
+ for otherunicode, kern in next, data do
+ -- kern[2] is true (all zero) or a table
+ local other = kern[2]
+ if other == true or (not other and not (kerns and kerns[otherunicode])) then
+ local kern = kern[1]
+ if kern == true then
+ -- all zero
+ elseif kern[1] ~= 0 or kern[2] ~= 0 or kern[4] ~= 0 then
+ -- a complex pair not suitable for basemode
+ else
+ kern = kern[3]
+ if kern ~= 0 then
+ if kerns then
+ kerns[otherunicode] = kern
+ else
+ kerns = { [otherunicode] = kern }
+ character.kerns = kerns
+ end
+ if traceindeed then
+ report_kern(feature,sequence,descriptions,unicode,otherunicode,kern)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+end
+
+local function initializehashes(tfmdata)
+ -- already done
+end
+
+local function checkmathreplacements(tfmdata,fullname,fixitalics)
+ if tfmdata.mathparameters then
+ local characters = tfmdata.characters
+ local changed = tfmdata.changed
+ if next(changed) then
+ if trace_preparing or trace_baseinit then
+ report_prepare("checking math replacements for %a",fullname)
+ end
+ for unicode, replacement in next, changed do
+ local u = characters[unicode]
+ local r = characters[replacement]
+ if u and r then
+ local n = u.next
+ local v = u.vert_variants
+ local h = u.horiz_variants
+ if fixitalics then
+ -- quite some warnings on stix ...
+ local ui = u.italic
+ if ui and not r.italic then
+ if trace_preparing then
+ report_prepare("using %i units of italic correction from %C for %U",ui,unicode,replacement)
+ end
+ r.italic = ui -- print(ui,ri)
+ end
+ end
+ if n and not r.next then
+ if trace_preparing then
+ report_prepare("forcing %s for %C substituted by %U","incremental step",unicode,replacement)
+ end
+ r.next = n
+ end
+ if v and not r.vert_variants then
+ if trace_preparing then
+ report_prepare("forcing %s for %C substituted by %U","vertical variants",unicode,replacement)
+ end
+ r.vert_variants = v
+ end
+ if h and not r.horiz_variants then
+ if trace_preparing then
+ report_prepare("forcing %s for %C substituted by %U","horizontal variants",unicode,replacement)
+ end
+ r.horiz_variants = h
+ end
+ else
+ if trace_preparing then
+ report_prepare("error replacing %C by %U",unicode,replacement)
+ end
+ end
+ end
+ end
+ end
+end
+
+local function featuresinitializer(tfmdata,value)
+ if true then -- value then
+ local starttime = trace_preparing and os.clock()
+ local features = tfmdata.shared.features
+ local fullname = tfmdata.properties.fullname or "?"
+ if features then
+ initializehashes(tfmdata)
+ local collectlookups = otf.collectlookups
+ local rawdata = tfmdata.shared.rawdata
+ local properties = tfmdata.properties
+ local script = properties.script
+ local language = properties.language
+ local rawresources = rawdata.resources
+ local rawfeatures = rawresources and rawresources.features
+ local basesubstitutions = rawfeatures and rawfeatures.gsub
+ local basepositionings = rawfeatures and rawfeatures.gpos
+ local substitutionsdone = false
+ local positioningsdone = false
+ --
+ if basesubstitutions or basepositionings then
+ local sequences = tfmdata.resources.sequences
+ for s=1,#sequences do
+ local sequence = sequences[s]
+ local sfeatures = sequence.features
+ if sfeatures then
+ local order = sequence.order
+ if order then
+ for i=1,#order do --
+ local feature = order[i]
+ local value = features[feature]
+ if value then
+ local validlookups, lookuplist = collectlookups(rawdata,feature,script,language)
+-- if not validlookups and not lookuplist and script == "math" then
+-- validlookups, lookuplist = collectlookups(rawdata,feature,"dflt","dflt")
+-- end
+ if not validlookups then
+ -- skip
+ elseif basesubstitutions and basesubstitutions[feature] then
+ if trace_preparing then
+ report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value)
+ end
+ preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist)
+ registerbasefeature(feature,value)
+ substitutionsdone = true
+ elseif basepositionings and basepositionings[feature] then
+ if trace_preparing then
+ report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value)
+ end
+ preparepositionings(tfmdata,feature,value,validlookups,lookuplist)
+ registerbasefeature(feature,value)
+ positioningsdone = true
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ --
+ if substitutionsdone then
+ checkmathreplacements(tfmdata,fullname,features.fixitalics)
+ end
+ --
+ registerbasehash(tfmdata)
+ end
+ if trace_preparing then
+ report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,fullname)
+ 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,
+ }
+}
+
+otf.basemodeinitializer = featuresinitializer
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt
index e7fcfc57675..9e7fdb1ab1e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt
@@ -7,92 +7,90 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences
license = "see context related readme files",
}
---[[ldx--
-<p>I need to check the description at the microsoft site ... it has been improved
-so maybe there are some interesting details there. Most below is based on old and
-incomplete documentation and involved quite a bit of guesswork (checking with the
-abstract uniscribe of those days. But changing things is tricky!</p>
-
-<p>This module is a bit more split up that I'd like but since we also want to test
-with plain <l n='tex'/> it has to be so. This module is part of <l n='context'/>
-and discussion about improvements and functionality mostly happens on the
-<l n='context'/> mailing list.</p>
-
-<p>The specification of OpenType is (or at least decades ago was) kind of vague.
-Apart from a lack of a proper free specifications there's also the problem that
-Microsoft and Adobe may have their own interpretation of how and in what order to
-apply features. In general the Microsoft website has more detailed specifications
-and is a better reference. There is also some information in the FontForge help
-files. In the end we rely most on the Microsoft specification.</p>
-
-<p>Because there is so much possible, fonts might contain bugs and/or be made to
-work with certain rederers. These may evolve over time which may have the side
-effect that suddenly fonts behave differently. We don't want to catch all font
-issues.</p>
-
-<p>After a lot of experiments (mostly by Taco, me and Idris) the first implementation
-was already quite useful. When it did most of what we wanted, a more optimized version
-evolved. Of course all errors are mine and of course the code can be improved. There
-are quite some optimizations going on here and processing speed is currently quite
-acceptable and has been improved over time. Many complex scripts are not yet supported
-yet, but I will look into them as soon as <l n='context'/> users ask for it.</p>
-
-<p>The specification leaves room for interpretation. In case of doubt the Microsoft
-implementation is the reference as it is the most complete one. As they deal with
-lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code and
-their suggestions help improve the code. I'm aware that not all border cases can be
-taken care of, unless we accept excessive runtime, and even then the interference
-with other mechanisms (like hyphenation) are not trivial.</p>
-
-<p>Especially discretionary handling has been improved much by Kai Eigner who uses complex
-(latin) fonts. The current implementation is a compromis between his patches and my code
-and in the meantime performance is quite ok. We cannot check all border cases without
-compromising speed but so far we're okay. Given good test cases we can probably improve
-it here and there. Especially chain lookups are non trivial with discretionaries but
-things got much better over time thanks to Kai.</p>
-
-<p>Glyphs are indexed not by unicode but in their own way. This is because there is no
-relationship with unicode at all, apart from the fact that a font might cover certain
-ranges of characters. One character can have multiple shapes. However, at the
-<l n='tex'/> end we use unicode so and all extra glyphs are mapped into a private
-space. This is needed because we need to access them and <l n='tex'/> has to include
-then in the output eventually.</p>
-
-<p>The initial data table is rather close to the open type specification and also not
-that different from the one produced by <l n='fontforge'/> but we uses hashes instead.
-In <l n='context'/> that table is packed (similar tables are shared) and cached on disk
-so that successive runs can use the optimized table (after loading the table is
-unpacked).</p>
-
-<p>This module is sparsely documented because it is has been a moving target. The
-table format of the reader changed a bit over time and we experiment a lot with
-different methods for supporting features. By now the structures are quite stable</p>
-
-<p>Incrementing the version number will force a re-cache. We jump the number by one
-when there's a fix in the reader or processing code that can result in different
-results.</p>
-
-<p>This code is also used outside context but in context it has to work with other
-mechanisms. Both put some constraints on the code here.</p>
-
---ldx]]--
-
--- Remark: We assume that cursives don't cross discretionaries which is okay because it
--- is only used in semitic scripts.
+-- I need to check the description at the microsoft site ... it has been improved so
+-- maybe there are some interesting details there. Most below is based on old and
+-- incomplete documentation and involved quite a bit of guesswork (checking with the
+-- abstract uniscribe of those days. But changing things is tricky!
+--
+-- This module is a bit more split up that I'd like but since we also want to test
+-- with plain TeX it has to be so. This module is part of ConTeXt and discussion
+-- about improvements and functionality mostly happens on the ConTeXt mailing list.
+--
+-- The specification of OpenType is (or at least decades ago was) kind of vague.
+-- Apart from a lack of a proper free specifications there's also the problem that
+-- Microsoft and Adobe may have their own interpretation of how and in what order to
+-- apply features. In general the Microsoft website has more detailed specifications
+-- and is a better reference. There is also some information in the FontForge help
+-- files. In the end we rely most on the Microsoft specification.
+--
+-- Because there is so much possible, fonts might contain bugs and/or be made to
+-- work with certain rederers. These may evolve over time which may have the side
+-- effect that suddenly fonts behave differently. We don't want to catch all font
+-- issues.
+--
+-- After a lot of experiments (mostly by Taco, me and Idris) the first
+-- implementation was already quite useful. When it did most of what we wanted, a
+-- more optimized version evolved. Of course all errors are mine and of course the
+-- code can be improved. There are quite some optimizations going on here and
+-- processing speed is currently quite acceptable and has been improved over time.
+-- Many complex scripts are not yet supported yet, but I will look into them as soon
+-- as ConTeXt users ask for it.
+--
+-- The specification leaves room for interpretation. In case of doubt the Microsoft
+-- implementation is the reference as it is the most complete one. As they deal with
+-- lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code
+-- and their suggestions help improve the code. I'm aware that not all border cases
+-- can be taken care of, unless we accept excessive runtime, and even then the
+-- interference with other mechanisms (like hyphenation) are not trivial.
+--
+-- Especially discretionary handling has been improved much by Kai Eigner who uses
+-- complex (latin) fonts. The current implementation is a compromis between his
+-- patches and my code and in the meantime performance is quite ok. We cannot check
+-- all border cases without compromising speed but so far we're okay. Given good
+-- test cases we can probably improve it here and there. Especially chain lookups
+-- are non trivial with discretionaries but things got much better over time thanks
+-- to Kai.
+--
+-- Glyphs are indexed not by unicode but in their own way. This is because there is
+-- no relationship with unicode at all, apart from the fact that a font might cover
+-- certain ranges of characters. One character can have multiple shapes. However, at
+-- the TeX end we use unicode so and all extra glyphs are mapped into a private
+-- space. This is needed because we need to access them and TeX has to include then
+-- in the output eventually.
+--
+-- The initial data table is rather close to the open type specification and also
+-- not that different from the one produced by Fontforge but we uses hashes instead.
+-- In ConTeXt that table is packed (similar tables are shared) and cached on disk so
+-- that successive runs can use the optimized table (after loading the table is
+-- unpacked).
+--
+-- This module is sparsely documented because it is has been a moving target. The
+-- table format of the reader changed a bit over time and we experiment a lot with
+-- different methods for supporting features. By now the structures are quite stable
+--
+-- Incrementing the version number will force a re-cache. We jump the number by one
+-- when there's a fix in the reader or processing code that can result in different
+-- results.
+--
+-- This code is also used outside ConTeXt but in ConTeXt it has to work with other
+-- mechanisms. Both put some constraints on the code here.
+--
+-- Remark: We assume that cursives don't cross discretionaries which is okay because
+-- it is only used in semitic scripts.
--
-- Remark: We assume that marks precede base characters.
--
--- Remark: When complex ligatures extend into discs nodes we can get side effects. Normally
--- this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}.
+-- Remark: When complex ligatures extend into discs nodes we can get side effects.
+-- Normally this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}.
--
-- Todo: check if we copy attributes to disc nodes if needed.
--
--- Todo: it would be nice if we could get rid of components. In other places we can use
--- the unicode properties. We can just keep a lua table.
+-- Todo: it would be nice if we could get rid of components. In other places we can
+-- use the unicode properties. We can just keep a lua table.
--
--- Remark: We do some disc juggling where we need to keep in mind that the pre, post and
--- replace fields can have prev pointers to a nesting node ... I wonder if that is still
--- needed.
+-- Remark: We do some disc juggling where we need to keep in mind that the pre, post
+-- and replace fields can have prev pointers to a nesting node ... I wonder if that
+-- is still needed.
--
-- Remark: This is not possible:
--
@@ -254,8 +252,8 @@ local math_code = nodecodes.math
local dir_code = nodecodes.dir
local par_code = nodecodes.par
-local lefttoright_code = nodes.dirvalues.lefttoright
-local righttoleft_code = nodes.dirvalues.righttoleft
+local lefttoright_code = tex.directioncodes.lefttoright
+local righttoleft_code = tex.directioncodes.righttoleft
local discretionarydisc_code = nodes.disccodes.discretionary
@@ -1092,10 +1090,8 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
end
end
---[[ldx--
-<p>We get hits on a mark, but we're not sure if the it has to be applied so
-we need to explicitly test for basechar, baselig and basemark entries.</p>
---ldx]]--
+-- We get hits on a mark, but we're not sure if the it has to be applied so we need
+-- to explicitly test for basechar, baselig and basemark entries.
function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,skiphash)
local markchar = getchar(start)
@@ -1292,10 +1288,8 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,sk
return head, start, false
end
---[[ldx--
-<p>I will implement multiple chain replacements once I run into a font that uses
-it. It's not that complex to handle.</p>
---ldx]]--
+-- I will implement multiple chain replacements once I run into a font that uses it.
+-- It's not that complex to handle.
local chainprocs = { }
@@ -1348,29 +1342,22 @@ end
chainprocs.reversesub = reversesub
---[[ldx--
-<p>This chain stuff is somewhat tricky since we can have a sequence of actions to be
-applied: single, alternate, multiple or ligature where ligature can be an invalid
-one in the sense that it will replace multiple by one but not neccessary one that
-looks like the combination (i.e. it is the counterpart of multiple then). For
-example, the following is valid:</p>
-
-<typing>
-<line>xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx</line>
-</typing>
-
-<p>Therefore we we don't really do the replacement here already unless we have the
-single lookup case. The efficiency of the replacements can be improved by deleting
-as less as needed but that would also make the code even more messy.</p>
---ldx]]--
-
---[[ldx--
-<p>Here we replace start by a single variant.</p>
---ldx]]--
-
--- To be done (example needed): what if > 1 steps
-
--- this is messy: do we need this disc checking also in alternates?
+-- This chain stuff is somewhat tricky since we can have a sequence of actions to be
+-- applied: single, alternate, multiple or ligature where ligature can be an invalid
+-- one in the sense that it will replace multiple by one but not neccessary one that
+-- looks like the combination (i.e. it is the counterpart of multiple then). For
+-- example, the following is valid:
+--
+-- xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx
+--
+-- Therefore we we don't really do the replacement here already unless we have the
+-- single lookup case. The efficiency of the replacements can be improved by
+-- deleting as less as needed but that would also make the code even more messy.
+--
+-- Here we replace start by a single variant.
+--
+-- To be done : what if > 1 steps (example needed)
+-- This is messy: do we need this disc checking also in alternates?
local function reportzerosteps(dataset,sequence)
logwarning("%s: no steps",cref(dataset,sequence))
@@ -1446,9 +1433,7 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r
return head, start, false
end
---[[ldx--
-<p>Here we replace start by new glyph. First we delete the rest of the match.</p>
---ldx]]--
+-- Here we replace start by new glyph. First we delete the rest of the match.
-- char_1 mark_1 -> char_x mark_1 (ignore marks)
-- char_1 mark_1 -> char_x
@@ -1500,9 +1485,7 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku
return head, start, false
end
---[[ldx--
-<p>Here we replace start by a sequence of new glyphs.</p>
---ldx]]--
+-- Here we replace start by a sequence of new glyphs.
function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
local mapping = currentlookup.mapping
@@ -1526,11 +1509,9 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup
return head, start, false
end
---[[ldx--
-<p>When we replace ligatures we use a helper that handles the marks. I might change
-this function (move code inline and handle the marks by a separate function). We
-assume rather stupid ligatures (no complex disc nodes).</p>
---ldx]]--
+-- When we replace ligatures we use a helper that handles the marks. I might change
+-- this function (move code inline and handle the marks by a separate function). We
+-- assume rather stupid ligatures (no complex disc nodes).
-- compare to handlers.gsub_ligature which is more complex ... why
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt
index 2d21687df7e..c8727de72b3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt
@@ -186,10 +186,10 @@ fonts.handlers.otf.features.register {
-- fonts.helpers.registerboxglyph { category = "demo", unicode = 105 }
-- fonts.helpers.registerboxglyph { category = "demo", unicode = 106 }
-local callbacks = fonts.callbacks or { }
-fonts.callbacks = callbacks
+local fontcallbacks = fonts.callbacks or { }
+fonts.callbacks = fontcallbacks
-function callbacks.devirtualize(chardata,f,c)
+function fontcallbacks.devirtualize(chardata,f,c)
if chardata.commands then
local h = node.hpack(nodes.pool.glyph(f,c))
local p = setboxdirectly(f,c,h)
@@ -205,7 +205,7 @@ local function processcallback(f,c)
if chardata then
local callback = chardata.callback
if callback then
- local action = type(callback) == "function" and callback or callbacks[callback]
+ local action = type(callback) == "function" and callback or fontcallbacks[callback]
if action then
action(chardata,f,c)
end
@@ -213,6 +213,6 @@ local function processcallback(f,c)
end
end
-callback.register("process_character",processcallback)
+callbacks.register("process_character",processcallback,"apply an action to a character in a font")
-callbacks.callback = processcallback
+fontcallbacks.callback = processcallback
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt
index 9fce8fc5fae..d6857b39ed1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt
@@ -50,21 +50,18 @@ constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua
fonts.formats.tfm = "type1" -- we need to have at least a value here
fonts.formats.ofm = "type1" -- we need to have at least a value here
---[[ldx--
-<p>The next function encapsulates the standard <l n='tfm'/> loader as
-supplied by <l n='luatex'/>.</p>
---ldx]]--
-
--- 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
-
--- ofm directive blocks local path search unless set; btw, in context we
--- don't support ofm files anyway as this format is obsolete
-
--- we need to deal with nested virtual fonts, but because we load in the
--- frontend we also need to make sure we don't nest too deep (esp when sizes
--- get large)
+-- The next function encapsulates the standard TFM loader as supplied by LuaTeX.
+--
+-- This might change: not scaling and then apply features and do scaling in the
+-- usual way with dummy descriptions but on the other hand. However, we no longer
+-- use TFM (except for the JMN math fonts) so why bother.
+--
+-- The ofm directive blocks a local path search unless set. Actually, in ConTeXt we
+-- never had to deal with OFM files anyway as this format is obsolete (there are
+-- hardly any fonts in that format that are of use).
+--
+-- We need to deal with nested virtual fonts, but because we load in the frontend we
+-- also need to make sure we don't nest too deep (esp when sizes get large)
--
-- (VTITLE Example of a recursion)
-- (MAPFONT D 0 (FONTNAME recurse)(FONTAT D 2))
@@ -72,7 +69,8 @@ supplied by <l n='luatex'/>.</p>
-- (CHARACTER C B (CHARWD D 2)(CHARHT D 2)(MAP (SETCHAR C A)))
-- (CHARACTER C C (CHARWD D 4)(CHARHT D 4)(MAP (SETCHAR C B)))
--
--- we added the same checks as below to the luatex engine
+-- The virtual fonts are handled in the backend and therefore LMTX provides more
+-- features than in the original specification. LuaTeX already had a few more.
function tfm.setfeatures(tfmdata,features)
local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt
index aae69ddd383..c42a3a655e3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt
@@ -122,7 +122,7 @@ local math_code = nodecodes.math
local dir_code = nodecodes.dir
local par_code = nodecodes.par
-local righttoleft_code = nodes.dirvalues.righttoleft
+local righttoleft_code = tex.directioncodes.righttoleft
local txtdirstate = otf.helpers.txtdirstate
local pardirstate = otf.helpers.pardirstate
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl
index cd5fd4ba34e..192c9c6f9d7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl
@@ -257,7 +257,7 @@
\installlanguage
[\s!sl]
- [\c!command=\v!no,
+ [\c!define=\v!no,
\c!spacing=\v!packed,
\c!leftsentence=\hbox{\endash\space},
\c!rightsentence=\hbox{\space\endash},
@@ -271,7 +271,7 @@
\installlanguage % for now we copy from slovenian
[\s!sq]
- [\c!command=\v!no,
+ [\c!define=\v!no,
\s!lefthyphenmin=2,
\s!righthyphenmin=2,
\c!spacing=\v!packed,
@@ -284,12 +284,12 @@
\c!leftquotation=\rightguillemot,
\c!rightquotation=\leftguillemot,
\c!date={\v!day,{.},\space,\v!month,\space,\v!year}]
-
+
\installlanguage
[\s!hy]
[\c!spacing=\v!packed,
\c!leftsentence=\endash, % *sentences not confirmed
- \c!rightsentence=\endash,
+ \c!rightsentence=\endash,
\c!leftsubsentence=\endash,
\c!rightsubsentence=\endash,
\c!leftquote=\guilsingleleft,
@@ -613,7 +613,7 @@
\installlanguage
[\s!lt]
- [\c!command=\v!no,
+ [\c!define=\v!no,
\c!spacing=\v!packed,
\c!leftsentence=\emdash,
\c!rightsentence=\emdash,
@@ -755,7 +755,7 @@
\installlanguage
[\s!it]
- [\c!command=\v!no,
+ [\c!define=\v!no,
\c!spacing=\v!packed,
\c!leftsentence=\emdash,
\c!rightsentence=\emdash,
@@ -798,7 +798,7 @@
\c!rightquote=\upperrightsingleninequote,
\c!leftquotation=\upperleftdoublesixquote,
\c!rightquotation=\upperrightdoubleninequote,
- \c!date={\v!year,\space,\v!month,\space,\v!day}]
+ \c!date={\v!day,\space,\v!month,\space,\v!year}]
\installlanguage[\s!pt-br][\c!default=\s!pt] % Brazil
\installlanguage[\s!es-es][\c!default=\s!es] % Spain
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
index 6152d287412..c8dc33cccf7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
@@ -375,4 +375,27 @@
\permanent\protected\def\LABELTEXT#1{\WORD{\labeltext{#1}}} % only for simple cases!
+%D For publications we have gender specific ones (one could use the main one for a
+%D gender neutral one).
+%D
+%D \startbuffer
+%D \startlines
+%D (\labeltext {demo-texts})
+%D (\labeltexts {demo-texts}{ TEST })
+%D (\leftlabeltext {demo-texts})
+%D (\rightlabeltext{demo-texts})
+%D \stoplines
+%D
+%D \startlines \mainlanguage[cs]
+%D test \btxlabeltext{editor} \par
+%D test \btxlabeltext{editor:f} \par
+%D test \btxlabeltext{editor:m} \par
+%D test \btxlabeltext{editors} \par
+%D test \btxlabeltext{editors:f} \par
+%D test \btxlabeltext{editors:m} \par
+%D \stoplines
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt b/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt
index b918464d032..7607d7d8472 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt
@@ -23,12 +23,10 @@ local v_after = variables.after
local is_letter = characters.is_letter
---[[
-<p>Hyphenating <l n='url'/>'s is somewhat tricky and a matter of taste. I did
-consider using a dedicated hyphenation pattern or dealing with it by node
-parsing, but the following solution suits as well. After all, we're mostly
-dealing with <l n='ascii'/> characters.</p>
-]]--
+-- Hyphenating URL's is somewhat tricky and a matter of taste. I did consider using
+-- a dedicated hyphenation pattern or dealing with it by node parsing, but the
+-- following solution suits as well. After all, we're mostly dealing with ASCII
+-- characters.
local urls = { }
languages.urls = urls
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt
index 55b145730b8..4d9af002c79 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt
@@ -26,11 +26,12 @@ local rep, format, find = string.rep, string.format, string.find
local min = math.min
local lpegmatch = lpeg.match
local formatters = string.formatters
-local sortedkeys, concat = table.sortedkeys, table.concat
+local sortedkeys, concat, swapped = table.sortedkeys, table.concat, table.swapped
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 trace_externals = false trackers.register("references.externals", function(v) trace_externals = v end)
local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end)
local untex_urls = true directives.register("references.untexurls", function(v) untex_urls = v end)
@@ -510,59 +511,65 @@ function nodeinjections.destination(width,height,depth,names,view)
if method == v_page then
for n=1,#names do
local name = names[n]
- local used = usedviews[name]
- if used and used ~= true then
- -- already done, maybe a warning
- elseif type(name) == "number" then
- -- if noview then
- -- usedviews[name] = view
- -- names[n] = false
- -- else
+ if name then
+ local used = usedviews[name]
+ if used and used ~= true then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ -- if noview then
+ -- usedviews[name] = view
+ -- names[n] = false
+ -- else
+ usedviews[name] = view
+ names[n] = false
+ -- end
+ else
usedviews[name] = view
- names[n] = false
- -- end
- else
- usedviews[name] = view
+ end
end
end
elseif method == v_name then
for n=1,#names do
local name = names[n]
- local used = usedviews[name]
- if used and used ~= true then
- -- already done, maybe a warning
- elseif type(name) == "number" then
- local used = usedinternals[name]
- usedviews[name] = view
- names[n] = registerautoprefix(name)
- doview = true
- else
- usedviews[name] = view
- doview = true
+ if name then
+ local used = usedviews[name]
+ if used and used ~= true then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ local used = usedinternals[name]
+ usedviews[name] = view
+ names[n] = registerautoprefix(name)
+ doview = true
+ else
+ usedviews[name] = view
+ doview = true
+ end
end
end
else
for n=1,#names do
local name = names[n]
- if usedviews[name] then
- -- already done, maybe a warning
- elseif type(name) == "number" then
- if noview then
- usedviews[name] = view
- names[n] = false
- else
- local used = usedinternals[name]
- if used and used ~= defaultview then
+ if name then
+ if usedviews[name] then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ if noview then
usedviews[name] = view
- names[n] = registerautoprefix(name)
- doview = true
- else
names[n] = false
+ else
+ local used = usedinternals[name]
+ if used and used ~= defaultview then
+ usedviews[name] = view
+ names[n] = registerautoprefix(name)
+ doview = true
+ else
+ names[n] = false
+ end
end
+ else
+ usedviews[name] = view
+ doview = true
end
- else
- usedviews[name] = view
- doview = true
end
end
end
@@ -634,20 +641,95 @@ end
-- annotations
-local function pdffilelink(filename,destination,page,actions)
- if not filename or filename == "" or file.basename(filename) == tex.jobname then
- return false
- end
- filename = file.addsuffix(filename,"pdf")
- if (not destination or destination == "") or (references.outermethod == v_page) then
- destination = pdfarray { (page or 1) - 1, pdf_fit }
+local pdffilelink do
+
+ local valid = table.setmetatableindex(function(t,filename)
+ local found = false
+ if lfs.isfile(filename) then
+ report_destinations("loading destinations from file %a",filename)
+ local pdffile = lpdf.epdf.load(filename)
+ if pdffile then
+ local pages = pdffile.pages
+ local nofpages = pdffile.nofpages
+ local destinations = pdffile.destinations
+ if pages and nofpages > 0 and destinations then
+ local reverse = swapped(pages)
+ local total = 0
+ found = { }
+ for k, v in next, destinations do
+ local D = v.D
+ if D then
+ found[k] = reverse[D[1]]
+ total = total + 1
+ end
+ end
+ t[filename] = found
+ report_destinations("%i destinations on %i pages found",total,nofpages)
+ end
+ end
+ end
+ return found
+ end)
+
+ local pagefromhash = structures.references.pagefromhash
+
+ pdffilelink = function(filename,destination,page,actions)
+ if not filename or filename == "" or file.basename(filename) == tex.jobname then
+ return false
+ end
+ filename = file.addsuffix(filename,"pdf")
+ -- page auto name
+ local forcepage = false
+ if not destination or destination == "" then
+ forcepage = true
+ elseif references.outermethod == v_page then
+ if not page then
+ local hash = valid[filename]
+ page = hash and hash[destination]
+ if not page or trace_externals then
+ report_destinations("no %s destination %a in file %a","page",destination,filename)
+ end
+ end
+ forcepage = true
+ else -- name or auto, maybe only check with auto
+ local hash = valid[filename]
+ if hash then
+ local p = nil
+ p, destination = pagefromhash(hash,destination,page,actions)
+ if p then
+ if references.outermethod == v_name then
+ -- keep destination string
+ elseif page then
+ if p ~= page then
+ report_destinations("page %i for destination %a in %a conflicts, %i expected",page,destination,filename,p)
+ page = p
+ end
+ forcepage = true
+ elseif p then
+ page = p
+ forcepage = true
+ end
+ else
+ if not page or trace_externals then
+ report_destinations("no %s destination %a in file %a","name",destination,filename)
+ end
+ forcepage = true
+ end
+ -- else
+ -- keep destination string
+ end
+ end
+ if forcepage then
+ destination = pdfarray { (page or 1) - 1, pdf_fit }
+ end
+ return pdfdictionary {
+ S = pdf_gotor, -- can also be pdf_launch
+ F = filename,
+ D = destination or defaultdestination,
+ NewWindow = actions.newwindow and true or nil,
+ }
end
- return pdfdictionary {
- S = pdf_gotor, -- can also be pdf_launch
- F = filename,
- D = destination or defaultdestination,
- NewWindow = actions.newwindow and true or nil,
- }
+
end
local untex = references.urls.untex
@@ -725,6 +807,7 @@ lpdf.action = pdfaction
function codeinjections.prerollreference(actions) -- share can become option
if actions then
+-- inspect(actions)
local main, n = pdfaction(actions)
if main then
local bs, bc = pdfborder()
@@ -980,6 +1063,9 @@ runners["outer"] = function(var,actions)
end
runners["outer with inner"] = function(var,actions)
+ if var.r then
+ actions.realpage = var.r
+ end
return pdffilelink(references.checkedfile(var.outer),var.inner,var.r,actions)
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt
index c241ccdb72a..e7dc663d6f0 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt
@@ -67,6 +67,7 @@ local zlibcompress = xzip.compress
local zlibdecompress = xzip.decompress
local trace = false
+local cleanvirtual = resolvers.cleaners.virtual -- false -- for now
local report_jpg = logs.reporter("graphics","jpg")
local report_jp2 = logs.reporter("graphics","jp2")
@@ -74,6 +75,8 @@ local report_png = logs.reporter("graphics","png")
trackers.register("graphics.backend", function(v) trace = v end)
+directives.register("graphics.cleanvirtuals", function(v) cleanvirtual = v and resolvers.cleaners.virtual or false end)
+
local injectors = { }
lpdf.injectors = injectors
@@ -158,6 +161,9 @@ do
if trace then
report_jpg("%s: width %i, height %i, colordepth %i, size %i",filename,xsize,ysize,colordepth,#content)
end
+ if cleanvirtual then
+ cleanvirtual(filename)
+ end
return createimage {
bbox = { 0, 0, specification.width/xsize, specification.height/ysize }, -- mandate
transform = specification.transform,
@@ -197,6 +203,9 @@ do
if trace then
report_jp2("%s: width %i, height %i, size %i",filename,xsize,ysize,#content)
end
+ if cleanvirtual then
+ cleanvirtual(filename)
+ end
return createimage {
bbox = { 0, 0, specification.width/xsize, specification.height/ysize }, -- mandate
transform = specification.transform,
@@ -1211,6 +1220,9 @@ do
end
local width = specification.width or xsize * 65536
local height = specification.height or ysize * 65536
+ if cleanvirtual then
+ cleanvirtual(filename)
+ end
return createimage {
bbox = { 0, 0, width/xsize, height/ysize }, -- mandate
transform = specification.transform,
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
index f443632b82b..7f3e53f285a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -38,6 +38,7 @@ local formatters, splitupstring = string.formatters, string.splitup
local concat, sortedhash = table.concat, table.sortedhash
local setmetatableindex = table.setmetatableindex
local loaddata = io.loaddata
+local ceil = math.ceil
local bpfactor <const> = number.dimenfactors.bp
@@ -2272,11 +2273,16 @@ end
}
end
if xformtype == 0 or xformtype == 1 or xformtype == 3 then
+-- wrapper.BBox = pdfarray {
+-- -margin * bpfactor,
+-- -margin * bpfactor,
+-- (boundingbox[3] + margin) * bpfactor,
+-- (boundingbox[4] + margin) * bpfactor,
wrapper.BBox = pdfarray {
- -margin * bpfactor,
- -margin * bpfactor,
- (boundingbox[3] + margin) * bpfactor,
- (boundingbox[4] + margin) * bpfactor,
+ -ceil( margin * bpfactor),
+ -ceil( margin * bpfactor),
+ ceil((boundingbox[3] + margin) * bpfactor),
+ ceil((boundingbox[4] + margin) * bpfactor),
}
end
if xformtype == 0 or xformtype == 2 or xformtype == 3 then
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt
index 68712d58d9d..4e5d73e0467 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt
@@ -67,7 +67,6 @@ local lpdf = lpdf
local lpdf_epdf = { }
lpdf.epdf = lpdf_epdf
-local pdfopen = pdfe.open
local pdfopenfile = pdfe.openfile
local pdfnew = pdfe.new
local pdfclose = pdfe.close
@@ -540,10 +539,9 @@ function lpdf_epdf.load(filename,userpassword,ownerpassword,fromstring)
local __file__
if fromstring then
__data__ = pdfnew(filename,#filename)
- elseif pdfopenfile then
- __data__ = pdfopenfile(ioopen(filename,"rb"))
else
- __data__ = pdfopen(filename)
+ local f = ioopen(filename,"rb")
+ __data__ = f and pdfopenfile(f)
end
if __data__ then
if userpassword and getstatus(__data__) < 0 then
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt
index 4efa17bb0bc..ce90488bd44 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt
@@ -21,7 +21,7 @@ local ruleactions = nuts.rules.ruleactions
local getwhd = nuts.getwhd
-local lefttoright_code = nodes.dirvalues.lefttoright
+local lefttoright_code = tex.directioncodes.lefttoright
local mpcolor = attributes.colors.mpcolor
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt
index e147c796fe0..aec12b22f85 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt
@@ -346,7 +346,8 @@ local function setupidentity()
pdfaddtoinfo("ConTeXt.Jobname",jobname)
end
--
- pdfaddtoinfo("ConTeXt.Url","www.pragma-ade.com")
+ -- pdfaddtoinfo("ConTeXt.Url","www.pragma-ade.com")
+ pdfaddtoinfo("ConTeXt.Url","github.com/contextgarden/context")
pdfaddtoinfo("ConTeXt.Support","contextgarden.net")
pdfaddtoinfo("TeX.Support","tug.org")
--
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt
index 744d12e279a..1726f1e5a63 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt
@@ -12,20 +12,16 @@ local collectgarbage, type, next = collectgarbage, type, next
local round = math.round
local sortedhash, sortedkeys, tohash = table.sortedhash, table.sortedkeys, table.tohash
---[[ldx--
-<p>Callbacks are the real asset of <l n='luatex'/>. They permit you to hook
-your own code into the <l n='tex'/> engine. Here we implement a few handy
-auxiliary functions.</p>
---ldx]]--
+-- Callbacks are the real asset of LuaTeX. They permit you to hook your own code
+-- into the TeX engine. Here we implement a few handy auxiliary functions. Watch
+-- out, there are diferences between LuateX and LuaMetaTeX.
callbacks = callbacks or { }
local callbacks = callbacks
---[[ldx--
-<p>When you (temporarily) want to install a callback function, and after a
-while wants to revert to the original one, you can use the following two
-functions. This only works for non-frozen ones.</p>
---ldx]]--
+-- When you (temporarily) want to install a callback function, and after a while
+-- wants to revert to the original one, you can use the following two functions.
+-- This only works for non-frozen ones.
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
@@ -47,13 +43,12 @@ local list = callbacks.list
local permit_overloads = false
local block_overloads = false
---[[ldx--
-<p>By now most callbacks are frozen and most provide a way to plug in your own code. For instance
-all node list handlers provide before/after namespaces and the file handling code can be extended
-by adding schemes and if needed I can add more hooks. So there is no real need to overload a core
-callback function. It might be ok for quick and dirty testing but anyway you're on your own if
-you permanently overload callback functions.</p>
---ldx]]--
+-- By now most callbacks are frozen and most provide a way to plug in your own code.
+-- For instance all node list handlers provide before/after namespaces and the file
+-- handling code can be extended by adding schemes and if needed I can add more
+-- hooks. So there is no real need to overload a core callback function. It might be
+-- ok for quick and dirty testing but anyway you're on your own if you permanently
+-- overload callback functions.
-- This might become a configuration file only option when it gets abused too much.
@@ -171,12 +166,15 @@ function callbacks.known(name)
end
function callbacks.report()
+ local usage = list_callbacks()
for name, _ in sortedhash(list) do
local str = frozen[name]
+ local sta = state(name)
+ local use = usage[name] and "+" or "-"
if str then
- report_callbacks("%s: %s -> %s",state(name),name,str)
+ report_callbacks("%-9s : %s : %-22s -> %s",sta,use,name,str)
else
- report_callbacks("%s: %s",state(name),name)
+ report_callbacks("%-9s : %s : %-22s", sta,use,name)
end
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt
index ea9eb0d8937..5859411731a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt
@@ -60,7 +60,7 @@ function texconfig.init()
-- not in luametatex
"unicode", "utf", "gzip", "zip", "zlib",
-- in luametatex
- "xzip", "xmath", "xcomplex", "xdecimal", "basexx",
+ "xzip", "xmath", "xcomplex", "xdecimal", "basexx", "posit",
-- maybe some day in luametatex
"lz4", "lzo",
-- always (mime can go)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl b/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl
index ed4a1398119..322076aa140 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl
@@ -42,7 +42,7 @@
\toksapp \everydump {%
\permanent\let\ctxlatelua \latelua
\permanent\def\ctxlatecommand#1{\latelua{commands.#1}}%
- \aliased\let\lateluacode \ctxlatelua
+ \aliased\let\lateluacode \ctxlatelua
} % no \appendtoks yet
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt
index 3202ea42b1a..56e3bd1c18d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt
@@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luat-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>We cannot load anything yet. However what we will do us reserve a few tables.
-These can be used for runtime user data or third party modules and will not be
-cluttered by macro package code.</p>
---ldx]]--
+-- We cannot load anything yet. However what we will do us reserve a few tables.
+-- These can be used for runtime user data or third party modules and will not be
+-- cluttered by macro package code.
userdata = userdata or { } -- for users (e.g. functions etc)
thirddata = thirddata or { } -- only for third party modules
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl b/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl
index cb161cafa7c..d701fd2937e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl
@@ -34,7 +34,7 @@
\registerctxluafile{util-sta}{}
-\registerctxluafile{util-sbx}{} % needs tracker and templates
+\registerctxluafile{util-sbx}{autosuffix} % needs tracker and templates
\registerctxluafile{util-soc-imp-reset} {}
\registerctxluafile{util-soc-imp-socket} {}
@@ -66,7 +66,7 @@
\registerctxluafile{data-dec}{}
\registerctxluafile{data-tar}{}
%registerctxluafile{data-crl}{}
-\registerctxluafile{data-sch}{}
+\registerctxluafile{data-sch}{autosuffix}
\registerctxluafile{data-tre}{}
\registerctxluafile{data-lua}{}
\registerctxluafile{data-ctx}{}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt
index f6b2ea06368..7796bb4b924 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt
@@ -156,10 +156,10 @@ appendaction(wrapupactions,"system",synctex.wrapup)
-- this can be done later
-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("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("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump
-callbacks.register('wrapup_run', wrapup_run, "actions performed after closing files")
+callbacks.register("wrapup_run", wrapup_run, "actions performed after closing files")
-- an example:
@@ -201,8 +201,6 @@ local report_open = logs.reporter("open source")
local report_close = logs.reporter("close source")
local report_load = logs.reporter("load resource")
-local register = callbacks.register
-
local level = 0
local total = 0
local stack = { }
@@ -211,56 +209,57 @@ function luatex.currentfile()
return stack[#stack] or tex.jobname
end
+function luatex.currentlevel()
+ return level
+end
+
+function luatex.currenttotal()
+ return total
+end
+
+local enabled = true directives.register("system.reportfiles", function(v) enabled = v end)
+
local function report_start(name,rest)
- if rest then
- -- luatex
- if name ~= 1 then
+ if enabled then
+ if rest then
+ -- luatex
+ if name ~= 1 then
+ insert(stack,false)
+ return
+ end
+ name = rest
+ end
+ if find(name,"virtual://",1,true) then
insert(stack,false)
- return
+ else
+ insert(stack,name)
+ total = total + 1
+ level = level + 1
+ -- report_open("%i > %i > %s",level,total,name or "?")
+ report_open("level %i, order %i, name %a",level,total,name or "?")
+ synctex.setfilename(name)
end
- name = rest
- end
- if find(name,"virtual://",1,true) then
- insert(stack,false)
- else
- insert(stack,name)
- total = total + 1
- level = level + 1
- -- report_open("%i > %i > %s",level,total,name or "?")
- report_open("level %i, order %i, name %a",level,total,name or "?")
- synctex.setfilename(name)
end
end
local function report_stop()
- local name = remove(stack)
- if name then
- -- report_close("%i > %i > %s",level,total,name or "?")
- report_close("level %i, order %i, name %a",level,total,name or "?")
- level = level - 1
- name = stack[#stack]
--- synctex.setfilename(stack[#stack] or tex.jobname)
+ if enabled then
+ local name = remove(stack)
if name then
- synctex.setfilename(name)
+ -- report_close("%i > %i > %s",level,total,name or "?")
+ report_close("level %i, order %i, name %a",level,total,name or "?")
+ level = level - 1
+ name = stack[#stack]
+ -- synctex.setfilename(stack[#stack] or tex.jobname)
+ if name then
+ synctex.setfilename(name)
+ end
end
end
end
-local function report_none()
-end
-
-register("start_file",report_start)
-register("stop_file", report_stop)
-
-directives.register("system.reportfiles", function(v)
- if v then
- register("start_file",report_start)
- register("stop_file", report_stop)
- else
- register("start_file",report_none)
- register("stop_file", report_none)
- end
-end)
+callbacks.register("start_file",report_start,"report opening of a file")
+callbacks.register("stop_file", report_stop, "report closing of a file")
-- start_run doesn't work
@@ -273,7 +272,7 @@ end)
local report = logs.reporter("csname overload")
local reported = { }
-callback.register("handle_overload", function(fatal,overload,csname,flags)
+callbacks.register("handle_overload", function(fatal,overload,csname,flags)
if not reported[csname] then
logs.newline()
local readstate = status.readstate
@@ -295,7 +294,7 @@ callback.register("handle_overload", function(fatal,overload,csname,flags)
osexit(1)
end
end
-end)
+end,"handle primitive and macro overload protection")
-- bonus
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl
index be249c1f3bd..a185efd124d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl
@@ -83,7 +83,7 @@
\immutable\def\xmltempbuffername{xml-temp}
\permanent\protected\def\prettyprintbuffer#1#2% only used here
- {\ifdefined\scitebuffer
+ {\ifdefined\scitebuffer % we could predefine to relax
\scitebuffer[#2][#1]%
\else
\typebuffer[#1][\c!option=#2]%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
index 49f97ae9c1c..2201ed88635 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
@@ -32,6 +32,49 @@
%D Older implementations are kept in the \MKII\ and \MKIV\ modules for educational
%D purposes.
+%D Only very few fonts provide flat accents but we emulate them for those that don't
+%D have them. We also need to fix the related font parameter for a few fonts like
+%D Lucida and Garamond.
+
+% \startbuffer
+% \im{
+% \dostepwiserecurse{`A}{`Z}{1}{
+% \blackrule[height=\the\Umathflattenedaccentbaseheight\textstyle,depth=0pt,width=0.05ts]
+% \hat{\char#1}
+% }
+% }
+% \stopbuffer
+%
+% \start % TEXpage[offset=1ts]
+% \showglyphs
+% \switchtobodyfont[modern] \getbuffer\par
+% \switchtobodyfont[erewhon] \getbuffer\par
+% \switchtobodyfont[concrete] \getbuffer\par
+% \switchtobodyfont[libertinus] \getbuffer\par
+% \switchtobodyfont[stixtwo] \getbuffer\par
+% \switchtobodyfont[kpfonts] \getbuffer\par
+% \switchtobodyfont[minion] \getbuffer\par
+% \switchtobodyfont[schola] \getbuffer\par
+% \switchtobodyfont[lucida] \getbuffer\par
+% \switchtobodyfont[xcharter] \getbuffer\par
+% \switchtobodyfont[libertinus] \getbuffer\par
+% \switchtobodyfont[termes] \getbuffer\par
+% \stop %TEXpage
+
+% scale:
+%
+% no : only use base
+% yes : use base, variants and extensible, stretch and shrink when set
+% keep : use base, variants and extensible, stretch and shrink when set, but keep base
+%
+% alignsymbol:
+%
+% center when accent is wider than base
+%
+% stretch|shrink:
+%
+% scale accent to fit (base and variants depending on 'scale' value)
+
\installcorenamespace{mathaccents}
\installcommandhandler \??mathaccents {mathaccent} \??mathaccents
@@ -43,7 +86,10 @@
\c!bottom=,
\c!mathstyle=,
\c!color=,
- \c!stretch=\v!no,
+ \c!scale=\v!no,
+ \c!alignsymbol=\v!yes,
+ %\c!stretch=\v!no,
+ %\c!shrink=\v!no,
\c!define=\v!yes] % not used
\definemathaccent
@@ -92,23 +138,51 @@
\installlocalcurrenthandler \??mathaccents {mathaccent}
+%D \starttyping
+%D \im { \showboxes \showglyphs
+%D \hat{\tilde{\dot{x}}}
+%D }
+%D \im { \showboxes \showglyphs
+%D \hat[align=middle]{\tilde[align=middle]{\dot{x}}}
+%D }
+%D \stoptyping
+
\tolerant\protected\def\math_accent_make_double#class#kind#top#bottom#*[#settings]#:#content%
{\beginmathgroup
\setlocalmathaccentcurrent{#class}% \edef\currentmathaccent{#class}%
\startusemathstyleparameter\mathaccentparameter\c!mathstyle
\setupcurrentmathaccent[#settings]%
- \edef\m_fixed{\ifcstok{\mathaccentparameter\c!stretch}\v!yes\else\s!fixed\fi}%
+ \edef\p_scale{\mathaccentparameter\c!scale}%
+ \ifx\p_scale\v!keep
+ \lettonothing\m_fixed
+ \orelse\ifx\p_scale\v!yes
+ \lettonothing\m_fixed
+ \else
+ \let\m_fixed\s!fixed
+ \fi
\Umathaccent
\usedcolorparameterattributes{\mathaccentparameter\c!color}%
- % nooverflow % there is never na overflow anyway but we do accept thekey
+ % nooverflow % there is never na overflow anyway but we do accept the key
+ \ifcstok{\mathaccentparameter\c!align }\v!middle\s!center \space\fi
+ \ifcstok{\mathaccentparameter\c!stretch}\v!yes \s!stretch\space\fi
+ \ifcstok{\mathaccentparameter\c!shrink }\v!yes \s!shrink \space\fi
+ \ifx\p_scale\v!keep
+ \s!keepbase\space
+ \fi
+ \ifcstok{\mathaccentparameter\c!alignsymbol}\v!yes
+ \s!nooverflow\space
+ \fi
\ifcase#kind\or
- top \m_fixed
+ \s!top\space
+ \m_fixed
\fam\zerocount#top
\or
- bottom \m_fixed
+ \s!bottom\space
+ \m_fixed
\fam\zerocount#bottom
\or
- both \m_fixed
+ \s!both\space
+ \m_fixed
\fam\zerocount#bottom
\fam\zerocount#top
\fi
@@ -135,7 +209,7 @@
\pushoverloadmode
% These retain the given unicode values ... but can stretch when configured
-% to do so: \setupmathaccent[\v!top][\c!stretch=\v!yes]
+% to do so: \setupmathaccent[\v!top][\c!scale=\v!yes]
% Extended/modified below
%
@@ -155,7 +229,7 @@
\definemathtopaccent[\v!top][acute] ["0301]
\definemathtopaccent[\v!top][hat] ["0302]
\definemathtopaccent[\v!top][tilde] ["0303]
-\definemathtopaccent[\v!top][bar] ["0304]
+\definemathtopaccent[\v!top][bar] ["0305]
%definemathtopaccent[\v!top][overbar] ["0305]% We expect overbar to stretch, so later
\definemathtopaccent[\v!top][breve] ["0306]
\definemathtopaccent[\v!top][dot] ["0307]
@@ -170,8 +244,8 @@
%definemathtopaccent[\v!top][overturnedcomma] ["0312]
%definemathtopaccent[\v!top][overcommatopright] ["0315]
%definemathtopaccent[\v!top][leftangleabove] ["031A]
-\definemathtopaccent[\v!top][leftharpoonaccent] ["20D0]
-\definemathtopaccent[\v!top][rightharpoonaccent] ["20D1]
+\definemathtopaccent[\v!top][overleftharpoon] ["20D0]
+\definemathtopaccent[\v!top][overrightharpoon] ["20D1]
%definemathtopaccent[\v!top][verticaloverlayaccent]["20D2]
%definemathtopaccent[\v!top][vec] ["20D7]% We expect vec to stretch, so later
\definemathtopaccent[\v!top][dddot] ["20DB]
@@ -189,17 +263,17 @@
\definemathaccent
[\v!top:\v!stretch]
[\v!top]
- [\c!stretch=\v!yes]
+ [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
\definemathaccent
[\v!bottom:\v!stretch]
[\v!bottom]
- [\c!stretch=\v!yes]
+ [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
\definemathaccent
[\v!both:\v!stretch]
[\v!both]
- [\c!stretch=\v!yes]
+ [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
%D We have a problem. We can use stackers but then we need to adapt the dimensions
%D which is font dependent. So, for now we keep them as accents.
@@ -208,7 +282,7 @@
\definemathtopaccent[\v!top:\v!stretch][wideacute]["0301]
\definemathtopaccent[\v!top:\v!stretch][widehat] ["0302]
\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303]
-\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]%or 305
+\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]% (not 304, the caret)
\definemathtopaccent[\v!top:\v!stretch][widebreve]["0306]
\definemathtopaccent[\v!top:\v!stretch][widedot] ["0307]
\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308]
@@ -220,17 +294,17 @@
\definemathtopaccent[\v!top:\v!stretch][wideoverleftharpoon] ["20D0]
\definemathtopaccent[\v!top:\v!stretch][wideoverrightharpoon] ["20D1]
-\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6]
-\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7]
+\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6]
+\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7]
\definemathtopaccent[\v!top:\v!stretch][wideoverleftrightarrow]["20E1]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde]["0330]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar]["0332]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon]["20EC]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon]["20ED]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow]["20EE]
-\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow]["20EF]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde] ["0330]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar] ["0332]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D] % weird code
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon] ["20EC]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon] ["20ED]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow] ["20EE]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow] ["20EF]
\aliased\let\mathring\ring % for a while
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
index a6614aaa508..ee9e56f8fab 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
@@ -18,6 +18,7 @@ local type, next, tonumber = type, next, tonumber
local fastcopy, copytable, insert, remove, concat = table.fastcopy, table.copy, table.insert, table.remove, table.concat
local formatters = string.formatters
local byte = string.byte
+local max = math.max
local setmetatableindex, sortedkeys, sortedhash = table.setmetatableindex, table.sortedkeys, table.sortedhash
local lpegmatch = lpeg.match
@@ -45,13 +46,18 @@ local blocks = characters.blocks
local stepper = utilities.parsers.stepper
local helpers = fonts.helpers
-local upcommand = helpers.commands.up
-local downcommand = helpers.commands.down
-local rightcommand = helpers.commands.right
-local leftcommand = helpers.commands.left
-local charcommand = helpers.commands.char
local prependcommands = helpers.prependcommands
+local vfcommands = helpers.commands
+local upcommand = vfcommands.up
+local downcommand = vfcommands.down
+local rightcommand = vfcommands.right
+local leftcommand = vfcommands.left
+local slotcommand = vfcommands.slot
+local charcommand = vfcommands.char
+local push = vfcommands.push
+local pop = vfcommands.pop
+
local sequencers = utilities.sequencers
local appendgroup = sequencers.appendgroup
local appendaction = sequencers.appendaction
@@ -290,7 +296,7 @@ local function report_tweak(fmt,target,original,...)
metadata and metadata.fontname or "unknown",
parameters.size or 655360,
parameters.mathsize or 1,
- string.formatters[fmt](...)
+ formatters[fmt](...)
)
else
print("something is wrong")
@@ -427,6 +433,8 @@ local detail do
return nxt
end
end
+ elseif list == "flataccent" then
+ return c.flataccent
end
end
end
@@ -527,7 +535,7 @@ do
k = mathgaps[k] or k
local character = targetcharacters[k]
if character then
--- if not character.tweaked then -- todo: add a force
+ -- if not character.tweaked then -- todo: add a force
local t = type(v)
if t == "number" then
v = list[v]
@@ -660,7 +668,7 @@ do
else
report_mathtweak("invalid dimension entry %U",k)
end
--- character.tweaked = true
+ -- character.tweaked = true
if v.all then
local nxt = character.next
if nxt then
@@ -674,7 +682,7 @@ do
end
end
end
--- end
+ -- end
else
report_tweak("no character %U",target,original,k)
end
@@ -1303,6 +1311,7 @@ do
else
c.width = width
end
+c.bottomanchor = width/2 -- maybe optional
end
if italic then
c.italic = nil
@@ -1343,8 +1352,9 @@ do
end
end
end
- return
- elseif not list or list == "all" or list == true or parameters.all then
+ goto done
+ end
+ if not list or list == "all" or list == true or parameters.all then
list = sortedkeys(targetcharacters)
elseif type(list) == "string" then
list = { list }
@@ -1371,6 +1381,7 @@ do
end
end
end
+ ::done::
feedback_tweak(whatever,target,original,done)
end
@@ -1695,7 +1706,8 @@ do
accent = {
[0x0300] = over, -- widegrave
[0x0308] = over, -- wideddot
- [0x0304] = over, -- widebar
+ [0x0304] = over, -- macron (bar)
+ [0x0305] = over, -- widebar
[0x0301] = over, -- wideacute
[0x0302] = over, -- widehat
[0x030C] = over, -- widecheck
@@ -1710,7 +1722,7 @@ do
datasets.accentdimensions = candidates
local function adapt(c,factor,baseheight,basedepth)
--- if not c.tweaked then
+ if not c.tweaked then
local height = c.height or 0
local depth = c.depth or 0
local yoffset = 0
@@ -1736,8 +1748,8 @@ do
c.yoffset = yoffset ~= 0 and yoffset or nil
c.height = height > 0 and height or nil
c.depth = depth > 0 and depth or nil
--- c.tweaked = true
--- end
+ c.tweaked = true
+ end
end
local function process(target,original,characters,list,baseheight,basedepth)
@@ -1806,46 +1818,18 @@ end
do
- local addprivate = fonts.helpers.addprivate
- local privateslot = fonts.helpers.privateslot
-
- -- function mathtweaks.addrules(target,original,parameters)
- -- local characters = target.characters
- -- local height = target.mathparameters.OverbarRuleThickness
- -- local depth = target.mathparameters.UnderbarRuleThickness
- -- local width = target.parameters.emwidth/2
- -- local step = 0.8 * width
- -- characters[0x203E] = { -- over
- -- width = width,
- -- height = height,
- -- depth = 0,
- -- unicode = 0x203E,
- -- commands = { { "rule", height, width } },
- -- parts = {
- -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 },
- -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 },
- -- }
- -- }
- -- characters[0x0332] = { -- under
- -- width = width,
- -- height = 0,
- -- depth = depth,
- -- yoffset = -depth,
- -- unicode = 0x0332,
- -- commands = { { "rule", height, width } },
- -- parts = {
- -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 },
- -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 },
- -- }
- -- }
- -- end
+ local addprivate = fonts.helpers.addprivate
+ local privateslot = fonts.helpers.privateslot
+ local newprivateslot = fonts.helpers.newprivateslot
function mathtweaks.addrules(target,original,parameters)
local characters = target.characters
local thickness = target.mathparameters.OverbarRuleThickness
local width = target.parameters.emwidth / 2
- local step = 0.8 * width
- characters[0x203E] = { -- over
+ local width = target.parameters.emwidth / 3
+-- local step = 0.8 * width
+ local step = 0.5 * width
+ characters[0x203E] = { -- middle used for all kind
width = width,
height = thickness / 2,
depth = thickness / 2,
@@ -1858,8 +1842,43 @@ do
},
partsorientation = "horizontal",
}
- --
- characters[0x0332] = characters[0x203E]
+ local function build(target,leftarrow,rightarrow)
+ if leftarrow and rightarrow then
+ -- actually the same sort of code as we have for antykwa
+ local left = leftarrow.parts
+ local right = rightarrow.parts
+ if left and right then
+ local leftline = right[1].glyph
+ local rightline = left [#left].glyph
+ local leftdata = characters[leftline]
+ local rightdata = characters[rightline]
+ local leftwidth = leftdata.width
+ local rightwidth = rightdata.width
+ local result = characters[target] -- copytable(leftdata)
+ if not result or result.width == 0 then
+ result = {
+ height = leftdata.height,
+ depth = leftdata.depth,
+ width = 0.9*leftwidth + rightwidth,
+ unicode = target,
+ commands = {
+ slotcommand[0][leftline],
+ leftcommand[0.1*leftwidth],
+ slotcommand[0][rightline],
+ },
+ }
+ characters[target] = result
+ end
+ result.parts = {
+ { advance = leftwidth, glyph = leftline, ["end"] = .9*leftwidth, start = 0 },
+ { advance = rightwidth, glyph = rightline, ["end"] = .1*leftwidth, start = .9*rightwidth, extender = 1 },
+ }
+ result.partsorientation = "horizontal"
+ end
+ end
+ end
+ build(0x305,characters[0x20D6],characters[0x20D7]) -- overbar accent
+ build(0x332,characters[0x20EE],characters[0x20EF]) -- underbar accent
--
-- lucida lacks them ...
--
@@ -1875,11 +1894,16 @@ do
commands = { { "rule", thickness * 2.5, thickness } },
})
characters[0x23B4] = { -- over
- width = width,
+-- width = width,
+ width = 2*thickness+width,
height = half,
depth = double,
unicode = 0x23B4,
- commands = { { "rule", thickness, width } },
+ commands = {
+ slotcommand[0][tpiece],
+ slotcommand[0][0x203E],
+ slotcommand[0][tpiece],
+ },
parts = {
{ advance = thickness, glyph = tpiece, ["end"] = 0, start = half },
{ advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
@@ -1896,12 +1920,16 @@ do
yoffset = - half,
commands = { { "rule", thickness * 2.5, thickness } },
})
- characters[0x23B5] = { -- over
- width = width,
+ characters[0x23B5] = { -- under
+ width = 2*thickness+width,
height = double,
depth = half,
unicode = 0x23B5,
- commands = { { "rule", thickness, width } },
+ commands = {
+ slotcommand[0][bpiece],
+ slotcommand[0][0x203E],
+ slotcommand[0][bpiece],
+ },
parts = {
{ advance = thickness, glyph = bpiece, ["end"] = 0, start = half },
{ advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
@@ -1913,10 +1941,216 @@ do
--
end
+ -- vfmath.builders.extension(target)
+
+ local rbe = newprivateslot("radical bar extender")
+ local fbe = newprivateslot("fraction bar extender")
+
+ local frp = {
+ newprivateslot("flat rule left piece"),
+ newprivateslot("flat rule middle piece"),
+ newprivateslot("flat rule right piece"),
+ }
+
+ local rrp = {
+ newprivateslot("radical rule left piece"),
+ newprivateslot("radical rule middle piece"),
+ newprivateslot("radical rule right piece"),
+ }
+
+ local mrp = {
+ newprivateslot("minus rule left piece"),
+ newprivateslot("minus rule middle piece"),
+ newprivateslot("minus rule right piece"),
+ }
+
+ local function useminus(target,unicode,characters,parameters,skipfirst,what,tounicode)
+ local minus = characters[0x2212]
+ local parts = minus.parts
+ if parameters == true then
+ parameters = { }
+ end
+ if parts then
+ what = copytable(what)
+ parts = copytable(parts)
+ local xscale = parameters.xscale or 1 -- why not applied to width ?
+ local yscale = parameters.yscale or 1
+ local mwidth = minus.width
+ local mheight = minus.height
+ local height = (parameters.height or 1) * mheight
+ local yshift = (parameters.yoffset or 0) * mheight
+ local loverlap = parameters.leftoverlap or 0
+ local roverlap = parameters.rightoverlap or 0
+ local loffset = parameters.leftoffset or 0
+ local roffset = parameters.rightoffset or 0
+ if skipfirst then
+ remove(parts,1)
+ remove(what,1)
+ end
+ height = height / 2
+ yshift = yshift + height
+ for i=1,#parts do
+ local part = parts[i]
+ local glyph = part.glyph
+ local gdata = characters[glyph]
+ local width = gdata.width
+ local xshift = 0
+ if i == 1 and loverlap ~= 0 then
+ xshift = loverlap * width
+ width = width - xshift
+ elseif i == #parts and roverlap ~= 0 then
+ width = width + roverlap * width
+ end
+ characters[what[i]] = {
+ height = height,
+ depth = height,
+ width = width,
+ advance = gdata.width,
+ commands = {
+ leftcommand[xshift],
+ downcommand[yshift],
+ { "slot", 0, glyph, xscale, yscale },
+ },
+ }
+if part["start"] >= width then
+ part["start"] = width
+end
+if part["end"] >= width then
+ part["end"] = width
+end
+part.advance = width
+ part.glyph = what[i]
+ end
+ xshift = loffset * mwidth + loverlap * mwidth
+ width = mwidth - xshift - roffset * mwidth - roverlap * mwidth
+ characters[unicode] = {
+ -- base character
+ height = height,
+ depth = height,
+ width = width,
+ commands = {
+ leftcommand[xshift],
+ downcommand[yshift],
+ { "slot", 0, 0x2212, xscale, yscale },
+ },
+ unicode = tounicode or unicode,
+ -- extensibles
+ parts = parts,
+ partsorientation = "horizontal",
+ }
+ end
+ end
+
+ -- add minus parts of not there and create clipped clone
+
+ local function checkminus(target,unicode,characters,parameters,skipfirst,what,tounicode)
+ local minus = characters[unicode]
+ local parts = minus.parts
+ if parameters == true then
+ parameters = { }
+ end
+ local p_normal = 0
+ local p_flat = 0
+ local mwidth = minus.width
+ local height = minus.height
+ local depth = minus.depth
+ local loffset = parameters.leftoffset or 0
+ local roffset = parameters.rightoffset or 0
+ local lshift = mwidth * loffset
+ local rshift = mwidth * roffset
+ local width = mwidth - lshift - rshift
+ if parts then
+ -- print("minus has parts")
+ if lshift ~= 0 or width ~= mwidth then
+ parts = copytable(parts)
+ for i=1,#parts do
+ local part = parts[i]
+ local glyph = part.glyph
+ local gdata = characters[glyph]
+ local width = gdata.width
+ local advance = part.advance
+ local lshift = 0
+ if i == 1 and left ~= 0 then
+ lshift = loffset * width
+ width = width - lshift
+ advance = advance - lshift
+ elseif i == #parts and roffset ~= 0 then
+ width = width - rshift
+ advance = advance - rshift
+ end
+ characters[what[i]] = {
+ height = height,
+ depth = depth,
+ width = width,
+ commands = {
+ leftcommand[lshift],
+ slotcommand[0][glyph],
+-- { "offset", lshift, 0, glyph },
+ },
+ }
+ part.glyph = what[i]
+ part.advance = advance
+ end
+ minus.parts = parts
+ minus.partsorientation = "horizontal"
+
+ end
+ else
+ local f_normal = formatters["M-NORMAL-%H"](unicode)
+ -- local p_normal = hasprivate(main,f_normal)
+ p_normal = addprivate(target,f_normal,{
+ height = height,
+ width = width,
+ commands = {
+ push,
+ leftcommand[lshift],
+ slotcommand[0][unicode],
+ pop,
+-- { "offset", lshift, 0, unicode },
+ },
+ })
+-- local step = width/2
+ local step = .8*width
+ minus.parts = {
+ { extender = 0, glyph = p_normal, ["end"] = step, start = 0, advance = width },
+ { extender = 1, glyph = p_normal, ["end"] = step, start = step, advance = width },
+ { extender = 0, glyph = p_normal, ["end"] = 0, start = step, advance = width },
+ }
+ minus.partsorientation = "horizontal"
+ end
+ minus.unicode = tounicode or unicode
+ end
+
+ function mathtweaks.replacerules(target,original,parameters)
+ local characters = target.characters
+ local minus = parameters.minus
+ local fraction = parameters.fraction
+ local radical = parameters.radical
+ local stacker = parameters.stacker
+ if minus then
+ checkminus(target,0x2212,characters,minus,false,mrp)
+ end
+ if fraction then
+ useminus(target,fbe,characters,fraction,false,frp,0x2044) -- division slash
+ end
+ if radical then
+if not characters[rbe] then
+ local skipfirst = true
+ if radical.skipfirst == false then -- explicit
+ skipfirst = false
+ end
+ useminus(target,rbe,characters,radical,skipfirst,rrp,0x2061) -- apply function
+end
+ end
+ if stacker then
+ useminus(target,0x203E,characters,stacker,false,frp)
+ end
+ end
+
local force = false experiments.register("math.arrows", function(v) force = v end)
local function tighten(target,unicode,left,right,squeeze,yoffset)
- local name = string.formatters["math tightened %U %.3N %.3N %.3N %.3N"](unicode,left,right,squeeze,yoffset)
+ local name = formatters["math tightened %U %.3N %.3N %.3N %.3N"](unicode,left,right,squeeze,yoffset)
local slot = privateslot(target,name)
if not slot then
local characters = target.characters
@@ -1947,7 +2181,7 @@ do
if chardata and (force or overloads[unicode] == false or not chardata.parts) then
if not list then
-- chardata.parts = nil -- when we test
- chardata.parts = { { glyph = unicode } }
+-- chardata.parts = { { glyph = unicode } }
else
local overload = overloads[unicode]
local parts = { }
@@ -1982,7 +2216,8 @@ do
end
end
if #parts == #list then
- chardata.parts = parts
+ chardata.parts = parts
+ chardata.partsorientation = "horizontal"
end
end
end
@@ -2024,6 +2259,7 @@ do
return {
--
[0x002D] = { { left = slack, right = slack, glyph = 0x2212 }, single }, -- rel
+-- [0x2212] = { { left = slack, right = slack, glyph = 0x2212 }, single }, -- rel
--
[0x2190] = leftsingle, -- leftarrow
[0x219E] = leftsingle, -- twoheadleftarrow
@@ -2259,7 +2495,8 @@ do
local function fix(target,original,characters,u,l)
local data = characters[u]
if data then
- data.innerlocation = l.location == "right" and 2 or 1
+ -- data.innerlocation = l.location == "right" and 2 or 1
+ data.innerlocation = l.location == "right" and "right" or "left"
data.innerxoffset = (l.hfactor or 1) * (data.width or 0)
data.inneryoffset = (l.vfactor or 1) * ((data.height or 0) + (data.depth or 0))
end
@@ -2451,17 +2688,18 @@ do -- see pagella for an extensive example
local nps = fonts.helpers.newprivateslot
local mapping = {
- [0x0300] = { 0x0060, false, nps("flat 0x0060 1") },
- [0x0308] = { 0x00A8, false, nps("flat 0x00A8 1") },
- [0x0304] = { 0x00AF, false, nps("flat 0x00AF 1") },
- [0x0301] = { 0x00B4, false, nps("flat 0x00B4 1") },
- [0x0302] = { 0x02C6, true, nps("flat 0x02C6 1") },
- [0x030C] = { 0x02C7, true, nps("flat 0x02C7 1") },
- [0x0306] = { 0x02D8, false, nps("flat 0x02D8 1") },
- [0x0307] = { 0x02D9, false, nps("flat 0x02D9 1") },
- [0x030A] = { 0x02DA, false, nps("flat 0x02DA 1") },
- [0x0303] = { 0x02DC, true, nps("flat 0x02DC 1") },
- [0x20DB] = { 0x20DB, false, nps("flat 0x20DB 1") },
+ [0x0300] = { 0x0060, false },
+ [0x0308] = { 0x00A8, false },
+ [0x0304] = { 0x00AF, false }, -- 305
+ [0x0301] = { 0x00B4, false },
+ [0x0302] = { 0x02C6, true },
+ [0x030C] = { 0x02C7, true },
+ [0x0306] = { 0x02D8, false },
+ [0x0307] = { 0x02D9, false },
+ [0x030A] = { 0x02DA, false },
+ [0x0303] = { 0x02DC, true },
+ [0x20DB] = { 0x20DB, false },
+-- [0x20EF] = { 0x20EF, false },
}
datasets.fixaccents = mapping
@@ -2469,6 +2707,18 @@ do -- see pagella for an extensive example
datasets.flattenaccents = mapping
datasets.copyaccents = mapping
+ -- local flat = stretchingdata.flataccent
+ -- if flat then
+ -- -- Nasty! xoffset needed. Check this when we patch vf.
+ -- local flatdata = characters[flat]
+ -- flatdata.width = width
+ -- flatdata.advance = 0
+ -- flatdata.topanchor = topanchor
+ -- flatdata.xoffset = width + topanchor
+ -- end
+
+local cdata = characters.data
+
function mathtweaks.fixaccents(target,original,parameters)
local characters = target.characters
local done = false
@@ -2476,13 +2726,27 @@ do -- see pagella for an extensive example
local alias = entry[1]
local stretchingdata = characters[stretching]
if stretchingdata and stretchingdata.width == 0 then
+if false then
+ local b = target.descriptions[stretching].boundingbox
+ if b then
+ local llx = b[1] * target.parameters.hfactor
+ local urx = b[3] * target.parameters.hfactor
+ width = urx - llx
+ stretchingdata.width = width
+ stretchingdata.xoffset = - llx
+ stretchingdata.advance = urx
+ stretchingdata.topanchor = width/2
+ stretchingdata.bottomanchor = width/2
+ end
+else
local topanchor = stretchingdata.topanchor or 0
local width = -topanchor
- topanchor = width/2
+ topanchor = width/2
stretchingdata.width = width
stretchingdata.advance = 0
stretchingdata.topanchor = topanchor
stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] }
+end
if not trace_tweaking then
done = true
elseif done then
@@ -2495,6 +2759,56 @@ do -- see pagella for an extensive example
feedback_tweak("fixaccents",target,original,done)
end
+ function mathtweaks.checkaccents(target,original,parameters)
+ local characters = target.characters
+ local done = false
+ local factor = target.parameters.hfactor
+ for unicode, data in sortedhash(characters) do
+ local width = data.width
+ if width == 0 then
+ local d = chardata[data.unicode or unicode]
+ local c = d and d.category
+ if c == "mn" or c == "sk" or c == "lm" then -- we can probably can go
+ local b = target.descriptions[unicode].boundingbox
+ if b then
+ local topanchor = data.topanchor or 0
+ local llx = b[1] * factor
+ local urx = b[3] * factor
+-- if topanchor < 0 then
+if true then
+ -- width = - topanchor
+ width = 2 * (topanchor - llx)
+-- data.commands = {
+-- -- rightcommand[width+width/2],
+-- rightcommand[-llx],
+-- slotcommand[0][unicode]
+-- }
+data.xoffset = -llx
+else
+ width = urx - llx
+ -- data.advance = urx
+ data.commands = {
+ leftcommand[llx],
+ slotcommand[0][unicode]
+ }
+end
+ data.width = width
+ data.topanchor = width/2
+ data.bottomanchor = width/2
+ end
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
+ end
+ end
+ end
+ feedback_tweak("checkaccents",target,original,done)
+ end
+
-- all true|number false
function mathtweaks.extendaccents(target,original,parameters)
@@ -2550,24 +2864,40 @@ do -- see pagella for an extensive example
-- offset factor 0.9|calculated
-- squeeze factor 0.1|calculated
+ local f_flat = formatters["flat accent %05X"]
+
function mathtweaks.flattenaccents(target,original,parameters)
local characters = target.characters
local force = parameters.force
- local squeeze = parameters.squeeze or 0.8
- local ofactor = parameters.offset or (squeeze/2)
- local hfactor = parameters.height or (1 - ofactor)
+ local squeeze = parameters.squeeze or 0.85
+ local ofactor = parameters.offset or (squeeze/8.5)
+ local hfactor = parameters.height or 0.95 -- (1 - ofactor)
local done = false
for stretching, entry in sortedhash(mapping) do
- local last = characters[stretching]
+ local code = stretching
+ local last = characters[stretching]
while last do
if force or not last.flataccent then
- local slot = entry[3]
- local data = copytable(last)
- local height = data.height or 0
- data.effect = { squeeze = squeeze }
- data.height = hfactor * height
- data.yoffset = ofactor * height
- characters[slot] = data
+ local slot = nps(f_flat(code))
+ local height = last.height or 0
+-- print(last.width/65536,code,slot)
+-- data.effect = { squeeze = squeeze }
+characters[slot] = {
+ width = last.width,
+ depth = last.depth,
+ height = last.height * hfactor,
+ topanchor = last.topanchor,
+ bottomanchor = last.bottomanchor,
+ commands = { { "offset", 0, ofactor * height, code, 1, squeeze } },
+-- commands = { slotcommand[0][code] },
+-- effect = { squeeze = squeeze },
+-- next = last.next,
+ unicode = last.unicode,
+}
+-- if code == 770 then
+-- inspect(last)
+-- end
+
last.flataccent = slot
if not trace_tweaking then
done = true
@@ -2577,9 +2907,9 @@ do -- see pagella for an extensive example
done = { [stretching] = true }
end
end
- local n = last.next
- if n then
- last = characters[n]
+ code = last.next
+ if code then
+ last = characters[code]
else
break
end
@@ -2602,7 +2932,8 @@ do -- see pagella for an extensive example
height = stretchingdata.height,
depth = stretchingdata.depth,
next = stretchingdata.next,
- commands = { charcommand[stretching] },
+-- commands = { charcommand[stretching] },
+ commands = stretchingdata.commands or { charcommand[stretching] },
topanchor = stretchingdata.topanchor,
-- unicode = stretching, -- when we alias to combiners
unicode = alias, -- when we keep the original
@@ -2620,6 +2951,34 @@ do -- see pagella for an extensive example
feedback_tweak("copyaccents",target,original,done)
end
+ function mathtweaks.keepbases(target,original,parameters)
+ local characters = target.characters
+ local done = false
+ local list = parameters.list
+ if list == "default" then
+ list = sortedkeys(mapping)
+ end
+ if list and #list > 0 then
+ for i=1,#list do -- assumes sorting
+ local unicode = list[i]
+ local chardata = characters[unicode]
+ if chardata then
+ chardata.keepbase = true
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
+ end
+ end
+ else
+ -- maybe also hash
+ end
+ feedback_tweak("keepbases",target,original,done)
+ end
+
end
do
@@ -2636,40 +2995,119 @@ do
end
+-- do
+--
+-- local single <const> = 0x003D
+-- local double <const> = 0x2A75
+-- local triple <const> = 0x2A76
+--
+-- function mathtweaks.addequals(target,original,parameters)
+-- local characters = target.characters
+-- local basechar = characters[single]
+-- local width = basechar.width
+-- local height = basechar.height
+-- local depth = basechar.depth
+-- local advance = (parameters.advance or 1/20) * width
+-- local char = charcommand[single]
+-- local left = leftcommand[advance]
+-- characters[double] = {
+-- unicode = double,
+-- width = 2*width - 1*advance,
+-- height = height,
+-- depth = depth,
+-- commands = { char, left, char },
+-- }
+-- characters[triple] = {
+-- unicode = triple,
+-- width = 3*width - 2*advance,
+-- height = height,
+-- depth = depth,
+-- commands = { char, left, char, left, char },
+-- }
+-- if trace_tweaking then
+-- report_tweak("double %U and triple %U equals added",target,original,double,triple)
+-- end
+-- end
+--
+-- end
+
do
- local single <const> = 0x003D
- local double <const> = 0x2A75
- local triple <const> = 0x2A76
+ local function jointwo(characters,force,unicode,ds,u1,d12,u2)
+ if force or not characters[unicode] then
+ local c1 = characters[u1]
+ local c2 = characters[u2]
+ if c1 and c2 then
+ local w1 = c1.width
+ local w2 = c2.width
+ local width
+ if d12 == false then
+ d12 = 0
+ width = w2
+ elseif d12 < 0 then
+ d12 = d12 * w2
+ width = w2
+ else
+ d12 = d12 * ds
+ width = w1 + w2 - d12
+ end
+ characters[unicode] = {
+ unicode = unicode,
+ width = width,
+ height = max(c1.height or 0, c2.height or 0),
+ depth = max(c1.depth or 0, c2.depth or 0),
+keepvirtual = true,
+ commands = {
+ -- { "inspect" },
+ -- { "trace" },
+ slotcommand[0][u1],
+ -- { "trace" },
+ d12 ~= 0 and leftcommand[d12] or false,
+ slotcommand[0][u2],
+ -- { "trace" },
+ },
+ }
+ end
+ end
+ end
+
+ local function jointhree(characters,force,unicode,ds,u1,d12,u2,d23,u3)
+ if force or not characters[unicode] then
+ local c1 = characters[u1]
+ local c2 = characters[u2]
+ local c3 = characters[u3]
+ if c1 and c2 and c3 then
+ local w1 = c1.width
+ local w2 = c2.width
+ local w3 = c3.width
+ d12 = d12 * ds
+ d23 = d23 * ds
+ characters[unicode] = {
+ unicode = unicode,
+ width = w1 + w2 + w3 - d12 - d23,
+ 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 = {
+ slotcommand[0][u1],
+ d12 ~= 0 and leftcommand[d12] or false,
+ slotcommand[0][u2],
+ d23 ~= 0 and leftcommand[d23] or false,
+ slotcommand[0][u3],
+ }
+ }
+ end
+ end
+ end
function mathtweaks.addequals(target,original,parameters)
local characters = target.characters
- local basechar = characters[single]
- local width = basechar.width
- local height = basechar.height
- local depth = basechar.depth
- local advance = (parameters.advance or 1/20) * width
- local char = charcommand[single]
- local left = leftcommand[advance]
- characters[double] = {
- unicode = double,
- width = 2*width - 1*advance,
- height = height,
- depth = depth,
--- callback = "devirtualize",
- commands = { char, left, char },
- }
- characters[triple] = {
- unicode = triple,
- width = 3*width - 2*advance,
- height = height,
- depth = depth,
--- callback = "devirtualize",
- commands = { char, left, char, left, char },
- }
- if trace_tweaking then
- report_tweak("double %U and triple %U equals added",target,original,double,triple)
- end
+ local step = target.parameters.size/18
+ local force = parameters.force
+force = true
+ jointwo (characters,force,0x2254,step,0x03A,0,0x03D) -- :=
+ jointhree(characters,force,0x2A74,step,0x03A,0,0x03A,0,0x03D) -- ::=
+ jointwo (characters,force,0x2A75,step,0x03D,0,0x03D) -- ==
+ jointhree(characters,force,0x2A76,step,0x03D,0,0x03D,0,0x03D) -- ===
end
end
@@ -2807,28 +3245,45 @@ do
{ 0x030A, nps("delimited right ring"), nps("delimited ghost ring") },
{ 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") },
{ 0x20DB, nps("delimited right dddot"), nps("delimited ghost dddot") },
+
+ { 0x231C, nps("delimited left upper corner"), nps("delimited ghost upper corner") },
+ { 0x231D, nps("delimited right upper corner"), nps("delimited ghost upper corner") },
+ { 0x231E, nps("delimited left lower corner"), nps("delimited ghost lower corner"), true },
+ { 0x231F, nps("delimited right lower corner"), nps("delimited ghost lower corner"), true },
+
+ -- If needed we can have an installer:
+
{ 0x2020, nps("delimited right dagger"), nps("delimited ghost dagger") },
{ 0x2021, nps("delimited right ddagger"), nps("delimited ghost ddagger") },
{ 0x2217, nps("delimited right ast"), nps("delimited ghost ast") },
{ 0x22C6, nps("delimited right star"), nps("delimited ghost star") },
- { 0x231C, nps("delimited left upper corner"), nps("delimited ghost upper corner") },
- { 0x231D, nps("delimited right upper corner"), nps("delimited ghost upper corner") },
- { 0x231E, nps("delimited left lower corner"), nps("delimited ghost lower corner"), true },
- { 0x231F, nps("delimited right lower corner"), nps("delimited ghost lower corner"), true },
+ { 0x2020, nps("delimited right dagger 1"), nps("delimited ghost dagger 1"), false, 1 },
+ { 0x2021, nps("delimited right ddagger 1"), nps("delimited ghost ddagger 1"), false, 1 },
+ { 0x2217, nps("delimited right ast 1"), nps("delimited ghost ast 1"), false, 1 },
+ { 0x22C6, nps("delimited right star 1"), nps("delimited ghost star 1"), false, 1 },
}
function mathtweaks.addfourier(target,original,parameters)
local characters = target.characters
for i=1,#list do
- local entry = list[i]
- local basecode = entry[1]
- local fouriercode = entry[2]
- local movecode = entry[3]
- local reverse = entry[4]
- local basechar = characters[basecode]
+ local entry = list[i]
+ local basecode = entry[1]
+ local fouriercode = entry[2]
+ local movecode = entry[3]
+ local reverse = entry[4]
+ local size = entry[5] or 0
+ local basechar = characters[basecode]
+ local compactscale = 1
+ if basechar and target.properties.compactmath and size > 0 then
+ compactscale = target.parameters[size > 1 and "scriptscriptscale" or "scriptscale"] / 1000
+ for i=1,size do
+ basecode = basechar.smaller or basecode
+ basechar = characters[basecode]
+ end
+ end
if basechar then
- local scale = parameters.scale or 1
+ local scale = (parameters.scale or 1) * compactscale
local variant = parameters.variant
if variant then
for i=1,variant do
@@ -2846,9 +3301,9 @@ do
local basewidth = scale * (basechar.width or 0)
local used = baseheight/2
local total = baseheight + basedepth
-if reverse then
- used = total / 2 -- basedepth / 2
-end
+ if reverse then
+ used = total / 2 -- basedepth / 2
+ end
characters[movecode] = {
width = basewidth,
height = used,
@@ -2908,59 +3363,6 @@ do
local double <const> = 0x2016
local triple <const> = 0x2980
- -- local nps = fonts.helpers.newprivateslot
- --
- -- local function variantlist(characters,unicode,chardata,what,total,used)
- -- local parenthesis = characters[0x28].next
- -- local width = chardata.width
- -- local height = chardata.height
- -- local depth = chardata.depth
- -- local total = height + depth
- -- local count = 1
- -- while parenthesis do
- -- local private = nps(what .. " size " .. count)
- -- local pardata = characters[parenthesis]
- -- local parheight = pardata.height
- -- local pardepth = pardata.depth
- -- local scale = (parheight+pardepth)/total
- -- local offset = - pardepth + scale * depth
- -- chardata.next = private
- -- chardata = {
- -- unicode = unicode,
- -- width = width,
- -- height = parheight,
- -- depth = pardepth,
- -- commands = {
- -- { "offset", 0, offset, unicode, 1, scale }
- -- },
- -- }
- -- characters[private] = chardata
- -- parenthesis = pardata.next
- -- if paranthesis then
- -- pardata = characters[parenthesis]
- -- end
- -- count = count + 1
- -- end
- -- chardata.parts = {
- -- {
- -- advance = total,
- -- ["end"] = used,
- -- glyph = unicode,
- -- start = 0,
- -- -- start = used/5,
- -- },
- -- {
- -- advance = total,
- -- -- ["end"] = 0,
- -- ["end"] = used/5, -- prevents small gap with inward curved endpoints
- -- extender = 1,
- -- glyph = unicode,
- -- start = used,
- -- },
- -- }
- -- chardata.partsorientation = "vertical"
- -- end
-
local function variantlist(unicode,chardata,total,used)
chardata.varianttemplate = 0x0028
chardata.parts = {
@@ -3126,6 +3528,45 @@ end
do
+ function mathtweaks.sortvariants(target,original,parameters)
+ local list = parameters.list
+ if list then
+ local characters = target.characters
+ local horizontal = parameters.orientation == "horizontal"
+ for i=1,#list do
+ local u = list[i]
+ local c = characters[u]
+ if c then
+ local t = { }
+ while true do
+ local n = c.next
+ if n then
+ c = characters[n]
+ end
+ if c and not c.parts then
+ if horizontal then
+ t[c.width or 0] = n
+ else
+ t[(c.height or 0) + (c.depth or 0)] = n
+ end
+ else
+ break
+ end
+ end
+ local c = characters[u]
+ for k, v in sortedhash(t) do
+ c.next = v
+ c = characters[v]
+ end
+ end
+ end
+ end
+ end
+
+end
+
+do
+
-- We started with the list that xits has in rtlm but most of them can be derived from
-- the database, and others need to be added.
@@ -3251,7 +3692,11 @@ do
end
local next = data.next
if next then
- add(target,original,characters,next,"next")
+ if next == unicode then
+ report_tweak("skipping cyclic %U (%s)",target,original,unicode,"next")
+ else
+ add(target,original,characters,next,"next")
+ end
end
end
end
@@ -3424,7 +3869,7 @@ do
end
end
- -- there is no real need for thios but let's play nice with memory anyway
+ -- there is no real need for this but let's play nice with memory anyway
local efindex = 0
local effects = setmetatableindex (function (t,k)
@@ -3462,6 +3907,7 @@ do
local feature = entry.feature
local thesource = entry.source
local thetarget = entry.target or thesource
+ local keep = (entry.keep == true) or (parameters.keep == true)
if thesource and thetarget then
local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps
local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps
@@ -3504,13 +3950,17 @@ do
local sourceunicode = mathgaps[s] or s
if chars[sourceunicode] then
local targetunicode = mathgaps[t] or t
- if feature then
- sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode
+ if keep and characters[targetunicode] then
+ -- okay
+ else
+ if feature then
+ sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode
+ end
+-- if trace_tweaking then
+-- report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode)
+-- end
+ characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index)
end
--- if trace_tweaking then
--- report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode)
--- end
- characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index)
end
end
--
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
index b37887332d2..7b61fd234df 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
@@ -938,13 +938,18 @@
\def\math_cases_NC_two
{\ifmmode\stopimath\fi}
-\def\math_cases_TC_zero
+\def\math_cases_TC_zero % needs checking
+ %{\ifmmode\else\startimath\fi}
{}
\def\math_cases_TC_one
{\ifmmode\stopimath\fi
\aligntab}
+\def\math_cases_TC_two
+ %{\ifmmode\stopimath\fi} % needs checking
+ {}
+
\permanent\protected\def\math_cases_NC
{\ifcase\c_math_cases_nc
\expandafter\math_cases_NC_zero
@@ -1268,6 +1273,7 @@
\newconditional\c_math_matrix_first
\newconstant \c_math_matrix_anchor_mode
+\newconditional\c_math_matrix_sl_seen
% enabled : 1
% left/both : 2
@@ -1403,9 +1409,41 @@
\c!toffset=.25\exheight,
\c!boffset=\mathmatrixparameter\c!toffset]
-\noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*%
+% \noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*%
+% {\noalign\bgroup
+% \math_matrix_check_rule[#1]%
+% \divideby\scratchdimen\plustwo
+% \ifdim\scratchdimen>\zeropoint
+% % \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax
+% \scratchdistance\mathmatrixparameter\c!toffset\relax
+% \ifdim\scratchdistance>\zeropoint
+% \nohrule
+% \s!attr \mathalignmentvruleattribute\plustwo
+% \s!height\scratchdistance
+% \s!depth \zeropoint
+% \relax
+% \fi
+% \hrule
+% \s!attr \mathalignmentvruleattribute\plusthree
+% \s!height\scratchdimen
+% \s!depth \scratchdimen
+% \relax
+% \scratchdistance\mathmatrixparameter\c!boffset\relax
+% \ifdim\scratchdistance>\zeropoint
+% \nohrule
+% \s!attr \mathalignmentvruleattribute\plusfour
+% \s!height\zeropoint
+% \s!depth \scratchdistance
+% \relax
+% \fi
+% \else
+% % zero dimensions disable the rule
+% \fi
+% \egroup}
+
+\def\math_matrix_HL_indeed#1#2%
{\noalign\bgroup
- \math_matrix_check_rule[#1]%
+ \math_matrix_check_rule[#2]%
\divideby\scratchdimen\plustwo
\ifdim\scratchdimen>\zeropoint
% \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax
@@ -1422,6 +1460,17 @@
\s!height\scratchdimen
\s!depth \scratchdimen
\relax
+ \ifnum#1>\plusone
+ \localcontrolledloop\plustwo#1\plusone
+ {\kern.125\d_math_eqalign_distance % hskip
+ \hrule
+ \s!attr \mathalignmentvruleattribute\plusthree
+ \s!height\scratchdimen
+ \s!depth \scratchdimen
+ \relax}%
+ \kern-2\scratchdimen
+ \kern-.125\d_math_eqalign_distance % hskip
+ \fi
\scratchdistance\mathmatrixparameter\c!boffset\relax
\ifdim\scratchdistance>\zeropoint
\nohrule
@@ -1435,6 +1484,9 @@
\fi
\egroup}
+\permanent\tolerant\noaligned\protected\def\math_matrix_HL [#1]#*{\math_matrix_HL_indeed\plusone{#1}}
+\permanent\tolerant\noaligned\protected\def\math_matrix_HLHL[#1]#*{\math_matrix_HL_indeed\plustwo{#1}}
+
\protected\def\math_matrix_vertical_rule_indeed#1#2%
{\math_matrix_check_rule[#2]%
\enablematrixrules
@@ -1456,7 +1508,7 @@
\protected\def\math_matrix_horizontal_rule_indeed#1#2%
{\math_matrix_check_rule[#2]%
\global\setfalse\c_math_matrix_first
- \global\settrue\c_math_matrix_sl_seen
+ \global\settrue \c_math_matrix_sl_seen
\enablematrixrules
\leaders#1%
\s!attr \mathalignmenthruleattribute\plusone
@@ -1514,19 +1566,38 @@
%boundary\c_math_matrix_sl_boundary
\enforced\let\NR\math_matrix_NL_NR}
-\permanent\tolerant\protected\def\math_matrix_VL[#1]#*%
+% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*%
+% {\span\omit
+% \ifconditional\c_math_matrix_first\else
+% \kern.5\d_math_eqalign_distance % hskip
+% \fi
+% \math_matrix_vertical_rule_yes{#1}%
+% \kern.5\d_math_eqalign_distance % hskip
+% \global\setfalse\c_math_matrix_first
+% \aligntab
+% \boundary\c_math_matrix_vl_boundary
+% \enforced\let\NR\math_matrix_NL_NR
+% }
+
+\def\math_matrix_VL_indeed#1#2%%
{\span\omit
\ifconditional\c_math_matrix_first\else
\kern.5\d_math_eqalign_distance % hskip
\fi
- \math_matrix_vertical_rule_yes{#1}%
- \kern.5\d_math_eqalign_distance % hskip
+ \math_matrix_vertical_rule_yes{#2}%
+ \localcontrolledloop\plustwo#1\plusone
+ {\kern.125\d_math_eqalign_distance % hskip
+ \math_matrix_vertical_rule_yes{#2}}%
+ \kern.5\d_math_eqalign_distance
\global\setfalse\c_math_matrix_first
\aligntab
\boundary\c_math_matrix_vl_boundary
\enforced\let\NR\math_matrix_NL_NR
}
+\permanent\tolerant\protected\def\math_matrix_VL [#1]#*{\math_matrix_VL_indeed\plusone{#1}}
+\permanent\tolerant\protected\def\math_matrix_VLVL[#1]#*{\math_matrix_VL_indeed\plustwo{#1}}
+
\permanent\tolerant\protected\def\math_matrix_NL[#1]#*%
{\span\omit
\ifconditional\c_math_matrix_first\else
@@ -1585,6 +1656,9 @@
\enforced\let\VC\math_matrix_VC % bonus, extra column
\enforced\let\VT\math_matrix_VT % bonus, idem but tight
\enforced\let\TB\math_common_TB
+ % just because it's easy:
+ \enforced\let\VLVL\math_matrix_VLVL
+ \enforced\let\HLHL\math_matrix_HLHL
\to \everymathmatrix
\definesystemattribute[mathmatrixornament][public]
@@ -2818,6 +2892,8 @@
{\unskip
\strc_formulas_place_number_nested{#1}{#2}\crcr}
+\aliased\let\math_align_strut\relax
+
\permanent\tolerant\protected\def\math_simplealign_start[#1]#*[#2]%
{\begingroup
\edef\currentmathsimplealign{#1}%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
index a423a6a7934..3e4d724aeae 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
@@ -46,6 +46,9 @@
\definemathfunction [deg]
\definemathfunction [det] [\c!mathlimits=\v!yes]
\definemathfunction [dim]
+\definemathfunction [erf]
+\definemathfunction [erfc]
+\definemathfunction [erfi]
\definemathfunction [exp]
\definemathfunction [gcd] [\c!mathlimits=\v!yes]
\definemathfunction [hom]
@@ -139,36 +142,57 @@
%D \formula {A \simcoloncolon B}
%D \stoplines
%D
-%D The next macros take care of the space between the colon and the
-%D relation symbol.
+%D The next macros take care of the space between the colon and the relation symbol,
+%D but they are kind of weird and not in \UNICODE. Either we define them virtual or
+%D we just keep these as bonus.
\pushoverloadmode
-\definemathcommand [colonsep] {\mkern-1.2mu}
-\definemathcommand [doublecolonsep] {\mkern-0.9mu}
-
-\definemathcommand [centercolon] [\s!relation] {\mathstylevcenteredhbox\colon}
-\definemathcommand [colonminus] [\s!relation] {\centercolon\colonsep\mathrel{-}}
-%definemathcommand [minuscolon] [\s!relation] {\mathrel{-}\colonsep\centercolon} % native char
-%definemathcommand [colonequals] [\s!relation] {\centercolon\colonsep=} % native char
-%definemathcommand [equalscolon] [\s!relation] {=\centercolon\colonsep} % native char
-\definemathcommand [colonapprox] [\s!relation] {\centercolon\colonsep\approx}
-\definemathcommand [approxcolon] [\s!relation] {\approx\centercolon\colonsep}
-\definemathcommand [colonsim] [\s!relation] {\centercolon\colonsep\sim}
-\definemathcommand [simcolon] [\s!relation] {\sim\centercolon\colonsep}
-
-\definemathcommand [coloncolon] [\s!relation] {\centercolon\doublecolonsep\centercolon}
-\definemathcommand [coloncolonminus] [\s!relation] {\coloncolon\colonsep\mathrel{-}}
-\definemathcommand [minuscoloncolon] [\s!relation] {\mathrel{-}\colonsep\coloncolon}
-\definemathcommand [coloncolonequals] [\s!relation] {\coloncolon\colonsep=} % native char
-\definemathcommand [equalscoloncolon] [\s!relation] {=\coloncolon\colonsep}
-\definemathcommand [coloncolonapprox] [\s!relation] {\coloncolon\colonsep\approx}
-\definemathcommand [approxcoloncolon] [\s!relation] {\approx\coloncolon\colonsep}
-\definemathcommand [coloncolonsim] [\s!relation] {\coloncolon\colonsep\sim}
-\definemathcommand [simcoloncolon] [\s!relation] {\sim\coloncolon\colonsep}
+\protected\def\math_relation_atom_ordinary{\mathatom \s!class \mathrelationcode \s!all \mathordcode}
+
+\definemathcommand [centercolon] {\math_relation_atom_ordinary{\colon}}
+\definemathcommand [colonminus] {\math_relation_atom_ordinary{\colon\minus}}
+\definemathcommand [colonapprox] {\math_relation_atom_ordinary{\colon\approx}}
+\definemathcommand [approxcolon] {\math_relation_atom_ordinary{\approx\colon}}
+\definemathcommand [colonsim] {\math_relation_atom_ordinary{\colon\sim}}
+\definemathcommand [simcolon] {\math_relation_atom_ordinary{\sim\colon}}
+
+\definemathcommand [coloncolon] {\math_relation_atom_ordinary{\colon\colon}}
+\definemathcommand [coloncolonminus] {\math_relation_atom_ordinary{\colon\colon\minus}}
+\definemathcommand [minuscoloncolon] {\math_relation_atom_ordinary{\minus\colon\colon}}
+\definemathcommand [coloncolonequals] {\math_relation_atom_ordinary{\colon\colon\eq}} % native char
+\definemathcommand [equalscoloncolon] {\math_relation_atom_ordinary{\eq\colon\colon}}
+\definemathcommand [coloncolonapprox] {\math_relation_atom_ordinary{\colon\colon\approx}}
+\definemathcommand [approxcoloncolon] {\math_relation_atom_ordinary{\approx\colon\colon}}
+\definemathcommand [coloncolonsim] {\math_relation_atom_ordinary{\colon\colon\sim}}
+\definemathcommand [simcoloncolon] {\math_relation_atom_ordinary{\sim\colon\colon}}
+
+% \definemathcommand [manycolons] [relation] [ordinary] {\colon\colon\colon\colon\colon\colon\colon}
\popoverloadmode
+%D \macros
+%D {amedian}
+%D
+%D Something language specific, the arithmic median:
+%D
+%D \starttyping
+%D \im {x + \amedian {x - a} + x}
+%D \mainlanguage[cs] \im {x + \amedian {x - a} + x}
+%D \stoptyping
+
+\defcsname \s!en:amedian\endcsname#1{\widebar {#1}}
+\defcsname \s!cs:amedian\endcsname#1{\widetilde{#1}}
+\defcsname \s!sk:amedian\endcsname#1{\widetilde{#1}}
+
+\permanent\protected\def\amedian
+ {\csname
+ \ifcsname\currentmainlanguage:amedian\endcsname
+ \currentmainlanguage\else\s!en
+ \fi
+ :amedian%
+ \endcsname}
+
% \appendtoks
% \def\over{\primitive\over}%
% \to \everymathematics
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl
index ad53ee25a27..4c11177260a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl
@@ -19,8 +19,8 @@
% For new times sake:
- \let\normal_math_dd\dd
- \let\normal_math_DD\DD
+ \ifdefined\dd \aliased\let\normal_math_dd\dd \else \lettonothing\normal_math_dd \fi
+ \ifdefined\DD \aliased\let\normal_math_DD\DD \else \lettonothing\normal_math_DD \fi
\def\c!differentiald{differentiald} % for now
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx
index dcbb17c5eca..281ccedb2c0 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx
@@ -28,7 +28,8 @@
\installcommandhandler \??mathdelimited {mathdelimited} \??mathdelimited
\setupmathdelimited
- [\c!alternative=\v!normal,
+ [\c!define=\v!yes,
+ \c!alternative=\v!normal,
\c!mpoffset=.25\exheight,
\c!topoffset=\zeropoint,
\c!bottomoffset=\zeropoint,
@@ -43,7 +44,7 @@
\c!rightmargin=\zeropoint]
\appendtoks
- \ifcstok{\mathdelimitedparameter\c!rightmargin}\v!no\else
+ \ifcstok{\mathdelimitedparameter\c!define}\v!yes
\frozen\protected\instance\edefcsname\currentmathdelimited\endcsname{\math_delimited_handle{\currentmathdelimited}}
\fi
\to \everydefinemathdelimited
@@ -70,7 +71,7 @@
\s!depth \dimexpr\mathdelimitedparameter\c!depth+\mathdelimitedparameter\c!bottomoffset\relax
\s!source\numexpr\namedboxanchor{\mathdelimitedparameter\c!source}\relax
\s!style \normalmathstyle
- \s!size \numexpr\namedboxanchor{\mathdelimitedparameter\c!size}\relax
+ \s!size \numexpr\mathdelimitedparameter\c!size\relax
\zerocount \mathdelimitedparameter\c!left
\zerocount \mathdelimitedparameter\c!right
\relax}
@@ -88,7 +89,6 @@
{\popcolor#body}%
\fi}
-
%integerdef\delimitedrightgraveuc \privatecharactercode{delimited right grave}
\integerdef\delimitedrightddotuc \privatecharactercode{delimited right ddot}
\integerdef\delimitedrightbaruc \privatecharactercode{delimited right bar}
@@ -100,10 +100,6 @@
\integerdef\delimitedrightringuc \privatecharactercode{delimited right ring}
\integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde}
\integerdef\delimitedrightdddotuc \privatecharactercode{delimited right dddot}
-\integerdef\delimitedrightdaggeruc \privatecharactercode{delimited right dagger}
-\integerdef\delimitedrightddaggeruc \privatecharactercode{delimited right ddagger}
-\integerdef\delimitedrightastuc \privatecharactercode{delimited right ast}
-\integerdef\delimitedrightstaruc \privatecharactercode{delimited right star}
% \integerdef\delimitedrighthatuc \privatecharactercode{delimited right hat}
% \integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde}
@@ -114,33 +110,38 @@
\definemathdelimited
[marked]
- [\c!command=\v!no,
+ [\c!define=\v!no,
\c!topoffset=.2\exheight]
\definemathdelimited
[ddotmarked]
[marked]
- [\c!right=\delimitedrightddotuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightddotuc]
\definemathdelimited
[barmarked]
[marked]
- [\c!right=\delimitedrightbaruc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightbaruc]
\definemathdelimited
[hatmarked]
[marked]
- [\c!right=\delimitedrighthatuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrighthatuc]
\definemathdelimited
[checkmarked]
[marked]
- [\c!right=\delimitedrightcheckuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightcheckuc]
\definemathdelimited
[brevemarked]
[marked]
- [\c!right=\delimitedrightbreveuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightbreveuc]
\definemathdelimited
[dotmarked]
@@ -150,44 +151,78 @@
\definemathdelimited
[ringmarked]
[marked]
- [\c!right=\delimitedrightringuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightringuc]
\definemathdelimited
[tildemarked]
[marked]
- [\c!right=\delimitedrighttildeuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrighttildeuc]
\definemathdelimited
[dddotmarked]
[marked]
- [\c!right=\delimitedrightdddotuc]
+ [\c!define=\v!yes,
+ \c!right=\delimitedrightdddotuc]
% The following ones are
% not really belonging here,
% but convenient
+% If there are more needed we can have:
+%
+% \c!ight=\privatecharactercode{delimited right dagger \mathdelimitedparameter\c!size}
+%
+% or even:
+%
+% \def\privatedelimitedcode#1{\privatecharactercode{delimited #1 \mathdelimitedparameter\c!size}}
+%
+% \c!right=\privatedelimitedcode{right dagger}
+%
+% with some glyph installer btu let's for now save some bytes in the format.
+
+\integerdef\delimitedrightdaggeruc \privatecharactercode{delimited right dagger}
+\integerdef\delimitedrightddaggeruc \privatecharactercode{delimited right ddagger}
+\integerdef\delimitedrightastuc \privatecharactercode{delimited right ast}
+\integerdef\delimitedrightstaruc \privatecharactercode{delimited right star}
+
+\integerdef\delimitedscriptrightdaggeruc \privatecharactercode{delimited right dagger 1}
+\integerdef\delimitedscriptrightddaggeruc \privatecharactercode{delimited right ddagger 1}
+\integerdef\delimitedscriptrightastuc \privatecharactercode{delimited right ast 1}
+\integerdef\delimitedscriptrightstaruc \privatecharactercode{delimited right star 1}
+
\definemathdelimited
[daggermarked]
[marked]
- [\c!size=1,
- \c!right=\delimitedrightdaggeruc]
+ [\c!define=\v!yes,
+ \c!size=1,
+ \c!right=\delimitedscriptrightdaggeruc]
+ %\c!right=\privatedelimitedcode{right dagger}]
\definemathdelimited
[ddaggermarked]
[marked]
- [\c!size=1,
- \c!right=\delimitedrightddaggeruc]
+ [\c!define=\v!yes,
+ \c!size=1,
+ \c!right=\delimitedscriptrightddaggeruc]
+ %\c!right=\privatedelimitedcode{right ddagger}]
\definemathdelimited
[astmarked]
- [\c!size=1,
- \c!right=\delimitedrightastuc]
+ [marked]
+ [\c!define=\v!yes,
+ \c!size=1,
+ \c!right=\delimitedscriptrightastuc]
+ %\c!right=\privatedelimitedcode{right ast}]
\definemathdelimited
[starmarked]
[marked]
- [\c!size=1,
- \c!right=\delimitedrightstaruc]
+ [\c!define=\v!yes,
+ \c!size=1,
+ \c!right=\delimitedscriptrightstaruc]
+ %\c!right=\privatedelimitedcode{right star}]
% More contextual
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl
index 1656f4b4a1c..53c34c56716 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl
@@ -15,7 +15,7 @@
\unprotect
-% \definemathfence [fancybracket] [bracket] [command=yes,color=blue]
+% \definemathfence [fancybracket] [bracket] [define=yes,color=blue]
%
% test $|x|$ test \par
% test $||x||$ test (okay) \par
@@ -42,7 +42,7 @@
\c!middle=,
\c!mathstyle=,
\c!color=,
- \c!command=,
+ \c!define=, % was \c!command
\c!mathclass=,
\c!leftclass=\mathopencode,
\c!rightclass=\mathclosecode,
@@ -59,9 +59,7 @@
\c!factor=\v!auto]
\appendtoks
- \edef\p_command{\mathfenceparameter\c!command}%
- \ifx\p_command\v!yes
- % \instance
+ \ifcstok{\mathfenceparameter\c!define}\v!yes
\protected\edefcsname\currentmathfence\endcsname{\math_fenced_fenced{\currentmathfence}}%
\fi
\to \everydefinemathfence
@@ -307,6 +305,9 @@
\directsetup{math:fence:set:bar}
\stopsetups
+\mutable\lettonothing\suchthat
+% \fastsetup{math:fence:set}
+
\protected\def\math_fenced_middle_common
{\math_fenced_middle} % redefined inside atom
@@ -338,6 +339,19 @@
% \definemathfence [tupdownarrows] [text] [\c!left="2191,\c!right="2193]
+\def\math_fenced_check#1%
+ {\iftok{\mathfenceparameter#1}\emptytoks\letmathfenceparameter#1\v!none\fi}
+
+\appendtoks
+ \math_fenced_check\c!left
+ \math_fenced_check\c!right
+\to \everysetupmathfence
+
+\appendtoks
+ \math_fenced_check\c!left
+ \math_fenced_check\c!right
+\to \everydefinemathfence
+
\protected\def\math_fenced_horizontal_common#1#2#3#4% \Uwhatever class symbol source
{\c_math_fenced_class\math_class_by_parameter\mathfenceparameter#2\relax
\edef\p_fence{#3}%
@@ -387,7 +401,7 @@
\setupmathfence
[\v!text]
[\c!text=\v!yes,
- \c!command=\v!yes,
+ \c!define=\v!yes,
\c!distance=.125\emwidth]
\tolerant\protected\def\math_fenced_vertical#1#*[#2]%
@@ -653,10 +667,23 @@
\immutable\protected\def\Lopenbracketmirrored {\math_fenced_fenced_stop {mirroredopenbracket}} \immutable\protected\def\Ropenbracketmirrored {\math_fenced_fenced_start{mirroredopenbracket}}
\immutable\protected\def\Lnothingmirrored {\math_fenced_fenced_stop {mirrorednothing}} \immutable\protected\def\Rnothingmirrored {\math_fenced_fenced_start{mirrorednothing}}
-\definemathfence [interval] [\c!left="2997,\c!right="2998]
-\definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998]
-\definemathfence [leftopeninterval] [interval] [\c!left="2997,\c!right="2997]
-\definemathfence [rightopeninterval] [interval] [\c!left="2998,\c!right="2998]
+% These tortoise chars almost only exist in stix (and ar not commonly used)
+
+% \definemathfence [interval] [\c!left="2997,\c!right="2998]
+% \definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998]
+% \definemathfence [leftopeninterval] [interval] [\c!left="2997,\c!right="2997]
+% \definemathfence [rightopeninterval] [interval] [\c!left="2998,\c!right="2998]
+
+% Different intervals. The variants are the ones suggested by Bourbaki.
+
+\definemathfence [interval] [\c!left="005B,\c!right="005D]
+\definemathfence [openinterval] [interval] [\c!left="0028,\c!right="0029]
+\definemathfence [closedinterval] [interval] [\c!left="005B,\c!right="005D]
+\definemathfence [leftopeninterval] [interval] [\c!left="0028,\c!right="005D]
+\definemathfence [rightopeninterval] [interval] [\c!left="005B,\c!right="0029]
+\definemathfence [varopeninterval] [interval] [\c!left="005D,\c!right="005B]
+\definemathfence [varleftopeninterval] [interval] [\c!left="005D,\c!right="005D]
+\definemathfence [varrightopeninterval] [interval] [\c!left="005B,\c!right="005B]
\immutable\protected\def\Linterval {\math_fenced_fenced_start{interval}}
\immutable\protected\def\Lointerval {\math_fenced_fenced_start{openinterval}}
@@ -693,6 +720,10 @@
% \im { \left\{ \frac{1}{2} \right\} }
% \im { \left\lbrace \frac{1}{2} \right\rbrace }
+\lettonothing\math_fenced_x_p_left
+\lettonothing\math_fenced_x_p_right
+\lettonothing\math_fenced_x_p_middle
+
\def\math_fenced_x_left
{\advanceby\c_math_fence_nesting\plusone
\ifx\math_fenced_x_p_left\bgroup\let\math_fenced_x_p_left\letterleftbrace\fi
@@ -957,7 +988,11 @@
\protected\def\math_choosemathbig_math#1#2% so we accept \big{||} as well
{\math_fenced_force_size\bigmathdelimitervariant{#1}\relax
- \Uvextensible#2\relax
+ \Uvextensible
+ \s!axis
+ \s!exact
+ #2%
+ \relax
\c_attr_mathsize\attributeunsetvalue}
\protected\def\math_choosemathbig_text#1#2% so we accept \big{||} as well
@@ -972,7 +1007,11 @@
\permanent\protected\def\mathdelimiterstep#1#2% not used, only in example
{\begingroup
\math_fenced_force_size\plusone{#1}%
- \Uvextensible#2\relax
+ \Uvextensible
+ \s!axis
+ \s!exact
+ #2%
+ \relax
\endgroup}
\definemathcommand [big] {\choosemathbig1}
@@ -1004,7 +1043,7 @@
% \vrule height 3cm depth 3cm
% \right\rintegral
-%definemathfence [fancybracket] [bracket] [command=yes,color=red]
+%definemathfence [fancybracket] [bracket] [define=yes,color=red]
%D The nested fences recovery code is needed for mathml and the original
%D code can still be found in the mkiv file.
@@ -1014,7 +1053,7 @@
\let\math_fences_normal_left \left
\let\math_fences_normal_right \right
\let\math_fences_normal_middle\middle
-\let\math_fences_normal_both \leftorright
+\let\math_fences_normal_both \relax % undefined
\protected\def\math_fences_auto_left #1{\c_attr_mathautofence\plusone #1\c_attr_mathautofence\attributeunsetvalue}
\protected\def\math_fences_auto_right #1{\c_attr_mathautofence\plustwo #1\c_attr_mathautofence\attributeunsetvalue}
@@ -1187,6 +1226,8 @@
{\let\math_fenced_trace\math_fenced_trace_indeed}
{\let\math_fenced_trace\donothing}
+\mutable\integerdef\c_math_fence_level\minusone
+
\appendtoks
\integerdef\c_math_fence_level\minusone
\c_math_fence_nesting\zerocount
@@ -1211,10 +1252,10 @@
% $x + \tdownuparrows{left}{right} + x$
% $x + \tupanddownarrows[color=red,leftcolor=green,rightcolor=blue]{left}{right} + x$
-\definemathfence [tupanddownarrows] [\v!text] [\c!left="2191,\c!right="2193]
-\definemathfence [tupdownarrows] [\v!text] [\c!left="21C5,\c!right=0]
-\definemathfence [tdownuparrows] [\v!text] [\c!middle="21F5]
-\definemathfence [tuparrow] [\v!text] [\c!middle="2191]
-\definemathfence [tdownarrow] [\v!text] [\c!middle="2193]
+\definemathfence [tupanddownarrows][\v!text][\c!left="2191,\c!right="2193]
+\definemathfence [tupdownarrows] [\v!text][\c!left="21C5,\c!right=0]
+\definemathfence [tdownuparrows] [\v!text][\c!middle="21F5]
+\definemathfence [tuparrow] [\v!text][\c!middle="2191]
+\definemathfence [tdownarrow] [\v!text][\c!middle="2193]
\protect
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt
index 911e0adb520..87dfe16e52a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt
@@ -54,98 +54,100 @@ local cache = setmetatableindex(function(t,width)
return v
end)
+local enabled = "vertical" directives.register("math.extensibles", function(v) enabled = v end) -- default per 2022-08-25
+
local function register_extensible(font,char,style,box)
- -- We don't share (yet)!
- local fontdata = chardata[font]
- local oldchar = fontdata[char]
- if oldchar and oldchar.keepvirtual then
- -- for now, needed for iwona etc
- return nil
- else
- local bx = tonut(box)
- updaters.apply("tagging.state.disable") -- fast enough
- nodes.handlers.finalizelist(bx)
- updaters.apply("tagging.state.enable")
- local id = getid(bx)
- local al = getattrlst(bx)
- local wd, ht, dp = getwhd(bx)
- local unicode = oldchar.unicode or char
- -- we cannot have self referencing t3 fonts
- local oldcommands = oldchar.oldcommands
- local newcommands = oldchar.commands
- if oldcommands then
- oldchar.commands = oldcommands
- end
- --
- local p = fonts.hashes.parameters[font]
- local sx = round(1000/p.extendfactor)
- local sy = round(1000/p.squeezefactor)
- -- we saved a scaled glyph stream so we now use an unscaled one ... horrible hack:
- if sx ~= 1000 then
- wd = wd * 7200/7227
- end
- if sy ~= 1000 then
- ht = ht * 7200/7227
- dp = dp * 7200/7227
- end
- --
- -- local private = fonts.helpers.setboxdirectly(font,unicode,box)
- local private = cache[wd][ht][dp][font][unicode]
- if not private then
- private = fonts.helpers.setboxdirectly(font,unicode,box)
- cache[wd][ht][dp][font][unicode] = private
- end
- local glyph = new_glyph(font,private,al)
- nuts.setscales(glyph,1000,sx,sy)
- --
- -- if fonts.hashes.properties[font].compactmath then
- -- nuts.setscales(g,1000,1000,1000)
- -- end
- --
- -- nasty, testcase: bold math sqrt extensible
- --
- local n = new_hlist(glyph)
- --
- if newcommands then
- oldchar.commands = newcommands
- end
- --
- -- local newchar = {
- -- unicode = unicode,
- -- width = wd,
- -- height = ht,
- -- depth = dp,
- -- }
- -- local p = oldchar.vparts
- -- if p then
- -- local first = fontdata[p[#p].glyph]
- -- local last = fontdata[p[ 1].glyph]
- -- if first then
- -- newchar.topleft = first.topleft
- -- newchar.topright = first.topright
- -- end
- -- if last then
- -- newchar.bottomleft = last.bottomleft
- -- newchar.bottomright = last.bottomright
- -- end
- -- end
- -- addcharacters(font, { [private] = newchar })
- -- so the dimensions of the box don't match the glyph scale!
- setwhd(n,wd,ht,dp)
- setattrlst(n,al)
- if id == vlist_code then
- n = new_vlist(n)
+ if enabled then
+ -- We don't share (yet)!
+ local fontdata = chardata[font]
+ local oldchar = fontdata[char]
+ if oldchar and not oldchar.keepvirtual then
+if enabled == true or enabled == "both" or oldchar.partsorientation == enabled then
+ -- we're okay
+else
+ return
+end
+ local bx = tonut(box)
+ -- actually we don't want colors and such so if we do finalize we
+ -- should be more selctive:
+ -- updaters.apply("tagging.state.disable")
+ -- nodes.handlers.finalizelist(bx)
+ -- updaters.apply("tagging.state.enable")
+ local id = getid(bx)
+ local al = getattrlst(bx)
+ local wd, ht, dp = getwhd(bx)
+ local unicode = oldchar.unicode or char
+ -- we cannot have self referencing t3 fonts
+ local oldcommands = oldchar.oldcommands
+ local newcommands = oldchar.commands
+ if oldcommands then
+ oldchar.commands = oldcommands
+ end
+ --
+ local p = fonts.hashes.parameters[font]
+ local sx = round(1000/p.extendfactor)
+ local sy = round(1000/p.squeezefactor)
+ -- we saved a scaled glyph stream so we now use an unscaled one ... horrible hack:
+ if sx ~= 1000 then
+ wd = wd * 7200/7227
+ end
+ if sy ~= 1000 then
+ ht = ht * 7200/7227
+ dp = dp * 7200/7227
+ end
+ --
+ -- local private = fonts.helpers.setboxdirectly(font,unicode,box)
+ local private = cache[wd][ht][dp][font][unicode]
+ if not private then
+ private = fonts.helpers.setboxdirectly(font,unicode,box)
+ cache[wd][ht][dp][font][unicode] = private
+ end
+ local glyph = new_glyph(font,private,al)
+ nuts.setscales(glyph,1000,sx,sy)
+ --
+ -- if fonts.hashes.properties[font].compactmath then
+ -- nuts.setscales(g,1000,1000,1000)
+ -- end
+ --
+ -- nasty, testcase: bold math sqrt extensible
+ --
+ local n = new_hlist(glyph)
+ --
+ if newcommands then
+ oldchar.commands = newcommands
+ end
+ --
+ -- local newchar = {
+ -- unicode = unicode,
+ -- width = wd,
+ -- height = ht,
+ -- depth = dp,
+ -- }
+ -- local p = oldchar.vparts
+ -- if p then
+ -- local first = fontdata[p[#p].glyph]
+ -- local last = fontdata[p[ 1].glyph]
+ -- if first then
+ -- newchar.topleft = first.topleft
+ -- newchar.topright = first.topright
+ -- end
+ -- if last then
+ -- newchar.bottomleft = last.bottomleft
+ -- newchar.bottomright = last.bottomright
+ -- end
+ -- end
+ -- addcharacters(font, { [private] = newchar })
+ -- so the dimensions of the box don't match the glyph scale!
setwhd(n,wd,ht,dp)
setattrlst(n,al)
+ if id == vlist_code then
+ n = new_vlist(n)
+ setwhd(n,wd,ht,dp)
+ setattrlst(n,al)
+ end
+ return tonode(n)
end
- return tonode(n)
end
end
-directives.register("math.extensibles", function(v)
- callback.register("register_extensible", v and register_extensible or nil)
-end)
-
--- Default per 2022-08-25
-
-callback.register("register_extensible", register_extensible)
+callbacks.register("register_extensible",register_extensible,"register math extensible construct")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl
index 47edc52c411..7e6f7c5ce4d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl
@@ -104,6 +104,14 @@
\c!vfactor=\plusthousand,
\c!rule=\v!auto]
+%D We now default to nice bars:
+
+\integerdef\fractionbarextenderuc \privatecharactercode{fraction bar extender}
+
+\setupmathfractions
+ [\c!rule=\v!symbol,
+ \c!symbol=\fractionbarextenderuc]
+
\appendtoks
\instance\frozen\protected\edefcsname\currentmathfraction\endcsname{\math_frac{\currentmathfraction}}%
\to \everydefinemathfraction
@@ -303,15 +311,23 @@
{\edef\p_method {\mathfractionparameter\c!method}%
\edef\p_rule {\mathfractionparameter\c!rule}%
\edef\p_thickness{\mathfractionparameter\c!rulethickness}%
- \scratchcounterone \mathfractionparameter\c!left \relax
- \scratchcountertwo \mathfractionparameter\c!right \relax
- \scratchcounterthree \mathfractionparameter\c!middle \relax
+ \scratchcounterone \mathfractionparameter\c!left \relax
+ \scratchcountertwo \mathfractionparameter\c!right \relax
+ \scratchcounterthree
+ \ifx\p_method\v!horizontal
+ \mathfractionparameter\c!middle
+ \orelse\ifx\p_method\v!line
+ \mathfractionparameter\c!middle
+ \else
+ \mathfractionparameter\c!symbol
+ \fi
+ \relax
\ifcsname
\??fractionmethods
\p_method
\ifx\p_method\v!horizontal
\orelse\ifx\p_method\v!line
- \orelse\ifcsname\??fractionmethods\p_method\p_rule\endcsname
+ \orelse\ifcsname\??fractionmethods\p_method\p_rule\endcsname % \v!vertical
\p_rule
\else
\v!auto
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt
index f26f24c93b1..904b98d790b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt
@@ -169,12 +169,11 @@ do
local fontchardata = fonts.hashes.characters
local f_dictionary = false
- local register = callback.register
local whatdetail = "all"
local function trace(n,properties,group,index,font,char)
-- local properties, group, index, font, char = nodes.nuts.getchardict(nodes.nuts.tonut(n))
- if properties ~= 0 or group ~= 0 or index ~= 0 then
+ if whatdetail and (properties ~= 0 or group ~= 0 or index ~= 0) then
local char = fontchardata[font][char]
if char or whatdetail == "all" then
local unicode = char and char.unicode
@@ -199,16 +198,9 @@ do
end
end
- trackers.register("math.dictionaries",function(v)
- whatdetail = v
- if whatdetail then
- register("get_math_dictionary",trace)
- else
- register("get_math_dictionary")
- end
- end)
+ trackers.register("math.dictionaries",function(v) whatdetail = v end)
- register("get_math_dictionary",trace)
+ callbacks.register("get_math_dictionary",trace,"provide math dictionary details")
-- This is experimental and a prelude to the long pending "relate math rendering to
-- some field" wish. In TeX characters and symbols are grouped by class but that is
@@ -410,7 +402,7 @@ classes["all"] = specialclasses["all"] classnames[specialclasses["all"] ]
classes["begin"] = specialclasses["begin"] classnames[specialclasses["begin"]] = "beg"
classes["end"] = specialclasses["end"] classnames[specialclasses["end"] ] = "end"
-callback.register("get_noad_class", function(n) return classnames[n] end)
+callbacks.register("get_noad_class", function(n) return classnames[n] end,"provide math class name")
local function registerprivateclass(name,parent)
local class = parent and classes[parent] or classes[name]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
index 7d0c8ef81fc..f9b733d9cb2 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
@@ -1399,6 +1399,10 @@
% \im{1\unit{hour} 20 \unit{minute} 56 \unit{second}}
%
\inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip
+ \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allsplitstyles \medmuskip
+ \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allunsplitstyles \pettymuskip
+ \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allsplitstyles \thickmuskip
+ \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allunsplitstyles \pettymuskip
%
\inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip
\inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip
@@ -1418,20 +1422,20 @@
\inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip
\inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip
%
- \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip
- \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip
+ \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \pettymuskip
+ \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
\stopsetups
\directsetup{math:spacing:default}
@@ -1732,6 +1736,9 @@
\permanent\protected\def\mathcodecommand#1%
{\mathatom \s!class \mathcodechecked{#1}}
+\permanent\protected\def\mathcodeallcommand#1#2%
+ {\mathatom \s!class \mathcodechecked{#1} \s!all \mathcodechecked{#2}}
+
\def\math_class_by_parameter #1#2{\normalexpanded{\noexpand\mathcodechecked{#1#2}}}
\def\math_atom_by_parameter #1{\normalexpanded{\noexpand\math_atom_by_parameter_indeed{#1\c!mathclass}}}
\def\math_atom_by_parameter_indeed#1{\mathatom \s!class \mathcodechecked{#1}}
@@ -1750,15 +1757,14 @@
\installcorenamespace{mathcommand}
-% todo: define these commands as frozen!
-
\permanent\tolerant\protected\def\definemathcommand[#1]#*[#2]#*[#3]#:#*#4% command class args meaning
{\ifparameter#3\or
- \edef\scratchstringone{#3}% make this one m_arguments
- \ifx\scratchstringone\v!one
+ \ifcstok{#3}\v!one
\frozen\protected\defcsname\??mathcommand#1\endcsname##1{\mathcodecommand{#2}{#4{##1}}}%
- \orelse\ifx\scratchstringone\v!two
+ \orelse\ifcstok{#3}\v!two
\frozen\protected\defcsname\??mathcommand#1\endcsname##1##2{\mathcodecommand{#2}{#4{##1}{##2}}}%
+ \orelse\ifchknum\mathcodechecked{#3}\or
+ \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodeallcommand{#2}{#3}{#4}}%
\else
\frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{#2}{#4}}%
\fi
@@ -2812,50 +2818,83 @@
\installcorenamespace {mathautopunctuation}
-\bgroup
-
- % This can and will be replaced by classes:
-
- \catcode\commaasciicode \activecatcode
- \catcode\periodasciicode \activecatcode
- \catcode\semicolonasciicode\activecatcode
-
- \gdefcsname\??mathautopunctuation\v!no\endcsname
- {\let,\math_punctuation_nop_comma
- \let.\math_punctuation_nop_period
- \let;\math_punctuation_nop_semicolon}
-
- \gdefcsname\??mathautopunctuation\v!yes\endcsname
- {\let,\math_punctuation_yes_comma
- \let.\math_punctuation_yes_period
- \let;\math_punctuation_nop_semicolon}
-
- \gdefcsname\??mathautopunctuation\v!all\endcsname
- {\let,\math_punctuation_all_comma
- \let.\math_punctuation_all_period
- \let;\math_punctuation_nop_semicolon}
-
- \gdefcsname\??mathautopunctuation comma\endcsname
- {\let,\math_punctuation_yes_comma
- \let.\math_punctuation_yes_period
- \let;\math_punctuation_nop_semicolon}
-
- \gdefcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname
- {\let,\math_punctuation_yes_comma
- \let.\math_punctuation_yes_period
- \let;\math_punctuation_yes_semicolon}
-
- \gdefcsname\??mathautopunctuation comma\string,semicolon\endcsname
- {\let,\math_punctuation_yes_comma
- \let.\math_punctuation_yes_period
- \let;\math_punctuation_yes_semicolon}
-
- \gdefcsname\??mathautopunctuation\v!all\string,semicolon\endcsname
- {\let,\math_punctuation_all_comma
- \let.\math_punctuation_all_period
- \let;\math_punctuation_all_semicolon}
+% \bgroup
+%
+% \catcode\commaasciicode \activecatcode
+% \catcode\periodasciicode \activecatcode
+% \catcode\semicolonasciicode\activecatcode
+%
+% \gdefcsname\??mathautopunctuation\v!no\endcsname
+% {\let,\math_punctuation_nop_comma
+% \let.\math_punctuation_nop_period
+% \let;\math_punctuation_nop_semicolon}
+%
+% \gdefcsname\??mathautopunctuation\v!yes\endcsname
+% {\let,\math_punctuation_yes_comma
+% \let.\math_punctuation_yes_period
+% \let;\math_punctuation_nop_semicolon}
+%
+% \gdefcsname\??mathautopunctuation\v!all\endcsname
+% {\let,\math_punctuation_all_comma
+% \let.\math_punctuation_all_period
+% \let;\math_punctuation_nop_semicolon}
+%
+% \gdefcsname\??mathautopunctuation comma\endcsname
+% {\let,\math_punctuation_yes_comma
+% \let.\math_punctuation_yes_period
+% \let;\math_punctuation_nop_semicolon}
+%
+% \gdefcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname
+% {\let,\math_punctuation_yes_comma
+% \let.\math_punctuation_yes_period
+% \let;\math_punctuation_yes_semicolon}
+%
+% \gdefcsname\??mathautopunctuation comma\string,semicolon\endcsname
+% {\let,\math_punctuation_yes_comma
+% \let.\math_punctuation_yes_period
+% \let;\math_punctuation_yes_semicolon}
+%
+% \gdefcsname\??mathautopunctuation\v!all\string,semicolon\endcsname
+% {\let,\math_punctuation_all_comma
+% \let.\math_punctuation_all_period
+% \let;\math_punctuation_all_semicolon}
+%
+% \egroup
-\egroup
+\defcsname\??mathautopunctuation\v!no\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_nop_comma
+ \letcharcode\periodasciicode \math_punctuation_nop_period
+ \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
+
+\defcsname\??mathautopunctuation\v!yes\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_yes_comma
+ \letcharcode\periodasciicode \math_punctuation_yes_period
+ \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
+
+\defcsname\??mathautopunctuation\v!all\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_all_comma
+ \letcharcode\periodasciicode \math_punctuation_all_period
+ \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
+
+\defcsname\??mathautopunctuation comma\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_yes_comma
+ \letcharcode\periodasciicode \math_punctuation_yes_period
+ \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
+
+\defcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_yes_comma
+ \letcharcode\periodasciicode \math_punctuation_yes_period
+ \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon}
+
+\defcsname\??mathautopunctuation comma\string,semicolon\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_yes_comma
+ \letcharcode\periodasciicode \math_punctuation_yes_period
+ \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon}
+
+\defcsname\??mathautopunctuation\v!all\string,semicolon\endcsname
+ {\letcharcode\commaasciicode \math_punctuation_all_comma
+ \letcharcode\periodasciicode \math_punctuation_all_period
+ \letcharcode\semicolonasciicode\math_punctuation_all_semicolon}
% \appendtoks
% \global\mathcode\commaasciicode \c_math_special
@@ -4548,8 +4587,8 @@
\def\math_axis_inject_indeed#1%
{\srule
- \s!height \dimexpr\scratchdimentwo+\scratchdimenone\relax
- \s!depth -\dimexpr\scratchdimentwo-\scratchdimenone\relax
+ \s!height \dimexpr(\scratchdimentwo+\scratchdimenone)*\c_math_m_scaled/\plusthousand\relax
+ \s!depth -\dimexpr(\scratchdimentwo-\scratchdimenone)*\c_math_m_scaled/\plusthousand\relax
\s!attr \mathaxisattribute#1%
\relax}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt
index 98cc59c8942..0bd75d74894 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt
@@ -7,31 +7,13 @@ if not modules then modules = { } end modules ['math-map'] = {
license = "see context related readme files"
}
--- todo: make sparse .. if self
-
---[[ldx--
-<p>Remapping mathematics alphabets.</p>
---ldx]]--
-
--- oldstyle: not really mathematics but happened to be part of
--- the mathematics fonts in cmr
---
--- persian: we will also provide mappers for other
--- scripts
-
--- todo: alphabets namespace
--- maybe: script/scriptscript dynamic,
-
--- superscripped primes get unscripted !
-
--- to be looked into once the fonts are ready (will become font
--- goodie):
---
--- (U+2202,U+1D715) : upright
--- (U+2202,U+1D715) : italic
--- (U+2202,U+1D715) : upright
---
--- plus add them to the regular vectors below so that they honor \it etc
+-- persian: we will also provide mappers for other scripts
+-- todo : alphabets namespace
+-- maybe : script/scriptscript dynamic,
+-- check : (U+2202,U+1D715) : upright
+-- (U+2202,U+1D715) : italic
+-- (U+2202,U+1D715) : upright
+-- add them to the regular vectors below so that they honor \it etc
local type, next = type, next
local merged, sortedhash = table.merged, table.sortedhash
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt
index 4a0cb57449e..cbcf6164d1f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt
@@ -881,47 +881,48 @@ do
local method = div(a,100)
local size = a % 100
setattr(pointer,a_mathsize,0)
- local delimiter = getdelimiter(pointer)
- if delimiter then
- local oldchar, font, fam = getcharspec(delimiter)
- if oldchar > 0 and font > 0 then
- local ht = getheight(pointer)
- local dp = getdepth(pointer)
- local data = fontdata[font]
- local characters = data.characters
- local olddata = characters[oldchar]
--- local oldheight = olddata.height or 0
--- local olddepth = olddata.depth or 0
- local template = olddata.varianttemplate
- local newchar = mathematics.big(data,template or oldchar,size,method)
- local newdata = characters[newchar]
- local newheight = newdata.height or 0
- local newdepth = newdata.depth or 0
- if template then
--- local ratio = (newheight + newdepth) / (oldheight + olddepth)
--- setheight(pointer,ratio * oldheight)
--- setdepth(pointer,ratio * olddepth)
- setheight(pointer,newheight)
- setdepth(pointer,newdepth)
- if not olddata.extensible then
- -- check this on bonum and antykwa
- setoptions(pointer,0)
- end
- if trace_fences then
--- report_fences("replacing %C using method %a, size %a, template %C and ratio %.3f",newchar,method,size,template,ratio)
- report_fences("replacing %C using method %a, size %a and template %C",newchar,method,size,template)
- end
- else
- -- 1 scaled point is a signal, for now
- if ht == 1 then
- setheight(pointer,newheight)
- end
- if dp == 1 then
- setdepth(pointer,newdepth)
- end
- setchar(delimiter,newchar)
- if trace_fences then
- report_fences("replacing %C by %C using method %a and size %a",oldchar,char,method,size)
+ if size ~= 0 then
+ local delimiter = getdelimiter(pointer)
+ if delimiter then
+ local oldchar, font, fam = getcharspec(delimiter)
+ if oldchar > 0 and font > 0 then
+ local ht = getheight(pointer)
+ local dp = getdepth(pointer)
+ local data = fontdata[font]
+ local characters = data.characters
+ local olddata = characters[oldchar]
+ if olddata then
+ local template = olddata.varianttemplate
+ local newchar = mathematics.big(data,template or oldchar,size,method)
+ local newdata = characters[newchar]
+ local newheight = newdata.height or 0
+ local newdepth = newdata.depth or 0
+ if template then
+ setheight(pointer,newheight)
+ setdepth(pointer,newdepth)
+ if not olddata.extensible then
+ -- check this on bonum and antykwa
+ setoptions(pointer,0)
+ end
+ setoptions(pointer,getoptions(pointer)| tex.noadoptioncodes.scale )
+ if trace_fences then
+ report_fences("replacing %C using method %a, size %a and template %C",newchar,method,size,template)
+ end
+ else
+ -- 1 scaled point is a signal, for now
+ if ht == 1 then
+ setheight(pointer,newheight)
+ end
+ if dp == 1 then
+ setdepth(pointer,newdepth)
+ end
+ setchar(delimiter,newchar)
+ if trace_fences then
+ report_fences("replacing %C by %C using method %a and size %a",oldchar,char,method,size)
+ end
+ end
+ elseif trace_fences then
+ report_fences("not replacing %C using method %a and size %a",oldchar,method,size)
end
end
end
@@ -1552,18 +1553,22 @@ do
local attributes = mathalternates.attributes
local registered = mathalternates.registered
local hashes = mathalternates.hashes
+ local newchar = nil
for i=1,#registered do
local r = registered[i]
if (a & r) ~= 0 then
- local char = getchar(pointer)
+ local char = newchar or getchar(pointer)
local alt = hashes[i][char]
if alt == nil then
local what = attributes[r]
+local list = what.list
+if not list or list[char] then
alt = otf.getalternate(fontdata[fontid],char,what.feature,what.value) or false
if alt == char then
alt = false
end
hashes[i][char] = alt
+end
end
if alt then
if trace_alternates then
@@ -1571,11 +1576,15 @@ do
report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U",
tostring(what.feature),tostring(what.value),char,alt)
end
- setchar(pointer,alt)
- break
+ -- setchar(pointer,alt)
+ -- break
+ newchar = alt
end
end
end
+ if newchar then
+ setchar(pointer,newchar)
+ end
end
end
end
@@ -2974,7 +2983,7 @@ function processors.mlisttohlist(head,style,penalties,beginclass,endclass,level)
return head
end
-callbacks.register('mlist_to_hlist',processors.mlisttohlist,"preprocessing math list")
+callbacks.register("mlist_to_hlist",processors.mlisttohlist,"convert a noad list into a node list")
-- tracing
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx
index 703481c0820..ee91243e0ae 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx
@@ -195,8 +195,8 @@
\zerocount
\fi
\Urooted
- \s!height\dimexpr\mathradicalparameter\c!height\relax
- \s!depth \dimexpr\mathradicalparameter\c!depth\relax
+ \s!height\dimexpr\ifcstok{\mathradicalparameter\c!height}\v!none\scaledpoint\else\mathradicalparameter\c!height\fi\relax
+ \s!depth \dimexpr\ifcstok{\mathradicalparameter\c!depth }\v!none\scaledpoint\else\mathradicalparameter\c!depth \fi\relax
\s!source\numexpr\namedboxanchor{\mathradicalparameter\c!source}\relax
\s!style \normalmathstyle
\ifzeronum\scratchcounter\else
@@ -378,6 +378,12 @@
\integerdef\delimitedrightanutityuc \privatecharactercode{delimited right annuity}
\integerdef\radicalbarextenderuc \privatecharactercode{radical bar extender}
+%D We now default to nice bars:
+
+\setupmathradical
+ [\c!rule=\v!symbol,
+ \c!top=\radicalbarextenderuc]
+
\definemathradical
[rannuity]
[\c!left=\zerocount,
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
index 9875f8b2d93..a575b17142e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
@@ -41,12 +41,18 @@ local getnormalizedline = node.direct.getnormalizedline
local getbox = nuts.getbox
local setoffsets = nuts.setoffsets
local addxoffset = nuts.addxoffset
+local setattrlist = nuts.setattrlist
local nextglue = nuts.traversers.glue
local nextlist = nuts.traversers.list
local nextboundary = nuts.traversers.boundary
local nextnode = nuts.traversers.node
+local insertafter = nuts.insertafter
+local insertbefore = nuts.insertbefore
+local newkern = nuts.pool.kern
+local newstrutrule = nuts.pool.strutrule
+
local texsetdimen = tex.setdimen
local texgetdimen = tex.getdimen
local texsetcount = tex.setcount
@@ -65,6 +71,10 @@ local d_strc_math_first_height = texisdimen("d_strc_math_first_height")
local d_strc_math_last_depth = texisdimen("d_strc_math_last_depth")
local d_strc_math_indent = texisdimen("d_strc_math_indent")
+local report = logs.reporter("mathalign")
+
+local trace = false trackers.register("mathalign",function(v) trace = v end )
+
local function moveon(s)
for n, id, subtype in nextnode, getnext(s) do
s = n
@@ -83,42 +93,6 @@ local function moveon(s)
return s
end
--- stages[1] = function(specification,stage)
--- local box = getbox(specification.box)
--- local head = getlist(box)
--- local align = specification.alignstate
--- local distance = specification.distance
--- for s in nextboundary, head do
--- local data = getdata(s)
--- if data == boundary then
--- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop
--- s = moveon(s)
--- for n, id, subtype in nextnode, getnext(s) do
--- s = n
--- if id == kern_code then
--- -- move on (s_2 case)
--- elseif id == glue_code then
--- -- move on
--- elseif id == penalty_code then
--- -- move on (untested)
--- elseif id == hlist_code and subtype == ghost_code then
--- -- move on
--- else
--- break
--- end
--- end
--- distance = distance + getdimensions(head,s)
--- break
--- end
--- end
--- texsetdimen("global",d_strc_math_indent,distance)
--- if align == 2 then
--- for n in nextglue, head do
--- setglue(n,getwidth(n),0,0,0,0)
--- end
--- end
--- end
-
-- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop
--
-- local n = getnext(s)
@@ -171,16 +145,20 @@ stages[1] = function(specification,stage)
p = getprev(p)
end
end
- -- we use a hangindent so we need to treat the first one
- local f = found[1]
- local delta = f[2] - max
- if delta ~= 0 then
- nuts.insertafter(head,moveon(head),nuts.pool.kern(-delta))
- end
- for i=2,#found do
+ for i=1,#found do
local f = found[i]
- local delta = f[2] - max
- nuts.insertafter(head,moveon(f[3]),nuts.pool.kern(-f[2])) -- check head
+ local w = f[2]
+ local d = i == 1 and (max-w) or -w
+ local k = newkern(d)
+ local r = newstrutrule(0,2*65536,2*65536)
+ local s = moveon(f[3])
+ if trace then
+ report("row %i, width %p, delta %p",i,w,d)
+ end
+ setattrlist(r,head)
+ setattrlist(k,head)
+ insertbefore(head,s,r)
+ insertafter(head,r,k)
end
end
texsetdimen("global",d_strc_math_indent,max)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx
index 5922fb1166c..1e488af2cbd 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx
@@ -78,47 +78,35 @@
% At some point we can consider to use the more natural \LUAMETATEX\ features but the
% problem is that we lack proper support in fonts and we also have less control.
-\installcorenamespace {mathextensiblefallbacks}
+%installcorenamespace {mathextensiblefallbacks}
-% currently no italic correction ... problem is that we don't know yet if we have an italic
-% below so we we need to postpone
-
-% \def\math_stackers_fallback
-% {\hbox to \scratchwidth{\csname\??mathextensiblefallbacks\ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname\number\scratchunicode\fi\endcsname}}
-% %{\csname\??mathextensiblefallbacks\ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname\number\scratchunicode\fi\endcsname }
+% In math mode we no longer fallback, simply because only a few fonts implement
+% extensible using minus and equal signs. So either we provide a tweaked one or we
+% simply ignore the lack. Better choose a font that matches expectations that some
+% fragile imperfect hackery.
\def\math_stackers_fallback
{\mathstylehbox to \scratchwidth{\usemathstackerscolorparameter\c!color
\hss
\hskip\mathstackersparameter\c!topoffset\relax % for manual italic correction
- \ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname
- \lastnamedcs
- \else
+ % \ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname
+ % \lastnamedcs
+ % \else
\Umathchar\zerocount\zerocount\scratchunicode
- \fi
+ % \fi
\hss}}
-% \def\math_stackers_regular
-% {\mathstylehbox{\usemathstackerscolorparameter\c!color
-% \hskip\d_math_stackers_offset_l
-% \Umathaccent\zerocount\zerocount\scratchunicode
-% {\hskip\dimexpr\scratchwidth-\d_math_stackers_offset_l-\d_math_stackers_offset_r}%
-% \hskip\d_math_stackers_offset_r
-% }}
-
-% \def\math_stackers_stretch % we don't have that one yet
-% {\mathstylehbox{\usemathstackerscolorparameter\c!color
-% \hskip\d_math_stackers_offset_l
-% \Umathaccent\zerocount\zerocount\scratchunicode
-% {\hskip\dimexpr\hsize-\d_math_stackers_offset_l-\d_math_stackers_offset_r}%
-% \hskip\d_math_stackers_offset_r
-% }}
-
\def\math_stackers_regular
{\mathstylehbox{\usemathstackerscolorparameter\c!color
\hskip\d_math_stackers_offset_l
\Uhextensible
middle
+ \ifcstok{\mathstackersparameter\c!stretch}\v!yes
+ stretch
+ \fi
+ \ifcstok{\mathstackersparameter\c!shrink}\v!yes
+ shrink
+ \fi
width \dimexpr\scratchwidth-\d_math_stackers_offset_l-\d_math_stackers_offset_r\relax
\zerocount\scratchunicode
\relax
@@ -130,18 +118,8 @@
% $\Umathaccent 0 0 "2190{x}$ \par $\Umathaccent 0 0 "27F8{x}$\par
% $\Udelimiterunder 0 "2190{x}$ \par $\Udelimiterunder 0 "27F8{x}$\par
-\defcsname\??mathextensiblefallbacks\endcsname
- {\hpack{\vrule\s!width\scratchwidth\s!height.1\mathexheight\s!depth\zeropoint}}
-
-% \def\math_stackers_with_fallback#codepoint%
-% {\begingroup
-% \scratchunicode#codepoint\relax
-% \ifcase\mathextensiblecode\fam\scratchunicode\relax
-% \math_stackers_fallback
-% \else
-% \math_stackers_stretch
-% \fi
-% \endgroup}
+% \defcsname\??mathextensiblefallbacks\endcsname
+% {\hpack{\vrule\s!width\scratchwidth\s!height.1\mathexheight\s!depth\zeropoint}}
%D We don't really need this because we can assume that fonts have the right
%D extensibles. If needed I will make a general virtual extender for \OPENTYPE\
@@ -337,6 +315,28 @@
\scratchbottomoffset\zeropoint
\fi}
+\def\math_stackers_get_max_width
+ {\ifdim\wd\scratchboxone>\scratchwidth
+ \scratchwidth\wd\scratchboxone
+ \fi
+ \ifdim\wd\scratchboxtwo>\scratchwidth
+ \scratchwidth\wd\scratchboxtwo
+ \fi
+ \ifdim\wd\scratchboxthree>\scratchwidth
+ \scratchwidth\wd\scratchboxthree
+ \fi}
+
+\def\math_stackers_set_max_width
+ {\ifdim\wd\scratchboxone<\scratchwidth
+ \setbox\scratchboxone\hpack to \scratchwidth{\hss\unhbox\scratchboxone\hss}% unhboxing makes leaders work
+ \fi
+ \ifdim\wd\scratchboxtwo<\scratchwidth
+ \setbox\scratchboxtwo\hpack to \scratchwidth{\hss\unhbox\scratchboxtwo\hss}%
+ \fi
+ \ifdim\wd\scratchboxthree<\scratchwidth
+ \setbox\scratchboxthree\hpack to \scratchwidth{\hss\unhbox\scratchboxthree\hss}%
+ \fi}
+
\protected\def\math_stackers_triplet#method#category#codepoint#toptext#bottomtext%
{\begingroup
\edef\currentmathstackers{#category}%
@@ -395,19 +395,7 @@
\else
\setmathtextbox\scratchboxthree\hbox{\math_stackers_middletext}%
\fi
- \scratchwidth\wd
- \ifdim\wd\scratchboxone>\wd\scratchboxtwo
- \ifdim\wd\scratchboxone>\wd\scratchboxthree
- \scratchboxone
- \else
- \scratchboxthree
- \fi
- \orelse\ifdim\wd\scratchboxtwo>\wd\scratchboxthree
- \scratchboxtwo
- \else
- \scratchboxthree
- \fi
- \relax
+ \math_stackers_get_max_width
\fi
%
\scratchdimen\mathstackersparameter\c!minwidth\relax
@@ -421,19 +409,11 @@
\setbox\scratchboxthree\csname\??mathstackersalternative\p_alternative\endcsname
\dostoptagged
\fi
- \ifdim\wd\scratchboxthree>\scratchwidth
- \scratchwidth\wd\scratchboxthree
- \fi
+% \ifdim\wd\scratchboxthree>\scratchwidth
+% \scratchwidth\wd\scratchboxthree
+% \fi
%
- \ifdim\wd\scratchboxone<\scratchwidth
- \setbox\scratchboxone\hpack to \scratchwidth{\hss\unhbox\scratchboxone\hss}% unhboxing makes leaders work
- \fi
- \ifdim\wd\scratchboxtwo<\scratchwidth
- \setbox\scratchboxtwo\hpack to \scratchwidth{\hss\unhbox\scratchboxtwo\hss}%
- \fi
- \ifdim\wd\scratchboxthree<\scratchwidth
- \setbox\scratchboxthree\hpack to \scratchwidth{\hss\unhbox\scratchboxthree\hss}%
- \fi
+ \math_stackers_set_max_width
%
\ifcsname\??mathstackerslocation\p_location\endcsname
\ifcase\csname\??mathstackerslocation\p_location\endcsname\relax
@@ -458,7 +438,6 @@
\ifzeropt\scratchdistance\else
\setbox\scratchboxthree\hpack{\lower\scratchdistance\box\scratchboxthree}%
\fi
- %
\math_stackers_normalize_three
% analysis
\ifdim\htdp\scratchboxtwo>\zeropoint
@@ -625,6 +604,8 @@
\fi
%
\math_stackers_normalize_three
+ \math_stackers_get_max_width
+ \math_stackers_set_max_width
% analysis
\ifcase\c_math_stackers_bottom
\ifcase\c_math_stackers_top
@@ -654,7 +635,7 @@
\math_stackers_bottom\bgroup
\lower\dimexpr
\scratchdepth
- +\ht\scratchboxtwo
+ +\ht\ifcase\c_math_stackers_top\scratchboxtwo\else\scratchboxone\fi
+\mathstackersparameter\c!distance % was \c!voffset
\relax
\ifcase\c_math_stackers_top
@@ -973,6 +954,7 @@
[\v!both]
[\v!mathematics]
[\c!location=\v!top, % ?
+ \c!mathclass=\s!accent, % check chemistry
\c!strut=\v!no,
\c!middlecommand=\mathematics,
\c!hoffset=\zeropoint]
@@ -989,7 +971,10 @@
[\v!vfenced]
[\v!both]
[\c!mathclass=\s!ordinary,
- \c!mathlimits=\v!yes]
+ \c!mathlimits=\v!yes,
+ % only these arrows make sense
+ \c!stretch=\v!yes,
+ \c!shrink=\v!yes]
% these are needed for mathml:
@@ -1037,7 +1022,7 @@
\immutable\protected\def\normaldoublebrace {\Umathaccent \s!both \zerocount \zerocount "23DE \zerocount \zerocount "23DF }
\immutable\protected\def\normaldoubleparent{\Umathaccent \s!both \zerocount \zerocount "23DC \zerocount \zerocount "23DD }
-% let's keep this
+% let's keep this .. some are not defined so there's nothing normal
\aliased\let\normaloverbrace \overbrace
\aliased\let\normalunderbrace \underbrace
@@ -1045,10 +1030,11 @@
\aliased\let\normalunderparent \underparent
\aliased\let\normaloverbracket \overbracket
\aliased\let\normalunderbracket \underbracket
-\aliased\let\normalunderleftarrow \underleftarrow
-\aliased\let\normaloverleftarrow \overleftarrow
-\aliased\let\normalunderrightarrow\underrightarrow
-\aliased\let\normaloverrightarrow \overrightarrow
+
+%aliased\let\normalunderleftarrow \underleftarrow
+%aliased\let\normaloverleftarrow \overleftarrow
+%aliased\let\normalunderrightarrow\underrightarrow
+%aliased\let\normaloverrightarrow \overrightarrow
%D Here come the new ones:
@@ -1058,7 +1044,7 @@
\definemathstackers [\v!medium] [\v!mathematics] [\c!hoffset=1.5\mathemwidth]
\definemathstackers [\v!big] [\v!mathematics] [\c!hoffset=2\mathemwidth]
-\definemathextensible [\v!reverse] [xrel] ["002D]
+\definemathextensible [\v!reverse] [xrel] ["2212] % ["002D]
\definemathextensible [\v!reverse] [xequal] ["003D]
\definemathextensible [\v!reverse] [xleftarrow] ["2190] % ["27F5]
\definemathextensible [\v!reverse] [xrightarrow] ["2192] % ["27F6]
@@ -1081,14 +1067,14 @@
\definemathextensible [\v!reverse] [xrightleftharpoons] ["21CC]
\definemathextensible [\v!reverse] [xtriplerel] ["2261]
-\definemathextensible [\v!mathematics] [mrel] ["002D]
+\definemathextensible [\v!mathematics] [mrel] ["2212] % ["002D]
\definemathextensible [\v!mathematics] [mequal] ["003D]
\definemathextensible [\v!mathematics] [mleftarrow] ["2190] % ["27F5]
\definemathextensible [\v!mathematics] [mrightarrow] ["2192] % ["27F6]
-\definemathextensible [\v!mathematics] [mleftrightarrow] ["27F7]
-\definemathextensible [\v!mathematics] [mLeftarrow] ["27F8]
-\definemathextensible [\v!mathematics] [mRightarrow] ["27F9]
-\definemathextensible [\v!mathematics] [mLeftrightarrow] ["27FA]
+\definemathextensible [\v!mathematics] [mleftrightarrow] ["2194]
+\definemathextensible [\v!mathematics] [mLeftarrow] ["21D0]
+\definemathextensible [\v!mathematics] [mRightarrow] ["21D2]
+\definemathextensible [\v!mathematics] [mLeftrightarrow] ["21D4]
\definemathextensible [\v!mathematics] [mtwoheadleftarrow] ["219E]
\definemathextensible [\v!mathematics] [mtwoheadrightarrow] ["21A0]
\definemathextensible [\v!mathematics] [mmapsto] ["21A6]
@@ -1104,17 +1090,18 @@
\definemathextensible [\v!mathematics] [mrightleftharpoons] ["21CC]
\definemathextensible [\v!mathematics] [mtriplerel] ["2261]
-\definemathextensible [\v!text] [trel] ["002D]
+\definemathextensible [\v!text] [trel] ["2212] % ["002D]
\definemathextensible [\v!text] [tequal] ["003D]
\definemathextensible [\v!text] [tmapsto] ["21A6]
\definemathextensible [\v!text] [tleftarrow] ["2190] % ["27F5]
\definemathextensible [\v!text] [trightarrow] ["2192] % ["27F6]
-\definemathextensible [\v!text] [tleftrightarrow] ["27F7]
-\definemathextensible [\v!text] [tLeftarrow] ["27F8]
-\definemathextensible [\v!text] [tRightarrow] ["27F9]
-\definemathextensible [\v!text] [tLeftrightarrow] ["27FA]
+\definemathextensible [\v!text] [tleftrightarrow] ["2194]
+\definemathextensible [\v!text] [tLeftarrow] ["21D0]
+\definemathextensible [\v!text] [tRightarrow] ["21D2]
+\definemathextensible [\v!text] [tLeftrightarrow] ["21D4]
\definemathextensible [\v!text] [ttwoheadleftarrow] ["219E]
\definemathextensible [\v!text] [ttwoheadrightarrow] ["21A0]
+\definemathextensible [\v!text] [tmapsto] ["21A6]
\definemathextensible [\v!text] [thookleftarrow] ["21A9]
\definemathextensible [\v!text] [thookrightarrow] ["21AA]
\definemathextensible [\v!text] [tleftharpoondown] ["21BD]
@@ -1127,25 +1114,47 @@
\definemathextensible [\v!text] [trightleftharpoons] ["21CC]
\definemathextensible [\v!text] [ttriplerel] ["2261]
-\definemathoverextensible [\v!top] [overleftarrow] ["2190] % ["27F5]
-\definemathoverextensible [\v!top] [overrightarrow] ["2192] % ["27F6]
-\definemathoverextensible [\v!top] [overleftrightarrow] ["27F7]
-\definemathoverextensible [\v!top] [overtwoheadleftarrow] ["27F8]
-\definemathoverextensible [\v!top] [overtwoheadrightarrow] ["27F9]
-\definemathoverextensible [\v!top] [overleftharpoondown] ["21BD]
-\definemathoverextensible [\v!top] [overleftharpoonup] ["21BC]
-\definemathoverextensible [\v!top] [overrightharpoondown] ["21C1]
-\definemathoverextensible [\v!top] [overrightharpoonup] ["21C0]
+\definemathoverextensible [\v!top] [overleftarrow] ["2190] % ["27F5]
+\definemathoverextensible [\v!top] [overrightarrow] ["2192] % ["27F6]
+\definemathoverextensible [\v!top] [overleftrightarrow] ["2194] % ["27F7]
+\definemathoverextensible [\v!top] [overtwoheadleftarrow] ["219E] % ["27F8]
+\definemathoverextensible [\v!top] [overtwoheadrightarrow] ["21A0] % ["27F9]
+\definemathoverextensible [\v!top] [overlefttailarrow] ["21A2]
+\definemathoverextensible [\v!top] [overrighttailarrow] ["21A3]
+\definemathoverextensible [\v!top] [overleftbararrow] ["21A4]
+\definemathoverextensible [\v!top] [overrightbararrow] ["21A6]
+\definemathoverextensible [\v!top] [overlefthookarrow] ["21A9]
+\definemathoverextensible [\v!top] [overrighthookarrow] ["21AA]
+\definemathoverextensible [\v!top] [overleftharpoondown] ["21BD]
+\definemathoverextensible [\v!top] [overleftharpoonup] ["21BC]
+\definemathoverextensible [\v!top] [overrightharpoondown] ["21C1]
+\definemathoverextensible [\v!top] [overrightharpoonup] ["21C0]
+\definemathoverextensible [\v!top] [overRightarrow] ["21D2] % ["27F9]
+\definemathoverextensible [\v!top] [overLeftarrow] ["21D0] % ["27F8]
+\definemathoverextensible [\v!top] [overLeftrightarrow] ["21D4] % ["27F8]
+\definemathoverextensible [\v!top] [overLeftbararrow] ["2906]
+\definemathoverextensible [\v!top] [overRightbararrow] ["2907]
\definemathunderextensible [\v!bottom] [underleftarrow] ["2190] % ["27F5]
\definemathunderextensible [\v!bottom] [underrightarrow] ["2192] % ["27F6]
-\definemathunderextensible [\v!bottom] [underleftrightarrow] ["27F7]
-\definemathunderextensible [\v!bottom] [undertwoheadleftarrow] ["27F8]
-\definemathunderextensible [\v!bottom] [undertwoheadrightarrow] ["27F9]
+\definemathunderextensible [\v!bottom] [underleftrightarrow] ["2194] % ["27F7]
+\definemathunderextensible [\v!bottom] [undertwoheadleftarrow] ["219E] % ["27F8]
+\definemathunderextensible [\v!bottom] [undertwoheadrightarrow] ["21A0] % ["27F9]
+\definemathunderextensible [\v!bottom] [underlefttailarrow] ["21A2]
+\definemathunderextensible [\v!bottom] [underrighttailarrow] ["21A3]
+\definemathunderextensible [\v!bottom] [underleftbararrow] ["21A4]
+\definemathunderextensible [\v!bottom] [underrightbararrow] ["21A6]
+\definemathunderextensible [\v!bottom] [underlefthookarrow] ["21A9]
+\definemathunderextensible [\v!bottom] [underrighthookarrow] ["21AA]
\definemathunderextensible [\v!bottom] [underleftharpoondown] ["21BD]
\definemathunderextensible [\v!bottom] [underleftharpoonup] ["21BC]
\definemathunderextensible [\v!bottom] [underrightharpoondown] ["21C1]
\definemathunderextensible [\v!bottom] [underrightharpoonup] ["21C0]
+\definemathunderextensible [\v!bottom] [underRightarrow] ["21D2] % ["27F9]
+\definemathunderextensible [\v!bottom] [underLeftarrow] ["21D0] % ["27F8]
+\definemathunderextensible [\v!bottom] [underLeftrightarrow] ["21D4] % ["27F8]
+\definemathunderextensible [\v!bottom] [underLeftbararrow] ["2906]
+\definemathunderextensible [\v!bottom] [underRightbararrow] ["2907]
%D We don't use overline and underline. This is one of the overlooked aspects of
%D unicode cq. opentype math: why treat rules different than e.g. arrows and
@@ -1160,9 +1169,9 @@
%D in the backend (okay, we still need to deal with some cut and paste issues but at
%D least we now know what we deal with.
-\definemathoverextensible [\v!vfenced] [overbar] ["203E]
-\definemathunderextensible [\v!vfenced] [underbar] ["203E] % ["0332]
-\definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] % ["0332]
+\definemathoverextensible [\v!vfenced] [overbar] ["203E] % todo: private
+\definemathunderextensible [\v!vfenced] [underbar] ["203E] % todo: private
+\definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] % todo: private
\definemathoverextensible [\v!vfenced] [overbrace] ["23DE]
\definemathunderextensible [\v!vfenced] [underbrace] ["23DF]
@@ -1178,13 +1187,13 @@
%D For mathml:
-\definemathdoubleextensible [\v!both] [overbarunderbar] ["203E] ["203E]
+\definemathdoubleextensible [\v!both] [overbarunderbar] ["203E] ["203E] % todo: private
\definemathdoubleextensible [\v!both] [overbraceunderbrace] ["23DE] ["23DF]
\definemathdoubleextensible [\v!both] [overparentunderparent] ["23DC] ["23DD]
\definemathdoubleextensible [\v!both] [overbracketunderbracket] ["23B4] ["23B5]
-\definemathovertextextensible [\v!bothtext] [overbartext] ["203E]
-\definemathundertextextensible [\v!bothtext] [underbartext] ["203E]
+\definemathovertextextensible [\v!bothtext] [overbartext] ["203E] % todo: private
+\definemathundertextextensible [\v!bothtext] [underbartext] ["203E] % todo: private
\definemathovertextextensible [\v!bothtext] [overbracetext] ["23DE]
\definemathundertextextensible [\v!bothtext] [underbracetext] ["23DF]
\definemathovertextextensible [\v!bothtext] [overparenttext] ["23DC]
@@ -1206,56 +1215,79 @@
\definemathextensible [\v!chemistry] [crightoverleftarrow] ["21C4]
\definemathextensible [\v!chemistry] [cleftoverrightarrow] ["21C6]
-\def\math_stackers_hacked_fill#1#2#3%
- {\mathematics
- {\begingroup
- \mathsurround\zeropoint
- \thickmuskip \zeromuskip
- \medmuskip \zeromuskip
- \thinmuskip \zeromuskip
- \tinymuskip \zeromuskip
- \pettymuskip \zeromuskip
- \ifrelax#1%
- \cleaders\mathstylehbox{#2}\hfill
- \else
- #1%
- \mkern-7\onemuskip
- \cleaders\mathstylehbox{\mkern-2\onemuskip#2\mkern-2\onemuskip}\hfill
- \mkern-7\onemuskip
- #3%
- \fi
- \endgroup}}
-
-\immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow}
-\immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar}
-\immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \relax \crightoverleftarrow \relax}
-\immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \relax \cleftoverrightarrow \relax}
-\immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar}
-\immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow}
-\immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar}
-\immutable\protected\def\Leftrightarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Rightarrow}
-\immutable\protected\def\leftrightarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \rightarrow}
-\immutable\protected\def\mapstofill {\math_stackers_hacked_fill{\mapstochar\relbar} \relbar \rightarrow}
-\immutable\protected\def\twoheadrightarrowfill {\math_stackers_hacked_fill \relbar \relbar \twoheadrightarrow}
-\immutable\protected\def\twoheadleftarrowfill {\math_stackers_hacked_fill \twoheadleftarrow \relbar \relbar}
-\immutable\protected\def\rightharpoondownfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoondown}
-\immutable\protected\def\rightharpoonupfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoonup}
-\immutable\protected\def\leftharpoondownfill {\math_stackers_hacked_fill \leftharpoondown \relbar \relbar}
-\immutable\protected\def\leftharpoonupfill {\math_stackers_hacked_fill \leftharpoonup \relbar \relbar}
-\immutable\protected\def\hookleftfill {\math_stackers_hacked_fill \leftarrow \relbar {\relbar\joinrel\rhook}}
-\immutable\protected\def\hookrightfill {\math_stackers_hacked_fill{\lhook\joinrel\relbar}\relbar \rightarrow}
-\immutable\protected\def\relfill {\math_stackers_hacked_fill \relbar \relbar \relbar}
-\immutable\protected\def\triplerelfill {\math_stackers_hacked_fill \equiv \equiv \equiv}
-
-%D For the moment (needs checking):
+% \def\math_stackers_hacked_fill#1#2#3%
+% {\mathematics
+% {\begingroup
+% \mathsurround\zeropoint
+% \thickmuskip \zeromuskip
+% \medmuskip \zeromuskip
+% \thinmuskip \zeromuskip
+% \tinymuskip \zeromuskip
+% \pettymuskip \zeromuskip
+% \ifrelax#1%
+% \cleaders\mathstylehbox{#2}\hfill
+% \else
+% #1%
+% \mkern-7\onemuskip
+% \cleaders\mathstylehbox{\mkern-2\onemuskip#2\mkern-2\onemuskip}\hfill
+% \mkern-7\onemuskip
+% #3%
+% \fi
+% \endgroup}}
+%
+% \immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow}
+% \immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar}
+% \immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \relax \crightoverleftarrow \relax}
+% \immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \relax \cleftoverrightarrow \relax}
+% \immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar}
+% \immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow}
+% \immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar}
+% \immutable\protected\def\Leftrightarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Rightarrow}
+% \immutable\protected\def\leftrightarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \rightarrow}
+% \immutable\protected\def\mapstofill {\math_stackers_hacked_fill{\mapstochar\relbar} \relbar \rightarrow}
+% \immutable\protected\def\twoheadrightarrowfill {\math_stackers_hacked_fill \relbar \relbar \twoheadrightarrow}
+% \immutable\protected\def\twoheadleftarrowfill {\math_stackers_hacked_fill \twoheadleftarrow \relbar \relbar}
+% \immutable\protected\def\rightharpoondownfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoondown}
+% \immutable\protected\def\rightharpoonupfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoonup}
+% \immutable\protected\def\leftharpoondownfill {\math_stackers_hacked_fill \leftharpoondown \relbar \relbar}
+% \immutable\protected\def\leftharpoonupfill {\math_stackers_hacked_fill \leftharpoonup \relbar \relbar}
+% \immutable\protected\def\hookleftfill {\math_stackers_hacked_fill \leftarrow \relbar {\relbar\joinrel\rhook}}
+% \immutable\protected\def\hookrightfill {\math_stackers_hacked_fill{\lhook\joinrel\relbar}\relbar \rightarrow}
+% \immutable\protected\def\relfill {\math_stackers_hacked_fill \relbar \relbar \relbar}
+% \immutable\protected\def\triplerelfill {\math_stackers_hacked_fill \equiv \equiv \equiv}
+%
+% \permanent\tolerant\protected\def\defineextensiblefiller[#1]#*[#2]%
+% {\immutable\letcsname\??mathextensiblefallbacks\number#2\expandafter\endcsname\csname#1\endcsname}
+
+\installcorenamespace {mathadaptiveextensible}
+
+\defineadaptive
+ [mathfiller]
+ [\c!setups=adaptive:mathfiller,
+ \c!stretch=1fill]
+
+\startsetups adaptive:mathfiller
+ \setbox\usedadaptivebox\hbox to \usedadaptivewidth \bgroup
+ \startimath
+ \Uhextensible
+ \s!width \usedadaptivewidth
+ \s!middle \zerocount \usedadaptivealternative
+ \relax
+ \stopimath
+ \egroup
+\stopsetups
+
+\def\mathfiller#1%
+ {\begingroup
+ \scratchunicode#1\relax
+ \adaptivebox[mathfiller][\c!alternative=#1]{\hss\strut\hss}%
+ \endgroup}
\permanent\tolerant\protected\def\defineextensiblefiller[#1]#*[#2]%
- {\immutable\letcsname\??mathextensiblefallbacks\number#2\expandafter\endcsname\csname#1\endcsname
- %\immutable\letcsname#1\expandafter\endcsname\csname#1\endcsname
- } % huh?
+ {\frozen\instance\edefcsname#1\endcsname{\mathfiller{\number#2}}}
-%defineextensiblefiller [barfill] ["203E] % yet undefined
-\defineextensiblefiller [relfill] ["002D]
+%defineextensiblefiller [barfill] ["203E] % % todo: private
+\defineextensiblefiller [relfill] ["2212] % ["002D]
\defineextensiblefiller [equalfill] ["003D]
\defineextensiblefiller [leftarrowfill] ["2190]
\defineextensiblefiller [rightarrowfill] ["2192]
@@ -1302,14 +1334,18 @@
{\begingroup
\edef\currentmathstackers{#category}%
\edef\p_moffset{\mathstackersparameter\c!moffset}%
- \ifempty\p_moffset \else
- \mskip\p_moffset\relax
+ \ifconditional\indisplaymath
+ \ifempty\p_moffset \else
+ \ifmmode\mskip\else\hskip\fi\p_moffset\relax
+ \fi
\fi
\ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi
{\usemathstackerscolorparameter\c!color
\Umathchar\zerocount\zerocount#codepoint}%
- \ifempty\p_moffset \else
- \mskip\p_moffset\relax
+ \ifconditional\indisplaymath
+ \ifempty\p_moffset \else
+ \ifmmode\mskip\else\hskip\fi\p_moffset\relax
+ \fi
\fi
\endgroup}
@@ -1319,6 +1355,7 @@
\definemathunstacked [\v!wide] [impliedby] ["27F8] % \mathrel{\;\Longleftarrow\;}
\definemathunstacked [\v!wide] [implies] ["27F9] % \mathrel{\;\Longrightarrow\;}
\definemathunstacked [\v!wide] [iff] ["27FA] % \mathrel{\;\Longleftrightarrow\;}
+\definemathunstacked [\v!wide] [impliesby] ["27FA] % \mathrel{\;\Longleftrightarrow\;}
% New (an example of using \mathexheight):
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt
index 3393ecc0391..3484d6c80c3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt
@@ -130,6 +130,7 @@ mathencodings["tex-ex"] = {
mathencodings["tex-mr"] = {
[0x00393] = 0x00, -- Gamma
[0x00394] = 0x01, -- Delta
+ [0x02206] = 0x01, -- Laplace
[0x00398] = 0x02, -- Theta
[0x0039B] = 0x03, -- Lambda
[0x0039E] = 0x04, -- Xi
@@ -144,7 +145,8 @@ mathencodings["tex-mr"] = {
-- [0x002C7] = 0x14, -- [math]check
-- [0x002D8] = 0x15, -- [math]breve
-- [0x000AF] = 0x16, -- [math]bar
--- [0x00021] = 0x21, -- !
+[0x00021] = 0x21, -- ! -- MS
+[0x00026] = 0x26, -- & -- MS
[0x00028] = 0x28, -- (
[0x00029] = 0x29, -- )
[0x0002B] = 0x2B, -- +
@@ -485,7 +487,8 @@ mathencodings["tex-sy"] = {
[0x02240] = 0x6F, -- wr
[0x0221A] = 0x70, -- sqrt. AM: Check surd??
[0x02A3F] = 0x71, -- amalg
- [0x1D6FB] = 0x72, -- nabla
+ [0x02207] = 0x72, -- nabla (upright)
+ [0x1D6FB] = 0x72, -- nabla (italic)
-- [0x0222B] = 0x73, -- smallint (TODO: what about intop?)
[0x02294] = 0x74, -- sqcup
[0x02293] = 0x75, -- sqcap
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl
index 6ffb3681840..6e015d3dec3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl
@@ -95,5 +95,12 @@
\permanent\protected\def\minute{\iffontchar\font\textminute\textminute\else\mathminute\fi}
\permanent\protected\def\second{\iffontchar\font\textsecond\textsecond\else\mathsecond\fi}
+% \startsetups[math:rules]
+% \letmathfractionparameter\c!rule\v!symbol
+% \setmathfractionparameter\c!middle{"203E}%
+% \letmathradicalparameter \c!rule\v!symbol
+% \setmathradicalparameter \c!top{\radicalbarextenderuc}%
+% \setmathfenceparameter \c!alternative{1}%
+% \stopsetups
\protect
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt
index f3e0ea81425..c29e167663d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['math-vfu'] = {
license = "see context related readme files"
}
+-- somehow an italic gets passed for 'next'
+
-- All these math vectors .. thanks to Aditya and Mojca they become better and
-- better. If you have problems with math fonts or miss characters report it to the
-- ConTeXt mailing list. Also thanks to Boguslaw for finding a couple of errors.
@@ -62,40 +64,69 @@ local staycommand = vfcommands.stay
local nps = fonts.helpers.newprivateslot
local ps = fonts.helpers.privateslot
+nps("rule middle piece")
+nps("rule right piece")
+nps("rule left piece")
+nps("double rule middle piece")
+nps("double rule right piece")
+nps("double rule left piece")
+nps("arrow left piece")
+nps("arrow right piece")
+nps("double arrow left piece")
+nps("double arrow right piece")
+
+nps("flat rule left piece")
+nps("flat rule middle piece")
+nps("flat rule right piece")
+
+nps("flat double rule left piece")
+nps("flat double rule middle piece")
+nps("flat double rule right piece")
+
+nps("minus rule left piece")
+nps("minus rule middle piece")
+nps("minus rule right piece")
+
do
- local function horibar(main,unicode,rule,left,right,normal)
+ -- this overlaps with math-act
+
+ local function horibar(main,unicode,rule,left,right,normal,force,m,l,r)
local characters = main.characters
- if not characters[unicode] then
+ local data = characters[unicode]
+ if force or not data then
local height = main.mathparameters.defaultrulethickness or 4*65536/10
- local f_rule = rule and formatters["M-HORIBAR-RULE-%H"](rule)
- local p_rule = rule and hasprivate(main,f_rule)
+ local f_rule = rule and formatters["M-HORIBAR-M-%H"](rule)
+ local p_rule = rule and hasprivate(main,f_rule)
+ local ndata = normal and characters[normal]
if rule and left and right and normal then
- local ldata = characters[left]
- local mdata = characters[rule]
- local rdata = characters[right]
- local ndata = characters[normal]
+ local ldata = characters[l or left]
+ local mdata = characters[m or rule]
+ local rdata = characters[r or right]
local lwidth = ldata.width or 0
local mwidth = mdata.width or 0
local rwidth = rdata.width or 0
local nwidth = ndata.width or 0
local down = (mdata.height / 2) - height
- --
- local f_left = right and formatters["M-HORIBAR-LEFT-%H"](right)
- local f_right = right and formatters["M-HORIBAR-RIGHT-%H"](right)
+if unicode == normal then
+ height = ndata.height
+ down = 0
+end --
+ local f_left = left and formatters["M-HORIBAR-L-%H"](left)
+ local f_right = right and formatters["M-HORIBAR-R-%H"](right)
local p_left = left and hasprivate(main,f_left)
local p_right = right and hasprivate(main,f_right)
--
if not characters[p_rule] then
p_rule = addprivate(main,f_rule,{
height = height,
- width = mwidth,
- width = .95*mwidth,
+ width = .95*mwidth,
+-- keepvirtual = true,
commands = {
push,
- leftcommand[.025*mwidth],
+ leftcommand[.025*mwidth],
downcommand[down],
- slotcommand[0][rule],
+ slotcommand[0][m or rule],
pop,
},
})
@@ -103,13 +134,13 @@ do
if not characters[p_left] then
p_left = addprivate(main,f_left,{
height = height,
- width = lwidth,
- width = .95*lwidth,
+ width = .95*lwidth,
+-- keepvirtual = true,
commands = {
push,
- leftcommand[.025*lwidth],
+ leftcommand[.025*lwidth],
downcommand[down],
- slotcommand[0][left],
+ slotcommand[0][l or left],
pop,
},
})
@@ -117,50 +148,78 @@ do
if not characters[p_right] then
p_right = addprivate(main,f_right,{
height = height,
- width = rwidth,
- width = .95*rwidth,
+ width = .95*rwidth,
+-- keepvirtual = true,
commands = {
push,
- leftcommand[.025*rwidth],
+ leftcommand[.025*rwidth],
downcommand[down],
- slotcommand[0][right],
+ slotcommand[0][r or right],
pop,
},
})
end
- characters[unicode] = {
- keepvirtual = true,
- partsorientation = "horizontal",
- height = height,
- width = nwidth,
- commands = {
+if unicode ~= normal then
+ data = {
+ unicode = unicode,
+ height = height,
+ width = nwidth,
+ commands = {
downcommand[down],
slotcommand[0][normal]
},
- parts = {
- { glyph = p_left, ["end"] = 0.4*lwidth },
- { glyph = p_rule, extender = 1, ["start"] = mwidth, ["end"] = mwidth },
- { glyph = p_right, ["start"] = 0.6*rwidth },
- }
+ }
+ characters[unicode] = data
+end
+ data.parts = {
+ { glyph = p_left, ["end"] = 0.4*lwidth },
+ { glyph = p_rule, extender = 1, ["start"] = mwidth, ["end"] = mwidth },
+ { glyph = p_right, ["start"] = 0.6*rwidth },
}
else
- local width = main.parameters.quad/4 or 4*65536
+ local width = main.parameters.quad/2 or 4*65536 -- 3
if not characters[p_rule] then
- p_rule = addprivate(main,f_rule,{
- height = height,
- width = width,
- commands = { push, { "rule", height, width }, pop },
- })
+ if unicode == normal then
+ p_rule = addprivate(main,f_rule,{
+ height = ndata.height,
+ width = width,
+ commands = {
+ push,
+ upcommand[(ndata.height - height)/2],
+ { "rule", height, width },
+ pop
+ },
+ })
+ else
+ p_rule = addprivate(main,f_rule,{
+ height = height,
+ width = width,
+ commands = {
+ push,
+ { "rule", height, width },
+ pop
+ },
+ })
+ end
end
- characters[unicode] = {
- keepvirtual = true,
- partsorientation = "horizontal",
- parts = {
- { glyph = p_rule },
- { glyph = p_rule, extender = 1, ["start"] = width/2, ["end"] = width/2 },
+if unicode ~= normal then
+ data = {
+ unicode = unicode,
+ height = height,
+ width = width,
+ commands = {
+ slotcommand[0][p_rule]
}
}
+ characters[unicode] = data
+end
+ data.parts = {
+ { glyph = p_rule, ["start"] = width/2, ["end"] = width/2 },
+ { glyph = p_rule, extender = 1, ["start"] = width/2, ["end"] = width/2 },
+ }
end
+ data.keepvirtual = true -- i need to figure this out
+ data.partsorientation = "horizontal"
end
end
@@ -180,8 +239,8 @@ do
local nwidth = ndata.width or 0
local down = (mdata.height / 2) - height
--
- local f_rule = rule and formatters["M-ROOTBAR-RULE-%H"](rule)
- local f_right = right and formatters["M-ROOTBAR-RIGHT-%H"](right)
+ local f_rule = rule and formatters["M-ROOTBAR-M-%H"](rule)
+ local f_right = right and formatters["M-ROOTBAR-R-%H"](right)
local p_rule = rule and hasprivate(main,f_rule)
local p_right = right and hasprivate(main,f_right)
--
@@ -234,21 +293,29 @@ do
if characters[unicode] then
local template = characters[first]
if template then
- if not characters[rule] then
- local xheight = main.mathparameters.xheight
+ local crule = characters[rule]
+ local xheight = main.mathparameters.xheight
+ local rheight = 0
+ local rdepth = 0
+-- if crule then
+-- rheight = crule.height
+-- rdepth = crule.depth
+-- else
local width = template.width / 4
local height = template.height
local depth = template.depth
- local rheight = where == "top" and height or 3*height
- local rdepth = where == "top" and 2*height or 0
+ rheight = where == "top" and height or 3*height
+ rdepth = where == "top" and 2*height or 0
characters[rule] = {
height = rheight,
depth = rdepth,
width = width,
commands = { push, { "rule", height, width }, pop },
}
- characters[first].depth = rdepth
- characters[last] .depth = rdepth
+-- end
+ characters[first].depth = rdepth
+ characters[last] .depth = rdepth
+ if where == "top" then
while true do
chardata.height = chardata.height - xheight
chardata.depth = 0
@@ -261,41 +328,49 @@ do
break
end
end
+ else
+ while true do
+ chardata.height = 0
+ local next = chardata.next
+ if next then
+ unicode = next
+ chardata = characters[unicode]
+ else
+ break
+ end
+ end
end
chardata.keepvirtual = true
chardata.partsorientation = "horizontal"
chardata.parts = {
{ glyph = first },
- { glyph = rule, extender = 1 },
+ { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 },
{ glyph = last },
}
end
end
end
- local function brace(main,unicode,first,rule,left,right,rule,last)
+ local function brace(main,unicode,first,rule,left,right,rule,last,where)
local characters = main.characters
local chardata = characters[unicode]
if chardata then
local template = characters[first]
if template then
- if not characters[rule] then
- local xheight = main.mathparameters.xheight
- local width = template.width / 4
- local height = template.height
- local depth = template.depth
- local rheight = 3*height
- local rdepth = 2*height
- characters[rule] = {
- height = rheight,
- depth = rdepth,
- width = width,
- commands = { push, { "rule", height, width }, pop },
- }
- characters[first].depth = rdepth
- characters[last] .depth = rdepth
- characters[left] .height = rheight
- characters[right].height = rheight
+ local xheight = main.mathparameters.xheight
+ local width = template.width / 4
+ local height = template.height
+ local depth = template.depth
+ local rheight = 3*height
+ local rdepth = 2*height
+ characters[rule] = {
+ height = rheight,
+ depth = rdepth,
+ width = width,
+ commands = { push, { "rule", height, width }, pop },
+ }
+ -- don't change snippets, they serve dual purposes
+ if where == "top" then
while true do
chardata.height = chardata.height - xheight
chardata.depth = 0
@@ -308,15 +383,26 @@ do
break
end
end
+ else
+ while true do
+ chardata.height = 0
+ local next = chardata.next
+ if next then
+ unicode = next
+ chardata = characters[unicode]
+ else
+ break
+ end
+ end
end
chardata.keepvirtual = true
chardata.partsorientation = "horizontal"
chardata.parts = {
{ glyph = first },
- { glyph = rule, extender = 1 },
+ { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 },
{ glyph = left },
{ glyph = right },
- { glyph = rule, extender = 1 },
+ { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 },
{ glyph = last },
}
end
@@ -436,9 +522,11 @@ do
width = w1 + w2 - d12
end
characters[unicode] = {
+ unicode = unicode,
width = width,
height = max(c1.height or 0, c2.height or 0),
depth = max(c1.depth or 0, c2.depth or 0),
+keepvirtual = true,
commands = {
-- { "inspect" },
-- { "trace" },
@@ -482,10 +570,11 @@ do
local w1 = c1.width
local w2 = c2.width
local w3 = c3.width
- local mu = main.parameters.size/18
+ local ds = main.parameters.size/18
d12 = d12 * ds
d23 = d23 * ds
characters[unicode] = {
+ unicode = unicode,
width = w1 + w2 + w3 - d12 - d23,
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),
@@ -572,6 +661,40 @@ do
end
end
+ local function extension(main,unicode,first,middle,last,ffactor,mfactor,lfactor)
+ local characters = main.characters
+ local chardata = characters[unicode]
+ if chardata then
+ local fw = first and characters[first]
+ local mw = middle and characters[middle]
+ local lw = last and characters[last]
+ if fw and lw then
+ fw = fw.width ; if fw == 0 then fw = 1 end
+ lw = lw.width ; if lw == 0 then lw = 1 end
+ if middle == "left" then
+ chardata.parts = {
+ { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw },
+ { extender = 1, glyph = last, ["end"] = lw/2, start = lw/2, advance = lw },
+ }
+ elseif middle == "right" then
+ chardata.parts = {
+ { extender = 1, glyph = first, ["end"] = fw/2, start = fw/2, advance = fw },
+ { extender = 0, glyph = last, ["end"] = lw/2, start = 0, advance = lw },
+ }
+ elseif mw then
+ mw = mw.width ; if mw == 0 then mw = 1 end
+ chardata.parts = {
+ { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = (ffactor or 1)*fw },
+ { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = (mfactor or 1)*mw },
+ { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = (lfactor or 1)*lw },
+ }
+ end
+ chardata.keepvirtual = true -- why this issue with nested virtuals
+ chardata.partsorientation = "horizontal"
+ end
+ end
+ end
+
vfmath.builders = {
horibar = horibar,
rootbar = rootbar,
@@ -583,6 +706,7 @@ do
jointhree = jointhree,
stack = stack,
repeated = repeated,
+ extension = extension,
}
-- todo: move this to the lfg files
@@ -621,6 +745,7 @@ local function copy_glyph(main,target,original,unicode,slot)
kerns = olddata.kerns,
mathkerns = olddata.mathkerns,
tounicode = olddata.tounicode,
+-- smaller = olddata.smaller,
commands = { slotcommand[slot][unicode] },
}
local glyphdata = newdata
@@ -755,7 +880,7 @@ local function virtualize(s,uni,fci,skewchar,move,mathparameters,unicode,paramet
end
end
-function vfmath.define(specification,set,goodies)
+function vfmath.define(specification,virtual,goodies)
local name = specification.name -- symbolic name
local size = specification.size -- given size
local loaded = { }
@@ -766,8 +891,9 @@ function vfmath.define(specification,set,goodies)
local okset = { }
local n = 0
local f_extra = formatters["virtual.extra.%05X"]
- for s=1,#set do
- local ss = set[s]
+ local setlist = virtual.recipe or virtual
+ for s=1,#setlist do
+ local ss = setlist[s]
local ssname = ss.name
if add_optional and ss.optional then
if trace_virtual then
@@ -781,6 +907,8 @@ function vfmath.define(specification,set,goodies)
main = s
end
local alreadyloaded = names[ssname] -- for px we load one twice (saves .04 sec)
+-- local sshash = name .. ":" .. ssname
+-- local alreadyloaded = names[sshash] -- for px we load one twice (saves .04 sec)
local f, id
if alreadyloaded then
f, id = alreadyloaded.f, alreadyloaded.id
@@ -790,6 +918,7 @@ function vfmath.define(specification,set,goodies)
else
f, id = fonts.constructors.readanddefine(ssname,size)
names[ssname] = {
+-- names[sshash] = {
f = f,
id = id,
fontname = ssname, -- diagnostics
@@ -934,7 +1063,7 @@ function vfmath.define(specification,set,goodies)
mathparameters.axisheight = newparameters[22] or 0 -- axisheight : height of fraction lines above the baseline
-- report_virtual("loading and virtualizing font %a at size %p, setting sy parameters",name,size)
end
- -- We no longer care about kerns and ligatures here. We use backmack because we need to know
+ -- We no longer care about kerns and ligatures here. We use backmap because we need to know
-- the original order and the loader has made a unicode font of it and weird glyph names have
-- spoiled that a bit too.
if ss.overlay then
@@ -1087,9 +1216,32 @@ function vfmath.define(specification,set,goodies)
fontname = name, -- diagnostics
}
--
- local addmissing = goodies.mathematics.addmissing
- if type(addmissing) == "function" then
- addmissing(main)
+ local virtualtweaks = virtual.tweaks
+ if virtualtweaks then
+ --
+ local mathtweaks = mathematics.tweaks
+ local knowntweaks = {
+ addmissing = function(main,specification)
+ local action = specification.action
+ if action then
+ action(main,specification) -- source == target
+ end
+ end
+ }
+ --
+ for i=1,#virtualtweaks do
+ local specification = virtualtweaks[i]
+ local tweak = specification.tweak
+ local action = knowntweaks[tweak]
+ if action then
+ action(main,specification)
+ else
+ action = mathtweaks[tweak]
+ if action then
+ action(main,main,specification)
+ end
+ end
+ end
end
--
mathematics.addfallbacks(main)
@@ -1102,22 +1254,6 @@ function vfmath.define(specification,set,goodies)
main.MathConstants = main.mathconstants
main.nomath = false
--
- mathematics.tweaks.setoptions(main,main,{
- tweak = "setoptions",
- set = { "ignorekerndimensions" }
- }) -- we have dp > ht fences
- --
- mathematics.tweaks.fixprimes(main, main, {
- tweak = "fixprimes",
- factor = 1, -- accent base height
- fake = 0.9, -- replace multiples with this width proportion
- })
- --
--- mathematics.tweaks.addbars(main,main,{
--- tweak = "addbars",
--- advance = 0.52,
--- })
- --
if trace_virtual or trace_timings then
report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start)
end
@@ -1148,40 +1284,6 @@ function vfmath.setdigits(font_encoding, name, digits)
end
end
--- local function extension(main,characters,id,size,unicode,first,middle,last)
--- local chr = characters[unicode]
--- if not chr then
--- return -- skip
--- end
--- local fw = characters[first]
--- if not fw then
--- return
--- end
--- local mw = characters[middle]
--- if not mw then
--- return
--- end
--- local lw = characters[last]
--- if not lw then
--- return
--- end
--- fw = fw.width
--- mw = mw.width
--- lw = lw.width
--- if fw == 0 then
--- fw = 1
--- end
--- if lw == 0 then
--- lw = 1
--- end
--- chr.partsorientation = "horizontal"
--- chr.parts = {
--- { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw },
--- { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = mw },
--- { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = lw },
--- }
--- end
-
-- local step = 0.2 -- 0.1 is nicer but gives larger files
-- local function clipped(main,characters,id,size,unicode,original) -- push/pop needed?
diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl
new file mode 100644
index 00000000000..40e9f826c33
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl
@@ -0,0 +1,251 @@
+%D \module
+%D [ file=meta-imp-kaktovik,
+%D version=2023.04.18,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Kaktovik Numbers,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%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 a quick hack for Hraban (after a post on the mailing list).
+
+\startMPcalculation{simplefun}
+
+ path kaktovik_glyphs[] ;
+
+ def InitializeKaktovik =
+
+ save p, d, u ;
+
+ pair p[] ; numeric d ; d := .1 ; numeric u ; u := .15 ;
+
+ % d := getparameterdefault "mpsfont" "d" .10 ;
+ % u := getparameterdefault "mpsfont" "u" .15 ;
+
+ p[0] := (0,1) ;
+ p[1] := (1,0) ;
+ p[2] := (2,1 - d) ;
+ p[3] := (3,0) ;
+ p[4] := (4,1 - 2d) ;
+
+ p[5] := (4,1 + u) ;
+ p[6] := (0,1 + 2u) ;
+ p[7] := (4,1 + 4u) ;
+
+ kaktovik_glyphs[0] := (1,1) { right } .. { left } (2,1/2) { left } .. { right } (3,1);
+
+ for i= 1 upto 4 :
+ kaktovik_glyphs[i] := p[0] for j=1 upto i : -- p[j] endfor ;
+ endfor ;
+
+ kaktovik_glyphs[ 5] := p[5] -- p[0] ; for i= 6 upto 9 : kaktovik_glyphs[i] := p[5] -- kaktovik_glyphs[i-5] ; endfor ;
+ kaktovik_glyphs[10] := p[6] -- kaktovik_glyphs[ 5] ; for i=11 upto 14 : kaktovik_glyphs[i] := p[6] -- kaktovik_glyphs[i-5] ; endfor ;
+ kaktovik_glyphs[15] := p[7] -- kaktovik_glyphs[10] ; for i=16 upto 19 : kaktovik_glyphs[i] := p[7] -- kaktovik_glyphs[i-5] ; endfor ;
+
+ enddef ;
+
+ vardef Kaktovik(expr i) =
+ draw image (
+ draw kaktovik_glyphs[i]
+ xscaled (10/20 -1/20)
+ yscaled (25/20 -2/20)
+ withpen (pencircle xscaled 1/20 yscaled 5/20) rotated -(2*20)
+ % withpen (pencircle xscaled 1/40 yscaled 5/40) rotated -(2*20)
+ % withpen (pencircle xscaled 2.5/40 yscaled 5/40) rotated -(2*20)
+ ;
+ ) shifted (2/20,2/20)
+ enddef ;
+
+ lmt_registerglyphs [
+ name = "kaktovik",
+ units = 2,
+ usecolor = true,
+ width = 2,
+ height = 2,
+ depth = 0,
+ preamble = "InitializeKaktovik"
+ ] ;
+
+ for i=0 upto 19 :
+ lmt_registerglyph [
+ category = "kaktovik",
+ unicode = 119488 + i, % "0x1D2C0"
+ code = "Kaktovik(" & decimal i & ")"
+ ] ;
+ endfor ;
+
+\stopMPcalculation
+
+\startluacode
+ local kaktovik = moduledata.kaktovik or { }
+ moduledata.kaktovik = kaktovik
+
+ local tonumber = tonumber
+ local load = load
+ local reverse = table.reverse
+ local utfchar = utf.char
+ local gsub = string.gsub
+ local concat = table.concat
+ local utfvalues = string.utfvalues
+ local lpegmatch = lpeg.match
+
+ function kaktovik.tointeger(s)
+ local n = 0
+ for b in utfvalues(s) do
+ local k = b - 0x1D2C0
+ n = n * 20 + k
+ end
+ return n
+ end
+
+-- function kaktovik.tostring(n)
+-- local digits = { }
+-- local count = 1
+-- while true do
+-- digits[count] = utfchar(0x1D2C0 + (n % 20))
+-- n = n // 20
+-- if n == 0 then
+-- break;
+-- end
+-- count = count + 1
+-- end
+-- return concat(reverse(digits))
+-- end
+
+ local f = string.formatters["%N"]
+
+ function kaktovik.tostring(n)
+ if n >= 0 and n <= 19 then
+ return utfchar(0x1D2C0 + n)
+ else
+ -- no need to optimize
+ local result = gsub(f(n),"(%d+)",function(s)
+ local digits = { }
+ local count = 1
+ local n = tonumber(s)
+ while true do
+ digits[count] = utfchar(0x1D2C0 + (n % 20))
+ n = n // 20
+ if n == 0 then
+ break;
+ end
+ count = count + 1
+ end
+ return concat(reverse(digits))
+ end)
+ return result
+ end
+ end
+
+ do
+
+ local k = { }
+ local n = 0
+ for i=0x1D2C0,0x1D2C0+19 do
+ k[utf.char(i)] = n
+ n = n + 1
+ end
+
+ local p = lpeg.Cs (
+ lpeg.Cc("return ")
+ * (
+ lpeg.utfchartabletopattern(k) / k
+ + lpeg.P(1)
+ )^0
+ )
+
+ local t = setmetatable({ },{ __index = math })
+
+ function kaktovik.calculate(old)
+ local new = lpegmatch(p,old)
+ if new then
+ new = load(new,nil,nil,t)
+ if type(new) == "function" then
+ new = new()
+ if new then
+ return new
+ end
+ end
+ end
+ return old
+ end
+
+ end
+
+ interfaces.implement {
+ name = "kaktoviknumerals",
+ arguments = "integer",
+ actions = { kaktovik.tostring, context }
+ }
+ interfaces.implement {
+ name = "kaktovikcalculate",
+ public = true,
+ arguments = "string",
+ actions = { kaktovik.calculate, kaktovik.tostring, context }
+ }
+\stopluacode
+
+\unprotect
+
+\permanent\def\kaktoviknumerals#1{\clf_kaktoviknumerals\numexpr#1\relax}
+
+\defineconversion [kaktoviknumerals] [\kaktoviknumerals]
+\defineconversion [K] [\kaktoviknumerals]
+
+\definefontfeature
+ [kaktovik]
+ [metapost=kaktovik]
+
+\protect
+
+\continueifinputfile{meta-imp-kaktovik.mkxl}
+
+\definefontfeature
+ [default]
+ [default]
+ [metapost=kaktovik]
+% [metapost={category=kaktovik,u=.25,d=.20,x=}]
+
+\setupbodyfont[dejavu]
+
+% \nopdfcompression
+
+\startTEXpage[offset=1ts,width=3es]
+
+ \start
+ \showglyphs
+ KAKTOVIK
+ \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
+ \stop
+
+ kaktovik \start
+ \red\glyphxscale 700
+ \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
+ \stop
+
+ \startitemize[packed,K][color=orange,stopper=]
+ \startitem first \stopitem
+ \startitem second \stopitem
+ \startitem third \stopitem
+ \stopitemize
+
+ KAKTOVIK \start
+ \red \kaktoviknumerals{2023} --
+ \green\kaktoviknumerals{4} --
+ \blue \kaktoviknumerals{18}
+ \stop
+
+ KAKTOVIK
+
+ 𝋂 + 𝋂 = \kaktovikcalculate{𝋂 + 𝋂} = \kaktoviknumerals{4}
+
+ \protected\def\ForWilli#1{#1 = \kaktovikcalculate{#1}}
+
+ \ForWilli{(𝋂 + 𝋂) ^ (𝋂 + 𝋂)}
+
+ \ForWilli{(sin ( 𝋂𝋓 ) )}
+\stopTEXpage
diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl
new file mode 100644
index 00000000000..af49f82ac61
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl
@@ -0,0 +1,76 @@
+%D \module
+%D [ file=meta-imp-newmath,
+%D version=2023.04.01,
+%D title=\METAPOST\ Graphics,
+%D subtitle=New Math Symbols,
+%D author=Mikael Sundqvist & Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%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 file we will collect solutions for special math symbols. When such symbols
+%D are used in publications the CMS will contact the Unicode Consortium to suggest that
+%D they get a slot, because then we have proof of usage. We also consider old obsolete
+%D symbols because they can be treated like some ancient out|-|of|-|use script and fit
+%D into the \type {ancient math script}.
+
+\startMPextensions
+ vardef math_ornament_hat(expr w,h,d,o,l) =
+ image ( path p ; p :=
+ (w/2,h + 10l) --
+ (o + w,h + o) --
+ (w/2,h + 7l) --
+ (-o,h + o) --
+ cycle ;
+ fill p randomized o ;
+ setbounds currentpicture to (-o,0) -- (w+o,0) -- (w+o,h+2o) -- (-o,h+2o) -- cycle ;
+ )
+ enddef ;
+\stopMPextensions
+
+\startuniqueMPgraphic{math:ornament:hat}
+ draw
+ math_ornament_hat(
+ OverlayWidth,
+ OverlayHeight,
+ OverlayDepth,
+ OverlayOffset,
+ OverlayLineWidth
+ )
+ withpen
+ pencircle
+ xscaled (2OverlayLineWidth)
+ yscaled (3OverlayLineWidth/4)
+ rotated 30
+ withcolor
+ OverlayLineColor ;
+% draw boundingbox currentpicture;
+\stopuniqueMPgraphic
+
+\definemathornament [widerandomhat] [mp=math:ornament:hat]
+
+\continueifinputfile{meta-imp-newnmath.mkxl}
+
+\starttext
+
+This symbol was designed for one of Mikaels students working on a thesis on
+probability. This student needed to typeset the characteristic function of a
+random variable \im {X} with density function \im {f_{X}}, and it was insisted to
+use another notation than the (wide) hat, that was already used for something
+else. For this reason the \tex {widerandomhat} was introduced,
+
+\startformula
+ E[\ee^{\ii tX}] = \widerandomhat{f_{X}}(t)\mtp{,}
+ E[\ee^{\ii t(X_1+X_2)}] = \widerandomhat{f_{X_1} \ast f_{X_2}}(t)\mtp{.}
+\stopformula
+
+Naturally, it is automatically scaled, just like the ordinary wide hat
+
+\startformula
+ \widehat{a+b+c+d+e+f} \neq \widerandomhat{a+b+c+d+e+f}
+\stopformula
+
+\stoptext
diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl
index 56a400b45c0..872d0b3e889 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl
@@ -56,6 +56,15 @@
["X"] = [[1111001110 1111000110 0001101000 0000110000 0000110000 0001011000 0110001111 0111001111]],
["Y"] = [[111100011 111100011 011000010 001110100 000111000 000011000 001111110 001111110]],
["Z"] = [[11111111 10000111 00001110 00011100 00111000 01110000 11100001 11111111]],
+
+ [","] = [[0000 0000 0000 0000 0000 0011 0111 0111]],
+ [";"] = [[0011 0011 0011 0000 0000 0011 0111 0111]],
+ ["."] = [[0000 0000 0000 0000 0000 0111 0111 0111]],
+ [":"] = [[0111 0111 0111 0000 0000 0111 0111 0111]],
+ ["!"] = [[0111 0111 0111 0111 0111 0000 0111 0111]],
+ ["?"] = [[11111 10111 00111 01110 01110 00000 01110 01110]],
+
+ [utf.char(0xAD)] = [[00000 00000 00000 11111 11111 00000 00000 00000]], -- hyphen
}
local f_code = string.formatters["ThreeSix(%s);"]
@@ -206,41 +215,24 @@
[metapost={category=fontthreesix,shape=diamond,color=random,pen=fancy,spread=.1,random=yes}]
\definefont[DEKFontA][Serif*fontthreesix-color @ 200pt]
-\definefont[DEKFontB][Serif*fontthreesix-color @ 60pt]
+\definefont[DEKFontB][Serif*fontthreesix-color @ 12pt]
% Or course:
-\startTEXpage
+\startTEXpage[offset=1dk]
\DEKFontA TEX
\stopTEXpage
-\startTEXpage
+\startTEXpage[offset=1dk]
\DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX
\stopTEXpage
-% One of the \CONTEXT\ 2020 posters (inspired by NewYork State AC's press
-% conferences as these keywords apply quite well to the audience of the
-% meeting):
-
-% \startTEXpage[align={lohi,middle,nothyphenated},offset=20pt]
-% \offinterlineskip \vskip10pt
-% \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vskip60pt
-% \DEKFontB TOUGH \vskip20pt
-% SMART \vskip20pt
-% UNITED \vskip20pt
-% DISCIPLINED \vskip20pt
-% LOVING \vskip10pt
-% \stopTEXpage
-
-\startpagemakeup
- \setupalign[middle,nothyphenated]
- \offinterlineskip \vfil\vfil
- \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vfil\vfil\vfil
- \DEKFontB TOUGH \vfil
- SMART \vfil
- UNITED \vfil
- DISCIPLINED \vfil
- LOVING \vfil
-\stoppagemakeup
+% We only have uppercase characters! But I added a few punctuation symbols so that
+% we can do the following. Actually we can consider lowercase to be just smaller and
+% another shape.
+
+\startTEXpage[offset=1dk,align=flushleft,foregroundstyle=\DEKFontB]
+ \WORD{\input{knuth}}
+\stopTEXpage
\stoptext
diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl
index 16b97e8cc40..c5d86e2af21 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl
@@ -211,6 +211,7 @@
\defineMPinstance[doublefun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!double]
\defineMPinstance[binaryfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!binary]
\defineMPinstance[decimalfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!decimal]
+\defineMPinstance[positfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!posit]
\defineMPinstance[mprun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt b/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt
index 0e955818e19..dc71eefab39 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt
@@ -6,28 +6,16 @@ if not modules then modules = { } end modules ['mlib-run'] = {
license = "see context related readme files",
}
--- cmyk -> done, native
--- spot -> done, but needs reworking (simpler)
--- multitone ->
--- shade -> partly done, todo: cm
--- figure -> done
--- hyperlink -> low priority, easy
-
--- new * run
--- or
--- new * execute^1 * finish
-
--- a*[b,c] == b + a * (c-b)
-
---[[ldx--
-<p>The directional helpers and pen analysis are more or less translated from the
-<l n='c'/> code. It really helps that Taco know that source so well. Taco and I spent
-quite some time on speeding up the <l n='lua'/> and <l n='c'/> code. There is not
-much to gain, especially if one keeps in mind that when integrated in <l n='tex'/>
-only a part of the time is spent in <l n='metapost'/>. Of course an integrated
-approach is way faster than an external <l n='metapost'/> and processing time
-nears zero.</p>
---ldx]]--
+-- The directional helpers and pen analysis are more or less translated from the C
+-- code. In LuaTeX we spent quite some time on speeding up the Lua interface as well
+-- as the C code. There is not much to gain, especially if one keeps in mind that
+-- when integrated in TeX only a part of the time is spent in MetaPost. Of course an
+-- integrated approach is way faster than an external MetaPost and processing time
+-- nears zero.
+--
+-- In LuaMetaTeX the MetaPost core has been cleaned up a it and as a result
+-- processing in double mode is now faster than in scaled mode. There are also extra
+-- features and interfaces, so the MkIV and MkXL (LMTX) implementation differ!
local type, tostring, tonumber, next = type, tostring, tonumber, next
local find, striplines = string.find, utilities.strings.striplines
@@ -164,6 +152,7 @@ local methods = {
-- binary = "binary",
binary = "double",
decimal = "decimal",
+ posit = "posit",
default = "scaled",
}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl b/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl
index 428a8ddcf03..b0df8703b98 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl
@@ -114,6 +114,7 @@
%D For proper \UNICODE\ support we need a few font related constants.
+\definesystemconstant {accent}
\definesystemconstant {action}
\definesystemconstant {all}
\definesystemconstant {ampersand}
@@ -164,6 +165,7 @@
\definesystemconstant {leftclass}
\definesystemconstant {rightclass}
\definesystemconstant {calligraphic}
+\definesystemconstant {center}
\definesystemconstant {clone}
\definesystemconstant {close}
\definesystemconstant {cmyk}
@@ -255,6 +257,7 @@
\definesystemconstant {italic}
%definesystemconstant {it}
\definesystemconstant {itemgroupcolumns}
+\definesystemconstant {keepbase}
\definesystemconstant {kernpairs}
\definesystemconstant {language}
\definesystemconstant {lcgreek}
@@ -310,6 +313,7 @@
\definesystemconstant {noheight}
\definesystemconstant {nomath}
\definesystemconstant {none}
+\definesystemconstant {nooverflow}
\definesystemconstant {noskips}
\definesystemconstant {normal}
\definesystemconstant {Normal}
@@ -331,6 +335,7 @@
\definesystemconstant {pickup}
\definesystemconstant {plural}
\definesystemconstant {plus}
+\definesystemconstant {posit}
%definesystemconstant {pt}
\definesystemconstant {realpage}
\definesystemconstant {register}
@@ -373,6 +378,7 @@
\definesystemconstant {setup}
\definesystemconstant {set}
\definesystemconstant {themaintextcolor}
+\definesystemconstant {shrink}
\definesystemconstant {simple}
\definesystemconstant {Simple}
\definesystemconstant {single}
@@ -393,6 +399,7 @@
\definesystemconstant {ss}
\definesystemconstant {start}
\definesystemconstant {stop}
+\definesystemconstant {stretch}
\definesystemconstant {subpage}
\definesystemconstant {subtype}
\definesystemconstant {sub}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
index ba2ccdde7d6..5eff779dc24 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
@@ -21,7 +21,6 @@ local setnext = nuts.setnext
local getnext = nuts.getnext
local getprev = nuts.getprev
local getboth = nuts.getboth
-local setglue = nuts.setglue
local getglue = nuts.getglue
local setglue = nuts.setglue
local getwhd = nuts.getwhd
@@ -372,6 +371,7 @@ do
if noflines > 0 then
local currentline = 1
for n, subtype in nextglue, head do
+-- print(currentline,height/65536,depth/65536)
-- one day we can decide what to do with intertext stuff based on the
-- subtype but not now ... on our agenda (intertext etc)
if subtype == baselineskip_code or subtype == lineskip_code then
@@ -383,9 +383,11 @@ do
if prevdp < depth then
setdepth(lines[currentline][1],depth)
delta = delta + (depth - prevdp)
+-- lines[currentline][5] = depth
end
if nextht < height then
setheight(lines[nextline][1],height)
+-- lines[nextline][4] = height
delta = delta + (height - nextht)
end
-- if subtype == lineskip_code then
@@ -394,7 +396,7 @@ do
-- else
setglue(n,amount+inbetween-delta,stretch,shrink)
-- end
- curline = nextline
+ currentline = nextline -- was curline
-- if currentline > noflines then
-- break
-- end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt
index 246bf34e40b..5692fddb720 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt
@@ -14,7 +14,8 @@ local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
local normaldir_code = nodes.dircodes.normal
local line_code = nodes.listcodes.line
-local lefttoright_code = nodes.dirvalues.lefttoright
+
+local lefttoright_code = tex.directioncodes.lefttoright
local getnext = nuts.getnext
local getlist = nuts.getlist
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt
index f1b9bb45299..435f3bf7e17 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt
@@ -6,19 +6,13 @@ if not modules then modules = { } end modules ['node-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Most of the code that had accumulated here is now separated in modules.</p>
---ldx]]--
-
local next, type, tostring = next, type, tostring
local gsub = string.gsub
local concat, remove = table.concat, table.remove
local sortedhash, sortedkeys, swapped = table.sortedhash, table.sortedkeys, table.swapped
---[[ldx--
-<p>Access to nodes is what gives <l n='luatex'/> its power. Here we implement a
-few helper functions. These functions are rather optimized.</p>
---ldx]]--
+-- Access to nodes is what gives LuaTeX its power. Here we implement a few helper
+-- functions. These functions are rather optimized.
nodes = nodes or { }
local nodes = nodes
@@ -29,7 +23,7 @@ local allocate = utilities.storage.allocate
local formatcolumns = utilities.formatters.formatcolumns
local getsubtypes = node.subtypes
-local getvalues = node.values
+----- getvalues = node.values
local listcodes = mark(getsubtypes("list"))
local rulecodes = mark(getsubtypes("rule"))
@@ -51,10 +45,6 @@ local choicecodes = mark(getsubtypes("choice"))
local parcodes = mark(getsubtypes("par"))
local attributecodes = mark(getsubtypes("attribute"))
-local fillvalues = mark(getvalues("fill"))
-local dirvalues = mark(getvalues("dir"))
-local mathvalues = mark(getvalues("math"))
-
local function simplified(t)
local r = { }
for k, v in next, t do
@@ -63,17 +53,17 @@ local function simplified(t)
return r
end
-local noadoptions = allocate {
- set = 0x08,
- unused_1 = 0x00 + 0x08,
- unused_2 = 0x01 + 0x08,
- axis = 0x02 + 0x08,
- no_axis = 0x04 + 0x08,
- exact = 0x10 + 0x08,
- left = 0x11 + 0x08,
- middle = 0x12 + 0x08,
- right = 0x14 + 0x08,
-}
+-- local noadoptions = allocate {
+-- set = 0x08,
+-- unused_1 = 0x00 + 0x08,
+-- unused_2 = 0x01 + 0x08,
+-- axis = 0x02 + 0x08,
+-- no_axis = 0x04 + 0x08,
+-- exact = 0x10 + 0x08,
+-- left = 0x11 + 0x08,
+-- middle = 0x12 + 0x08,
+-- right = 0x14 + 0x08,
+-- }
local nodecodes = simplified(node.types())
@@ -96,11 +86,6 @@ choicecodes = allocate(swapped(choicecodes,choicecodes))
parcodes = allocate(swapped(parcodes,parcodes))
attributecodes = allocate(swapped(attributecodes,attributecodes))
rulecodes = allocate(swapped(rulecodes,rulecodes))
-noadoptions = allocate(swapped(noadoptions,noadoptions))
-
-dirvalues = allocate(swapped(dirvalues,dirvalues))
-fillvalues = allocate(swapped(fillvalues,fillvalues))
-mathvalues = allocate(swapped(mathvalues,mathvalues))
nodes.gluecodes = gluecodes
nodes.dircodes = dircodes
@@ -121,24 +106,26 @@ nodes.parcodes = parcodes
nodes.attributecodes = attributecodes
nodes.rulecodes = rulecodes
-nodes.noadoptions = noadoptions
-nodes.fillvalues = fillvalues
-nodes.fillcodes = fillvalues -- for now
-nodes.dirvalues = dirvalues
-nodes.mathvalues = mathvalues
+nodes.nodecodes = nodecodes
-nodes.nodecodes = nodecodes
+-- these are now in tex namespace but we keep them for old times sake
+
+nodes.fillvalues = tex.fillcodes
+nodes.fillcodes = tex.fillcodes
+nodes.dirvalues = tex.directioncodes
+nodes.directionvalues = tex.directioncodes
+nodes.mathvalues = tex.mathparametercodes
-- we will transition to more verbose subtypes (after other math is done)
-noadcodes.ord = noadcodes.ord or noadcodes.ordinary
-noadcodes.operator = noadcodes.op or noadcodes.operator
-noadcodes.bin = noadcodes.bin or noadcodes.binary
-noadcodes.rel = noadcodes.rel or noadcodes.relation
-noadcodes.punct = noadcodes.punct or noadcodes.punctuation
-noadcodes.rad = noadcodes.rad or noadcodes.radical
-noadcodes.frac = noadcodes.frac or noadcodes.fraction
-noadcodes.acc = noadcodes.acc or noadcodes.accent
+noadcodes.ord = noadcodes.ord or noadcodes.ordinary
+noadcodes.operator = noadcodes.op or noadcodes.operator
+noadcodes.bin = noadcodes.bin or noadcodes.binary
+noadcodes.rel = noadcodes.rel or noadcodes.relation
+noadcodes.punct = noadcodes.punct or noadcodes.punctuation
+noadcodes.rad = noadcodes.rad or noadcodes.radical
+noadcodes.frac = noadcodes.frac or noadcodes.fraction
+noadcodes.acc = noadcodes.acc or noadcodes.accent
-- so for now:
@@ -194,8 +181,6 @@ nodes.skipcodes = gluecodes
nodes.directioncodes = dircodes
nodes.discretionarycodes = disccodes
-nodes.directionvalues = dirvalues
-
glyphcodes.glyph = glyphcodes.character
gluecodes.parfillrightskip = gluecodes.parfillrightskip or gluecodes.parfillskip
@@ -207,18 +192,6 @@ listcodes.column = listcodes.alignment
kerncodes.kerning = kerncodes.fontkern
kerncodes.italiccorrection = kerncodes.italiccorrection or 1 -- new
-nodes.noadoptions = {
- set = 0x08,
- unused_1 = 0x00 + 0x08,
- unused_2 = 0x01 + 0x08,
- axis = 0x02 + 0x08,
- no_axis = 0x04 + 0x08,
- exact = 0x10 + 0x08,
- left = 0x11 + 0x08,
- middle = 0x12 + 0x08,
- right = 0x14 + 0x08,
-}
-
-- We use the real node code numbers.
local texsetintegervalue = tex.setintegervalue
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt
new file mode 100644
index 00000000000..42b79695c0a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt
@@ -0,0 +1,32 @@
+if not modules then modules = { } end modules ['node-pag'] = {
+ version = 1.001,
+ comment = "companion to node-pag.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Currently we have no usage for this and it can even be dangerous to mess with
+-- the list at this stage, so this is effectively just a placeholder. Users can
+-- only mess with before and after hooks.
+
+pagebuilders = pagebuilders or { }
+
+local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming
+
+local actions = nodes.tasks.actions("pagebuilders")
+
+local function processor(head,groupcode,size,packtype,maxdepth,direction)
+ if head then
+ starttiming(pagebuilders)
+ head = actions(head,groupcode,size,packtype,maxdepth,direction)
+ stoptiming(pagebuilders)
+ end
+ return head
+end
+
+callbacks.register("pre_output_filter",processor,"preparing output box")
+
+statistics.register("output preparation time", function()
+ return statistics.elapsedseconds(pagebuilders)
+end)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl
new file mode 100644
index 00000000000..970939dcf76
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl
@@ -0,0 +1,20 @@
+%D \module
+%D [ file=node-pag,
+%D version=2008.09.30,
+%D title=\CONTEXT\ Node Macros,
+%D subtitle=Page Building,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%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 Macros / Page Building}
+
+\unprotect
+
+\registerctxluafile{node-pag}{}
+
+\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt
index 15c35cba992..18bda16e987 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt
@@ -96,9 +96,9 @@ local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
local listcodes = nodes.listcodes
-local dirvalues = nodes.dirvalues
-local lefttoright_code = dirvalues.lefttoright
-local righttoleft_code = dirvalues.righttoleft
+local directioncodes = tex.directioncodes
+local lefttoright_code = directioncodes.lefttoright
+local righttoleft_code = directioncodes.righttoleft
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
@@ -689,7 +689,8 @@ do
local function setdestination(n,h,d,name,view) -- n = grouplevel, name == table
topofstack = topofstack + 1
- stack[topofstack] = { n, h, d, name, view }
+ -- stack[topofstack] = { n, h, d, name, view }
+ stack[topofstack] = { n, h or false, d or false, name, view }
return topofstack
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt
index 6fed08b6393..b514a3568bf 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt
@@ -10,11 +10,6 @@ local type, next, rawset = type, next, rawset
local gmatch, format = string.gmatch, string.format
local round = math.round
---[[ldx--
-<p>The next function is not that much needed but in <l n='context'/> we use
-for debugging <l n='luatex'/> node management.</p>
---ldx]]--
-
local nodes, node = nodes, node
local report_nodes = logs.reporter("nodes","housekeeping")
@@ -179,7 +174,7 @@ local cleader = register_nut(copy_nut(glue)) setsubtype(cleader,glueco
-- the dir field needs to be set otherwise crash:
-local lefttoright_code = nodes.dirvalues.lefttoright
+local lefttoright_code = tex.directioncodes.lefttoright
local rule = register_nut(new_nut(rule_code)) -- setdirection(rule, lefttoright_code)
local emptyrule = register_nut(new_nut(rule_code,rulecodes.empty)) -- setdirection(rule, lefttoright_code)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt
index 1ef1bb8ad78..4aa476ce540 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt
@@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['node-tra'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>This is rather experimental. We need more control and some of this
-might become a runtime module instead. This module will be cleaned up!</p>
---ldx]]--
+-- Some of the code here might become a runtime module instead. This old module will
+-- be cleaned up anyway!
local next = next
local utfchar = utf.char
@@ -67,7 +65,7 @@ local new_rule = nutpool.rule
local nodecodes = nodes.nodecodes
local whatsitcodes = nodes.whatsitcodes
-local fillcodes = nodes.fillcodes
+local fillcodes = tex.fillcodes
local subtypes = nodes.subtypes
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt
index c4871b56808..edc435836ce 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt
@@ -1016,6 +1016,56 @@ nonut = [[
-- }
-- }
+tasks.new {
+ name = "pagebuilders",
+ processor = nodeprocessor,
+ sequence = {
+ "before", -- for users
+ "normalizers",
+ "after", -- for users
+ },
+ templates = {
+
+default = [[
+return function(head)
+ return head
+end
+]],
+
+process = [[
+local tonut = nodes.tonut
+local tonode = nodes.nuts.tonode
+
+%localize%
+
+return function(head,groupcode,size,packtype,maxdepth,direction)
+ local nuthead = tonut(head)
+
+%actions%
+ return tonode(nuthead)
+end
+]],
+
+step = [[
+ nuthead = tonut((%action%(tonode(nuthead),groupcode,size,packtype,maxdepth,direction)))
+]],
+
+nut = [[
+ nuthead = %action%(nuthead,groupcode,size,packtype,maxdepth,direction)
+]],
+
+nohead = [[
+ %action%(tonode(nuthead),groupcode,size,packtype,maxdepth,direction)
+]],
+
+nonut = [[
+ %action%(nuthead,groupcode,size,packtype,maxdepth,direction)
+]],
+
+ }
+
+}
+
-- for now quite useless (too fuzzy)
--
-- tasks.new {
@@ -1135,3 +1185,106 @@ nonut = [[
}
}
+
+-- -- quality -- --
+
+tasks.new {
+ name = "hquality",
+ processor = nodeprocessor,
+ sequence = {
+ "before", -- for users
+ "system",
+ "after", -- for users
+ },
+ templates = {
+
+default = [[
+return function(how,detail,nod,first,last,filename)
+ -- nil
+end
+]],
+
+process = [[
+local tonut = nodes.tonut
+local tonode = nodes.nuts.tonode
+
+%localize%
+
+return function(how,detail,nod,first,last,filename)
+ local nut = tonut(nod)
+ local rul = nil
+
+%actions%
+
+ return rul and tonode(rul)
+end
+]],
+
+step = [[
+ rul = tonut((%action%(how,detail,nod,first,last,filename,rul and tonode(rul))))
+]],
+
+nut = [[
+ rul = %action%(how,detail,nut,first,last,filename,rul)
+]],
+
+nohead = [[
+ %action%(how,detail,nod,first,last,filename,rul and tonode(rul))
+]],
+
+nonut = [[
+ %action%(how,detail,nut,first,last,filename,rul)
+]],
+
+ }
+}
+
+tasks.new {
+ name = "vquality",
+ processor = nodeprocessor,
+ sequence = {
+ "before", -- for users
+ "system",
+ "after", -- for users
+ },
+ templates = {
+
+default = [[
+return function(how,detail,nod,first,last,filename)
+ -- nil
+end
+]],
+
+process = [[
+local tonut = nodes.tonut
+local tonode = nodes.nuts.tonode
+
+%localize%
+
+return function(how,detail,nod,first,last,filename)
+ local nut = tonut(nod)
+ local rul = nil
+
+%actions%
+ return rul and tonode(rul)
+end
+]],
+
+step = [[
+ rul = tonut((%action%(how,detail,nod,first,last,filename,tonode(rul))))
+]],
+
+nut = [[
+ rul = %action%(how,detail,nut,first,last,filename,rul)
+]],
+
+nohead = [[
+ %action%(how,detail,nod,first,last,filename,rul and tonode(rul))
+]],
+
+nonut = [[
+ %action%(how,detail,nut,first,last,filename,rul)
+]],
+
+ }
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl
index 5a66d394598..ea270f88b79 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl
@@ -1165,6 +1165,8 @@
\fi
\endgroup}
+\mutable\lettonothing\currentanchorbox
+
\permanent\tolerant\protected\def\setanchorbox[#1]#*[#2]%
{\begingroup
\dowithnextbox
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl
index 0fff4ca1bbf..e07e0ff8ddd 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl
@@ -501,17 +501,24 @@
\def\pack_combinations_caption_second
{\ifx\nexttoken\egroup
% the caption is empty
- \orelse\ifx\nexttoken\stopcaption
+ \orelse\ifx\nexttoken\stopcaption % language
% the caption is empty (new per 2014-05-24)
+ \orelse\ifx\nexttoken\pack_combinations_float_hack_b
+ % make sure we honor empty captions (new per 2023-04-20)
\else
% todo: \p_pack_combinations_alternative\v!none: no style, strut etc
\hsize\wd\b_pack_combinations_content
\usealignparameter\combinationparameter
\usecombinationstyleandcolor\c!style\c!color
\bgroup
- \aftergroup\endstrut
- \aftergroup\egroup
- \begstrut
+ \ifcstok{\combinationparameter\c!strut}\v!no
+ % make sure we have empty captions (new per 2023-04-20)
+ \aftergroup\egroup
+ \else
+ \aftergroup\endstrut
+ \aftergroup\egroup
+ \begstrut
+ \fi
\fi}
\def\pack_combinations_pickup_package_pair % we need to store the caption row
@@ -624,6 +631,10 @@
%D
%D \typebuffer \getbuffer
+\definecombination
+ [\v!float]
+% [\c!strut=\v!no] % not needed, we intercept anyway
+
\protected\def\pack_combinations_float_hack_a#1%
{\strc_floats_build_box_separate_split{#1}%
\box\b_strc_floats_separate_content}
@@ -657,7 +668,8 @@
{\pack_combinations_float_hack_b{\recurselevel}}%
\to\scratchtoks}% brrr
\let\pack_combinations_check_x_y\pack_combinations_float_check_x_y
- \normalexpanded{\startcombination[#1]\the\scratchtoks}\stopcombination
+ % \normalexpanded{\startcombination[#1]\the\scratchtoks}\stopcombination
+ \normalexpanded{\startcombination[\v!float][#1]\the\scratchtoks}\stopcombination
\resetlocalfloats
\egroup}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl
index b93d3296079..cc4a7381f23 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl
@@ -97,35 +97,35 @@
\permanent\def\layeranchor{\currentlayer:\the\realpageno}
+\lettonothing\m_pack_layers_anchor
+\lettonothing\m_pack_layers_page
+\lettonothing\m_pack_layers_region
+\lettonothing\m_pack_layers_target
+\lettonothing\p_pack_layers_column
+\lettonothing\p_pack_layers_corner
+\lettonothing\p_pack_layers_direction
\lettonothing\p_pack_layers_doublesided
-\lettonothing\p_pack_layers_state
-\lettonothing\p_pack_layers_option
+\lettonothing\p_pack_layers_dx
+\lettonothing\p_pack_layers_dy
+\lettonothing\p_pack_layers_height
+\lettonothing\p_pack_layers_hoffset
+\lettonothing\p_pack_layers_line
+\lettonothing\p_pack_layers_location
\lettonothing\p_pack_layers_method
+\lettonothing\p_pack_layers_offset
+\lettonothing\p_pack_layers_option
+\lettonothing\p_pack_layers_position
\lettonothing\p_pack_layers_preset
+\lettonothing\p_pack_layers_region
+\lettonothing\p_pack_layers_repeat
\lettonothing\p_pack_layers_rotation
-\lettonothing\p_pack_layers_position
-\lettonothing\p_pack_layers_hoffset
-\lettonothing\p_pack_layers_voffset
-\lettonothing\p_pack_layers_offset
-\lettonothing\p_pack_layers_dx
-\lettonothing\p_pack_layers_dy
+\lettonothing\p_pack_layers_state
\lettonothing\p_pack_layers_sx
\lettonothing\p_pack_layers_sy
+\lettonothing\p_pack_layers_voffset
+\lettonothing\p_pack_layers_width
\lettonothing\p_pack_layers_x
\lettonothing\p_pack_layers_y
-\lettonothing\p_pack_layers_corner
-\lettonothing\p_pack_layers_location
-\lettonothing\p_pack_layers_line
-\lettonothing\p_pack_layers_column
-\lettonothing\p_pack_layers_width
-\lettonothing\p_pack_layers_height
-\lettonothing\p_pack_layers_direction
-\lettonothing\p_pack_layers_region
-
-\lettonothing\m_pack_layers_page
-\lettonothing\m_pack_layers_target
-\lettonothing\m_pack_layers_region
-\lettonothing\m_pack_layers_anchor
\newconditional\c_pack_layers_repeated
\newconditional\c_pack_layers_trace
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt b/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt
index 1e22515b95b..a18f5e7e739 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt
@@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['pack-obj'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>We save object references in the main utility table. jobobjects are
-reusable components.</p>
---ldx]]--
+-- We save object references in the main utility table; job objects are reusable
+-- components.
local context = context
local codeinjections = backends.codeinjections
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt
index 12d131c8873..62a90490137 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt
@@ -7,10 +7,6 @@ if not modules then modules = { } end modules ['pack-rul'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>An explanation is given in the history document <t>mk</t>.</p>
---ldx]]--
-
-- we need to be careful with display math as it uses shifts
-- \framed[align={lohi,middle}]{$x$}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl
index 36b4fc7b0c0..1daa8bcf7e1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl
@@ -237,30 +237,34 @@
%newdimen \d_framed_linewidth \aliased\let \ruledlinewidth\d_framed_linewidth % needed at lua end
\newdimension\d_framed_linewidth \aliasdimension\ruledlinewidth\d_framed_linewidth % needed at lua end
-\lettonothing\p_framed_frame % \framedparameter\c!frame
-\lettonothing\p_framed_backgroundoffset
-\lettonothing\p_framed_foregroundstyle
-\lettonothing\p_framed_autostrut
-\lettonothing\p_framed_location
-\lettonothing\p_framed_orientation
+\lettonothing\p_frame
+\lettonothing\p_framed_adaptive
\lettonothing\p_framed_anchoring
-\lettonothing\p_framed_synchronize
+\lettonothing\p_framed_autostrut
\lettonothing\p_framed_autowidth
-\lettonothing\p_framed_franalyze
+\lettonothing\p_framed_background
+\lettonothing\p_framed_backgroundcolor
\lettonothing\p_framed_backgroundcorner
+\lettonothing\p_framed_backgroundoffset
\lettonothing\p_framed_backgroundradius
+\lettonothing\p_framed_component
+\lettonothing\p_framed_empty
+\lettonothing\p_framed_foregroundcolor
+\lettonothing\p_framed_foregroundstyle
+\lettonothing\p_framed_frame % \framedparameter\c!frame
+\lettonothing\p_framed_framecolor
\lettonothing\p_framed_framecorner
\lettonothing\p_framed_frameradius
+\lettonothing\p_framed_franalyze
\lettonothing\p_framed_lines
-\lettonothing\p_framed_empty
-\lettonothing\p_framed_backgroundcolor
-\lettonothing\p_framed_framecolor
-\lettonothing\p_framed_component
-\lettonothing\p_framed_background
+\lettonothing\p_framed_location
+\lettonothing\p_framed_minheight
+\lettonothing\p_framed_orientation
\lettonothing\p_framed_rulethickness
-\lettonothing\p_framed_foregroundcolor
\lettonothing\p_framed_setups
\lettonothing\p_framed_synchronize
+\lettonothing\p_framed_text_depthcorrection
+\lettonothing\p_framed_text_strut
%D We don't have to stick to a \TEX\ drawn rule, but also can use rounded
%D or even fancier shapes, as we will see later on.
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl
index 23ffc872d38..8c92148fca4 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl
@@ -90,7 +90,7 @@
% disable reset after shipout
\global\pageornamentstate\plustwo
\fi
- % maybe \ifcstok{#1}\emptytoks
+ % maybe \iftok{#1}\emptytoks
\ifparameter#1\or
\page_breaks_handle{#1}%
\else % so, no pagebreak when \pagebreak[] ! ! !
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
index ae2bd4cf8e9..fb699626432 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
@@ -297,7 +297,31 @@
\newtoks\everybeforeflushedpagefloat
-\def\page_floats_flush_page_floats_indeed#1% future releases can do more clever things
+\let\m_page_otr_checked_page_float\relax
+
+\newconditional\c_page_floats_flushed
+
+% \def\page_floats_flush_page_floats_indeed#1% future releases can do more clever things
+% {\page_floats_flush{#1}\plusone
+% \edef\floatspecification{\clf_getfloatvariable{specification}}% Is this okay?
+% \the\everybeforeflushedpagefloat
+% \vpack to \textheight
+% {\doifnotinset\v!high\floatspecification\vfill
+% \box\floatbox
+% \doifnotinset\v!low\floatspecification\vfill}%
+% \page_otr_fill_and_eject_page}
+
+% \protected\def\page_floats_flush_page_floats % used in postpone
+% {\edef\m_page_otr_checked_page_float{\clf_checkedpagefloat}%
+% \ifempty\m_page_otr_checked_page_float
+% % nothing
+% \orelse\ifx\m_page_otr_checked_page_float\v!empty
+% \emptyhbox \page_otr_fill_and_eject_page % why not dummy_page
+% \else
+% \page_floats_flush_page_floats_indeed\m_page_otr_checked_page_float
+% \fi}
+
+\def\page_floats_flush_page_floats_inject#1% future releases can do more clever things
{\page_floats_flush{#1}\plusone
\edef\floatspecification{\clf_getfloatvariable{specification}}% Is this okay?
\the\everybeforeflushedpagefloat
@@ -305,18 +329,26 @@
{\doifnotinset\v!high\floatspecification\vfill
\box\floatbox
\doifnotinset\v!low\floatspecification\vfill}%
- \page_otr_fill_and_eject_page}
-
-\let\m_page_otr_checked_page_float\relax
+ % \page_otr_fill_and_eject_page
+ \global\settrue\c_page_floats_flushed}
\protected\def\page_floats_flush_page_floats % used in postpone
+ {\global\setfalse\c_page_floats_flushed
+ \page_floats_flush_page_floats_indeed
+ \ifconditional\c_page_floats_flushed
+ \page_otr_fill_and_eject_page
+ \fi}
+
+\protected\def\page_floats_flush_page_floats_indeed % used in postpone
{\edef\m_page_otr_checked_page_float{\clf_checkedpagefloat}%
\ifempty\m_page_otr_checked_page_float
% nothing
\orelse\ifx\m_page_otr_checked_page_float\v!empty
\emptyhbox \page_otr_fill_and_eject_page % why not dummy_page
+ \expandafter\page_floats_flush_page_floats
\else
- \page_floats_flush_page_floats_indeed\m_page_otr_checked_page_float
+ \page_floats_flush_page_floats_inject\m_page_otr_checked_page_float
+ \expandafter\page_floats_flush_page_floats
\fi}
% temp hack, needed to prevent floatbox being forgotten during
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl
index 00a0430e6e3..4c192c5549a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl
@@ -1264,7 +1264,7 @@
%
% \starttext \dorecurse{30}{test \recurselevel \page} \stoptext
-\permanent\protected\protected\def\pusharrangedpageXY#1%
+\permanent\protected\def\pusharrangedpageXY#1%
{\advancearrangedpageN
\global\advanceby\arrangedpageM\plusone
\reportarrangedpage\arrangedpageN
@@ -1300,7 +1300,7 @@
\poparrangedpages
\fi}
-\permanent\protected\protected\def\poparrangedpagesXY
+\permanent\protected\def\poparrangedpagesXY
{\ifnum\arrangedpageN>\zerocount
\paperwidth \arrangedpageX\paperwidth
\paperheight\arrangedpageY\paperheight
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx b/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx
index 02f853c5561..2e245fd8bd5 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx
@@ -32,6 +32,12 @@
\let\page_boxes_flush_before\clf_flushpageinjectionsbefore
\let\page_boxes_flush_after \clf_flushpageinjectionsafter
+\lettonothing\p_page_injections_delay
+\lettonothing\p_page_injections_n
+\lettonothing\p_page_injections_page
+\lettonothing\p_page_injections_pagestate
+\lettonothing\p_page_injections_state
+
\def\page_injections_flush_indeed
{\begingroup
\setbox\scratchbox\normalhpack
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx b/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx
index 57c23abc6e3..3dc1c4e7c95 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx
@@ -75,12 +75,16 @@
\setfalse\c_page_margin_blocks_enabled
+\let\page_margin_blocks_stop_block\relax
+
\permanent\tolerant\protected\def\startmarginblock[#tag]%
{\begingroup
\edef\currentmarginblock{#tag}%
- \doifelse{\marginblockparameter\c!state}\v!start
- \page_margin_blocks_start_block_yes
- \page_margin_blocks_start_block_nop}
+ \ifcstok{\marginblockparameter\c!state}\v!start
+ \expandafter\page_margin_blocks_start_block_yes
+ \else
+ \expandafter\page_margin_blocks_start_block_nop
+ \fi}
\permanent\protected\def\stopmarginblock
{\page_margin_blocks_stop_block
diff --git a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt
new file mode 100644
index 00000000000..d3b6f80ba24
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt
@@ -0,0 +1,1118 @@
+if not modules then modules = { } end modules ['phys-dim'] = {
+ version = 1.001,
+ comment = "companion to phys-dim.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is pretty old code that I found back, but let's give it a try
+-- in practice. It started out as m-units.lua but as we want to keep that
+-- module around we moved the code to the dimensions module.
+--
+-- todo: maybe also an sciunit command that converts to si units (1 inch -> 0.0254 m)
+-- etc .. typical something to do when listening to a news whow or b-movie
+--
+-- todo: collect used units for logging (and list of units, but then we need
+-- associations too).
+
+-- The lists have been checked and completed by Robin Kirkham.
+
+-- dubious/wrong
+
+-- Atom = [[u]], -- should be amu (atomic mass unit)
+-- Bell = [[B]], -- should be bel
+-- Sterant = [[sr]], -- should be steradian
+-- Equivalent = [[eql]], -- qualifier?
+-- At = [[at]], -- qualifier?
+-- Force = [[f]], -- qualifier?
+-- eVolt = [[eV]],
+-- -- AC or DC voltages should be qualified in the text
+-- VoltAC = [[V\unitsbackspace\unitslower{ac}]],
+-- VoltDC = [[V\unitsbackspace\unitslower{dc}]],
+-- AC = [[V\unitsbackspace\unitslower{ac}]],
+-- DC = [[V\unitsbackspace\unitslower{dc}]],
+-- -- probably not harmful but there are better alternatives
+-- -- e.g., revolution per second (rev/s)
+-- RPS = [[RPS]],
+-- RPM = [[RPM]],
+-- RevPerSec = [[RPS]],
+-- RevPerMin = [[RPM]],
+
+local rawset, next = rawset, next
+local V, P, S, R, C, Cc, Cs, matchlpeg = lpeg.V, lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.match
+local format, lower, gsub = string.format, string.lower, string.gsub
+local appendlpeg = lpeg.append
+local utfchartabletopattern = lpeg.utfchartabletopattern
+local mergetable, mergedtable, keys, loweredkeys, sortedhash = table.merge, table.merged, table.keys, table.loweredkeys, table.sortedhash
+local setmetatablenewindex = table.setmetatablenewindex
+local utfchar = utf.char
+
+physics = physics or { }
+physics.units = physics.units or { }
+
+local allocate = utilities.storage.allocate
+
+local context = context
+local commands = commands
+local implement = interfaces.implement
+
+local trace_units = false
+local report_units = logs.reporter("units")
+
+trackers.register("physics.units", function(v) trace_units = v end)
+
+-- digits parser (todo : use patterns)
+
+local math_one = Cs((P("$") /"") * (1-P("$"))^1 * (P("$")/"")) / context.m
+local math_two = Cs((P("\\m {")/"") * (1-P("}"))^1 * (P("}")/"")) / context.m -- watch the space after \m
+
+local digit = R("09")
+local plus = P("+")
+local minus = P("-")
+local plusminus = P("±")
+local sign = plus + minus
+local power = S("^e")
+local digitspace = S("~@_")
+local comma = P(",")
+local period = P(".")
+local semicolon = P(";")
+local colon = P(":")
+local signspace = P("/")
+local positive = P("++") -- was p
+local negative = P("--") -- was n
+local highspace = P("//") -- was s
+local padding = P("=")
+local space = P(" ")
+local lparent = P("(")
+local rparent = P(")")
+
+local lbrace = P("{")
+local rbrace = P("}")
+
+local digits = digit^1
+
+local powerdigits = plus * C(digits) / context.digitspowerplus
+ + minus * C(digits) / context.digitspowerminus
+ + C(digits) / context.digitspower
+
+local ddigitspace = digitspace / "" / context.digitsspace
+local ddigit = digits / context.digitsdigit
+local dsemicomma = semicolon / "" / context.digitsseparatorspace
+local dsemiperiod = colon / "" / context.digitsseparatorspace
+local dfinalcomma = comma / "" / context.digitsfinalcomma
+local dfinalperiod = period / "" / context.digitsfinalperiod
+local dintercomma = comma / "" / context.digitsintermediatecomma
+local dinterperiod = period / "" / context.digitsintermediateperiod
+local dskipcomma = comma / "" / context.digitsseparatorspace
+local dskipperiod = period / "" / context.digitsseparatorspace
+local dsignspace = signspace / "" / context.digitssignspace
+local dpositive = positive / "" / context.digitspositive
+local dnegative = negative / "" / context.digitsnegative
+local dhighspace = highspace / "" / context.digitshighspace
+local dsomesign = plus / "" / context.digitsplus
+ + minus / "" / context.digitsminus
+ + plusminus / "" / context.digitsplusminus
+local dpower = power / "" * ( powerdigits + lbrace * powerdigits * rbrace )
+
+local dpadding = padding / "" / context.digitszeropadding -- todo
+
+local dleader = (dpositive + dnegative + dhighspace + dsomesign + dsignspace)^0
+local dtrailer = dpower^0
+local dfinal = P(-1) + #P(1 - comma - period - semicolon - colon)
+local dnumber = (ddigitspace + ddigit)^1
+
+-- ___,000,000 ___,___,000 ___,___,__0 000,000,000 000.00 000,000,000.00 000,000,000.==
+
+-- : ; for the moment not used, maybe for invisible fraction . , when no leading number
+
+-- local c_p = (ddigitspace^1 * dskipcomma)^0 -- ___,
+-- * (ddigitspace^0 * ddigit * dintercomma)^0 -- _00, 000,
+-- * ddigitspace^0 * ddigit^0 -- _00 000
+-- * (
+-- dfinalperiod * ddigit -- .00
+-- + dskipperiod * dpadding^1 -- .==
+-- + dsemiperiod * ddigit -- :00
+-- + dsemiperiod * dpadding^1 -- :==
+-- )^0
+-- + ddigit -- 00
+--
+-- local p_c = (ddigitspace^1 * dskipperiod)^0 -- ___.
+-- * (ddigitspace^0 * ddigit * dinterperiod)^0 -- _00. 000.
+-- * ddigitspace^0 * ddigit^0 -- _00 000
+-- * (
+-- dfinalcomma * ddigit -- ,00
+-- + dskipcomma * dpadding^1 -- ,==
+-- + dsemicomma * ddigit -- :00
+-- + dsemicomma * dpadding^1 -- :==
+-- )^0
+-- + ddigit -- 00
+--
+-- fix by WS/SB (needs further testing)
+
+local c_p = (ddigitspace^1 * dskipcomma)^0 -- ___,
+ * (ddigitspace^0 * ddigit * dintercomma)^0 -- _00, 000,
+ * ddigitspace^0 * ddigit^0 -- _00 000
+ * (
+ dfinalperiod * ddigit^1 * dpadding^1 -- .0=
+ + dfinalperiod * ddigit * (dintercomma * ddigit)^0 -- .00
+ + dskipperiod * dpadding^1 -- .==
+ + dsemiperiod * ddigit * (dintercomma * ddigit)^0 -- :00
+ + dsemiperiod * dpadding^1 -- :==
+ )^0
+ + ddigit -- 00
+
+local p_c = (ddigitspace^1 * dskipperiod)^0 -- ___.
+ * (ddigitspace^0 * ddigit * dinterperiod)^0 -- _00. 000.
+ * ddigitspace^0 * ddigit^0 -- _00 000
+ * (
+ dfinalcomma * ddigit^1 * dpadding^1 -- ,0=
+ + dfinalcomma * ddigit * (dinterperiod * ddigit)^0 -- 00
+ + dskipcomma * dpadding^1 -- ,==
+ + dsemicomma * ddigit * (dinterperiod * ddigit)^0 -- :00
+ + dsemicomma * dpadding^1 -- :==
+ )^0
+ + ddigit -- 00
+
+local p_c_dparser = math_one + math_two + dleader * p_c * dtrailer * dfinal
+local c_p_dparser = math_one + math_two + dleader * c_p * dtrailer * dfinal
+
+local function makedigits(str,reverse)
+ if reverse then
+ matchlpeg(p_c_dparser,str)
+ else
+ matchlpeg(c_p_dparser,str)
+ end
+end
+
+-- tables:
+
+local user_long_prefixes = { }
+local user_long_units = { }
+local user_long_operators = { }
+local user_long_suffixes = { }
+local user_symbol_units = { }
+local user_packaged_units = { }
+
+local user_short_prefixes = { }
+local user_short_units = { }
+local user_short_operators = { }
+local user_short_suffixes = { }
+
+local long_prefixes = {
+
+ -- Le Système international d'unités (SI) 8e édition (Table 5)
+
+ Yocto = "yocto", -- 10^{-24}
+ Zepto = "zepto", -- 10^{-21}
+ Atto = "atto", -- 10^{-18}
+ Femto = "femto", -- 10^{-15}
+ Pico = "pico", -- 10^{-12}
+ Nano = "nano", -- 10^{-9}
+ Micro = "micro", -- 10^{-6}
+ Milli = "milli", -- 10^{-3}
+ Centi = "centi", -- 10^{-2}
+ Deci = "deci", -- 10^{-1}
+
+ Deca = "deca", -- 10^{1}
+ Hecto = "hecto", -- 10^{2}
+ Kilo = "kilo", -- 10^{3}
+ Mega = "mega", -- 10^{6}
+ Giga = "giga", -- 10^{9}
+ Tera = "tera", -- 10^{12}
+ Peta = "peta", -- 10^{15}
+ Exa = "exa", -- 10^{18}
+ Zetta = "zetta", -- 10^{21}
+ Yotta = "yotta", -- 10^{24}
+
+ -- IEC 60027-2: 2005, third edition, Part 2
+
+ Kibi = "kibi", -- 2^{10} (not ki)
+ Mebi = "mebi", -- 2^{20}
+ Gibi = "gibi", -- 2^{30}
+ Tebi = "tebi", -- 2^{40}
+ Pebi = "pebi", -- 2^{50}
+ Exbi = "exbi", -- 2^{60}
+
+ -- not standard
+
+ Zebi = "zebi", -- binary
+ Yobi = "yobi", -- binary
+
+ Micro = "micro",
+ Root = "root",
+}
+
+local long_units = {
+
+ -- Le Système international d'unités (SI) 8e édition (except synonyms)
+ -- SI base units (Table 1)
+
+ Meter = "meter",
+ Gram = "gram",
+ Second = "second",
+ Ampere = "ampere",
+ Kelvin = "kelvin",
+ Mole = "mole",
+ Candela = "candela",
+
+ -- synonyms
+
+ Mol = "mole",
+ Metre = "meter",
+
+ -- SI derived units with special names (Table 3)
+
+ Radian = "radian",
+ Steradian = "steradian",
+ Hertz = "hertz",
+ Newton = "newton",
+ Pascal = "pascal",
+ Joule = "joule",
+ Watt = "watt",
+ Coulomb = "coulomb",
+ Volt = "volt",
+ Farad = "farad",
+ Ohm = "ohm",
+ Siemens = "siemens",
+ Weber = "weber",
+ Tesla = "tesla",
+ Henry = "henry",
+ Celsius = "celsius",
+ Lumen = "lumen",
+ Lux = "lux",
+ Becquerel = "becquerel",
+ Gray = "gray",
+ Sievert = "sievert",
+ Katal = "katal",
+
+ -- non SI units accepted for use with SI (Table 6)
+
+ Minute = "minute",
+ Hour = "hour",
+ Day = "day",
+
+ -- (degree, minute, second of arc are treated specially later)
+
+ Gon = "gon",
+ Grad = "grad",
+ Hectare = "hectare",
+ Liter = "liter",
+
+ Tonne = "tonne",
+
+ -- synonyms
+
+ MetricTon = "tonne",
+ Litre = "liter",
+
+ ["Metric Ton"] = "tonne",
+
+ -- non-SI units whose values must be obtained experimentally (Table 7)
+
+ AtomicMassUnit = "atomicmassunit",
+ AstronomicalUnit = "astronomicalunit",
+ ElectronVolt = "electronvolt",
+ Dalton = "dalton",
+
+ ["Atomic Mass Unit"] = "atomicmassunit",
+ ["Astronomical Unit"] = "astronomicalunit",
+ ["Electron Volt"] = "electronvolt",
+
+ -- special cases (catch doubles, okay, a bit over the top)
+
+ DegreesCelsius = "celsius",
+ DegreesFahrenheit = "fahrenheit",
+ DegreeCelsius = "celsius",
+ DegreeFahrenheit = "fahrenheit",
+
+ ["Degrees Celsius"] = "celsius",
+ ["Degrees Fahrenheit"] = "fahrenheit",
+ ["Degree Celsius"] = "celsius",
+ ["Degree Fahrenheit"] = "fahrenheit",
+
+ -- too late as we already have connected symbols catched:
+ --
+ -- ["° Celsius"] = "celsius",
+ -- ["° Fahrenheit"] = "fahrenheit",
+ -- ["°Celsius"] = "celsius",
+ -- ["°Fahrenheit"] = "fahrenheit",
+
+ -- the "natural units" and "atomic units" are omitted for now
+ -- synonyms
+
+ eV = "electronvolt",
+ AMU = "atomicmassunit",
+
+ -- other non-SI units (Table 8)
+
+ Bar = "bar",
+ Hg = "mercury",
+ -- ["Millimetre Of Mercury"] = [[mmHg]],
+ Angstrom = "angstrom", -- strictly Ångström
+ NauticalMile = "nauticalmile",
+ Barn = "barn",
+ Knot = "knot",
+ Neper = "neper",
+ Bel = "bel", -- in practice only decibel used
+
+ ["Nautical Mile"] = "nauticalmile",
+
+ -- other non-SI units from CGS system (Table 9)
+
+ Erg = "erg",
+ Dyne = "dyne",
+ Poise = "poise",
+ Stokes = "stokes",
+ Stilb = "stilb",
+ Phot = "phot",
+ Gal = "gal",
+ Maxwell = "maxwell",
+ Gauss = "gauss",
+ Oersted = "oersted",
+
+ -- end of SI
+
+ -- data: for use with the binary prefixes (except Erlang)
+
+ Bit = "bit",
+ Byte = "byte" ,
+ Baud = "baud",
+ Erlang = "erlang",
+
+ -- common units, not part of SI
+
+ Atmosphere = "atmosphere",
+ Revolution = "revolution",
+
+ -- synonyms
+
+ Atm = "atmosphere",
+ Rev = "revolution",
+
+ -- imperial units (very incomplete)
+
+ Fahrenheit = "fahrenheit",
+ Foot = "foot",
+ Inch = "inch",
+ Calorie = "calorie",
+
+ -- synonyms
+
+ Cal = "calorie",
+
+}
+
+local long_operators = {
+
+ Times = "times",
+ Solidus = "solidus",
+ Per = "per",
+ OutOf = "outof",
+
+}
+
+local long_suffixes = {
+
+ Linear = "linear",
+ Square = "square",
+ Cubic = "cubic",
+ Quadratic = "quadratic",
+ Inverse = "inverse",
+ ILinear = "ilinear",
+ ISquare = "isquare",
+ ICubic = "icubic",
+ IQuadratic = "iquadratic",
+
+}
+
+local short_prefixes = {
+
+ y = "yocto",
+ z = "zetto",
+ a = "atto",
+ f = "femto",
+ p = "pico",
+ n = "nano",
+ u = "micro",
+ m = "milli",
+ c = "centi",
+ d = "deci",
+ da = "deca",
+ h = "hecto",
+ k = "kilo",
+ M = "mega",
+ G = "giga",
+ T = "tera",
+ P = "peta",
+ E = "exa",
+ Z = "zetta",
+ Y = "yotta",
+
+}
+
+local short_units = { -- I'm not sure about casing
+
+ m = "meter",
+ Hz = "hertz",
+ hz = "hertz",
+ B = "bel",
+ b = "bel",
+ lx = "lux",
+ -- da = "dalton",
+ h = "hour",
+ s = "second",
+ g = "gram",
+ n = "newton",
+ V = "volt",
+ t = "tonne",
+ l = "liter",
+ -- w = "watt",
+ W = "watt",
+ -- a = "ampere",
+ A = "ampere",
+
+ Ω = "ohm",
+
+-- C = "coulomb", -- needs checking with (c)enti
+-- K = "kelvin", -- needs checking with (k)ilo
+-- N = "newton", -- needs checking with (n)ewton
+
+ min = "minute",
+
+ [utfchar(0x2103)] = "celsius",
+ [utfchar(0x2109)] = "fahrenheit",
+}
+
+local short_operators = {
+ ["."] = "times",
+ ["*"] = "times",
+ ["/"] = "solidus",
+ [":"] = "outof",
+}
+
+local short_suffixes = { -- maybe just raw digit match
+ ["1"] = "linear",
+ ["2"] = "square",
+ ["3"] = "cubic",
+ ["4"] = "quadratic",
+ ["+1"] = "linear",
+ ["+2"] = "square",
+ ["+3"] = "cubic",
+ ["+4"] = "quadratic",
+ ["-1"] = "inverse",
+ ["-1"] = "ilinear",
+ ["-2"] = "isquare",
+ ["-3"] = "icubic",
+ ["-4"] = "iquadratic",
+ ["^1"] = "linear",
+ ["^2"] = "square",
+ ["^3"] = "cubic",
+ ["^4"] = "quadratic",
+ ["^+1"] = "linear",
+ ["^+2"] = "square",
+ ["^+3"] = "cubic",
+ ["^+4"] = "quadratic",
+ ["^-1"] = "inverse",
+ ["^-1"] = "ilinear",
+ ["^-2"] = "isquare",
+ ["^-3"] = "icubic",
+ ["^-4"] = "iquadratic",
+}
+
+local symbol_units = {
+ Degrees = "degree",
+ Degree = "degree",
+ -- Deg = "degree",
+ ["°"] = "degree",
+ ArcMinute = "arcminute",
+ ["′"] = "arcminute", -- 0x2032
+ ArcSecond = "arcsecond",
+ ["″"] = "arcsecond", -- 0x2033
+ Percent = "percent",
+ ["%"] = "percent",
+ Promille = "permille",
+ Permille = "permille",
+}
+
+local packaged_units = {
+ Micron = "micron",
+ mmHg = "millimetermercury",
+}
+
+-- rendering:
+
+local ctx_unitsPUS = context.unitsPUS
+local ctx_unitsPU = context.unitsPU
+local ctx_unitsPS = context.unitsPS
+local ctx_unitsP = context.unitsP
+local ctx_unitsUS = context.unitsUS
+local ctx_unitsU = context.unitsU
+local ctx_unitsS = context.unitsS
+local ctx_unitsO = context.unitsO
+local ctx_unitsN = context.unitsN
+local ctx_unitsC = context.unitsC
+local ctx_unitsQ = context.unitsQ
+local ctx_unitsRPM = context.unitsRPM
+local ctx_unitsRTO = context.unitsRTO
+local ctx_unitsRabout = context.unitsRabout
+local ctx_unitsNstart = context.unitsNstart
+local ctx_unitsNstop = context.unitsNstop
+local ctx_unitsNspace = context.unitsNspace
+local ctx_unitsPopen = context.unitsPopen
+local ctx_unitsPclose = context.unitsPclose
+
+local labels = languages.data.labels
+
+labels.prefixes = allocate {
+ yocto = { labels = { en = [[y]] } }, -- 10^{-24}
+ zepto = { labels = { en = [[z]] } }, -- 10^{-21}
+ atto = { labels = { en = [[a]] } }, -- 10^{-18}
+ femto = { labels = { en = [[f]] } }, -- 10^{-15}
+ pico = { labels = { en = [[p]] } }, -- 10^{-12}
+ nano = { labels = { en = [[n]] } }, -- 10^{-9}
+ micro = { labels = { en = [[\mu]] } }, -- 10^{-6}
+ milli = { labels = { en = [[m]] } }, -- 10^{-3}
+ centi = { labels = { en = [[c]] } }, -- 10^{-2}
+ deci = { labels = { en = [[d]] } }, -- 10^{-1}
+ deca = { labels = { en = [[da]] } }, -- 10^{1}
+ hecto = { labels = { en = [[h]] } }, -- 10^{2}
+ kilo = { labels = { en = [[k]] } }, -- 10^{3}
+ mega = { labels = { en = [[M]] } }, -- 10^{6}
+ giga = { labels = { en = [[G]] } }, -- 10^{9}
+ tera = { labels = { en = [[T]] } }, -- 10^{12}
+ peta = { labels = { en = [[P]] } }, -- 10^{15}
+ exa = { labels = { en = [[E]] } }, -- 10^{18}
+ zetta = { labels = { en = [[Z]] } }, -- 10^{21}
+ yotta = { labels = { en = [[Y]] } }, -- 10^{24}
+ kibi = { labels = { en = [[Ki]] } }, -- 2^{10} (not ki)
+ mebi = { labels = { en = [[Mi]] } }, -- 2^{20}
+ gibi = { labels = { en = [[Gi]] } }, -- 2^{30}
+ tebi = { labels = { en = [[Ti]] } }, -- 2^{40}
+ pebi = { labels = { en = [[Pi]] } }, -- 2^{50}
+ exbi = { labels = { en = [[Ei]] } }, -- 2^{60}
+ zebi = { labels = { en = [[Zi]] } }, -- binary
+ yobi = { labels = { en = [[Yi]] } }, -- binary
+ micro = { labels = { en = [[µ]] } }, -- 0x00B5 \textmu
+ root = { labels = { en = [[√]] } }, -- 0x221A
+}
+
+labels.units = allocate {
+ meter = { labels = { en = [[m]] } },
+ gram = { labels = { en = [[g]] } }, -- strictly kg is the base unit
+ second = { labels = { en = [[s]] } },
+ ampere = { labels = { en = [[A]] } },
+ kelvin = { labels = { en = [[K]] } },
+ mole = { labels = { en = [[mol]] } },
+ candela = { labels = { en = [[cd]] } },
+ mol = { labels = { en = [[mol]] } },
+ radian = { labels = { en = [[rad]] } },
+ steradian = { labels = { en = [[sr]] } },
+ hertz = { labels = { en = [[Hz]] } },
+ newton = { labels = { en = [[N]] } },
+ pascal = { labels = { en = [[Pa]] } },
+ joule = { labels = { en = [[J]] } },
+ watt = { labels = { en = [[W]] } },
+ coulomb = { labels = { en = [[C]] } },
+ volt = { labels = { en = [[V]] } },
+ farad = { labels = { en = [[F]] } },
+ ohm = { labels = { en = [[Ω]] } }, -- 0x2126 \textohm
+ siemens = { labels = { en = [[S]] } },
+ weber = { labels = { en = [[Wb]] } },
+ mercury = { labels = { en = [[Hg]] } },
+ millimetermercury = { labels = { en = [[mmHg]] } }, -- connected
+ tesla = { labels = { en = [[T]] } },
+ henry = { labels = { en = [[H]] } },
+ celsius = { labels = { en = [[\checkedtextcelsius]] } }, -- 0x2103
+ lumen = { labels = { en = [[lm]] } },
+ lux = { labels = { en = [[lx]] } },
+ becquerel = { labels = { en = [[Bq]] } },
+ gray = { labels = { en = [[Gy]] } },
+ sievert = { labels = { en = [[Sv]] } },
+ katal = { labels = { en = [[kat]] } },
+ minute = { labels = { en = [[min]] } },
+ hour = { labels = { en = [[h]] } },
+ day = { labels = { en = [[d]] } },
+ gon = { labels = { en = [[gon]] } },
+ grad = { labels = { en = [[grad]] } },
+ hectare = { labels = { en = [[ha]] } },
+ liter = { labels = { en = [[l]] } }, -- symbol l or L
+ tonne = { labels = { en = [[t]] } },
+ electronvolt = { labels = { en = [[eV]] } },
+ dalton = { labels = { en = [[Da]] } },
+ atomicmassunit = { labels = { en = [[u]] } },
+ astronomicalunit = { labels = { en = [[au]] } },
+ bar = { labels = { en = [[bar]] } },
+ angstrom = { labels = { en = [[Å]] } }, -- strictly Ångström
+ nauticalmile = { labels = { en = [[M]] } },
+ barn = { labels = { en = [[b]] } },
+ knot = { labels = { en = [[kn]] } },
+ neper = { labels = { en = [[Np]] } },
+ bel = { labels = { en = [[B]] } }, -- in practice only decibel used
+ erg = { labels = { en = [[erg]] } },
+ dyne = { labels = { en = [[dyn]] } },
+ poise = { labels = { en = [[P]] } },
+ stokes = { labels = { en = [[St]] } },
+ stilb = { labels = { en = [[sb]] } },
+ phot = { labels = { en = [[phot]] } },
+ gal = { labels = { en = [[gal]] } },
+ maxwell = { labels = { en = [[Mx]] } },
+ gauss = { labels = { en = [[G]] } },
+ oersted = { labels = { en = [[Oe]] } }, -- strictly Œrsted
+ bit = { labels = { en = [[bit]] } },
+ byte = { labels = { en = [[B]] } },
+ baud = { labels = { en = [[Bd]] } },
+ erlang = { labels = { en = [[E]] } },
+ atmosphere = { labels = { en = [[atm]] } },
+ revolution = { labels = { en = [[rev]] } },
+ fahrenheit = { labels = { en = [[\checkedtextfahrenheit]] } }, -- 0x2109
+ foot = { labels = { en = [[ft]] } },
+ inch = { labels = { en = [[inch]] } },
+ calorie = { labels = { en = [[cal]] } },
+ --
+ degree = { labels = { en = [[°]]} },
+ arcminute = { labels = { en = [[\checkedtextprime]] } }, -- ′ 0x2032
+ arcsecond = { labels = { en = [[\checkedtextdoubleprime]] } }, -- ″ 0x2033
+ percent = { labels = { en = [[\percent]] } },
+ permille = { labels = { en = [[\promille]] } },
+ --
+ micron = { labels = { en = [[\textmu m]] } },
+}
+
+labels.operators = allocate {
+ times = { labels = { en = [[\unitsTIMES]] } },
+ solidus = { labels = { en = [[\unitsSOLIDUS]] } },
+ per = { labels = { en = [[\unitsSOLIDUS]] } },
+ outof = { labels = { en = [[\unitsOUTOF]] } },
+}
+
+labels.suffixes = allocate {
+ linear = { labels = { en = [[1]] } },
+ square = { labels = { en = [[2]] } },
+ cubic = { labels = { en = [[3]] } },
+ quadratic = { labels = { en = [[4]] } },
+ inverse = { labels = { en = [[\mathminus1]] } },
+ ilinear = { labels = { en = [[\mathminus1]] } },
+ isquare = { labels = { en = [[\mathminus2]] } },
+ icubic = { labels = { en = [[\mathminus3]] } },
+ iquadratic = { labels = { en = [[\mathminus4]] } },
+}
+
+local function dimpus(p,u,s)
+ if trace_units then
+ report_units("prefix %a, unit %a, suffix %a",p,u,s)
+ end --
+ if p ~= "" then
+ if u ~= "" then
+ if s ~= "" then
+ ctx_unitsPUS(p,u,s)
+ else
+ ctx_unitsPU(p,u)
+ end
+ elseif s ~= "" then
+ ctx_unitsPS(p,s)
+ else
+ ctx_unitsP(p)
+ end
+ else
+ if u ~= "" then
+ if s ~= "" then
+ ctx_unitsUS(u,s)
+ -- elseif c then
+ -- ctx_unitsC(u)
+ else
+ ctx_unitsU(u)
+ end
+ elseif s ~= "" then
+ ctx_unitsS(s)
+ else
+ ctx_unitsP(p)
+ end
+ end
+end
+
+local function dimspu(s,p,u)
+ return dimpus(p,u,s)
+end
+
+local function dimop(o)
+ if trace_units then
+ report_units("operator %a",o)
+ end
+ if o then
+ ctx_unitsO(o)
+ end
+end
+
+local function dimsym(s)
+ if trace_units then
+ report_units("symbol %a",s)
+ end
+ s = symbol_units[s] or s
+ if s then
+ ctx_unitsC(s)
+ end
+end
+
+local function dimpre(p)
+ if trace_units then
+ report_units("prefix [%a",p)
+ end
+ p = packaged_units[p] or p
+ if p then
+ ctx_unitsU(p)
+ end
+end
+
+-- patterns:
+--
+-- space inside Cs else funny captures and args to function
+--
+-- square centi meter per square kilo seconds
+
+-- todo 0x -> rm
+
+local function update_parsers(keepcase) -- todo: don't remap utf sequences
+
+ local all_long_prefixes = { }
+ local all_long_units = { }
+ local all_long_operators = { }
+ local all_long_suffixes = { }
+ local all_symbol_units = { }
+ local all_packaged_units = { }
+
+ local all_short_prefixes = { }
+ local all_short_units = { }
+ local all_short_operators = { }
+ local all_short_suffixes = { }
+
+ for k, v in sortedhash(long_prefixes) do all_long_prefixes [k] = v all_long_prefixes [lower(k)] = v end
+ for k, v in sortedhash(long_units) do all_long_units [k] = v all_long_units [lower(k)] = v end
+ for k, v in sortedhash(long_operators) do all_long_operators[k] = v all_long_operators[lower(k)] = v end
+ for k, v in sortedhash(long_suffixes) do all_long_suffixes [k] = v all_long_suffixes [lower(k)] = v end
+ for k, v in sortedhash(symbol_units) do all_symbol_units [k] = v all_symbol_units [lower(k)] = v end
+ for k, v in sortedhash(packaged_units) do all_packaged_units[k] = v all_packaged_units[lower(k)] = v end
+
+ for k, v in sortedhash(user_long_prefixes) do all_long_prefixes [k] = v if not keepcase then all_long_prefixes [lower(k)] = v end end
+ for k, v in sortedhash(user_long_units) do all_long_units [k] = v if not keepcase then all_long_units [lower(k)] = v end end
+ for k, v in sortedhash(user_long_operators) do all_long_operators[k] = v if not keepcase then all_long_operators[lower(k)] = v end end
+ for k, v in sortedhash(user_long_suffixes) do all_long_suffixes [k] = v if not keepcase then all_long_suffixes [lower(k)] = v end end
+ for k, v in sortedhash(user_symbol_units) do all_symbol_units [k] = v if not keepcase then all_symbol_units [lower(k)] = v end end
+ for k, v in sortedhash(user_packaged_units) do all_packaged_units[k] = v if not keepcase then all_packaged_units[lower(k)] = v end end
+
+ for k, v in sortedhash(short_prefixes) do all_short_prefixes [k] = v end
+ for k, v in sortedhash(short_units) do all_short_units [k] = v end
+ for k, v in sortedhash(short_operators) do all_short_operators[k] = v end
+ for k, v in sortedhash(short_suffixes) do all_short_suffixes [k] = v end
+
+ for k, v in sortedhash(user_short_prefixes) do all_short_prefixes [k] = v end
+ for k, v in sortedhash(user_short_units) do all_short_units [k] = v end
+ for k, v in sortedhash(user_short_operators) do all_short_operators[k] = v end
+ for k, v in sortedhash(user_short_suffixes) do all_short_suffixes [k] = v end
+
+ local somespace = P(" ")^0/""
+
+ local p_long_prefix = appendlpeg(all_long_prefixes,nil,true)
+ local p_long_unit = appendlpeg(all_long_units,nil,true)
+ local p_long_operator = appendlpeg(all_long_operators,nil,true)
+ local p_long_suffix = appendlpeg(all_long_suffixes,nil,true)
+ local p_symbol = appendlpeg(all_symbol_units,nil,true)
+ local p_packaged = appendlpeg(all_packaged_units,nil,true)
+
+ local p_short_prefix = appendlpeg(all_short_prefixes)
+ local p_short_unit = appendlpeg(all_short_units)
+ local p_short_operator = appendlpeg(all_short_operators)
+ local p_short_suffix = appendlpeg(all_short_suffixes)
+
+ -- more efficient but needs testing
+
+-- local p_long_prefix = utfchartabletopattern(all_long_prefixes) / all_long_prefixes
+-- local p_long_unit = utfchartabletopattern(all_long_units) / all_long_units
+-- local p_long_operator = utfchartabletopattern(all_long_operators) / all_long_operators
+-- local p_long_suffix = utfchartabletopattern(all_long_suffixes) / all_long_suffixes
+-- local p_symbol = utfchartabletopattern(all_symbol_units) / all_symbol_units
+-- local p_packaged = utfchartabletopattern(all_packaged_units) / all_packaged_units
+
+-- local p_short_prefix = utfchartabletopattern(all_short_prefixes) / all_short_prefixes
+-- local p_short_unit = utfchartabletopattern(all_short_units) / all_short_units
+-- local p_short_operator = utfchartabletopattern(all_short_operators) / all_short_operators
+-- local p_short_suffix = utfchartabletopattern(all_short_suffixes) / all_short_suffixes
+
+ -- we can can cleanup some space issues here (todo)
+
+ local unitparser = P { "unit",
+ --
+ longprefix = Cs(V("somespace") * p_long_prefix),
+ shortprefix = Cs(V("somespace") * p_short_prefix),
+ longsuffix = Cs(V("somespace") * p_long_suffix),
+ shortsuffix = Cs(V("somespace") * p_short_suffix),
+ shortunit = Cs(V("somespace") * p_short_unit),
+ longunit = Cs(V("somespace") * p_long_unit),
+ longoperator = Cs(V("somespace") * p_long_operator),
+ shortoperator = Cs(V("somespace") * p_short_operator),
+ packaged = Cs(V("somespace") * p_packaged),
+ --
+ nothing = Cc(""),
+ somespace = somespace,
+ nospace = (1-somespace)^1, -- was 0
+ -- ignore = P(-1),
+ --
+ qualifier = Cs(V("somespace") * (lparent/"") * (1-rparent)^1 * (rparent/"")),
+ --
+ somesymbol = V("somespace")
+ * (p_symbol/dimsym)
+ * V("somespace"),
+ somepackaged = V("somespace")
+ * (V("packaged") / dimpre)
+ * V("somespace"),
+ -- someunknown = V("somespace")
+ -- * (V("nospace")/ctx_unitsU)
+ -- * V("somespace"),
+ --
+ combination = V("longprefix") * V("longunit") -- centi meter
+ + V("nothing") * V("longunit")
+ + V("shortprefix") * V("shortunit") -- c m
+ + V("nothing") * V("shortunit")
+ + V("longprefix") * V("shortunit") -- centi m
+ + V("shortprefix") * V("longunit"), -- c meter
+
+-- combination = ( V("longprefix") -- centi meter
+-- + V("nothing")
+-- ) * V("longunit")
+-- + ( V("shortprefix") -- c m
+-- + V("nothing")
+-- + V("longprefix")
+-- ) * V("shortunit") -- centi m
+-- + ( V("shortprefix") -- c meter
+-- ) * V("longunit"),
+
+
+ dimension = V("somespace")
+ * (
+ V("packaged") / dimpre
+ + (V("longsuffix") * V("combination")) / dimspu
+ + (V("combination") * (V("shortsuffix") + V("nothing"))) / dimpus
+ )
+ * (V("qualifier") / ctx_unitsQ)^-1
+ * V("somespace"),
+ operator = V("somespace")
+ * ((V("longoperator") + V("shortoperator")) / dimop)
+ * V("somespace"),
+ snippet = V("dimension")
+ + V("somesymbol"),
+ unit = ( V("snippet") * (V("operator") * V("snippet"))^0
+ + V("somepackaged")
+ )^1,
+ }
+
+ -- todo: avoid \ctx_unitsNstart\ctx_unitsNstop (weird that it can happen .. now catched at tex end)
+
+ local letter = R("az","AZ")
+ local bound = #(1-letter)
+ -- local number = lpeg.patterns.number
+ local number = Cs( P("$") * (1-P("$"))^1 * P("$")
+ + P([[\m{]]) * (1-P("}"))^1 * P("}")
+ + (1-letter-P(" "))^1 -- todo: catch { } -- not ok
+ ) / ctx_unitsN
+
+ local start = Cc(nil) / ctx_unitsNstart
+ local stop = Cc(nil) / ctx_unitsNstop
+ local space = P(" ") * Cc(nil) / ctx_unitsNspace
+ local open = P("(") * Cc(nil) / ctx_unitsPopen
+ local close = P(")") * Cc(nil) / ctx_unitsPclose
+
+ local range = somespace
+ * ( (P("±") + P("pm") * bound) / "" / ctx_unitsRPM
+ + (P("–") + P("to") * bound) / "" / ctx_unitsRTO )
+ * somespace
+
+ local about = (P("±") + P("pm") * bound) / "" / ctx_unitsRabout
+ * somespace
+
+ -- todo: start / stop
+
+ local function combine(parser)
+ return P { "start",
+ number = start * dleader * (parser + number) * stop,
+ anumber = space
+ * open
+ * V("about")^-1
+ * V("number")
+ * close,
+ rule = V("number")^-1
+ * (V("range") * V("number") + V("anumber"))^-1,
+ unit = unitparser,
+ about = about,
+ range = range,
+ space = space,
+ start = V("rule")
+ * V("unit")
+ * (V("space") * V("rule") * V("unit"))^0
+ + open
+ * V("number")
+ * (V("range") * V("number"))^-1
+ * close
+ * dtrailer^-1
+ * V("unit")
+ + V("number")
+ }
+ end
+
+ return combine(p_c_dparser), combine(c_p_dparser)
+end
+
+local p_c_parser_lowercase = nil
+local c_p_parser_lowercase = nil
+local p_c_parser_keepcase = nil
+local c_p_parser_keepcase = nil
+
+local dirty_lowercase = true
+local dirty_keepcase = true
+
+local v_reverse = interfaces.variables.reverse
+local v_keep = interfaces.variables.keep
+
+local function makeunit(order,option,str)
+ local reverse = order == v_reverse
+ local keep = option == v_keep
+ local parser
+ if keep then
+ if dirty_keepcase then
+ if trace_units then
+ report_units("initializing case %s parser","sensititive")
+ end
+ p_c_parser_keepcase, c_p_parser_keepcase = update_parsers(true)
+ dirty_keepcase = false
+ end
+ parser = reverse and p_c_parser_keepcase or c_p_parser_keepcase
+ else
+ if dirty_lowercase then
+ if trace_units then
+ report_units("initializing case %s parser","insensititive")
+ end
+ p_c_parser_lowercase, c_p_parser_lowercase = update_parsers()
+ dirty_lowercase = false
+ end
+ parser = reverse and p_c_parser_lowercase or c_p_parser_lowercase
+ end
+ if not matchlpeg(parser,str) then
+ report_units("unable to parse: %s",str)
+ context(str)
+ end
+end
+
+local function trigger(t,k,v)
+ rawset(t,k,v)
+ dirty_lowercase = true
+ dirty_keepcase = true
+end
+
+local t_units = {
+ prefixes = setmetatablenewindex(long_prefixes,trigger),
+ units = setmetatablenewindex(long_units,trigger),
+ operators = setmetatablenewindex(long_operators,trigger),
+ suffixes = setmetatablenewindex(long_suffixes,trigger),
+ symbols = setmetatablenewindex(symbol_units,trigger),
+ packaged = setmetatablenewindex(packaged_units,trigger),
+}
+
+local t_shortcuts = {
+ prefixes = setmetatablenewindex(short_prefixes,trigger),
+ units = setmetatablenewindex(short_units,trigger),
+ operators = setmetatablenewindex(short_operators,trigger),
+ suffixes = setmetatablenewindex(short_suffixes,trigger),
+}
+
+local t_userunits = {
+ prefixes = setmetatablenewindex(user_long_prefixes,trigger),
+ units = setmetatablenewindex(user_long_units,trigger),
+ operators = setmetatablenewindex(user_long_operators,trigger),
+ suffixes = setmetatablenewindex(user_long_suffixes,trigger),
+ symbols = setmetatablenewindex(user_symbol_units,trigger),
+ packaged = setmetatablenewindex(user_packaged_units,trigger),
+}
+
+local t_usershortcuts = {
+ prefixes = setmetatablenewindex(user_short_prefixes,trigger),
+ units = setmetatablenewindex(user_short_units,trigger),
+ operators = setmetatablenewindex(user_short_operators,trigger),
+ suffixes = setmetatablenewindex(user_short_suffixes,trigger),
+}
+
+physics.units.tables = allocate {
+ units = t_units,
+ shortcuts = t_shortcuts,
+ userunits = t_userunits,
+ usershortcuts = t_usershortcuts,
+}
+
+local mapping = {
+ prefix = "prefixes",
+ unit = "units",
+ operator = "operators",
+ suffix = "suffixes",
+ symbol = "symbols",
+ packaged = "packaged",
+}
+
+local function register(category,list,target)
+ if not list or list == "" then
+ list = category
+ category = "unit"
+ end
+ local t = target[mapping[category]]
+ if t then
+ for k, v in next, utilities.parsers.settings_to_hash(list or "") do
+ t[k] = v
+ end
+ end
+ -- inspect(tables)
+end
+
+local function registerunit (category,list) register(category,list,t_userunits) end
+local function registershortcut(category,list) register(category,list,t_usershortcuts) end
+
+physics.units.registerunit = registerunit
+physics.units.registershortcut = registershortcut
+
+implement {
+ name = "digits_normal",
+ actions = makedigits,
+ arguments = "string",
+}
+
+implement {
+ name = "digits_reverse",
+ actions = makedigits,
+ arguments = { "string", true },
+}
+
+implement {
+ name = "unit",
+ actions = makeunit,
+ arguments = "3 strings"
+}
+
+implement {
+ name = "registerunit",
+ actions = registerunit,
+ arguments = "2 strings",
+}
+
+implement {
+ name = "registerunitshortcut",
+ actions = registershortcut,
+ arguments = "2 strings",
+}
+
+implement {
+ name = "hyphenateddigits",
+ public = true,
+ protected = true,
+ arguments = { "optional", "string" },
+ actions = function(filler, digits)
+ digits = gsub(digits,"(%d)","%1\\digitsbreak ") -- space needed for following letters
+ digits = gsub(digits,"\\-$",filler)
+ context(digits)
+ end
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl
index 8277ba2317d..e085ba844f8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\registerctxluafile{phys-dim}{}
+\registerctxluafile{phys-dim}{autosuffix}
% TAGGING NEEDS CHECKING ... WILL DO WHEN PARSER IS OK
@@ -354,7 +354,8 @@
[\c!alternative=, % done: text
\c!separator=\v!normal, % done: cdot|big|medium|space
\s!language=\currentlanguage, % done: (no interface yet)
- \c!order=\v!normal, % ,. (reverse: .,)
+ \c!order=, % reverse
+ \c!option=, % keep (case)
\c!method=0,
%\c!grid=\v!yes, % (maybe)
%\c!style=..., % done
@@ -431,7 +432,7 @@
\to \everyunits
\appendtoks
- \frozen\instance\setuevalue\currentunit{\phys_units_direct{\currentunit}}
+ \frozen\protected\instance\edefcsname\currentunit\endcsname{\phys_units_direct{\currentunit}}
\to \everydefineunit
\protected\def\phys_units_direct#1%
@@ -441,9 +442,10 @@
\settrue\c_phys_units_dospace
\removelastskip
\fi
+ \edef\currentunit{#1}%
\c_phys_digits_method\unitparameter\c!method\relax
\ifmmode\else\dontleavehmode\fi
- \edef\currentunit{#1}%
+% \edef\currentunit{#1}%
\enforced\edef\unitlanguage{\unitparameter\s!language}%
\enforced\let\prefixlanguage\unitlanguage
\enforced\let\operatorlanguage\unitlanguage
@@ -503,9 +505,17 @@
\let\phys_units_direct\phys_units_direct_nested
\to \everyunits
+% \protected\def\phys_units_indeed#1%
+% {\edef\p_order{\unitparameter\c!order}%
+% \ifx\p_order\v!reverse
+% \expandafter\clf_unit_reverse
+% \else
+% \expandafter\clf_unit_normal
+% \fi
+% {\detokenize{#1}}}
+
\protected\def\phys_units_indeed#1%
- {\edef\p_order{\unitparameter\c!order}%
- \ifx\p_order\v!reverse\expandafter\clf_unit_reverse\else\expandafter\clf_unit_normal\fi{\detokenize{#1}}}
+ {\clf_unit{\unitparameter\c!order}{\unitparameter\c!option}{\detokenize{#1}}}
\permanent\protected\def\unitsPUS#1#2#3{\phys_units_next\prefixtext{#1}\unittext{#2}\unitsraise{\suffixtext{#3}}\c_phys_units_state\plusone} % suffix
\permanent\protected\def\unitsPU #1#2{\phys_units_next\prefixtext{#1}\unittext{#2}\c_phys_units_state\plusthree} % unit
@@ -521,10 +531,10 @@
\permanent\protected\def\unitsR #1#2{% todo: tagging
\ifmmode
#2%
- \orelse\ifnum#1=\plusone
+ \orelse\ifnum#1=\plusone % why this test if we do the same in both cases
\digitstextbinop{#2}% before and after
\else
- \digitstextbinnop{#2}% after
+ \digitstextbinop{#2}% after
\fi
\c_phys_units_state\zerocount
\setfalse\c_phys_units_dospace
@@ -682,7 +692,7 @@
\setfalse\c_phys_units_dospace
\phys_units_start}
-\permanent\protected\def\unitsTIMES % GP: Does this do anything? HH: yes "times"
+\permanent\protected\def\unitsTIMES % GP: Does this do anything? HH: yes "times"
{\ifnum\c_phys_units_state=\plusone % suffix
\else
\unitssmallspace
@@ -696,9 +706,16 @@
\fi
:}
+% \permanent\protected\def\unitsSOLIDUS
+% {\ifnum\c_phys_units_state=\plusone % suffix
+% \unitsbackspace
+% \fi
+% {/}%
+% }%\unitsbackspace}
+
\permanent\protected\def\unitsSOLIDUS
{\ifnum\c_phys_units_state=\plusone % suffix
- \unitsbackspace
+ \ifmmode\else\unitsbackspace\fi % we have advanced solidus handling in math
\fi
{/}%
}%\unitsbackspace}
@@ -737,8 +754,44 @@
%D cicero=cc]
%D \stoptyping
-\permanent\tolerant\protected\def\registerunit[#1]#*[#2]% todo: public implementer
- {\clf_registerunit{#1}{#2}}
+\permanent\tolerant\protected\def\registerunit [#1]#*[#2]{\clf_registerunit {#1}{#2}}
+\permanent\tolerant\protected\def\registerunitshortcut[#1]#*[#2]{\clf_registerunitshortcut{#1}{#2}}
+
+%D \starttyping
+%D \registerunit
+%D [unit]
+%D [Point=PT,
+%D point=pt,
+%D Basepoint=BP,
+%D % basepoint=bp,
+%D ]
+%D
+%D \registerunitshortcut
+%D [unit]
+%D [C=coulomb]
+%D
+%D \startlines
+%D 10 \unit {square meter per second}
+%D 10 \unit {square Meter per Second}
+%D 10 \unit {point}
+%D 10 \unit {Point}
+%D 10 \unit {basepoint}
+%D 10 \unit {Basepoint}
+%D 10 \unit {C}
+%D \stoplines
+%D
+%D \setupunit[unit][option=keep]
+%D
+%D \startlines
+%D 10 \unit {square meter per second}
+%D 10 \unit {square Meter per Second}
+%D 10 \unit {point}
+%D 10 \unit {Point}
+%D 10 \unit {basepoint}
+%D 10 \unit {Basepoint}
+%D 10 \unit {C}
+%D \stoplines
+%D \stoptyping
%D You can generate a list as follows:
%D
diff --git a/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl
index b75a933adbf..f120c55fb99 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl
@@ -342,7 +342,7 @@
\newtoks\t_btx_cmd
\newbox \b_btx_cmd
-\t_btx_cmd{\global\setbox\b_btx_cmd\hpack{\clf_btxcmdstring}}
+\t_btx_cmd{\global\setbox\b_btx_cmd\hbox{\clf_btxcmdstring}} % no \hpack, otherwise prerolling --- doesn't work
\aliased\let\btxcmd\btxcommand
@@ -876,6 +876,7 @@
ignored {\btxrenderingparameter\c!ignore}%
group {\btxrenderingparameter\c!group}%
filter {\btxrenderingparameter\c!filter}%
+ filename {\btxrenderingparameter\c!file}% for now
\relax
\ifnum\nofbtxlistentries>\zerocount
\clf_btxpreparelistentries{\currentbtxdataset}% could be put in collect
@@ -1155,7 +1156,7 @@
{\the\t_btx_reference_inject
\strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { }
[\s!btx]%
- [\c!type=\s!btx]% \c!location=\v!none
+ [\c!type=\s!btx,\c!location=\v!here]%
[\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi%
\s!btxref=\currentbtxtag,%
%\ifempty\currentbtxcombis \else\s!btxcom={\currentbtxcombis},\fi%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt
index c0cd4f1c8ef..efacd512816 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt
@@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['regi-ini'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Regimes take care of converting the input characters into
-<l n='utf'/> sequences. The conversion tables are loaded at
-runtime.</p>
---ldx]]--
+-- Regimes take care of converting the input characters into UTF sequences. The
+-- conversion tables are loaded at runtime.
local tostring = tostring
local utfchar = utf.char
diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx b/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx
index d5dadcb78bf..e3bde47c678 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx
@@ -274,7 +274,7 @@
%D A few testing macros (expandable for historic reasons):
-\permanent\def\doifelsefieldbody #tag{\clf_doifelsefield{#tag}}
+\permanent\def\doifelsefieldbody #tag{\clf_doifelsefieldset{#tag}}
\permanent\def\doifelsefieldcategory#tag{\clf_doifelsefieldcategory{#tag}}
\aliased\let\doiffieldbodyelse \doifelsefieldbody
diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt
index be298e2d1d2..43c3a0276a6 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt
@@ -51,7 +51,26 @@ function references.setclosepageaction(close)
end
end
-implement { name = "setopendocumentaction", arguments = "string", actions = references.setopendocumentaction }
-implement { name = "setclosedocumentaction", arguments = "string", actions = references.setclosedocumentaction }
-implement { name = "setopenpageaction", arguments = "string", actions = references.setopenpageaction }
-implement { name = "setclosepageaction", arguments = "string", actions = references.setclosepageaction }
+implement {
+ name = "setopendocumentaction",
+ arguments = "string",
+ actions = references.setopendocumentaction
+}
+
+implement {
+ name = "setclosedocumentaction",
+ arguments = "string",
+ actions = references.setclosedocumentaction
+}
+
+implement {
+ name = "setopenpageaction",
+ arguments = "string",
+ actions = references.setopenpageaction
+}
+
+implement {
+ name = "setclosepageaction",
+ arguments = "string",
+ actions = references.setclosepageaction
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt b/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt
index caa09adbd93..f2112aa1171 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt
@@ -42,8 +42,6 @@ interactions.linkedlists = linkedlists
local texsetbox = tex.setbox
-local jobpasses = job.passes
-
local texgetcount = tex.getcount
local codeinjections = backends.codeinjections
@@ -277,7 +275,24 @@ implement {
}
}
--- Linkedlists (only a context interface)
+-- Linkedlists (only a context interface) .. untested, just adapted from old code.
+
+local collected = allocate()
+local tobesaved = allocate()
+
+local linkedlists = {
+ collected = collected,
+ tobesaved = tobesaved,
+}
+
+job.linkedlists = linkedlists
+
+local function initializer()
+ collected = linkedlists.collected
+ tobesaved = linkedlists.tobesaved
+end
+
+job.register("job.linkedlists.collected", tobesaved, initializer, nil)
implement {
name = "definelinkedlist",
@@ -291,10 +306,12 @@ implement {
name = "enhancelinkedlist",
arguments = { "string", "integer" },
actions = function(tag,n)
- local ll = jobpasses.gettobesaved(tag)
- if ll then
- ll[n] = texgetcount("realpageno")
+ local linkedlist = tobesaved[tag]
+ if not linkedlist then
+ linkedlist = { }
+ tobesaved[tag] = linkedlist
end
+ linkedlist[n] = texgetcount("realpageno")
end
}
@@ -302,15 +319,18 @@ implement {
name = "addlinklistelement",
arguments = "string",
actions = function(tag)
- local tobesaved = jobpasses.gettobesaved(tag)
- local collected = jobpasses.getcollected(tag) or { }
+ local tobesaved = tobesaved[tag] or { }
+ local collected = collected[tag] or { }
local currentlink = #tobesaved + 1
local noflinks = #collected
- tobesaved[currentlink] = 0
+ --
+ tobesaved[currentlink] = 0 -- needs checking
+ --
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/mkxl/spac-ali.lmt b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt
index 9fa02467292..0eeda643aaf 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt
@@ -22,7 +22,8 @@ local takeattr = nuts.takeattr
local getwidth = nuts.getwidth
local findtail = nuts.tail
-local righttoleft_code = nodes.dirvalues.righttoleft
+local righttoleft_code = tex.directioncodes.righttoleft
+
local linelist_code = nodes.listcodes.line
local hpack_nodes = nuts.hpack
diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl
index f5b0e2fb846..9d9feab9b17 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl
@@ -1325,4 +1325,17 @@
\permanent\protected\def\spaceorpar{\endgraf\ifhmode\space\fi}
+%D Kind of documenting:
+%D
+%D \starttyping
+%D \disabletrackers[builders.hpack.quality] % enabled by default
+%D \enabletrackers[builders.hpack.collect]
+%D \enabletrackers[builders.hpack.overflow]
+%D
+%D \starttext
+%D {\hsize 4cm \input tufte \par} \page
+%D {\hsize 8cm \input tufte \par} \page
+%D \stoptext
+%D \stoptyping
+
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl
index 3c4fd1eb466..ab15e7a6eca 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl
@@ -269,9 +269,15 @@
\aliased\let\dorechecknextindentation\relax % public (in macros)
-\permanent\protected\protected\def\spac_indentation_check_next_indentation
+% \permanent\protected\def\spac_indentation_check_next_indentation
+% {\global\enforced\let\dorechecknextindentation\relax
+% \doifelsenextchar\par\donothing\spac_indentation_variant_no} % messy check as next is seldom \par
+
+\permanent\protected\def\spac_indentation_check_next_indentation
{\global\enforced\let\dorechecknextindentation\relax
- \doifelsenextchar\par\donothing\spac_indentation_variant_no} % messy check as next is seldom \par
+ \begingroup
+ \autoparagraphmode\zerocount
+ \doifelsenextchar\par\endgroup{\endgroup\spac_indentation_variant_no}} % messy check as next is seldom \par
\def\spac_indentation_variant_auto
{\global\enforced\let\dorechecknextindentation\spac_indentation_check_next_indentation}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl
index d61ddcbe6ae..2e3e1bc0058 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl
@@ -16,7 +16,6 @@
\unprotect
\newif \ifpagestatemismatch
-\newinteger \realpagestateno
\newconstant\frozenpagestate
\permanent\protected\def\dotrackpagestate#1#2%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl
index 11c96f9c149..e85d222c276 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl
@@ -47,6 +47,7 @@
\mutable\lettonothing\currentstructurecomponentbookmark
\mutable\lettonothing\currentstructurecomponentcatcodes
\mutable\lettonothing\currentstructurecomponentcoding
+\mutable\lettonothing\currentstructurecomponentcounter
\mutable\lettonothing\currentstructurecomponentexpansion
\mutable\lettonothing\currentstructurecomponentlabel
\mutable\lettonothing\currentstructurecomponentlevel
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
index 6af22631a80..b3f33734e35 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
@@ -531,9 +531,9 @@
\def\strc_floats_apply_caption_command
{\setbox\b_strc_floats_caption\hbox\bgroup
- %\unless\ifcstok{\floatcaptionparameter\c!command}\emptytoks
+ %\unless\iftok{\floatcaptionparameter\c!command}\emptytoks
\floatcaptionparameter\c!command{\box\b_strc_floats_caption}%
- %\orunless\ifcstok{\floatcaptionparameter\c!deeptextcommand}\emptytoks
+ %\orunless\iftok{\floatcaptionparameter\c!deeptextcommand}\emptytoks
% \floatcaptionparameter\c!deeptextcommand{\unvbox\b_strc_floats_caption}%
%\else
% \box\b_strc_floats_caption
@@ -742,7 +742,7 @@
\edef\p_location {\floatcaptionparameter\c!location}%
\edef\p_topoffset {\floatcaptionparameter\c!topoffset}%
\edef\p_bottomoffset{\floatcaptionparameter\c!bottomoffset}%
- \edef\P_freeregion {\floatcaptionparameter\c!freeregion}%
+ \edef\p_freeregion {\floatcaptionparameter\c!freeregion}%
% preset
\resetfloatcaptionparameter \c!location
\setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}%
@@ -778,7 +778,7 @@
\letfloatcaptionparameter\c!location \p_location
\letfloatcaptionparameter\c!topoffset \p_topoffset
\letfloatcaptionparameter\c!bottomoffset\p_bottomoffset
- \letfloatcaptionparameter\c!freeregion \P_freeregion
+ \letfloatcaptionparameter\c!freeregion \p_freeregion
%
\strc_floats_analyze_location
\doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt
index f9153c98e8b..4ee084ca3b7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt
@@ -6,20 +6,28 @@ if not modules then modules = { } end modules ['strc-itm'] = {
license = "see context related readme files"
}
-local structures = structures
-local itemgroups = structures.itemgroups
-local jobpasses = job.passes
-
+local allocate = utilities.storage.allocate
local implement = interfaces.implement
-local setvariable = jobpasses.save
-local getvariable = jobpasses.getfield
-
local texsetcount = tex.setcount
local texsetdimen = tex.setdimen
-local f_stamp = string.formatters["itemgroup:%s:%s"]
-local counts = table.setmetatableindex("number")
+local itemgroups = structures.itemgroups
+
+local collected = allocate()
+local tobesaved = allocate()
+
+itemgroups.collected = collected
+itemgroups.tobesaved = tobesaved
+
+local function initializer()
+ collected = itemgroups.collected
+ tobesaved = itemgroups.tobesaved
+end
+
+if job then
+ job.register("structures.itemgroups.collected", tobesaved, initializer)
+end
local c_strc_itemgroups_max_items = tex.iscount("c_strc_itemgroups_max_items")
local d_strc_itemgroups_max_width = tex.isdimen("d_strc_itemgroups_max_width")
@@ -28,6 +36,8 @@ local d_strc_itemgroups_max_width = tex.isdimen("d_strc_itemgroups_max_width")
-- an itemgroup which in turn makes for less passes when one itemgroup
-- entry is added or removed.
+local counts = table.setmetatableindex("number")
+
local trialtypesetting = context.trialtypesetting
local function analyzeitemgroup(name,level)
@@ -36,16 +46,37 @@ local function analyzeitemgroup(name,level)
n = n + 1
counts[name] = n
end
- local stamp = f_stamp(name,n)
- texsetcount(c_strc_itemgroups_max_items,getvariable(stamp,level,1,0))
- texsetdimen(d_strc_itemgroups_max_width,getvariable(stamp,level,2,0))
+ local items = 0
+ local width = 0
+ local itemgroup = collected[name]
+ if itemgroup then
+ local entry = itemgroup[n]
+ if entry then
+ local l = entry[level]
+ if l then
+ items = l[1] or 0
+ width = l[2] or 0
+ end
+ end
+ end
+ texsetcount(c_strc_itemgroups_max_items,items)
+ texsetdimen(d_strc_itemgroups_max_width,width)
end
local function registeritemgroup(name,level,nofitems,maxwidth)
local n = counts[name]
if not trialtypesetting() then
- -- no trialtypsetting
- setvariable(f_stamp(name,n), { nofitems, maxwidth }, level)
+ local itemgroup = tobesaved[name]
+ if not itemgroup then
+ itemgroup = { }
+ tobesaved[name] = itemgroup
+ end
+ local entry = itemgroup[n]
+ if not entry then
+ entry = { }
+ itemgroup[n] = entry
+ end
+ entry[level] = { nofitems, maxwidth }
elseif level == 1 then
counts[name] = n - 1
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
index 737580a274d..a7dda8fdd45 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
@@ -1325,7 +1325,7 @@
\strc_itemgroups_stop_head_indeed
\strc_itemgroups_head_body_indeed}
-\protected\permanent\def\stopitemgrouphead
+\permanent\protected\def\stopitemgrouphead
{\dostoptagged
\stopitemgroupitem}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
index b60b7520875..312a815cd88 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
@@ -37,7 +37,8 @@ local conditionals = tex.conditionals
local ctx_latelua = context.latelua
-local cheat = true
+----- cheat = true -- fragile when we have a multi-component document with cross references
+local cheat = false -- so this will become a directive or maybe even just an experiment
local structures = structures
local lists = structures.lists
@@ -259,27 +260,34 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end)
numberdata.numbers = cached[groupindex].numberdata.numbers
end
end
- local setcomponent = references.setcomponent
- if setcomponent then
- setcomponent(t) -- can be inlined
- end
+ --
+-- local setcomponent = references.setcomponent
+-- if setcomponent then
+-- setcomponent(t) -- can be inlined, will be replaced by setstructure below
+-- end
+ --
local r = t.references
- if r and not r.section then
- r.section = structures.sections.currentid()
- end
- local b = r and t.block
- if r and not b then
- local s = r.section
- if s then
- s = structures.sections.tobesaved[s]
- r.block = s and s.block or nil
- end
- end
local i = r and r.internal or 0 -- brrr
- if r and kind and name then
- local tag = tags.getid(kind,name)
- if tag and tag ~= "?" then
- r.tag = tag -- todo: use internal ... is unique enough
+ if r then
+ if not r.section then
+ r.section = structures.sections.currentid()
+ end
+ if not r.structure then
+ r.structure = resolvers.jobs.currentstructure()
+ end
+ local b = r and t.block
+ if not b then
+ local s = r.section
+ if s then
+ s = structures.sections.tobesaved[s]
+ r.block = s and s.block or nil
+ end
+ end
+ if kind and name then
+ local tag = tags.getid(kind,name)
+ if tag and tag ~= "?" then
+ r.tag = tag -- todo: use internal ... is unique enough
+ end
end
end
local p = pushed[i]
@@ -597,7 +605,7 @@ filters[v_intro] = function(specification)
return result
end
-filters[v_reference] = function(specification)
+filters[v_reference] = function(specification) -- this will go away
local collected = specification.collected
local result = { }
local nofresult = 0
@@ -954,7 +962,6 @@ filters[v_default] = function(specification) -- is named
for i=1,#collected do
local v = collected[i]
local r = v.references
--- inspect(v)
if r and (not block or not r.block or pblock == r.block) then
local sectionnumber = sections[r.section]
if sectionnumber then
@@ -1016,10 +1023,9 @@ function lists.process(specification)
local references = listentry.references
local special = specials and numberdata and specials[zerostrippedconcat(numberdata.numbers,".")] or ""
local view = usedviews[i]
- -- if cheat and references then
- -- -- HH: I still need to test this patch:
+-- if cheat and references and cheats[view] then
if cheat and references and view and cheats[view] then
- -- this permits runs=2 with interactivity
+ -- this permits runs=2 with interactivity
local internal = references.internal
usedinternals[internal] = true
usedviews [internal] = references.view
@@ -1571,7 +1577,7 @@ end
function lists.integrate(utilitydata)
local filename = utilitydata.comment.file
- if filename then
+ if filename and filename ~= environment.jobname then
local structures = utilitydata.structures
if structures then
local lists = structures.lists.collected or { }
@@ -1591,6 +1597,12 @@ function lists.integrate(utilitydata)
-- references.internal = nil
-- references.realpage = nil
-- references.section = nil
+ if references.view then
+ references.view = nil
+ end
+ if references.used then
+ references.used = nil
+ end
if references.x then
references.x = nil
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
index 6b8f2504f03..3fd0e979eb4 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
@@ -1257,8 +1257,8 @@
\noindent % otherwise annotations are mirrored up
\typo_injectors_mark_list
\hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute {
- \letlistparameter \c!depth\zeropoint
- \resettlistparameter\c!color
+ \letlistparameter \c!depth\zeropoint
+ \resetlistparameter\c!color
\inheritedlistframed {
\letinteractionparameter\c!strut\v!no % still needed?
\strc_lists_set_style_color\c!style\c!color\v!all
@@ -1498,7 +1498,8 @@
\ifcsname\??listinteractions\p_interaction_forward\endcsname
%\expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname
\expandafter\let\expandafter\p_interaction_forward\lastnamedcs
- \ifcstok{\structurelistexternal}\emptytoks % luacall
+ %\ifcstok{\structurelistexternal}\emptytoks % luacall
+ \iftok{\structurelistexternal}\emptytoks % luacall
\strc_references_get_simple_reference{internal(\currentlistentrylocation)}%
\else
% \writestatus{FAR OUT LIST}{\structurelistexternal::page(\number\structurelistrealpagenumber)}%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt
index e5266daf0dc..61972009c95 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt
@@ -109,7 +109,7 @@ implement {
}
implement {
- name = "getsynchronizedmarking",
+ name = "getsynchronizemarking",
arguments = { "integer", "string", "string" },
actions = function(class,category,what)
local category, n = lpegmatch(pattern,category)
@@ -136,7 +136,7 @@ implement {
}
implement {
- name = "resetsynchronizedmarking",
+ name = "resetsynchronizemarking",
arguments = "argument",
actions = function(category)
local category, n = lpegmatch(pattern,category)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl
index 4c279f6dd6e..6dbb0e20771 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl
@@ -169,7 +169,7 @@
\ifcstok{#2}\v!page
\markingcommand{#1}{\csname\??markingfilter#3\endcsname{#1}}%
\else
- \markingcommand{#1}{\clf_getsynchronizedmarking\begincsname\??markingclass#1\endcsname{#2}{#3}}%
+ \markingcommand{#1}{\clf_getsynchronizemarking\begincsname\??markingclass#1\endcsname{#2}{#3}}%
\fi
\orelse\ifparameter#2\or
\markingcommand{#1}{\csname\??markingfilter#2\endcsname{#1}}%
@@ -208,7 +208,7 @@
\ifcstok{#2}\v!page
\markingcommand{#1}{\begincsname\??markingfilter#3\endcsname{#1}}%
\else
- \markingcommand{#1}{\clf_getsynchronizedmarking{#1}{#2}}%
+ \markingcommand{#1}{\clf_getsynchronizemarking{#1}{#2}}%
\fi
\fi
\fi}
@@ -221,9 +221,9 @@
\markingseparator{#1}%
\markingcommand{#1}{\begincsname\??markingfilter\v!last\endcsname{#1}}%
\else
- \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!first}%
+ \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!first}%
\markingseparator{#1}%
- \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!last}%
+ \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!last}%
\fi
\fi
\fi}
@@ -240,9 +240,9 @@
\else
%\markingcommand{#1}{\begincsname\??markclass:\v!previous\endcsname{#1}}%
%\markingseparator{#1}%
- \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!first}%
+ \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!first}%
\markingseparator{#1}%
- \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!last}%
+ \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!last}%
\fi
\fi
\fi}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
index 2e6c21ad27f..6c639bb1f0f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
@@ -1035,6 +1035,28 @@
\boundary\c_bndr_mathalign
\fi}
+% \tolerant\protected\def\strc_math_skip_here[#1]%
+% {% no strut as it will influence fences
+% \ifconditional\c_strc_math_trace_hang
+% \strc_math_trace_okay{darkblue}{S #1}%
+% \fi
+% \scratchdimen\dimexpr\formulaparameter\c!textmargin\relax
+% \ifchkdim#1\or
+% \d_strc_math_hang_state#1%
+% \orelse\ifchknum#1\or
+% \d_strc_math_hang_state#1\scratchdimen
+% \orelse\iftok{#1}{+}%
+% \advanceby\d_strc_math_hang_state\scratchdimen
+% \orelse\iftok{#1}{-}%
+% \advanceby\d_strc_math_hang_state-\scratchdimen
+% \else
+% \d_strc_math_hang_state\scratchdimen
+% \fi
+% \kern\d_strc_math_hang_state
+% \strc_math_pickup_again}
+
+\newboundary\c_bndr_skiphere
+
\tolerant\protected\def\strc_math_skip_here[#1]%
{% no strut as it will influence fences
\ifconditional\c_strc_math_trace_hang
@@ -1052,6 +1074,7 @@
\else
\d_strc_math_hang_state\scratchdimen
\fi
+ \boundary\c_bndr_skiphere
\kern\d_strc_math_hang_state
\strc_math_pickup_again}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt
index e05228b2b51..2c68cc5993f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt
@@ -520,11 +520,13 @@ notes.check_spacing = check_spacing
-- only notes, kind of hardcoded .. bah
-callback.register("build_page_insert", function(index,slot)
+local function action(index,slot)
local state = notes.numbers[index]
if state then
return tonode(newgluespec(check_spacing(index,slot)))
else
return tonode(newgluespec())
end
-end)
+end
+
+callbacks.register("build_page_insert",action,"check spacing around inserts")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
index 26b1894753c..272e7e99298 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
@@ -30,6 +30,7 @@ local trace_referencing = false trackers.register("structures.referencing",
local trace_analyzing = false trackers.register("structures.referencing.analyzing", function(v) trace_analyzing = v end)
local trace_identifying = false trackers.register("structures.referencing.identifying", function(v) trace_identifying = v end)
local trace_importing = false trackers.register("structures.referencing.importing", function(v) trace_importing = v end)
+local trace_external = false trackers.register("structures.referencing.external", function(v) trace_external = v end)
local trace_empty = false trackers.register("structures.referencing.empty", function(v) trace_empty = v end)
local check_duplicates = true
@@ -39,6 +40,7 @@ directives.register("structures.referencing.checkduplicates", function(v) check_
local report_references = logs.reporter("references")
local report_identifying = logs.reporter("references","identifying")
local report_importing = logs.reporter("references","importing")
+local report_external = logs.reporter("references","external")
local report_empty = logs.reporter("references","empty")
local report = report_references
@@ -174,6 +176,11 @@ local function initializer() -- can we use a tobesaved as metatable for collecte
if i then
internals[i] = data
usedinternals[i] = r.used
+ local structure = r.structure
+ if structure then
+ structure = resolvers.jobs.namelist(structure,namestack)
+ r.namestack = structure
+ end
end
end
end
@@ -347,33 +354,44 @@ local function currentorder(kind,name)
return orders[kind] and orders[kind][name] or lastorder
end
-local function setcomponent(data)
- -- we might consider doing this at the tex end, just like prefix
- local component = productcomponent()
- if component then
- local references = data and data.references
- if references then
- references.component = component
- if references.prefix == component then
- references.prefix = nil
- end
- end
- return component
- end
- -- but for the moment we do it here (experiment)
-end
+-- local function setstructure(data)
+-- local structure = resolvers.jobs.currentnamehash()
+-- if structure then
+-- local references = data and data.references
+-- if references then
+-- references.structure = structure
+-- end
+-- end
+-- end
+
+-- local function setcomponent(data)
+-- -- we might consider doing this at the tex end, just like prefix
+-- local component = productcomponent() -- todo: maybe a list
+-- -- local component = resolvers.jobs.currentcomponent()
+-- if component then
+-- local references = data and data.references
+-- if references then
+-- references.component = component
+-- if references.prefix == component then
+-- references.prefix = nil
+-- end
+-- end
+-- return component
+-- end
+-- end
references.setnextorder = setnextorder
references.setnextinternal = setnextinternal
references.currentorder = currentorder
-references.setcomponent = setcomponent
+references.setstructure = resolvers.jobs.currentstructure -- yes or no here
+----------.setcomponent = setcomponent
+
+implement {
+ name = "setnextreferenceorder", -- used in strc-enu
+ actions = setnextorder,
+ arguments = "2 strings",
+}
--- implement {
--- name = "setnextreferenceorder",
--- actions = setnextorder,
--- arguments = "2 strings",
--- }
---
-- implement {
-- name = "currentreferenceorder",
-- actions = { currentorder, context },
@@ -405,6 +423,9 @@ function references.set(data)
-- report_references("invalid reference") -- harmless
return 0
end
+ --
+ references.structure = resolvers.jobs.currentstructure()
+ --
local prefix = references.prefix or ""
local pd = tobesaved[prefix] -- nicer is a metatable
if not pd then
@@ -497,31 +518,82 @@ implement {
-- no metatable here .. better be sparse
-local function register_from_list(collected,derived,external)
+local function register_from_list(collected,derived,external,namestack)
local derived_g = derived[""] -- global
local derived_p = nil
local derived_c = nil
local prefix = nil
- local component = nil
+-- local component = nil
local entry = nil
if not derived_g then
derived_g = { }
derived[""] = derived_g
end
- local function action(s)
- if trace_referencing then
- report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage)
- end
- if derived_p and not derived_p[s] then
- derived_p[s] = entry
- end
- if derived_c and not derived_c[s] then
- derived_c[s] = entry
+ local action = trace_external and
+ function(s)
+ if structure then
+ for i=1,#structure do
+ local si = structure[i]
+ -- if si == component then
+ -- -- skipped
+ -- elseif si == prefix then
+ -- -- skipped
+ -- else
+ local ds = derived[si]
+ if not ds then
+ derived[si] = { [s] = entry }
+ report_external("reference %a, %s %a",s,"structure",si)
+ elseif not ds[s] then
+ ds[s] = entry
+ report_external("reference %a, %s %a",s,"structure",si)
+ end
+ -- end
+ end
+ end
+ if derived_p and not derived_p[s] then
+ report_external("reference %a, %s %a",s,"prefix",prefix)
+ derived_p[s] = entry
+
+ end
+-- if derived_c and not derived_c[s] then
+-- report_external("reference %a, %s %a",s,"component",component)
+-- derived_c[s] = entry
+-- end
+ if not derived_g[s] then
+ report_external("reference %a, %s %a",s,"global","")
+ derived_g[s] = entry -- first wins
+ end
end
- if not derived_g[s] then
- derived_g[s] = entry -- first wins
+ or
+ function(s)
+ if derived_p and not derived_p[s] then
+ derived_p[s] = entry
+ end
+-- if derived_c and not derived_c[s] then
+-- derived_c[s] = entry
+-- end
+ if not derived_g[s] then
+ derived_g[s] = entry -- first wins
+ end
+ if structure then
+ for i=1,#structure do
+ local si = structure[i]
+ if si == component then
+ -- skipped
+ elseif si == prefix then
+ -- skipped
+ else
+ local ds = derived[si]
+ if not ds then
+ derived[si] = { [s] = entry }
+ elseif not ds[s] then
+ ds[s] = entry
+ end
+ end
+ end
+ end
end
- end
+ --
for i=1,#collected do
entry = collected[i]
local metadata = entry.metadata
@@ -535,20 +607,32 @@ local function register_from_list(collected,derived,external)
local realpage = references.realpage
if realpage then
prefix = references.prefix
- component = references.component
+-- component = references.component
if prefix and prefix ~= "" then
derived_p = derived[prefix]
if not derived_p then
derived_p = { }
derived[prefix] = derived_p
end
+ else
+ derived_p = nil
end
- if component and component ~= "" and component ~= prefix then
- derived_c = derived[component]
- if not derived_c then
- derived_c = { }
- derived[component] = derived_c
- end
+-- if component and component ~= "" and component ~= prefix then
+-- derived_c = derived[component]
+-- if not derived_c then
+-- derived_c = { }
+-- derived[component] = derived_c
+-- end
+-- else
+-- derived_c = nil
+-- end
+ structure = references.structure
+ if structure then
+ structure = resolvers.jobs.namelist(structure,namestack)
+ references.namestack = structure
+ end
+ if trace_referencing or trace_external then
+ report_references("list entry %a provides %a reference %a on realpage %a",i,kind,reference,realpage)
end
process_settings(reference,action)
end
@@ -561,13 +645,13 @@ end
function references.integrate(utilitydata)
local filename = utilitydata.comment.file
- if filename then
+ if filename and filename ~= environment.jobname then
-- lists are already internalized
local structures = utilitydata.structures
if structures then
local lists = structures.lists.collected
if lists then
- register_from_list(lists,derived,filename)
+ register_from_list(lists,derived,filename,utilitydata)
end
end
end
@@ -575,7 +659,7 @@ end
references.registerinitializer(function()
-- the main document
- register_from_list(lists.collected,derived)
+ register_from_list(lists.collected,derived) -- false, false
end)
-- tracing
@@ -652,10 +736,10 @@ end)
-- urls
-local urls = references.urls or { }
-references.urls = urls
-local urldata = urls.data or { }
-urls.data = urldata
+local urls = references.urls or { }
+references.urls = urls
+local urldata = urls.data or { }
+urls.data = urldata
local p_untexurl = Cs ( (
P("\\")/"" * (P("%")/"%%" + P(1))
@@ -1097,13 +1181,6 @@ local function loadexternalreferences(name,utilitydata)
target = { }
external[prefix] = target
end
- -- for s in gmatch(reference,"%s*([^,]+)") do
- -- if trace_importing then
- -- report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a",
- -- "external",kind,name,prefix,s)
- -- end
- -- target[s] = target[s] or entry
- -- end
local function action(s)
if trace_importing then
report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a",
@@ -1147,7 +1224,7 @@ setmetatableindex(externals, function(t,k) -- either or not automatically
return false
end)
-local productdata = allocate {
+local productdata = allocate { -- will go
productreferences = { },
componentreferences = { },
components = { },
@@ -1196,6 +1273,13 @@ local function loadproductreferences(productname,componentname,utilitydata)
if kind and realpage then
local prefix = references.prefix or ""
local component = references.component
+
+ -- local structure = references.structure
+ -- print("!!!!!!!!",structure)
+ -- if structure then
+ -- inspect(resolvers.job.namelist(structure))
+ -- end
+
local ctarget, ptarget
if not component or component == componentname then
-- skip
@@ -1327,7 +1411,7 @@ function references.loadpresets(product,component) -- we can consider a special
loadproductvariables (product,component,utilitydata)
loadproductcomponents(product,component,utilitydata)
loadproductreferences(product,component,utilitydata)
--- loadproductcomponents(product,component,utilitydata)
+ -- loadproductcomponents(product,component,utilitydata)
end
end
end
@@ -1483,11 +1567,20 @@ end
-- foo:bar -> foo == prefix (first we try the global one)
-- -:bar -> ignore prefix
-local function finish_inner(var,p,i)
- var.kind = "inner"
+local function finish_inner(set,var,p,i)
+ local external = i.references.external
+ local realpage = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1
+ if external then
+ var.kind = "outer with inner"
+ var.external = true
+ var.outer = external
+ set.external = true -- probably not needed
+ else
+ var.kind = "inner"
+ var.p = p
+ end
+ var.r = realpage
var.i = i
- var.p = p
- var.r = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1
return var
end
@@ -1506,7 +1599,7 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[splitinner]
if i then
- return finish_inner(var,"",i)
+ return finish_inner(set,var,"",i)
end
end
end
@@ -1514,7 +1607,7 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[splitinner]
if i then
- return finish_inner(var,splitprefix,i)
+ return finish_inner(set,var,splitprefix,i)
end
end
if derived then
@@ -1522,11 +1615,13 @@ local function identify_inner(set,var,prefix,collected,derived)
-- using the prefix that is active at this moment (so we overload the given
-- these are taken from other data structures (like lists)
if splitprefix == "-" then
+-- loop over the current structure list reversed
+-- and end with "" .. needs example
local i = derived[""]
if i then
i = i[splitinner]
if i then
- return finish_inner(var,"",i)
+ return finish_inner(set,var,"",i)
end
end
end
@@ -1534,7 +1629,7 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[splitinner]
if i then
- return finish_inner(var,splitprefix,i)
+ return finish_inner(set,var,splitprefix,i)
end
end
end
@@ -1545,7 +1640,7 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[inner]
if i then
- return finish_inner(var,prefix,i)
+ return finish_inner(set,var,prefix,i)
end
end
if not i and derived then
@@ -1554,7 +1649,22 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[inner]
if i then
- return finish_inner(var,prefix,i)
+ return finish_inner(set,var,prefix,i)
+ end
+ end
+ --
+ local n, list = resolvers.jobs.currentstructure()
+ if list then
+ for i=#list,1,-1 do
+ local l = list[i]
+ local i = derived[l]
+ if i then
+ i = i[inner]
+ if i then
+ -- return finish_inner(set,var,"",i)
+ return finish_inner(set,var,l,i)
+ end
+ end
end
end
end
@@ -1571,10 +1681,7 @@ local function unprefixed_inner(set,var,prefix,collected,derived,tobesaved)
(derived and derived [""] and derived [""][inner]) or
(tobesaved and tobesaved[""] and tobesaved[""][inner])
if i then
- var.kind = "inner"
- var.p = ""
- var.i = i
- var.r = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1
+ finish_inner(set,var,"",i)
else
var.error = "unknown inner or special"
end
@@ -1611,13 +1718,13 @@ local function identify_auto(set,var,i)
end
end
-- escape from prefix
--- local pdata = odata[""]
--- if pdata then
--- local r = pdata[inner]
--- if r then
--- return okay(o,"2h")
--- end
--- end
+ -- local pdata = odata[""]
+ -- if pdata then
+ -- local r = pdata[inner]
+ -- if r then
+ -- return okay(o,"2h")
+ -- end
+ -- end
else
for p, pdata in sortedhash(odata) do
local r = pdata[inner]
@@ -1765,7 +1872,6 @@ end
local function identify_inner_or_outer(set,var,i)
-- here we fall back on product data
local inner = var.inner
-
if inner and inner ~= "" then
-- first we look up in collected and derived using the current prefix
@@ -1780,7 +1886,8 @@ local function identify_inner_or_outer(set,var,i)
return v
end
- if var.inner == var.reference and identify_auto(set,var,i) and var.outer and var.outer ~= "" then
+-- if var.inner == var.reference and identify_auto(set,var,i) and var.outer and var.outer ~= "" then
+ if var.inner == var.reference and var.outer and var.outer ~= "" then
return identify_outer(set,var,i)
end
@@ -1804,7 +1911,6 @@ local function identify_inner_or_outer(set,var,i)
end
-- as a last resort we will consult the global lists
-
local v = unprefixed_inner(set,var,"",collected,derived,tobesaved)
if v then
if trace_identifying then
@@ -1873,6 +1979,7 @@ local function identify_inner_or_outer(set,var,i)
end
end
end
+
var.error = "unknown inner"
else
var.error = "no inner"
@@ -1896,40 +2003,51 @@ local function identify_inner_component(set,var,i)
return var
end
+local function identify_outer_component_step(set,var,vi,i,component,where)
+ if vi then
+ var.outer = component
+ var.i = vi
+ var.kind = "outer with inner"
+ set.external = true
+ if trace_identifying then
+ report_identify_outer(set,var,i,where)
+ end
+ return true
+ end
+end
+
local function identify_outer_component(set,var,i)
local component = var.component
- local inner = var.inner
+ local inner = var.inner
+ --
local data = productdata.componentreferences[component]
if data then
local d = data[""]
- local vi = d and d[inner]
- if vi then
- var.inner = inner
- var.outer = component
- var.i = vi
- var.kind = "outer with inner"
- set.external = true
- if trace_identifying then
- report_identify_outer(set,var,i,"6a")
- end
+ local d = d and d[inner]
+ if d and identify_outer_component_step(set,var,d,i,component,"6a") then
return var
end
end
+ --
local data = productdata.productreferences[component]
if data then
- local vi = data[inner]
- if vi then
- var.inner = inner
- var.outer = component
- var.i = vi
- var.kind = "outer with inner"
- set.external = true
- if trace_identifying then
- report_identify_outer(set,var,i,"6b")
- end
+ local d = data[inner]
+ if d and identify_outer_component_step(set,var,d,i,component,"6b") then
+ return var
+ end
+ end
+ --
+if texconditionals.autocrossfilereferences then
+ references.loadpresets(component,component)
+ local data = productdata.productreferences[component]
+ if data then
+ local d = data[inner]
+ if d and identify_outer_component_step(set,var,d,i,component,"6c") then
return var
end
end
+end
+ --
var.error = "unknown component"
if trace_identifying then
report_identify_outer(set,var,i,"6c")
@@ -1962,6 +2080,8 @@ local function identify(prefix,reference)
var = identify_outer(set,var,i)
elseif var.arguments then
var = identify_arguments(set,var,i)
+-- else
+-- var = identify_inner_or_outer(set,var,i)
elseif not var.component then
var = identify_inner_or_outer(set,var,i)
elseif productcomponent() then
@@ -2364,6 +2484,7 @@ local function filterreference(name,prefixspec,numberspec) -- number page title
if data then
if name == "realpage" then
local cs = references.analyze() -- normally already analyzed but also sets state
+ -- or just get from references.realpage when present
context(tonumber(cs.realpage) or 0)
else -- assumes data is table
local kind = false
@@ -2399,6 +2520,26 @@ local function filterreferencedefault()
return filterreference("default",getcurrentprefixspec("default"))
end
+local function getreferencesectionnumber(reference)
+ if references.valid("",reference,{},false) then
+ local data = currentreference and currentreference.i
+ if type(data) == "table" then
+ local metadata = data.metadata
+ if metadata and metadata.kind == "section" then
+ local numberdata = data.numberdata
+ if numberdata then
+ numberdata = numberdata.numbers
+ context(numberdata[#numberdata] or 0)
+ return
+ end
+ end
+ elseif trace_referencing then
+ report_references("name %a, no reference",reference)
+ end
+ end
+ context(0)
+end
+
references.filter = filterreference
references.filterdefault = filterreferencedefault
@@ -2418,6 +2559,13 @@ implement {
}
}
+implement {
+ name = "getreferencesectionnumber",
+ actions = getreferencesectionnumber,
+ arguments = "string",
+ public = true,
+}
+
function genericfilters.title(data)
if data then
local titledata = data.titledata or data.useddata
@@ -2691,6 +2839,7 @@ function references.analyze(actions,position,spread)
actions.pagestate = checkedpagestate(actions.n,realpage,actions,position,spread)
end
end
+-- inspect(actions)
return actions
end
@@ -2698,6 +2847,8 @@ local function referencepagestate(position,detail,spread)
local actions = references.currentset
if not actions then
return 0
+ elseif actions.external then
+ return 0
else
local pagestate = actions.pagestate
for i=1,#actions do
@@ -3067,3 +3218,32 @@ implement {
name = "popreferenceprefix",
actions = { popreferenceprefix, context }, -- we can use setmacro
}
+
+-- a bit weird one, used for checkinh in the backend
+
+function references.pagefromhash(hash,destination,page,actions)
+ local r = actions[1]
+ if type(r) == "table" then
+ r = r.i
+ if r then
+ r = r.references
+ if r then
+ local structure = r.structure
+ if structure then
+ local namestack = r.namestack
+ if namestack then
+ for i=#namestack,1,-1 do
+ local d = namestack[i] .. ":" .. destination
+ page = hash[d]
+ if page then
+ destination = d
+ break
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ return page, destination
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
index a1b6ac22d45..8619d084e74 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
@@ -994,6 +994,8 @@
\aliased\let\from \strc_references_from
\to \everydump
+% can be defined visible at lua end
+
\permanent \def\filterreference #key{\clf_filterreference{#key}} % no checking, expandable
\permanent\protected\def\getreferenceentry#key{\clf_filterreference{#key}} % no checking, not expandable
@@ -1005,7 +1007,6 @@
\permanent\def\currentreferencerealpage{\clf_filterreference{realpage}}
\aliased \let\currentreferenceorder \getinternalorderreference
-
%D The most straightforward way of retrieving references is using \type {\ref}.
\permanent\tolerant\protected\def\getreference[#key]#spacer[#label]% #key = number page title text default realpage ...
@@ -1017,6 +1018,25 @@
\aliased\let\ref\getreference
+% setnumber-001.tex
+%
+% \starttext
+% \chapter[one]{One} see setnumber-002
+% \chapter[two]{Two} see setnumber-002
+% \stoptext
+%
+% setnumber-002.tex
+%
+% \setupreferencing[autofile=yes]
+% \useexternaldocument[foo] [setnumber-001] [{TEST 1}]
+% \setupheadnumber[chapter][\getreferencesectionnumber{foo::two}]
+% \starttext
+% \chapter[three]{Three} from setnumber-001, one: \getreferencesectionnumber{foo::one}\par
+% \chapter[four] {Four} from setnumber-001, two: \getreferencesectionnumber{foo::two}\par
+% \stoptext
+%
+% \getreferencesectionnumber{reference} : defined at the lua end
+
%D Special cases:
\permanent\protected\def\strc_references_about[#label]%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
index b66b229212c..6affc02f89c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
@@ -536,7 +536,13 @@ local function preprocessentries(rawdata)
end
local seeword = rawdata.seeword
if seeword then
- seeword.processor, seeword.text = splitprocessor(seeword.text or "")
+ local text = seeword.text or ""
+ local sp, st = splitprocessor(text)
+ seeword.text = text
+ -- seeword.list = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,st)
+ if sp then
+ seeword.processor = sp
+ end
end
end
@@ -585,8 +591,10 @@ local function storeregister(rawdata) -- metadata, references, entries
rawdata.userdata = touserdata(userdata)
end
--
- references.section = currentid()
- metadata.level = currentlevel()
+ references.block = structures.sections.currentblock()
+ references.structure = resolvers.jobs.currentstructure()
+ references.section = currentid()
+ metadata.level = currentlevel()
--
local data = notsaved and collected[name] or tobesaved[name]
local entries = data.entries
@@ -1045,6 +1053,7 @@ function registers.use(tag,filename,class,prefix)
filename = filename,
data = job.loadother(filename),
prefix = prefix or class,
+ label = prefix or class,
}
end
@@ -1054,13 +1063,43 @@ implement {
actions = registers.use,
}
+-- function registers.use(tag,specification)
+-- local class = specification.class
+-- local filename = specification.filename
+-- local prefix = specification.prefix or class
+-- local label = specification.label or prefix
+-- if class and filename then
+-- used[tag] = {
+-- class = class,
+-- filename = filename,
+-- data = job.loadother(filename),
+-- prefix = prefix,
+-- label = label,
+-- }
+-- end
+-- end
+
+-- implement {
+-- name = "useregister",
+-- actions = registers.use,
+-- arguments = {
+-- "string",
+-- {
+-- { "filename" },
+-- { "class" },
+-- { "prefix" },
+-- { "label" },
+-- },
+-- }
+-- }
+
implement {
- name = "registerprefix",
+ name = "registerlabel",
arguments = "string",
actions = function(tag)
local u = used[tag]
if u then
- context(u.prefix)
+ context(u.label)
end
end
}
@@ -1075,7 +1114,13 @@ local function analyzeregister(class,options)
local list = utilities.parsers.settings_to_array(class)
local entries = { }
local nofentries = 0
- local metadata = false
+ local multiple = false
+ for i=1,#list do
+ if used[list[i]] then
+ multiple = true
+ break
+ end
+ end
for i=1,#list do
local l = list[i]
local u = used[l]
@@ -1089,16 +1134,26 @@ local function analyzeregister(class,options)
end
if d then
local e = d.entries
- local u = u and { u.prefix } or nil
+-- local u = u and { u.prefix } or nil
+local u = multiple and { string.formatters["%03i"](i) } or nil -- maybe prefix but then how about main
for i=1,#e do
+ -- see has no pagedata
local ei = e[i]
+ local external = ei.external
+if multiple and ei.metadata.kind == "see" and external then
+ -- too messy, could be an option but useless
+else
+
nofentries = nofentries + 1
entries[nofentries] = ei
if u then
local eil = ei.list
eil[#eil+1] = u
+if external then
ei.external = l -- this is the (current) abstract tag, used for prefix
+end
end
+end
end
if not metadata then
metadata = d.metadata
@@ -1107,9 +1162,11 @@ local function analyzeregister(class,options)
end
data = {
metadata = metadata or { },
+ multiple = multiple,
entries = entries,
}
collected[class] = data
+ options.multiple = multiple
end
if data and data.entries then
options = options or { }
@@ -1322,7 +1379,9 @@ function registers.flush(data,options,prefixspec,pagespec)
-- report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1])
end
end
- if entry.external then
+-- move up ?
+-- if entry.external then
+ if options.multiple or entry.external then
local list = entry.list
list[#list] = nil
end
@@ -1538,6 +1597,10 @@ function registers.flush(data,options,prefixspec,pagespec)
local seetext = seeword.text or ""
local processor = seeword.processor or (entry.processors and entry.processors[1]) or ""
local seeindex = entry.external or entry.references.seeindex or ""
+ local seelist = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,seetext)
+ if #seelist > 1 then
+ seetext = concat(seelist,", ")
+ end
ctx_registerseeword(
metadata.name or "",
i,
@@ -1741,7 +1804,7 @@ interfaces.implement {
function registers.integrate(utilitydata)
local filename = utilitydata.comment.file
- if filename then
+ if filename and filename ~= environment.jobname then
local structures = utilitydata.structures
if structures then
local registers = structures.registers.collected or { }
@@ -1772,6 +1835,7 @@ function registers.integrate(utilitydata)
end
references.external = filename -- not really needed
end
+ entry.external = true
end
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
index afe3d27a09c..7dd07b2e261 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
@@ -155,16 +155,17 @@
\mutable\lettonothing\currentregisternumber
\mutable\lettonothing\currentregisterownnumber
\mutable\lettonothing\currentregisterpageindex
+\mutable\lettonothing\currentregisterpageprefix
\mutable\lettonothing\currentregisterpagesymbol
+\mutable\lettonothing\currentregisterprocessors
+\mutable\lettonothing\currentregisterprocessorsa
+\mutable\lettonothing\currentregisterprocessorsb
+\mutable\lettonothing\currentregisterprocessorsc
\mutable\lettonothing\currentregistersectionindex
\mutable\lettonothing\currentregisterseeindex
\mutable\lettonothing\currentregisterseeword
\mutable\lettonothing\currentregistersynchronize
\mutable\lettonothing\currentregisterxmlsetup
-\mutable\lettonothing\currentregisterprocessors
-\mutable\lettonothing\currentregisterprocessorsa
-\mutable\lettonothing\currentregisterprocessorsb
-\mutable\lettonothing\currentregisterprocessorsc
\newconditional\c_strc_registers_defining
\setnewconstant\c_strc_registers_maxlevel \plusfive
@@ -792,6 +793,25 @@
{\doifelsefiledefined{#1}{}{\usefile[#1][#2]}%
\clf_useregister{#1}{#2}{#3}{#4}}
+% \permanent\protected\tolerant\def\useregister[#1]#*[#2]#*[#3]#*[#4]% tag file class prefix
+% {\begingroup
+% \doifelsefiledefined{#1}{}{\usefile[#1][#2]}%
+% \ifhastok={#4}%
+% \getdummyparameters[\c!prefix=#1,\c!label=#1,#4]%
+% \else
+% \getdummyparameters[\c!prefix=#4,\c!label=#4]%
+% \fi
+% \clf_useregister
+% {#1}
+% {
+% filename {#2}
+% class {#3}
+% prefix {\dummyparameter\c!prefix}
+% label {\dummyparameter\c!label}
+% }
+% \relax
+% \endgroup}
+
%D Character rendering (sections):
\installcorenamespace{registerindicator}
@@ -975,6 +995,8 @@
\setfalse\settrue\c_strc_registers_vertical
\to \everysetupregister
+\mutable\lettonothing\currentnestedregister
+
\permanent\protected\def\usenestedregisterstyleandcolor#1#2% will change
{\useregisterstyleandcolor#1#2%
% how about style
@@ -1123,15 +1145,16 @@
% todo: adapt \strc_references_goto_internal to take an extra argument, the ref
\permanent\protected\def\withregisterpagecommand#1#2#3#4% #1:processor #2:internal #3:realpage #4:page
- {\ifcase#3\relax
- {\tt [entry\space not\space flushed]}%
+ {\begingroup
+ \ifcase#3\relax
+ \tt [entry\space not\space flushed]%
\else
\def\currentregisterpageindex{#2}%
\def\currentregisterrealpage{#3}%
\ifchknum\currentregisterpageindex\or
\lettonothing\currentregisterpageprefix
\else
- \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterpageindex}}%
+ \def\currentregisterpageprefix{\clf_registerlabel{\currentregisterpageindex}}%
\fi
\iflocation
\ifempty\currentregisterpageprefix
@@ -1144,7 +1167,8 @@
\setlocationattributes
\fi
\applyprocessor{#1}{\currentregisterpageprefix\registerparameter\c!pagecommand{#4}}%
- \fi}
+ \fi
+ \endgroup}
\lettonothing\m_current_register
@@ -1281,7 +1305,7 @@
\ifchknum\currentregisterseeindex\or
\lettonothing\currentregisterpageprefix
\else
- \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterseeindex}}%
+ \def\currentregisterpageprefix{\clf_registerlabel{\currentregisterseeindex}}%
\fi
\iflocation
\ifempty\currentregisterpageprefix
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
index 227d24704dc..db100f0dde3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
@@ -704,7 +704,8 @@
\ifcsname\??headincrement\currentheadincrement\endcsname
\lastnamedcs
\else
- \settrue \c_strc_sectioning_increment\settrue \c_strc_sectioning_to_list
+ \settrue\c_strc_sectioning_increment
+ \settrue\c_strc_sectioning_to_list
% \filterheadnumber
\fi}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
index 9b4c37ceb53..9b4d410e123 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
@@ -266,6 +266,7 @@
\mutable\lettonothing\currentsynonym
\mutable\lettonothing\currentsynonymtag
\mutable\lettonothing\currentsynonymtext
+\mutable\lettonothing\currentsynonymsortkey
\permanent\tolerant\protected\def\definesynonyms[#1]#*[#2]#*[#3]#*[#4]% name plural \meaning \use
{\ifnum\lastarguments=\plusfour
@@ -626,7 +627,6 @@
\permanent\protected\def\currentsortingname {\clf_synonymname\currentsimplelist\currentsortingtag}
\permanent\protected\def\currentsortingpages {\clf_synonympages\currentsimplelist\currentsortingtag}
\permanent\protected\def\doifelsecurrentsortingused {\clf_doifelsesynonymused\currentsimplelist\currentsortingtag}
-\permanent\protected\def\resetusedsortings [#1]{\clf_resetusedsynonyms{#1}}
\permanent\protected\def\sortingname [#1]#*[#2]{\clf_synonymname {#1}{#2}}
\permanent\protected\def\sortingpages[#1]#*[#2]{\clf_synonympages{#1}{#2}}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt b/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt
index a5bfe139452..a26f77ae20e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt
@@ -481,9 +481,9 @@ local doifelse = commands.doifelse
do
- local dirvalues = nodes.dirvalues
- local lefttoright_code = dirvalues.lefttoright
- local righttoleft_code = dirvalues.righttoleft
+ local directioncodes = tex.directioncodes
+ local lefttoright_code = directioncodes.lefttoright
+ local righttoleft_code = directioncodes.righttoleft
local function firstdirinbox(n)
local b = getbox(n)
@@ -1395,6 +1395,8 @@ do
actions = boxlinecount,
}
+ -- todoL: just inline so that s-system-macros can find them
+
define_one("boxline", "get")
define_one("setboxline", "set")
define_one("copyboxline", "copy")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt b/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt
index b043d835df8..1bcb237f635 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt
@@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['symb-emj'] = {
license = "see context related readme files"
}
--- processors.hpack_filter does it all
-
local symbols = fonts.symbols
local resolvedemoji = characters.emoji.resolve
diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl b/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl
index 2b87f4b3d45..58678f9f3c5 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl
@@ -587,7 +587,7 @@
% or (test this):
%
% \permanent\protected\def\processallactionsinset[#1]%
-% {\ifcstok{#1}\emptytoks
+% {\iftok{#1}\emptytoks
% \expandafter\processaction
% \else
% \expandafter\syst_helpers_process_all_actions_in_set_indeed
@@ -6854,6 +6854,8 @@
%D
%D \typebuffer \startpacked \getbuffer \stoppacked
+\lettonothing\syst_helpers_wipe_tokens_yes
+
\def\syst_helpers_wipe_tokens_nop#-^^04{}%
\permanent\def\wipetokens#1#2%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl
index 2b37e30c622..d55a821758d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl
@@ -322,6 +322,7 @@
\permanent\countdef\c_syst_max_allocated_toks = 216 \c_syst_max_allocated_toks = \directlua{tex.write(tex.magicconstants.max_toks_register_index)} % idem
\permanent\countdef\c_syst_max_allocated_read = 217 \c_syst_max_allocated_read = \c_syst_max_allocated_iohandle
\permanent\countdef\c_syst_max_allocated_write = 218 \c_syst_max_allocated_write = \c_syst_max_allocated_iohandle
+\permanent\countdef\c_syst_max_allocated_float = 220 \c_syst_max_allocated_float = \directlua{tex.write(tex.magicconstants.max_float_register_index or 0)} % idem
\permanent\countdef\c_syst_last_allocated_count = 221 \c_syst_last_allocated_count = \c_syst_min_allocated_register
\permanent\countdef\c_syst_last_allocated_dimen = 222 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register
@@ -332,6 +333,7 @@
\permanent\countdef\c_syst_last_allocated_read = 227 \c_syst_last_allocated_read = \c_syst_min_allocated_iohandle
\permanent\countdef\c_syst_last_allocated_write = 228 \c_syst_last_allocated_write = \c_syst_min_allocated_iohandle
\permanent\countdef\c_syst_last_allocated_marks = 229 \c_syst_last_allocated_marks = \c_syst_min_allocated_mark
+\permanent\countdef\c_syst_last_allocated_float = 230 \c_syst_last_allocated_float = \c_syst_min_allocated_register
\permanent\countdef\c_syst_min_counter_value = 253 \c_syst_min_counter_value = -"7FFFFFFF
\permanent\countdef\c_syst_max_counter_value = 254 \c_syst_max_counter_value = "7FFFFFFF
@@ -358,6 +360,7 @@
\permanent\protected\def\newdimension #1{\dimensiondef #1\zeropoint}
\permanent\protected\def\newgluespec #1{\gluespecdef #1\zeropoint}
\permanent\protected\def\newmugluespec#1{\mugluespecdef#1\zeropoint}
+\permanent\protected\def\newposit #1{\positdef #1\zerocount}
%D The aliasing here is tricky: we need to make sure the alias is not let to the
%D current value but behaves dynamic. Instead we can use just \newcount, unless of
@@ -366,6 +369,7 @@
\protected\def\aliasinteger #1#2{\untraced\protected\def#1{#2}}% name parent
\protected\def\aliasdimension#1#2{\untraced\protected\def#1{#2}}% name parent
+\protected\def\aliasposit #1#2{\untraced\protected\def#1{#2}}% name parent
%D So, effectively we start allocating from 256 and upwards. The inserts sit in the
%D range 128 upto 254. Page numbers use the counters 0 upto 9 and the pagebox is
@@ -386,6 +390,7 @@
\permanent\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_read}
\permanent\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_write}
\permanent\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_mark}
+\permanent\protected\def\newfloat {\syst_basics_allocate\c_syst_last_allocated_float \float \floatdef \c_syst_max_allocated_float}
\firstvalidlanguage \plusone % so zero is ignored in hyphenation, this might become the default
@@ -1308,7 +1313,7 @@
\endlocalcontrol
#2}
-\permanent\protected\def\suggestedalias#1#2%
+\permanent\protected\def\suggestedalias#1#2% old new
{\ifflags#2\permanent\permanent\fi % the rest is taken with the copy
\def#1{\syst_suggested_alias#1#2}}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt b/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt
index d8e06d4fd2f..0f80f57d3e7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt
@@ -58,6 +58,9 @@ local ctx_secondoftwoarguments = context.secondoftwoarguments
local ctx_firstofoneargument = context.firstofoneargument
local ctx_gobbleoneargument = context.gobbleoneargument
+local values = tokens.values
+local boolean_code = values.boolean
+
implement { -- will be overloaded later
name = "writestatus",
arguments = "2 arguments",
@@ -309,6 +312,21 @@ end
do
+ interfaces.implement {
+ name = "iflua",
+ public = true,
+ usage = "condition",
+ arguments = "string",
+ actions = function(s)
+ local c = load("return(" .. s .. ")")
+ return boolean_code, (c and c()) and true or false
+ end,
+ }
+
+end
+
+do
+
-- This is some 20% slower than native but we only provide this for compatibility
-- reasons so we don't care that much about it. Eventually we can drop the built-in
-- method.
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl
index d8eb7ada7eb..8621d2f6223 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl
@@ -49,6 +49,7 @@
\permanent\protected\lettonothing\BH
\permanent\protected\lettonothing\BL
\permanent\protected\lettonothing\BR
+\permanent\protected\lettonothing\BT
\permanent\protected\lettonothing\CC
\permanent\protected\lettonothing\CL
\permanent\protected\lettonothing\CM
@@ -68,6 +69,8 @@
\permanent\protected\lettonothing\HL
\permanent\protected\lettonothing\HQ
\permanent\protected\lettonothing\HR
+\permanent\protected\lettonothing\HF
+\permanent\protected\lettonothing\HLHL
\permanent\protected\lettonothing\LB
\permanent\protected\lettonothing\LC
\permanent\protected\lettonothing\LT
@@ -94,9 +97,13 @@
\permanent\protected\lettonothing\SM
\permanent\protected\lettonothing\SR
\permanent\protected\lettonothing\TB
+\permanent\protected\lettonothing\TC
\permanent\protected\lettonothing\TL
+\permanent\protected\lettonothing\TM
\permanent\protected\lettonothing\TR
+\permanent\protected\lettonothing\TT
\permanent\protected\lettonothing\VL
+\permanent\protected\lettonothing\VLVL
\permanent\protected\lettonothing\VC
\permanent\protected\lettonothing\VD
\permanent\protected\lettonothing\VN
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
index 414a04f3a1b..b82dcb585e3 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
@@ -1634,13 +1634,22 @@
% enabled per 2018-02-22
-\def\tabl_ntb_table_get_max_width_step
- {\advanceby\scratchdimen\tabl_ntb_get_wid\fastloopindex
- \advanceby\scratchdimen\tabl_ntb_get_dis\fastloopindex}
+% \def\tabl_ntb_table_get_max_width_step
+% {\advanceby\scratchdimen\tabl_ntb_get_wid\fastloopindex
+% \advanceby\scratchdimen\tabl_ntb_get_dis\fastloopindex}
+%
+% \def\tabl_ntb_table_get_max_width
+% {\scratchdimen\zeropoint
+% \dofastloopcs\c_tabl_ntb_maximum_col\tabl_ntb_table_get_max_width_step
+% \ifdim\scratchdimen<\wd\scratchbox\relax
+% \scratchdimen\wd\scratchbox\relax
+% \fi}
\def\tabl_ntb_table_get_max_width
{\scratchdimen\zeropoint
- \dofastloopcs\c_tabl_ntb_maximum_col\tabl_ntb_table_get_max_width_step
+ \localcontrolledloop\zerocount\c_tabl_ntb_maximum_col\plusone
+ {\advanceby\scratchdimen\tabl_ntb_get_wid\currentloopiterator
+ \advanceby\scratchdimen\tabl_ntb_get_dis\currentloopiterator}%
\ifdim\scratchdimen<\wd\scratchbox\relax
\scratchdimen\wd\scratchbox\relax
\fi}
@@ -2377,7 +2386,7 @@
\tabl_ntb_section_disable}
\tolerant\permanent\protected\def\bTABLEsection[#1]%
- {\ifempty{#1}%
+ {\iftok{#1}\emptytoks
\global\c_tabl_ntb_section_repeat\zerocount
\else
\letdummyparameter\c!repeat\zerocount
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl
index 8c872cd477b..ff0d201cfd7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl
@@ -58,7 +58,7 @@
\tabl_table_restore_lineskips
\normalbaselines
% \enforced\let~\fixedspace
-` \enforced\letcharcode\tildeasciicode\fixedspace % why
+ \enforced\letcharcode\tildeasciicode\fixedspace % why
\inhibitblank % \blank[\v!disable]% % added
\the\everytableparbox}
@@ -504,7 +504,7 @@
% Key "M": Displaymath mode.
\newtableformatkey M%
- {\doreadtableformatkeys \{ b{\normalstartimath\displaystyle} a{\normalstopimath}}
+ {\doreadtableformatkeys \{ b{\normalstartimath\forcedisplaymath} a{\normalstopimath}}
% Key "\m": Template ${}#\hfil$
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
index 6c4c3fd47a1..b2e4f50908a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
@@ -589,7 +589,7 @@
\installtabulatepreambleoption{m}{\t_tabl_tabulate_bmath{\normalstartimath}%
\t_tabl_tabulate_emath{\normalstopimath}%
\tabl_tabulate_set_preamble}
-\installtabulatepreambleoption{M}{\t_tabl_tabulate_bmath{\normalstartimath\displaystyle}%
+\installtabulatepreambleoption{M}{\t_tabl_tabulate_bmath{\normalstartimath\forcedisplaymath}%
\t_tabl_tabulate_emath{\normalstopimath}%
\tabl_tabulate_set_preamble}
\installtabulatepreambleoption{h}{\tabl_tabulate_set_hook}
@@ -791,6 +791,7 @@
\defcsname\??tabulatewidth\v!auto\endcsname
{\c_tabl_tabulate_modus\plusthree\settrue\c_tabl_tabulate_reshape}
+\lettonothing\tabl_tabulate_hook_box
\lettonothing\tabl_tabulate_hook_box_begin
\lettonothing\tabl_tabulate_hook_box_end
@@ -1608,13 +1609,19 @@
\tabl_tabulate_vrule_reset_indeed
\fi}
+% \def\tabl_tabulate_vrule_reset_indeed
+% {\gletcsname\??tabulatevrule0\endcsname\undefined
+% \dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step
+% \global\c_tabl_tabulate_max_vrulecolumn\zerocount}
+%
+% \def\tabl_tabulate_vrule_reset_step % undefined or relax
+% {\gletcsname\??tabulatevrule\the\fastloopindex\endcsname\undefined}
+
\def\tabl_tabulate_vrule_reset_indeed
- {\dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step
+ {\localcontrolledloop\zerocount\c_tabl_tabulate_max_vrulecolumn\plusone % start at 0
+ {\gletcsname\??tabulatevrule\the\currentloopiterator\endcsname\undefined}%
\global\c_tabl_tabulate_max_vrulecolumn\zerocount}
-\def\tabl_tabulate_vrule_reset_step % undefined or relax
- {\gletcsname\??tabulatevrule\the\fastloopindex\endcsname\undefined}
-
\appendtoks
\tabl_tabulate_vrule_reset
\to \t_tabl_tabulate_every_after_row
@@ -1798,11 +1805,16 @@
\tabl_tabulate_color_reset_indeed
\fi}
-\def\tabl_tabulate_color_reset_indeed
- {\dofastloopcs\c_tabl_tabulate_max_colorcolumn\tabl_tabulate_color_reset_step}
+% \def\tabl_tabulate_color_reset_indeed
+% {\dofastloopcs\c_tabl_tabulate_max_colorcolumn\tabl_tabulate_color_reset_step}
+%
+% \def\tabl_tabulate_color_reset_step % undefined or empty?
+% {\gletcsname\??tabulatecolor\number\fastloopindex\endcsname\undefined}
-\def\tabl_tabulate_color_reset_step % undefined or empty?
- {\gletcsname\??tabulatecolor\number\fastloopindex\endcsname\undefined}
+\def\tabl_tabulate_color_reset_indeed
+ {\localcontrolledloop\zerocount\c_tabl_tabulate_max_colorcolumn\plusone % start at 1
+ {\gletcsname\??tabulatecolor\the\currentloopiterator\endcsname\undefined}%
+ \global\c_tabl_tabulate_max_colorcolumn\zerocount} % why not like vrule?
\appendtoks
\tabl_tabulate_color_reset
@@ -2201,34 +2213,40 @@
% {\glettonothing\tabl_tabulate_flush_collected_indeed
% \global\c_tabl_tabulate_column\zerocount
% \tabl_tabulate_pbreak_check
+% \global\setfalse\c_tabl_tabulate_split_done % new 27/12/2022
% \dofastloopcs\c_tabl_tabulate_columns\tabl_tabulate_flush_second_step
+% \ifconditional\c_tabl_tabulate_split_done\else
+% \glet\tabl_tabulate_tm\s!reset % new 27/12/2022
+% \fi
% \global\settrue\c_tabl_tabulate_firstflushed}
-%
+
% \protected\def\tabl_tabulate_flush_second_step
-% {\ifvoid\b_tabl_tabulate_current\fastloopindex\else
+% {\ifvoid\b_tabl_tabulate_current\fastloopindex
+% \else
% \gdef\tabl_tabulate_flush_collected_indeed{\the\t_tabl_tabulate_dummy}%
+% \ifvoid\b_tabl_tabulate_current\fastloopindex \else
+% \global\settrue\c_tabl_tabulate_split_done % new 27/12/2022
+% \fi
% \fi}
-%
-% \def\tabl_tabulate_flush_second
-% {\noalign{\tabl_tabulate_flush_second_indeed}%
-% \tabl_tabulate_flush_collected_indeed}
+
+\newconditional\c_tabl_tabulate_split_done
\protected\def\tabl_tabulate_flush_second_indeed
{\glettonothing\tabl_tabulate_flush_collected_indeed
\global\c_tabl_tabulate_column\zerocount
\tabl_tabulate_pbreak_check
\global\setfalse\c_tabl_tabulate_split_done % new 27/12/2022
- \dofastloopcs\c_tabl_tabulate_columns\tabl_tabulate_flush_second_step
+ \localcontrolledloop\plusone\c_tabl_tabulate_columns\plusone{\tabl_tabulate_flush_second_step}%
\ifconditional\c_tabl_tabulate_split_done\else
\glet\tabl_tabulate_tm\s!reset % new 27/12/2022
\fi
\global\settrue\c_tabl_tabulate_firstflushed}
\protected\def\tabl_tabulate_flush_second_step
- {\ifvoid\b_tabl_tabulate_current\fastloopindex
+ {\ifvoid\b_tabl_tabulate_current\currentloopiterator
\else
\gdef\tabl_tabulate_flush_collected_indeed{\the\t_tabl_tabulate_dummy}%
- \ifvoid\b_tabl_tabulate_current\fastloopindex \else
+ \ifvoid\b_tabl_tabulate_current\currentloopiterator \else
\global\settrue\c_tabl_tabulate_split_done % new 27/12/2022
\fi
\fi}
@@ -3016,7 +3034,7 @@
\lettonothing\m_table_current_row_background
\lettonothing\m_table_current_row_background_default
\lettonothing\m_table_current_row_background_filler
-\lettonothing\m_table_current_row_background_defaultfiller
+\lettonothing\m_table_current_row_background_default_filler
\lettonothing\m_table_current_row_background_auto
\protected\def\tabl_register_row_background#1%
@@ -3262,7 +3280,7 @@
%\letcsname\??tabulatespana r\endcsname\relax
\noaligned\tolerant\def\tabl_tabulate_NS[#1]#*[#2]%
- {\NC\loopcs{#1}\tabl_tabulate_span
+ {\NC\loopcs{#1}\tabl_tabulate_span % use localloop and quit
\gdef\tabl_tabulate_kooh
{\begincsname\??tabulatespana#2\endcsname
\glet\tabl_tabulate_kooh\relax}%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
index c475d62330a..50f321c0dc9 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
@@ -87,7 +87,7 @@ local new_glue = nodepool.glue
local new_kern = nodepool.kern
local new_hlist = nodepool.hlist
-local lefttoright_code = nodes.dirvalues.lefttoright
+local lefttoright_code = tex.directioncodes.lefttoright
local v_stretch = variables.stretch
local v_normal = variables.normal
diff --git a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
index 57376ae2be8..962a7ef9af7 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
@@ -176,11 +176,20 @@ appendaction("alignments", "normalizers", "nodes.handlers.mathmatrixrules",
appendaction("localboxes", "lists", "typesetters.localboxes.handler", nil, "nut", "enabled" )
+appendaction("hquality", "system", "builders.hpack.report", nil, "nonut", "enabled" )
+appendaction("hquality", "system", "builders.hpack.show", nil, "nut", "enabled" )
+appendaction("vquality", "system", "builders.vpack.report", nil, "nonut", "enabled" )
+------------("vquality", "system", "builders.vpack.show", nil, "nut", "enabled" )
+
-- some protection
-freezecallbacks("find_.*_file", "find file using resolver")
-freezecallbacks("read_.*_file", "read file at once")
-freezecallbacks("open_.*_file", "open file for reading")
+freezecallbacks("find_log_file", "provide the log file name")
+freezecallbacks("find_format_file", "locate the format file")
+freezecallbacks("open_data_file", "open the given file for reading")
+freezecallbacks("process_jobname", "manipulate jobname")
+freezecallbacks("trace_memory", "show memory usage details")
+
+freezecallbacks("hpack_filter", "hlist processing (not used, replaced)") -- no need to add more overhead
-- experimental (needs to be updated):
@@ -197,6 +206,9 @@ freezegroup("finalizers", "lists")
freezegroup("math", "normalizers")
freezegroup("math", "builders")
+freezegroup("hquality", "system")
+freezegroup("vquality", "system")
+
freezegroup("shipouts", "normalizers")
freezegroup("shipouts", "finishers")
freezegroup("shipouts", "wrapup")
@@ -204,8 +216,8 @@ freezegroup("shipouts", "wrapup")
freezegroup("mvlbuilders", "normalizers")
freezegroup("vboxbuilders", "normalizers")
------------("parbuilders", "lists")
------------("pagebuilders", "lists")
+-----------("parbuilders", "normalizers")
+freezegroup("pagebuilders", "normalizers")
freezegroup("math", "normalizers")
freezegroup("math", "builders")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt
index 83e714d7738..2027ed78e23 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt
@@ -197,6 +197,9 @@ tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode
tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode")
---.alignmentcontextcodes = getthem(tex.getalignmentcontextvalues ) -- only at lua end
tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) -- only at lua end
+tex.directioncodes = getthem(tex.getdirectionvalues ) -- only at lua end (todo tex)
+tex.fillcodes = getthem(tex.getfillvalues ) -- only at lua end (todo tex)
+tex.mathparametercodes = getthem(tex.getmathparametervalues ) -- only at lua end (todo tex)
function tex.stringtocodesbitmap(str,codes)
local bitmap = 0
diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt
index e4bf7626f19..d45e3ae1c35 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt
@@ -48,6 +48,7 @@ local scanvalue = token.scanvalue
local scanchar = token.scanchar
local scancsname = token.scancsname
local scannextchar = token.scannextchar
+local scanposit = token.scanposit
local scanreal = token.scanreal
local scanfloat = token.scanfloat
local scanluanumber = token.scanluanumber
@@ -160,6 +161,7 @@ tokens.scanners = { -- these expand
gluespec = scanskip,
integer = scaninteger,
cardinal = scancardinal,
+ posit = scanposit,
real = scanreal,
float = scanfloat,
luanumber = scanluanumber,
diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
index ab531a46288..855bca6ad23 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
@@ -29,6 +29,7 @@ local scantoks = scanners.toks
local scaninteger = scanners.integer
local scancardinal = scanners.cardinal
local scannumber = scanners.number
+local scanfloat = scanners.float
local scankeyword = scanners.keyword
local scankeywordcs = scanners.keywordcs
local scanword = scanners.word
@@ -226,6 +227,7 @@ local shortcuts = {
scaninteger = scaninteger,
scancardinal = scancardinal,
scannumber = scannumber,
+ scanfloat = scanfloat,
scantable = scantable, -- not directly useable
scankeyword = scankeyword,
scankeywordcs = scankeywordcs,
@@ -262,6 +264,7 @@ local shortcuts = {
toboolean = toboolean,
inspect = inspect,
report = report_scan,
+ posit = posit,
}
tokens.shortcuts = shortcuts
diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt
index caa5464f8d4..83603ef59e8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt
@@ -289,15 +289,15 @@ end
directives.register("system.errorcontext", function(v)
local register = callback.register
if v then
- register('show_error_message', nop)
- register('show_warning_message', function() processwarning(v) end)
- register('intercept_lua_error', function() processerror(v) end)
- register('intercept_tex_error', function(mode,eof) processerror(v,eof) return mode end)
+ register("show_error_message", nop)
+ register("show_warning_message", function() processwarning(v) end)
+ register("intercept_lua_error", function() processerror(v) end)
+ register("intercept_tex_error", function(mode,eof) processerror(v,eof) return mode end)
else
- register('show_error_message', nil)
- register('show_warning_message', nil)
- register('intercept_lua_error', nil)
- register('intercept_tex_error', nil)
+ register("show_error_message", nil)
+ register("show_warning_message", nil)
+ register("intercept_lua_error", nil)
+ register("intercept_tex_error", nil)
end
end)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt
index feef3714fe7..649fef30bff 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt
@@ -304,6 +304,9 @@ local registered = false
local enabled = false
local finished = false
+local status = status -- needed for --sandbox
+local mplib = mplib -- needed for --sandbox
+
function statistics.showusage(when)
if finished and when == "finish" then
return
diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt
index dddb4799deb..9b467de29d0 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt
@@ -760,16 +760,16 @@ end
local ruleddir, ruledpar do
- local dircodes = nodes.dircodes
- local dirvalues = nodes.dirvalues
+ local dircodes = nodes.dircodes
+ local directioncodes = tex.directioncodes -- nodes.dirvalues
- local cancel_code = dircodes.cancel
- local l2r_code = dirvalues.l2r
- local r2l_code = dirvalues.r2l
+ local cancel_code = dircodes.cancel
+ local l2r_code = directioncodes.l2r
+ local r2l_code = directioncodes.r2l
- local d_cache = caches["dir"]
+ local d_cache = caches["dir"]
- local getdirection = nuts.getdirection
+ local getdirection = nuts.getdirection
local tags = {
l2r = "L2R",
@@ -1295,7 +1295,7 @@ local ruledglue, ruledmathglue do
-- we sometimes pass previous as we can have issues in math (not watertight for all)
- local mathvalues = nodes.mathvalues
+ local mathvalues = tex.mathparametercodes -- nodes.mathvalues
mathvalues[-1] = "left"
mathvalues[-2] = "right"
@@ -1946,7 +1946,7 @@ do
head, current = ruledkern(head,current,vertical)
end
end
- goto next;
+ goto next
::list::
if id == hlist_code then
local content = getlist(current)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
index 62dd3c9ab4b..ae1c85ee97d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
@@ -180,6 +180,6 @@
\definefilesynonym [type-imp-antykwa-light.mkiv] [type-imp-antykwa.mkiv]
\definefilesynonym [type-imp-antykwa-cond.mkiv] [type-imp-antykwa.mkiv]
-\definefilesynonym [type-imp-antykwa-lightcond.mkiv] [type-imp-antykwa.mkiv]
+\definefilesynonym [type-imp-antykwa-light-cond.mkiv] [type-imp-antykwa.mkiv]
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt
index 37393ca77f7..09947938350 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt
@@ -62,12 +62,13 @@ function adaptive.set(settings)
texsetattribute(a_adaptive,registervalue(a_adaptive,settings))
end
-local function setadaptive(w,h,d,l,c)
+local function setadaptive(w,h,d,l,c,a)
setdimen(d_adaptive_width,w)
setdimen(d_adaptive_height,h)
setdimen(d_adaptive_depth,d)
setdimen(d_adaptive_line,l)
setmacro("m_adaptive_color",c)
+ setmacro("m_adaptive_alternative",a)
end
local methods = {
@@ -76,7 +77,7 @@ local methods = {
local setups = settings.setups
if setups and setups ~= "" then
local w, h, d = getwhd(parent)
- setadaptive(w,h,d,settings.rulethickness,settings.color)
+ setadaptive(w,h,d,settings.rulethickness,settings.color,settings.alternative)
expandmacro("setup",true,setups)
local l = takebox("b_adaptive_box")
if l then
@@ -150,6 +151,7 @@ interfaces.implement {
{ "mp", "string" },
{ "color", "string" },
{ "rulethickness", "dimension" },
+ { "alternative", "string" },
}
}
}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl
index 733b2ca5be0..d6eae424922 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl
@@ -39,6 +39,10 @@
\aliased\let\usedadaptivebox\b_adaptive_box
\mutable\lettonothing\m_adaptive_color
+\mutable\lettonothing\m_adaptive_alternative
+
+\permanent\def\usedadaptivecolor {\m_adaptive_color}
+\permanent\def\usedadaptivealternative{\m_adaptive_alternative}
\protected\untraced\def\usedadaptivetotal{\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax}
@@ -56,6 +60,7 @@
[\c!foregroundstyle=,
\c!foregroundcolor=,
\c!color=gray,
+ \c!alternative=,
\c!rulethickness=\linewidth,
\c!method=1,
\c!stretch=,
@@ -95,6 +100,7 @@
method \adaptiveparameter\c!method
setups {\p_setups}%
color {\adaptiveparameter\c!color}%
+ alternative {\adaptiveparameter\c!alternative}%
rulethickness \adaptiveparameter\c!rulethickness
}%
\fi
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl
index 5c129f07e35..bf754cdbf8c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl
@@ -51,7 +51,7 @@
\tolerant\def\typo_adjusters_blank#1[#2]% no need for speed
{\begingroup
- % \setbox\scratchbox\vbox{\ifcstok{#2}\emptytoks\blank\else\blank[#2]\fi}%
+ % \setbox\scratchbox\vbox{\iftok{#2}\emptytoks\blank\else\blank[#2]\fi}%
\setbox\scratchbox\vbox{\blank[#2]}%
\vadjust #1 index \plustwo {\vskip\htdp\scratchbox}%
\endgroup}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt
index 00ff9f26796..c0b42001e66 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt
@@ -19,6 +19,12 @@ local parbuilders = builders.paragraphs
parbuilders.constructors = parbuilders.constructors or { }
local constructors = parbuilders.constructors
+builders.hpack = builders.hpack or { }
+builders.vpack = builders.vpack or { }
+
+local hpackbuilders = builders.hpack
+local vpackbuilders = builders.vpack
+
constructors.names = constructors.names or { }
local names = constructors.names
@@ -52,6 +58,7 @@ local nuts = nodes.nuts
local tonode = nodes.tonode
local tonut = nodes.tonut
local getattr = nuts.getattr
+local flush = nuts.flush
local starttiming = statistics.starttiming
local stoptiming = statistics.stoptiming
@@ -200,13 +207,12 @@ local builders = nodes.builders
local vpackactions = nodes.tasks.actions("vboxbuilders")
function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction)
- local done = false
if head then
starttiming(builders)
- head, done = vpackactions(head,groupcode)
+ head = vpackactions(head,groupcode)
stoptiming(builders)
end
- return head, done
+ return head
end
-- This one is special in the sense that it has no head and we operate on the mlv. Also,
@@ -244,8 +250,8 @@ function builders.buildpage_filter(pagecontext)
end
end
-registercallback('vpack_filter', builders.vpack_filter, "vertical spacing etc")
-registercallback('buildpage_filter', builders.buildpage_filter, "vertical spacing etc (mvl)")
+registercallback("vpack_filter", builders.vpack_filter, "vertical spacing etc")
+registercallback("buildpage_filter", builders.buildpage_filter, "vertical spacing etc (mvl)")
local vboxactions = nodes.tasks.actions("vboxhandlers")
@@ -258,7 +264,7 @@ function builders.vbox_filter(head,groupcode)
return head
end
-registercallback('packed_vbox_filter', builders.vbox_filter, "packed vbox treatments")
+registercallback("packed_vbox_filter", builders.vbox_filter, "packed vbox treatments")
statistics.register("v-node processing time", function()
return statistics.elapsedseconds(builders)
@@ -297,37 +303,51 @@ local report_quality = logs.reporter("pack quality")
-- overflow|badness w h d dir
-local function vpack_quality(how,n,detail,first,last,filename)
- if last <= 0 then
- report_quality("%s vbox",how)
- elseif first > 0 and first < last then
- report_quality("%s vbox at line %i - %i in file %a",how,first,last,filename or "?")
- else
- report_quality("%s vbox at line %i in file %a",how,filename or "?",last)
+local report = true trackers.register("builders.vpack.quality", function(v) report = v end)
+local collect = false trackers.register("builders.vpack.collect", function(v) collect = v end)
+---- show = false trackers.register("builders.vpack.overflow",function(v) show = v end)
+
+function vpackbuilders.report(how,detail,n,first,last,filename) -- no return value
+ if report then
+ if last <= 0 then
+ report_quality("%s vbox",how)
+ elseif first > 0 and first < last then
+ report_quality("%s vbox at line %i - %i in file %a",how,first,last,filename or "?")
+ else
+ report_quality("%s vbox at line %i in file %a",how,last,filename or "?")
+ end
+ end
+ if collect then
+ list[#list+1] = { "hbox", how, filename, first, last, how, detail }
end
- list[#list+1] = { "hbox", how, filename, first, last, how }
end
-trackers.register("builders.vpack.quality",function(v)
- registercallback("vpack_quality",v and vpack_quality or nil,"check vpack quality")
-end)
+-- function builders.vpack.show(how,detail,n,first,last,filename) -- return value
+-- if show then
+-- end
+-- end
-local report = false
-local show = false
+local report = true trackers.register("builders.hpack.quality", function(v) report = v end)
+local collect = false trackers.register("builders.hpack.collect", function(v) collect = v end)
+local show = false trackers.register("builders.hpack.overflow",function(v) show = v end)
-local function hpack_quality(how,detail,n,first,last,filename)
- n = tonut(n)
+function hpackbuilders.report(how,detail,n,first,last,filename) -- no return value
+ local str = (report or collect) and listtoutf(getlist(n),"",true,nil,true)
if report then
- local str = listtoutf(getlist(n),"",true,nil,true)
if last <= 0 then
- report_quality("%s hbox: %s",how,str)
+ report_quality("%s hbox: %s (%p)",how,str,detail)
elseif first > 0 and first < last then
- report_quality("%s hbox at line %i - %i in file %a: %s",how,first,last,filename or "?",str)
+ report_quality("%s hbox at line %i - %i in file %a: %s (%p)",how,first,last,filename or "?",str,detail)
else
- report_quality("%s hbox at line %i in file %a: %s",how,last,filename or "?",str)
+ report_quality("%s hbox at line %i in file %a: %s (%p)",how,last,filename or "?",str,detail)
end
- list[#list+1] = { "hbox", how, filename, first, last, str }
end
+ if collect then
+ list[#list+1] = { "hbox", how, filename, first, last, str, detail }
+ end
+end
+
+function hpackbuilders.show(how,detail,n,first,last,filename,rule) -- return value
if show then
local width = 2*65536
local height = getheight(n)
@@ -339,7 +359,10 @@ local function hpack_quality(how,detail,n,first,last,filename)
if depth < 2*65526 then
depth = 2*65526
end
- local rule = new_rule(width,height,depth)
+ if rule then
+ flush(rule)
+ end
+ rule = new_rule(width,height,depth)
setdirection(rule,direction)
if how == "overfull" then
setcolor(rule,"red")
@@ -356,19 +379,40 @@ local function hpack_quality(how,detail,n,first,last,filename)
rule = hpack(rule)
setwidth(rule,0) -- maybe better whd all zero
setdirection(rule,direction)
- return tonode(rule) -- can be a nut
+ else
+ local width = texget("overfullrule")
+ if width > 0 then
+ rule = new_rule(width)
+ end
end
+ return rule
end
-trackers.register("builders.hpack.quality",function(v)
- report = v
- registercallback("hpack_quality",(report or show) and hpack_quality or nil,"check hpack quality")
-end)
+--
-trackers.register("builders.hpack.overflow",function(v)
- show = v
- registercallback("hpack_quality",(report or show) and hpack_quality or nil,"check hpack quality")
-end)
+local hqualityactions = nodes.tasks.actions("hquality")
+local vqualityactions = nodes.tasks.actions("vquality")
+
+function hpackbuilders.qualityactions(how,detail,n,first,last,filename)
+ local rul = nil
+ -- starttiming(builders)
+ rul = hqualityactions(how,detail,n,first,last,filename)
+ -- stoptiming(builders)
+ return rul
+end
+function vpackbuilders.qualityactions(how,detail,n,first,last,filename)
+ local rul = nil
+ -- starttiming(builders)
+ rul = vqualityactions(how,detail,n,first,last,filename)
+ -- stoptiming(builders)
+ return rul
+end
+
+registercallback("hpack_quality", hpackbuilders.qualityactions, "report horizontal packing quality")
+registercallback("vpack_quality", vpackbuilders.qualityactions, "report vertical packing quality")
+
+
+--
statistics.register("quality reports", function()
local n = #list
@@ -390,7 +434,7 @@ statistics.register("quality reports", function()
logs.startfilelogging(report_quality)
for i=1,n do
local l = list[i]
- report_quality("%-" .. fw .. "s [%04i - %04i] : %-" .. hw .. "s %s : %s",file.basename(l[3]),l[4],l[5],l[2],l[1],l[6])
+ report_quality("%-" .. fw .. "s [%04i - %04i] : %-" .. hw .. "s %s : %s (%p)",file.basename(l[3]),l[4],l[5],l[2],l[1],l[6],l[7])
end
logs.stopfilelogging()
report_quality()
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt
new file mode 100644
index 00000000000..469859162fb
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt
@@ -0,0 +1,109 @@
+if not modules then modules = { } end modules ['typo-cln'] = {
+ version = 1.001,
+ comment = "companion to typo-cln.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This quick and dirty hack took less time than listening to a CD (In
+-- this case Dream Theaters' Octavium). Of course extensions will take
+-- more time.
+
+-- This feature is probably never used so we can get rid of it.
+
+local tonumber = tonumber
+local utfbyte = utf.byte
+
+local trace_cleaners = false trackers.register("typesetters.cleaners", function(v) trace_cleaners = v end)
+local trace_autocase = false trackers.register("typesetters.cleaners.autocase",function(v) trace_autocase = v end)
+
+local report_cleaners = logs.reporter("nodes","cleaners")
+local report_autocase = logs.reporter("nodes","autocase")
+
+typesetters.cleaners = typesetters.cleaners or { }
+local cleaners = typesetters.cleaners
+
+local variables = interfaces.variables
+
+local nodecodes = nodes.nodecodes
+
+local enableaction = nodes.tasks.enableaction
+
+local texsetattribute = tex.setattribute
+
+local nuts = nodes.nuts
+
+local getattr = nuts.getattr
+local setattr = nuts.setattr
+
+local setchar = nuts.setchar
+
+local nextglyph = nuts.traversers.glyph
+
+local unsetvalue = attributes.unsetvalue
+
+local glyph_code = nodecodes.glyph
+local uccodes = characters.uccodes
+
+local a_cleaner = attributes.private("cleaner")
+
+local resetter = { -- this will become an entry in char-def
+ [utfbyte(".")] = true
+}
+
+-- Contrary to the casing code we need to keep track of a state.
+-- We could extend the casing code with a status tracker but on
+-- the other hand we might want to apply casing afterwards. So,
+-- cleaning comes first.
+
+function cleaners.handler(head)
+ local inline = false
+ for n, char, font in nextglyph, head do
+ if resetter[char] then
+ inline = false
+ elseif not inline then
+ local a = getattr(n,a_cleaner)
+ if a == 1 then -- currently only one cleaner so no need to be fancy
+ local upper = uccodes[char]
+ if type(upper) == "table" then
+ -- some day, not much change that \SS ends up here
+ else
+ setchar(n,upper)
+ if trace_autocase then
+ report_autocase("")
+ end
+ end
+ end
+ inline = true
+ end
+ end
+ return head
+end
+
+-- see typo-cap for a more advanced settings handler .. not needed now
+
+local enabled = false
+
+function cleaners.set(n)
+ if n == variables.reset or not tonumber(n) or n == 0 then
+ texsetattribute(a_cleaner,unsetvalue)
+ else
+ if not enabled then
+ enableaction("processors","typesetters.cleaners.handler")
+ if trace_cleaners then
+ report_cleaners("enabling cleaners")
+ end
+ enabled = true
+ end
+ texsetattribute(a_cleaner,tonumber(n))
+ end
+end
+
+-- interface
+
+interfaces.implement {
+ name = "setcharactercleaning",
+ actions = cleaners.set,
+ arguments = "string"
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl
index 84fc1d2353b..fba9d4ab8ae 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl
@@ -15,7 +15,7 @@
\unprotect
-\registerctxluafile{typo-cln}{}
+\registerctxluafile{typo-cln}{autosuffix}
\definesystemattribute[cleaner][public]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl
index 08d0a9b09a1..bd427b954be 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl
@@ -412,10 +412,10 @@
{\begingroup
\typo_delimited_push{#1}{#2}%
\dostarttaggedchained\t!delimitedblock\currentdelimitedtext\??delimitedtext
- \edef\p_delimited_method{\delimitedtextparameter\c!method}%
- \ifx\p_delimited_method\v!font
+ \edef\p_method{\delimitedtextparameter\c!method}%
+ \ifx\p_method\v!font
\expandafter\typo_delimited_start_font
- \orelse\ifx\p_delimited_method\v!paragraph
+ \orelse\ifx\p_method\v!paragraph
\expandafter\typo_delimited_start_font
\else
\expandafter\typo_delimited_start_other
@@ -485,12 +485,14 @@
\endgroup
\dostoptagged}
+\lettonothing\p_delimited_left
+\lettonothing\p_delimited_right
+\lettonothing\p_delimited_nextleft
+\lettonothing\p_delimited_nextright
+
\tolerant\def\typo_delimited_start_par[#1]%
{\let\typo_delimited_stop\typo_delimited_stop_par
- \edef\p_delimited_spacebefore{\delimitedtextparameter\c!spacebefore}%
- \ifempty\p_delimited_spacebefore \else
- \blank[\p_delimited_spacebefore]%
- \fi
+ \checkedblank[\delimitedtextparameter\c!spacebefore]%
\delimitedtextparameter\c!before
\edef\m_delimited_argument{#1}%
\ifempty\m_delimited_argument
@@ -538,10 +540,7 @@
\pop_macro_checkindentation
\typo_delimited_stop_par_indeed
\delimitedtextparameter\c!after
- \edef\p_delimited_spaceafter{\delimitedtextparameter\c!spaceafter}%
- \ifempty\p_delimited_spaceafter \else
- \blank[\p_delimited_spaceafter]%
- \fi
+ \checkedblank[\delimitedtextparameter\c!spaceafter]%
\useindentnextparameter\delimitedtextparameter
\aftergroup\dorechecknextindentation}% AM: This was missing!
@@ -566,10 +565,10 @@
\permanent\tolerant\protected\def\delimitedtext[#1]#*[#2]%
{\dontleavehmode % following ones can be omited
\typo_delimited_push{#1}{#2}%
- \edef\p_delimited_method{\delimitedtextparameter\c!method}%
- \ifx\p_delimited_method\v!font
+ \edef\p_method{\delimitedtextparameter\c!method}%
+ \ifx\p_method\v!font
\expandafter\typo_delimited_fontdriven
- \orelse\ifx\p_delimited_method\v!text
+ \orelse\ifx\p_method\v!text
\expandafter\typo_delimited_fontdriven
\else
\expandafter\typo_delimited_other
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt
new file mode 100644
index 00000000000..8671970d889
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt
@@ -0,0 +1,481 @@
+if not modules then modules = { } end modules ['typo-dha'] = {
+ version = 1.001,
+ comment = "companion to typo-dir.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Some analysis by Idris:
+--
+-- 1. Assuming the reading- vs word-order distinction (bidi-char types) is governing;
+-- 2. Assuming that 'ARAB' represents an actual arabic string in raw input order, not word-order;
+-- 3. Assuming that 'BARA' represent the correct RL word order;
+--
+-- Then we have, with input: LATIN ARAB
+--
+-- \textdirection 1 LATIN ARAB => LATIN BARA
+-- \textdirection 1 LATIN ARAB => LATIN BARA
+-- \textdirection 1 LRO LATIN ARAB => LATIN ARAB
+-- \textdirection 1 LRO LATIN ARAB => LATIN ARAB
+-- \textdirection 1 RLO LATIN ARAB => NITAL ARAB
+-- \textdirection 1 RLO LATIN ARAB => NITAL ARAB
+
+-- elseif d == "es" then -- European Number Separator
+-- elseif d == "et" then -- European Number Terminator
+-- elseif d == "cs" then -- Common Number Separator
+-- elseif d == "nsm" then -- Non-Spacing Mark
+-- elseif d == "bn" then -- Boundary Neutral
+-- elseif d == "b" then -- Paragraph Separator
+-- elseif d == "s" then -- Segment Separator
+-- elseif d == "ws" then -- Whitespace
+-- elseif d == "on" then -- Other Neutrals
+
+-- todo : use new dir functions
+-- todo : make faster
+-- todo : move dir info into nodes
+-- todo : swappable tables and floats i.e. start-end overloads (probably loop in builders)
+
+-- I removed the original tracing code and now use the colorful one. If I ever want to change
+-- something I will just inject prints for tracing.
+
+local nodes, node = nodes, node
+
+local trace_directions = false trackers.register("typesetters.directions", function(v) trace_directions = v end)
+
+local report_directions = logs.reporter("typesetting","text directions")
+
+local nuts = nodes.nuts
+
+local getnext = nuts.getnext
+local getprev = nuts.getprev
+local getchar = nuts.getchar
+local getid = nuts.getid
+local getsubtype = nuts.getsubtype
+local getlist = nuts.getlist
+local getattr = nuts.getattr
+local getprop = nuts.getprop
+local getdirection = nuts.getdirection
+local isglyph = nuts.isglyph -- or ischar
+
+local setprop = nuts.setprop
+local setstate = nuts.setstate
+local setchar = nuts.setchar
+
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+local remove_node = nuts.remove
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
+
+local nodepool = nuts.pool
+
+local nodecodes = nodes.nodecodes
+local gluecodes = nodes.gluecodes
+
+local glyph_code = nodecodes.glyph
+local math_code = nodecodes.math
+local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
+local dir_code = nodecodes.dir
+local par_code = nodecodes.par
+
+local parfillskip_code = gluecodes.parfillskip
+
+local directioncodes = tex.directioncodes
+local lefttoright_code = directioncodes.lefttoright
+local righttoleft_code = directioncodes.righttoleft
+
+local new_direction = nodepool.direction
+
+local insert = table.insert
+
+local fonthashes = fonts.hashes
+local fontchar = fonthashes.characters
+
+local chardirections = characters.directions
+local charmirrors = characters.mirrors
+local charclasses = characters.textclasses
+
+local directions = typesetters.directions
+local setcolor = directions.setcolor
+local getglobal = directions.getglobal
+
+local a_directions = attributes.private('directions')
+
+local strip = false
+
+local s_isol = fonts.analyzers.states.isol
+
+local function stopdir(finish) -- we could use finish directly
+ local n = new_direction(finish == righttoleft_code and righttoleft_code or lefttoright_code,true)
+ setprop(n,"direction",true)
+ return n
+end
+
+local function startdir(finish) -- we could use finish directly
+ local n = new_direction(finish == righttoleft_code and righttoleft_code or lefttoright_code)
+ setprop(n,"direction",true)
+ return n
+end
+
+local function nextisright(current)
+ current = getnext(current)
+ local character, id = isglyph(current)
+ if character then
+ local direction = chardirections[character]
+ return direction == "r" or direction == "al" or direction == "an"
+ end
+end
+
+local function previsright(current)
+ current = getprev(current)
+ local character, id = isglyph(current)
+ if character then
+ local direction = chardirections[character]
+ return direction == "r" or direction == "al" or direction == "an"
+ end
+end
+
+local function process(start)
+
+ local head = start
+ local current = head
+ local autodir = 0
+ local embedded = 0
+ local override = 0
+ local pardir = 0
+ local textdir = 0
+ local done = false
+ local stack = { }
+ local top = 0
+ local obsolete = { }
+ local rlo = false
+ local lro = false
+ local prevattr = false
+ local fences = { }
+
+ while current do
+ -- no isglyph here as we test for skips first
+ local id = getid(current)
+ local next = getnext(current)
+ if id == math_code then
+ current = getnext(endofmath(next))
+ elseif getprop(current,"direction") then
+ -- this handles unhbox etc
+ current = next
+ else
+ local attr = getattr(current,a_directions)
+ if attr and attr > 0 then
+ if attr ~= prevattr then
+ if not getglobal(a) then
+ lro = false
+ rlo = false
+ end
+ prevattr = attr
+ end
+ end
+ local prop = true
+ if id == glyph_code then
+ if attr and attr > 0 then
+ local character, font = isglyph(current)
+ if character == 0 then
+ -- skip signals
+ -- setprop(current,"direction",true)
+ else
+ local direction = chardirections[character]
+ local reversed = false
+ if rlo or override > 0 then
+ if direction == "l" then
+ direction = "r"
+ reversed = true
+ end
+ elseif lro or override < 0 then
+ if direction == "r" or direction == "al" then
+ setstate(current,s_isol) -- hm
+ direction = "l"
+ reversed = true
+ end
+ end
+ if direction == "on" then
+ local mirror = charmirrors[character]
+ if mirror and fontchar[font][mirror] then
+ local class = charclasses[character]
+ if class == "open" then
+ if nextisright(current) then
+ setchar(current,mirror)
+ -- setprop(current,"direction","r")
+ prop = "r"
+ elseif autodir < 0 then
+ setchar(current,mirror)
+ -- setprop(current,"direction","r")
+ prop = "r"
+ else
+ mirror = false
+ -- setprop(current,"direction","l")
+ prop = "l"
+ end
+ local fencedir = autodir == 0 and textdir or autodir
+ fences[#fences+1] = fencedir
+ elseif class == "close" and #fences > 0 then
+ local fencedir = fences[#fences]
+ fences[#fences] = nil
+ if fencedir < 0 then
+ setchar(current,mirror)
+ -- setprop(current,"direction","r")
+ prop = "r"
+ else
+ -- setprop(current,"direction","l")
+ prop = "l"
+ mirror = false
+ end
+ elseif autodir < 0 then
+ setchar(current,mirror)
+ -- setprop(current,"direction","r")
+ prop = "r"
+ else
+ -- setprop(current,"direction","l")
+ prop = "l"
+ mirror = false
+ end
+ else
+ -- setprop(current,"direction",true)
+ end
+ if trace_directions then
+ setcolor(current,direction,false,mirror)
+ end
+ elseif direction == "l" then
+ if trace_directions then
+ setcolor(current,"l",reversed)
+ end
+ -- setprop(current,"direction","l")
+ prop = "l"
+ elseif direction == "r" then
+ if trace_directions then
+ setcolor(current,"r",reversed)
+ end
+ -- setprop(current,"direction","r")
+ prop = "r"
+ elseif direction == "en" then -- european number
+ if trace_directions then
+ setcolor(current,"l")
+ end
+ -- setprop(current,"direction","l")
+ prop = "l"
+ elseif direction == "al" then -- arabic letter
+ if trace_directions then
+ setcolor(current,"r")
+ end
+ -- setprop(current,"direction","r")
+ prop = "r"
+ elseif direction == "an" then -- arabic number
+ -- needs a better scanner as it can be a float
+ if trace_directions then
+ setcolor(current,"l") -- was r
+ end
+ -- setprop(current,"direction","n") -- was r
+ prop = "n"
+ elseif direction == "lro" then -- Left-to-Right Override -> right becomes left
+ top = top + 1
+ stack[top] = { override, embedded }
+ override = -1
+ obsolete[#obsolete+1] = current
+ goto obsolete
+ elseif direction == "rlo" then -- Right-to-Left Override -> left becomes right
+ top = top + 1
+ stack[top] = { override, embedded }
+ override = 1
+ obsolete[#obsolete+1] = current
+ goto obsolete
+ elseif direction == "lre" then -- Left-to-Right Embedding -> lefttoright_code
+ top = top + 1
+ stack[top] = { override, embedded }
+ embedded = 1
+ obsolete[#obsolete+1] = current
+ goto obsolete
+ elseif direction == "rle" then -- Right-to-Left Embedding -> righttoleft_code
+ top = top + 1
+ stack[top] = { override, embedded }
+ embedded = -1
+ obsolete[#obsolete+1] = current
+ goto obsolete
+ elseif direction == "pdf" then -- Pop Directional Format
+ if top > 0 then
+ local s = stack[top]
+ override = s[1]
+ embedded = s[2]
+ top = top - 1
+ else
+ override = 0
+ embedded = 0
+ end
+ obsolete[#obsolete+1] = current
+ goto obsolete
+ elseif trace_directions then
+ setcolor(current)
+ -- setprop(current,"direction",true)
+ else
+ -- setprop(current,"direction",true)
+ end
+ end
+ else
+ -- setprop(current,"direction",true)
+ end
+ elseif id == glue_code then
+ if getsubtype(current) == parfillskip_code then
+ -- setprop(current,"direction","!")
+ prop = "!"
+ else
+ -- setprop(current,"direction","g")
+ prop = "g"
+ end
+ elseif id == kern_code then
+ -- setprop(current,"direction","k")
+ prop = "k"
+ elseif id == dir_code then
+ local direction, pop = getdirection(current)
+ if direction == righttoleft_code then
+ if not pop then
+ autodir = -1
+ elseif embedded and embedded~= 0 then
+ autodir = embedded
+ else
+ autodir = 0
+ end
+ elseif direction == lefttoright_code then
+ if not pop then
+ autodir = 1
+ elseif embedded and embedded~= 0 then
+ autodir = embedded
+ else
+ autodir = 0
+ end
+ end
+ textdir = autodir
+ -- setprop(current,"direction",true)
+ elseif id == par_code and startofpar(current) then
+ local direction = getdirection(current)
+ if direction == righttoleft_code then
+ autodir = -1
+ elseif direction == lefttoright_code then
+ autodir = 1
+ end
+ pardir = autodir
+ textdir = pardir
+ -- setprop(current,"direction",true)
+ else
+ -- setprop(current,"direction",true)
+ end
+ setprop(current,"direction",prop)
+ ::obsolete::
+ current = next
+ end
+ end
+
+ -- todo: track if really needed
+ -- todo: maybe we need to set the property (as it can be a copied list)
+
+ if done and strip then
+ local n = #obsolete
+ if n > 0 then
+ for i=1,n do
+ remove_node(head,obsolete[i],true)
+ end
+ if trace_directions then
+ report_directions("%s character nodes removed",n)
+ end
+ end
+ end
+
+ local state = false
+ local last = false
+ local collapse = true
+ current = head
+
+ -- todo: textdir
+ -- todo: inject before parfillskip
+
+ while current do
+ local id = getid(current)
+ if id == math_code then
+ -- todo: this might be tricky nesting
+ current = getnext(endofmath(getnext(current)))
+ else
+ local cp = getprop(current,"direction")
+ if cp == "n" then
+ local swap = state == "r"
+ if swap then
+ head = insertnodebefore(head,current,startdir(lefttoright_code))
+ end
+ setprop(current,"direction",true)
+ while true do
+ local n = getnext(current)
+ if n and getprop(n,"direction") == "n" then
+ current = n
+ setprop(current,"direction",true)
+ else
+ break
+ end
+ end
+ if swap then
+ head, current = insertnodeafter(head,current,stopdir(lefttoright_code))
+ end
+ elseif cp == "l" then
+ if state ~= "l" then
+ if state == "r" then
+ head = insertnodebefore(head,last or current,stopdir(righttoleft_code))
+ end
+ head = insertnodebefore(head,current,startdir(lefttoright_code))
+ state = "l"
+ done = true
+ end
+ last = false
+ elseif cp == "r" then
+ if state ~= "r" then
+ if state == "l" then
+ head = insertnodebefore(head,last or current,stopdir(lefttoright_code))
+ end
+ head = insertnodebefore(head,current,startdir(righttoleft_code))
+ state = "r"
+ done = true
+ end
+ last = false
+ elseif collapse then
+ if cp == "k" or cp == "g" then
+ last = last or current
+ else
+ last = false
+ end
+ else
+ if state == "r" then
+ head = insertnodebefore(head,current,stopdir(righttoleft_code))
+ elseif state == "l" then
+ head = insertnodebefore(head,current,stopdir(lefttoright_code))
+ end
+ state = false
+ last = false
+ end
+ setprop(current,"direction",true)
+ end
+ local next = getnext(current)
+ if next then
+ current = next
+ else
+ local sd = (state == "r" and stopdir(righttoleft_code)) or (state == "l" and stopdir(lefttoright_code))
+ if sd then
+ if id == glue_code and getsubtype(current) == parfillskip_code then
+ head = insertnodebefore(head,current,sd)
+ else
+ head = insertnodeafter(head,current,sd)
+ end
+ end
+ break
+ end
+ end
+
+ return head
+
+end
+
+directions.installhandler(interfaces.variables.default,process)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl
index a5a4bc5686d..d9937ce7302 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl
@@ -19,9 +19,7 @@
\unprotect
\registerctxluafile{typo-dir}{autosuffix}
-\registerctxluafile{typo-dha}{}
-%registerctxluafile{typo-dua}{}
-%registerctxluafile{typo-dub}{}
+\registerctxluafile{typo-dha}{autosuffix}
\registerctxluafile{typo-duc}{autosuffix}
\definesystemattribute[directions][public,pickup]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt
index 2e36389466d..ecc1396a17a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt
@@ -99,9 +99,9 @@ local penalty_code = nodecodes.penalty
local parfillskip_code = gluecodes.parfillskip
local parfillleftskip_code = gluecodes.parfillleftskip
-local dirvalues = nodes.dirvalues
-local lefttoright_code = dirvalues.lefttoright
-local righttoleft_code = dirvalues.righttoleft
+local directioncodes = tex.directioncodes
+local lefttoright_code = directioncodes.lefttoright
+local righttoleft_code = directioncodes.righttoleft
local maximum_stack = 0xFF
@@ -609,23 +609,23 @@ local function resolve_weak(list,size,start,limit,orderbefore,orderafter)
else -- only more efficient when we have es/cs
local runner = start + 2
if runner <= limit then
- local before = list[start]
- local entry = list[start + 1]
- local after = list[runner]
+ local before = list[start]
+ local current = list[start + 1]
+ local after = list[runner]
while after do
- local direction = entry.direction
+ local direction = current.direction
if direction == "es" then
if before.direction == "en" and after.direction == "en" then
- entry.direction = "en"
+ current.direction = "en"
end
elseif direction == "cs" then
local prevdirection = before.direction
if prevdirection == "en" then
if after.direction == "en" then
- entry.direction = "en"
+ current.direction = "en"
end
elseif prevdirection == "an" and after.direction == "an" then
- entry.direction = "an"
+ current.direction = "an"
end
end
before = current
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl
index 93a2fc86fa8..57186856fed 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl
@@ -100,6 +100,8 @@
%D existing local box we create nested ones. This is handled in the callback but if
%D really needed one can do something like (do we need a primitive?):
+\mutable\lettonothing\currentlocalboxeslocation
+
\def\typo_localboxes_localbox
{\ifx\currentlocalboxeslocation\v!right
\localrightbox
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt
index 42ee5a9576f..2a0182e28f5 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt
@@ -97,7 +97,7 @@ local new_hlist = nodepool.hlist
local new_rule = nodepool.rule
local new_glue = nodepool.glue
-local righttoleft_code = nodes.dirvalues.righttoleft
+local righttoleft_code = tex.directioncodes.righttoleft
local setmetatableindex = table.setmetatableindex
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
index f2df329860f..f9a8f8e5efb 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
@@ -54,6 +54,8 @@
\installcommandhandler \??processor {processor} \??processor
+\mutable\let\currentprocessor\empty % weird that this is needed
+
\appendtoks
\letcsname\??processorcheck\currentprocessor\endcsname\relax
\clf_registerstructureprocessor{\currentprocessor}% global, but it permits using processor that are yet undefined
diff --git a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt
new file mode 100644
index 00000000000..aafaf0ae723
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt
@@ -0,0 +1,26 @@
+if not modules then modules = { } end modules ['unic-ini'] = {
+ version = 1.001,
+ comment = "companion to unic-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local context = context
+local utfchar = utf.char
+
+-- Beware, initializing unicodechar happens at first usage and takes
+-- 0.05 -- 0.1 second (lots of function calls).
+
+interfaces.implement {
+ name = "unicodechar",
+ public = true,
+ protected = true,
+ arguments = "argument",
+ actions = function(asked)
+ local n = characters.unicodechar(asked)
+ if n then
+ context(utfchar(n))
+ end
+ end
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl
index aedfe47ed2a..7d2302daeb1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Unicode Support / Initialization}
-\registerctxluafile{unic-ini}{}
+\registerctxluafile{unic-ini}{autosuffix}
\unprotect
@@ -26,7 +26,8 @@
%D
%D \typebuffer \getbuffer
-\permanent\def\unicodechar#1{\clf_unicodechar{#1}}
+% \permanent\def\unicodechar#1% defined at the lua end
+% {\clf_unicodechar{#1}}
\permanent\protected\def\unknownchar
{\dontleavehmode\hpack{\vrule\s!width.5\emwidth\s!height\exheight\s!depth\zeropoint}}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt b/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt
new file mode 100644
index 00000000000..b48d4a9f6fb
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt
@@ -0,0 +1,658 @@
+if not modules then modules = { } end modules ['util-sbx'] = {
+ 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"
+}
+
+-- Note: we use expandname and collapsepath and these use chdir which is overloaded
+-- so we need to use originals there. Just something to keep in mind. This is old
+-- code that I might need to upgrade to fit lmtx better. I'll stepwise also try to
+-- integrate e.g. curl and graphicmagick a bit more natural. Some code below can
+-- be simplified because we don't share any longer with luatex.
+
+if not sandbox then require("l-sandbox") end -- for testing
+
+local next, type = next, type
+
+local replace = utilities.templates.replace
+local collapsepath = file.collapsepath
+local expandname = dir.expandname
+local sortedhash = table.sortedhash
+local lpegmatch = lpeg.match
+local platform = os.type
+local P, S, C = lpeg.P, lpeg.S, lpeg.C
+local gsub = string.gsub
+local lower = string.lower
+local find = string.find
+local concat = string.concat
+local unquoted = string.unquoted
+local optionalquoted = string.optionalquoted
+local basename = file.basename
+local nameonly = file.nameonly
+
+local sandbox = sandbox
+local validroots = { }
+local validrunners = { }
+local validbinaries = true -- all permitted
+local validlibraries = true -- all permitted
+local validators = { }
+local finalized = nil
+local trace = false
+
+local p_validroot = nil
+local p_split = lpeg.firstofsplit(" ")
+
+local report = logs.reporter("sandbox")
+
+trackers.register("sandbox",function(v) trace = v end) -- often too late anyway
+
+sandbox.setreporter(report)
+
+sandbox.finalizer {
+ category = "files",
+ action = function()
+ finalized = true
+ end
+}
+
+local function registerroot(root,what) -- what == read|write
+ if finalized then
+ report("roots are already finalized")
+ else
+ if type(root) == "table" then
+ root, what = root[1], root[2]
+ end
+ if type(root) == "string" and root ~= "" then
+ root = collapsepath(expandname(root))
+ if what == "r" or what == "ro" or what == "readable" then
+ what = "read"
+ elseif what == "w" or what == "wo" or what == "writable" then
+ what = "write"
+ end
+ -- true: read & write | false: read
+ validroots[root] = what == "write" or false
+ end
+ end
+end
+
+sandbox.finalizer {
+ category = "files",
+ action = function() -- initializers can set the path
+ if p_validroot then
+ report("roots are already initialized")
+ else
+ sandbox.registerroot(".","write") -- always ok
+ -- also register texmf as read
+ for name in sortedhash(validroots) do
+ if p_validroot then
+ p_validroot = P(name) + p_validroot
+ else
+ p_validroot = P(name)
+ end
+ end
+ p_validroot = p_validroot / validroots
+ end
+ end
+}
+
+local function registerbinary(name)
+ if finalized then
+ report("binaries are already finalized")
+ elseif type(name) == "string" and name ~= "" then
+ if not validbinaries then
+ return
+ end
+ if validbinaries == true then
+ validbinaries = { [name] = true }
+ else
+ validbinaries[name] = true
+ end
+ elseif name == true then
+ validbinaries = { }
+ end
+end
+
+local function registerlibrary(name)
+ if finalized then
+ report("libraries are already finalized")
+ elseif type(name) == "string" and name ~= "" then
+ if not validlibraries then
+ return
+ end
+ if validlibraries == true then
+ validlibraries = { [nameonly(name)] = true }
+ else
+ validlibraries[nameonly(name)] = true
+ end
+ elseif name == true then
+ validlibraries = { }
+ end
+end
+
+-- begin of validators
+
+local p_write = S("wa") p_write = (1 - p_write)^0 * p_write
+local p_path = S("\\/~$%:") p_path = (1 - p_path )^0 * p_path -- be easy on other arguments
+
+local function normalized(name) -- only used in executers
+ if platform == "windows" then
+ name = gsub(name,"/","\\")
+ end
+ return name
+end
+
+function sandbox.possiblepath(name)
+ return lpegmatch(p_path,name) and true or false
+end
+
+local filenamelogger = false
+
+function sandbox.setfilenamelogger(l)
+ filenamelogger = type(l) == "function" and l or false
+end
+
+local function validfilename(name,what)
+ if p_validroot and type(name) == "string" and lpegmatch(p_path,name) then
+ local asked = collapsepath(expandname(name))
+ -- if platform == "windows" then
+ -- asked = lower(asked) -- we assume ascii names
+ -- end
+ local okay = lpegmatch(p_validroot,asked)
+ if okay == true then
+ -- read and write access
+ if filenamelogger then
+ filenamelogger(name,"w",asked,true)
+ end
+ return name
+ elseif okay == false then
+ -- read only access
+ if not what then
+ -- no further argument to io.open so a readonly case
+ if filenamelogger then
+ filenamelogger(name,"r",asked,true)
+ end
+ return name
+ elseif lpegmatch(p_write,what) then
+ if filenamelogger then
+ filenamelogger(name,"w",asked,false)
+ end
+ return -- we want write access
+ else
+ if filenamelogger then
+ filenamelogger(name,"r",asked,true)
+ end
+ return name
+ end
+ elseif filenamelogger then
+ filenamelogger(name,"*",name,false)
+ end
+ else
+ return name
+ end
+end
+
+local function readable(name,finalized)
+-- if platform == "windows" then -- yes or no
+-- name = lower(name) -- we assume ascii names
+-- end
+ return validfilename(name,"r")
+end
+
+local function normalizedreadable(name,finalized)
+-- if platform == "windows" then -- yes or no
+-- name = lower(name) -- we assume ascii names
+-- end
+ local valid = validfilename(name,"r")
+ if valid then
+ return normalized(valid)
+ end
+end
+
+local function writeable(name,finalized)
+-- if platform == "windows" then
+-- name = lower(name) -- we assume ascii names
+-- end
+ return validfilename(name,"w")
+end
+
+local function normalizedwriteable(name,finalized)
+-- if platform == "windows" then
+-- name = lower(name) -- we assume ascii names
+-- end
+ local valid = validfilename(name,"w")
+ if valid then
+ return normalized(valid)
+ end
+end
+
+validators.readable = readable
+validators.writeable = normalizedwriteable
+validators.normalizedreadable = normalizedreadable
+validators.normalizedwriteable = writeable
+validators.filename = readable
+
+table.setmetatableindex(validators,function(t,k)
+ if k then
+ t[k] = readable
+ end
+ return readable
+end)
+
+-- function validators.verbose(s)
+-- return s
+-- end
+
+function validators.string(s,finalized)
+ -- can be used to prevent filename checking (todo: only when registered)
+ if finalized and suspicious(s) then
+ return ""
+ else
+ return s
+ end
+end
+
+function validators.cache(s)
+ if finalized then
+ return basename(s)
+ else
+ return s
+ end
+end
+
+function validators.url(s)
+ if finalized and find("^file:") then
+ return ""
+ else
+ return s
+ end
+end
+
+-- end of validators
+
+local function filehandlerone(action,one,...)
+ local checkedone = validfilename(one)
+ if checkedone then
+ return action(one,...)
+ else
+ -- report("file %a is unreachable",one)
+ end
+end
+
+local function filehandlertwo(action,one,two,...)
+ local checkedone = validfilename(one)
+ if checkedone then
+ local checkedtwo = validfilename(two)
+ if checkedtwo then
+ return action(one,two,...)
+ else
+ -- report("file %a is unreachable",two)
+ end
+ else
+ -- report("file %a is unreachable",one)
+ end
+end
+
+local function iohandler(action,one,...)
+ if type(one) == "string" then
+ local checkedone = validfilename(one)
+ if checkedone then
+ return action(one,...)
+ end
+ elseif one then
+ return action(one,...)
+ else
+ return action()
+ end
+end
+
+-- runners can be strings or tables
+--
+-- os.execute : string
+-- os.exec : string or table with program in [0|1] -- no longer there
+-- os.spawn : string or table with program in [0|1] -- no longer there
+--
+-- our execute: registered program with specification
+
+local osexecute = sandbox.original(os.execute)
+local iopopen = sandbox.original(io.popen)
+local reported = { }
+
+local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict)
+ if validbinaries ~= false and (validbinaries == true or validbinaries[program]) then
+ local binpath = nil
+ if variables then
+ for variable, value in next, variables do
+ local chktype = checkers[variable]
+ if chktype == "verbose" then
+ -- for now, we will have a "flags" checker
+ else
+ local checker = validators[chktype]
+ if checker and type(value) == "string" then
+ value = checker(unquoted(value),strict)
+ if value then
+ variables[variable] = optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
+ else
+ report("variable %a has no checker",variable)
+ return
+ end
+ end
+ end
+ for variable, default in next, defaults do
+ local value = variables[variable]
+ if not value or value == "" then
+ local chktype = checkers[variable]
+ if chktype == "verbose" then
+ -- for now, we will have a "flags" checker
+ elseif type(default) == "string" then
+ local checker = validators[chktype]
+ if checker then
+ default = checker(unquoted(default),strict)
+ if default then
+ variables[variable] = optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
+ end
+ end
+ end
+ end
+ binpath = variables.binarypath
+ end
+ if type(binpath) == "string" and binpath ~= "" then
+ -- this works on the console but not from e.g. scite
+ -- program = '"' .. binpath .. "/" .. program .. '"'
+ program = binpath .. "/" .. program
+ end
+ local command = program .. " " .. replace(template,variables)
+ if reporter then
+ reporter("executing runner %a: %s",name,command)
+ elseif trace then
+ report("executing runner %a: %s",name,command)
+ end
+ return command
+ elseif not reported[name] then
+ report("executing program %a of runner %a is not permitted",program,name)
+ reported[name] = true
+ end
+end
+
+local runners = {
+ --
+ -- name,program,template,checkers,variables,reporter
+ --
+ resultof = function(...)
+ local command = validcommand(...)
+ if command then
+ if trace then
+ report("resultof: %s",command)
+ end
+ local handle = iopopen(command,"rb") -- already has flush
+ if handle then
+ local result = handle:read("*all") or ""
+ handle:close()
+ return result
+ end
+ end
+ end,
+ execute = function(...)
+ local command = validcommand(...)
+ if command then
+ if trace then
+ report("execute: %s",command)
+ end
+ local okay = osexecute(command)
+ return okay
+ end
+ end,
+ pipeto = function(...)
+ local command = validcommand(...)
+ if command then
+ if trace then
+ report("pipeto: %s",command)
+ end
+ return iopopen(command,"w") -- already has flush
+ end
+ end,
+}
+
+function sandbox.registerrunner(specification)
+ if type(specification) == "string" then
+ local wrapped = validrunners[specification]
+ inspect(table.sortedkeys(validrunners))
+ if wrapped then
+ return wrapped
+ else
+ report("unknown predefined runner %a",specification)
+ return
+ end
+ end
+ if type(specification) ~= "table" then
+ report("specification should be a table (or string)")
+ return
+ end
+ local name = specification.name
+ if type(name) ~= "string" then
+ report("invalid name, string expected",name)
+ return
+ end
+ if validrunners[name] then
+ report("invalid name, runner %a already defined",name)
+ return
+ end
+ local program = specification.program
+ if type(program) == "string" then
+ -- common for all platforms
+ elseif type(program) == "table" then
+ program = program[platform] or program.default or program.unix
+ end
+ if type(program) ~= "string" or program == "" then
+ report("invalid runner %a specified for platform %a",name,platform)
+ return
+ end
+ local template = specification.template
+ if not template then
+ report("missing template for runner %a",name)
+ return
+ end
+ local method = specification.method or "execute"
+ local checkers = specification.checkers or { }
+ local defaults = specification.defaults or { }
+ local internal = specification.internal
+ local runner = runners[method]
+ if runner then
+ local finalized = finalized -- so, the current situation is frozen
+ local internalized = false
+ local wrapped = function(variables)
+ if internal and not internalized then
+ -- So internal returns a function but can also just return false in which
+ -- case we fallback in the runner; this permits optional library support.
+ internal = internal(specification)
+ if type(internal) ~= "function" then
+ internal = false
+ end
+ internalized = true
+ end
+ return (internal or runner)(name,program,template,checkers,defaults,variables,specification.reporter,finalized)
+ end
+ validrunners[name] = wrapped
+ return wrapped
+ else
+ validrunners[name] = nil
+ report("invalid method for runner %a",name)
+ end
+end
+
+function sandbox.getrunner(name)
+ return name and validrunners[name]
+end
+
+local function suspicious(str)
+ return (find(str,"[/\\]") or find(command,"..",1,true)) and true or false
+end
+
+local function binaryrunner(action,command,...)
+ if validbinaries == false then
+ -- nothing permitted
+ report("no binaries permitted, ignoring command: %s",command)
+ return
+ end
+ if type(command) ~= "string" then
+ -- we only handle strings, maybe some day tables
+ report("command should be a string")
+ return
+ end
+ local program = lpegmatch(p_split,command)
+ if not program or program == "" then
+ report("unable to filter binary from command: %s",command)
+ return
+ end
+ if validbinaries == true then
+ -- everything permitted
+ elseif not validbinaries[program] then
+ report("binary not permitted, ignoring command: %s",command)
+ return
+ elseif suspicious(command) then
+ report("/ \\ or .. found, ignoring command (use sandbox.registerrunner): %s",command)
+ return
+ end
+ return action(command,...)
+end
+
+local function dummyrunner(action,command,...)
+ if type(command) == "table" then
+ command = concat(command," ",command[0] and 0 or 1)
+ end
+ report("ignoring command: %s",command)
+end
+
+sandbox.filehandlerone = filehandlerone
+sandbox.filehandlertwo = filehandlertwo
+sandbox.iohandler = iohandler
+
+do
+
+ local library = optional.library
+ local foreign = optional.foreign
+ local reported = { }
+ local libraryload = library.load
+ local foreignload = foreign.load
+
+ function library.load(name,...)
+ if validlibraries == false then
+ -- all blocked
+ elseif validlibraries == true then
+ -- all permitted
+ return libraryload(name,...)
+ elseif validlibraries[nameonly(name)] then
+ -- 'name' permitted
+ return libraryload(name,...)
+ else
+ -- 'name' not permitted
+ end
+ if not reported[name] then
+ report("using library %a is not permitted",name)
+ reported[name] = true
+ end
+ return nil
+ end
+
+ function foreign.load(name,...)
+ if validlibraries == false then
+ -- all blocked
+ elseif validlibraries == true then
+ -- all permitted
+ return foreignload(name,...)
+ elseif validlibraries[nameonly(name)] then
+ -- 'name' permitted
+ return foreignload(name,...)
+ else
+ -- 'name' not permitted
+ end
+ if not reported[name] then
+ report("using foreign %a is not permitted",name)
+ reported[name] = true
+ end
+ return nil
+ end
+
+ -- we can do this in the engine: a one time flag
+
+ function sandbox.disablelibraries()
+ validlibraries = false
+ library.load = function() end
+ foreign.load = function() end
+ end
+
+ function sandbox.disablerunners()
+ validbinaries = false
+ end
+
+end
+
+-------------------
+
+local overload = sandbox.overload
+local register = sandbox.register
+
+ overload(loadfile, filehandlerone,"loadfile") -- todo
+
+if io then
+ overload(io.open, filehandlerone,"io.open")
+ overload(io.popen, binaryrunner, "io.popen")
+ overload(io.input, iohandler, "io.input")
+ overload(io.output, iohandler, "io.output")
+ overload(io.lines, filehandlerone,"io.lines")
+end
+
+if os then
+ overload(os.execute, binaryrunner, "os.execute")
+ overload(os.spawn, dummyrunner, "os.spawn") -- no longer there
+ overload(os.exec, dummyrunner, "os.exec") -- no longer there
+ overload(os.resultof, binaryrunner, "os.resultof")
+ overload(os.pipeto, binaryrunner, "os.pipeto")
+ overload(os.rename, filehandlertwo,"os.rename")
+ overload(os.remove, filehandlerone,"os.remove")
+end
+
+if lfs then
+ overload(lfs.chdir, filehandlerone,"lfs.chdir")
+ overload(lfs.mkdir, filehandlerone,"lfs.mkdir")
+ overload(lfs.rmdir, filehandlerone,"lfs.rmdir")
+ overload(lfs.isfile, filehandlerone,"lfs.isfile")
+ overload(lfs.isdir, filehandlerone,"lfs.isdir")
+ overload(lfs.attributes, filehandlerone,"lfs.attributes")
+ overload(lfs.dir, filehandlerone,"lfs.dir")
+ overload(lfs.lock_dir, filehandlerone,"lfs.lock_dir")
+ overload(lfs.touch, filehandlerone,"lfs.touch")
+ overload(lfs.link, filehandlertwo,"lfs.link")
+ overload(lfs.setmode, filehandlerone,"lfs.setmode")
+ overload(lfs.readlink, filehandlerone,"lfs.readlink")
+ overload(lfs.shortname, filehandlerone,"lfs.shortname")
+ overload(lfs.symlinkattributes,filehandlerone,"lfs.symlinkattributes")
+end
+
+-- these are used later on
+
+if zip then
+ zip.open = register(zip.open, filehandlerone,"zip.open")
+end
+
+sandbox.registerroot = registerroot
+sandbox.registerbinary = registerbinary
+sandbox.registerlibrary = registerlibrary
+sandbox.validfilename = validfilename
+
+-- not used in a normal mkiv run : os.spawn = os.execute
+-- not used in a normal mkiv run : os.exec = os.exec
+
+-- print(io.open("test.log"))
+-- sandbox.enable()
+-- print(io.open("test.log"))
+-- print(io.open("t:/test.log"))
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc
deleted file mode 100644
index daaa7480ad7..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc
deleted file mode 100644
index 8fd642f8568..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc
deleted file mode 100644
index efceaef631b..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc
deleted file mode 100644
index 0c46e9eb8bf..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc
deleted file mode 100644
index dceb393f600..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc
deleted file mode 100644
index cfbd03e1f78..00000000000
--- a/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg
index 5bbd2cf6ce5..975ada70e11 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg
@@ -1,24 +1,4 @@
-local common = fonts.goodies.load("common-math-jmn.lfg")
-local helpers = common.mathematics.helpers
-
-if not fonts.encodings.math["extensible-jmn-private"] then
-
- local nps = fonts.helpers.newprivateslot
-
- fonts.encodings.math["extensible-jmn-private"] = {
- [nps("rule middle piece")] = 200, -- minusjmn
- [nps("rule right piece")] = 201, -- minusrightjmn
- [nps("rule left piece")] = 202, -- minusleftjmn
- [nps("double rule middle piece")] = 203, -- equaljmn
- [nps("double rule right piece")] = 204, -- equalrightjmn
- [nps("double rule left piece")] = 205, -- equalleftjmn
- [nps("arrow left piece")] = 206, -- arrowleftjmn
- [nps("arrow right piece")] = 207, -- arrowrightjmn
- [nps("double arrow left piece")] = 208, -- arrowdblleftjmn
- [nps("double arrow right piece")] = 209, -- arrowdblrightjmn
- }
-
-end
+-- no longer ok for mkiv: digits are not antykwa
local fraction = .25
@@ -105,6 +85,95 @@ local uglyones = {
vextenddouble = true,
}
+local recipes = {
+ ["antykwa-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa", main = true, parameters = false },
+ --
+ { name = "rm-anttr.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-anttbi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttb.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
+ { name = "sy-anttrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
+ { name = "file:AntykwaTorunska-Regular", vector = "tex-ex-braces", backmap = false },
+ { name = "ex-anttr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["antykwa-light-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-light", main = true, parameters = false },
+ --
+ { name = "rm-anttl.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-anttli.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-anttli.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-anttri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
+ { name = "sy-anttlz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
+ { name = "file:AntykwaTorunskaLight-Regular", vector = "tex-ex-braces", backmap = false },
+ { name = "ex-anttl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["antykwa-cond-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-cond", main = true, parameters = false },
+ --
+ { name = "rm-anttcr.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-anttcri.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-anttcri.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-anttcbi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttcb.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
+ { name = "sy-anttcrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
+ { name = "file:AntykwaTorunskaCond-Regular", vector = "tex-ex-braces", backmap = false },
+ { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["antykwa-light-cond-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-lightcond", main = true, parameters = false },
+ --
+ { name = "rm-anttcl.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-anttcli.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-anttcli.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-anttcri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttcr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
+ { name = "sy-anttclz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
+ { name = "file:AntykwaTorunskaCondLight-Regular", vector = "tex-ex-braces", backmap = false },
+ { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+}
+
+local tweaks = nil
+local common = fonts.goodies.load("common-math-jmn.lfg")
+
+if common then
+
+ tweaks = {
+ {
+ tweak = "addmissing",
+ action = common.mathematics.helpers.addmissing,
+ },
+ {
+ tweak = "setoptions",
+ set = { "ignorekerndimensions" }
+ }, -- we have dp > ht fences
+ {
+ tweak = "fixprimes",
+ factor = 1.0, -- accent base height
+ fake = 0.9, -- replace multiples with this width proportion
+ },
+ {
+ tweak = "addequals",
+ force = true,
+ },
+ {
+ tweak = "keepbases",
+-- list = { 0x302 }
+ list = "default"
+ },
+}
+
+ common.mathematics.helpers.copyrecipes(recipes)
+
+end
+
return {
name = "antykwa-math",
version = "1.00",
@@ -123,59 +192,15 @@ return {
notshiftfactor = 0.075,
},
virtuals = {
- ["antykwa-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-antykwa", main = true, parameters = false },
- --
- { name = "rm-anttr.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-anttbi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-anttb.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
- { name = "sy-anttrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
- { name = "file:AntykwaTorunska-Regular", vector = "tex-ex-braces", backmap = false },
- { name = "ex-anttr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["antykwa-light-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-antykwa-light", main = true, parameters = false },
- --
- { name = "rm-anttl.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-anttli.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-anttli.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-anttri.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-anttr.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
- { name = "sy-anttlz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
- { name = "file:AntykwaTorunskaLight-Regular", vector = "tex-ex-braces", backmap = false },
- { name = "ex-anttl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone },
- },
- ["antykwa-cond-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-antykwa-cond", main = true, parameters = false },
- --
- { name = "rm-anttcr.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-anttcri.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-anttcri.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-anttcbi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-anttcb.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
- { name = "sy-anttcrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
- { name = "file:AntykwaTorunskaCond-Regular", vector = "tex-ex-braces", backmap = false },
- { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone },
- },
- ["antykwa-lightcond-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-antykwa-lightcond", main = true, parameters = false },
- --
- { name = "rm-anttcl.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-anttcli.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-anttcli.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-anttcri.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-anttcr.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true
- { name = "sy-anttclz.tfm", vector = "extensible-jmn-private", skewchar=0x30 },
- { name = "file:AntykwaTorunskaCondLight-Regular", vector = "tex-ex-braces", backmap = false },
- { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone },
- }
+ ["antykwa-math"] = { recipe = recipes["antykwa-math"], tweaks = tweaks },
+ ["antykwa-light-math"] = { recipe = recipes["antykwa-light-math"], tweaks = tweaks },
+ ["antykwa-cond-math"] = { recipe = recipes["antykwa-cond-math"], tweaks = tweaks },
+ ["antykwa-light-cond-math"] = { recipe = recipes["antykwa-light-cond-math"], tweaks = tweaks },
+
+ ["antykwa-math-nt"] = common and { recipe = recipes["antykwa-math-nt"] } or nil,
+ ["antykwa-light-math-nt"] = common and { recipe = recipes["antykwa-light-math-nt"] } or nil,
+ ["antykwa-cond-math-nt"] = common and { recipe = recipes["antykwa-cond-math-nt"] } or nil,
+ ["antykwa-light-cond-math-nt"] = common and { recipe = recipes["antykwa-light-cond-math-nt"] } or nil,
},
- addmissing = helpers.addmissing,
}
}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg
index 56262eb3264..13be0e69d15 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg
@@ -59,6 +59,7 @@ return {
},
},
},
+ presets.smalldigits { factor = 0.95 },
presets.scripttocalligraphic { },
presets.rsfstoscript { rscale = 0.98 },
presets.rsfsuprighttoscript { rscale = 0.98 },
@@ -71,6 +72,9 @@ return {
presets.wipeanchors { },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
-- We need to check these, are the tweaks necessary or not?
tweak = "dimensions",
list = {
@@ -90,8 +94,8 @@ return {
{
tweak = "kerns",
list = {
- [0x002F] = { topleft = -0.2, bottomright = -0.2 },
- ["0x002F.variants.*"] = { topleft = -0.2, bottomright = -0.2 },
+ [0x002F] = { topleft = -0.2, bottomright = -0.2 },
+ ["0x002F.variants.*"] = { topleft = -0.2, bottomright = -0.2 },
[0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants
["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants
["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top
@@ -109,9 +113,9 @@ return {
[0x27EB] = { topright = -0.1, bottomright = -0.1 },
["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 },
--
- [0x1D465] = { bottomright = -0.05, }, -- italic x (ic is too large)
- [0x00393] = { bottomright = -0.30, }, -- upright Gamma
- [0x1D43F] = { bottomright = 0.01, }, -- upright L
+ [0x1D465] = { bottomright = -0.05 }, -- italic x (ic is too large)
+ [0x00393] = { bottomright = -0.30 }, -- upright Gamma
+ [0x1D43F] = { bottomright = 0.01 }, -- upright L
["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int
["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint
["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint
@@ -125,10 +129,10 @@ return {
tweak = "extendaccents",
},
{
- tweak = "flattenaccents",
- squeeze = 0.8,
- height = 0.9,
- offset = 0.1,
+ tweak = "flattenaccents",
+ },
+ {
+ tweak = "fixaccents", -- after flatten (zero width intefrerence)
},
{
tweak = "radicaldegreeanchors",
@@ -142,28 +146,23 @@ return {
{
tweak = "dimensions",
list = {
- -- [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants
- ["0x7C"] = { width = 1.4, xoffset=0.2 }, -- vertical bar
- -- ["0x7C.variants.*"] = { width = 1, extend = 2.4 }, -- vertical bar
- -- ["0x7C.parts.top"] = { , }, -- vertical bar
- -- ["0x7C.parts.bottom"] = { bottomright = -0.15 }, -- vertical bar
+ -- [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants
+ ["0x7C"] = { width = 1.4, xoffset=0.2 }, -- vertical bar (just looks better tis way)
+ -- ["0x7C.variants.*"] = { width = 1, extend = 2.4 },
+ -- ["0x7C.parts.top"] = { },
+ -- ["0x7C.parts.bottom"] = { bottomright = -0.15 },
},
},
-
- {
- tweak = "fixaccents",
- },
-- First we set the dimensions of the initial accent which started out as zero but we want
- -- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+ -- a proper width. Thjis is no longer needed because we tweak the dimensions automatically,
+ -- so this is just some documented history.
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+ -- ["0x00302.flataccent"] = { width = 1.4, anchor = 1.20 }, -- no offset, because we copy
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here. But none for Bonum.
-- We now copy these to the not wide slots so that we can set these to stretch as well,
@@ -233,6 +232,12 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ fraction = { height = .244, yoffset = .758 },
+ radical = { height = .244, yoffset = .758, leftoffset = .1, rightoffset = .1 },
+ stacker = { height = .244, yoffset = .758 },
+ },
+ {
-- This tweak is only needed for the funny arrows and these now get properly
-- centered. (Could actually be done in the engine).
tweak = "addarrows",
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg
index a855a2513c3..15fad23c45b 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg
@@ -70,6 +70,9 @@ return {
tweak = "extendaccents",
},
{
+ tweak = "fixaccents",
+ },
+ {
tweak = "radicaldegreeanchors",
list = {
[0x221A] = { location = "left", hfactor = -0.15, vfactor = .75 },
@@ -82,20 +85,17 @@ return {
["0x221A.parts.bottom"] = { location = "left", hfactor = -0.1, vfactor = 0.95 },
}
},
- {
- tweak = "fixaccents",
- },
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat
- [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde
- [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve
- [0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat
+ -- [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde
+ -- [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve
+ -- [0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here.
{
@@ -131,6 +131,27 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ minus = {
+ leftoffset = .0925,
+ rightoffset = .0925,
+ },
+ fraction = {
+ height = .204,
+ yoffset = .796,
+ },
+ radical = {
+ height = .204,
+ yoffset = .796,
+ leftoffset = .0925,
+ rightoffset = .0925,
+ },
+ stacker = {
+ height = .204,
+ yoffset = .796,
+ },
+ },
+ {
tweak = "wipecues",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg
index 331d65a5d5a..1df814b2fda 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg
@@ -1,3 +1,43 @@
+if CONTEXTLMTXMODE == 0 then
+
+ fonts.encodings.math["extensible-jmn-private"] = { }
+ fonts.encodings.math["tex-ex-braces"] = { }
+
+ return false
+
+end
+
+local nps = fonts.helpers.newprivateslot
+
+local fake20D6 = nps("arrow fake 0x20D6")
+local fake20D7 = nps("arrow fake 0x20D7")
+local fake20E1 = nps("arrow fake 0x20E1")
+
+local fake20EE = nps("arrow fake 0x20EE")
+local fake20EF = nps("arrow fake 0x20EF")
+local fake034D = nps("arrow fake 0x034D")
+
+local real034D = nps("arrow real 0x034D")
+
+if not fonts.encodings.math["extensible-jmn-private"] then
+
+ local ps = fonts.helpers.privateslot
+
+ fonts.encodings.math["extensible-jmn-private"] = {
+ [ps("rule middle piece")] = 200, -- minusjmn
+ [ps("rule right piece")] = 201, -- minusrightjmn
+ [ps("rule left piece")] = 202, -- minusleftjmn
+ [ps("double rule middle piece")] = 203, -- equaljmn
+ [ps("double rule right piece")] = 204, -- equalrightjmn
+ [ps("double rule left piece")] = 205, -- equalleftjmn
+ [ps("arrow left piece")] = 206, -- arrowleftjmn
+ [ps("arrow right piece")] = 207, -- arrowrightjmn
+ [ps("double arrow left piece")] = 208, -- arrowdblleftjmn
+ [ps("double arrow right piece")] = 209, -- arrowdblrightjmn
+ }
+
+end
+
return {
name = "common-math-jmn",
version = "1.00",
@@ -6,8 +46,21 @@ return {
copyright = "ConTeXt development team",
mathematics = {
helpers = {
+ copyrecipes = function(recipes)
+ local list = table.keys(recipes)
+ for i=1,#list do
+ local n = list[i]
+ local t = table.copy(recipes[n])
+ t[1].features = t[1].features .. "-nt"
+ recipes[n .. "-nt"] = t
+ end
+ end,
addmissing = function(main)
+ local max = math.max
+ local copytable = table.copy
+ local slotcommand = fonts.helpers.commands.slot
+
local builders = fonts.handlers.vf.math.builders
local ps = fonts.helpers.privateslot
@@ -25,8 +78,8 @@ return {
local llbracepiece = ps("ll brace piece")
local lrbracepiece = ps("lr brace piece")
- builders.brace(main,0x23DE,ulbracepiece,cmbracepiece,lrbracepiece,llbracepiece,cmbracepiece,urbracepiece)
- builders.brace(main,0x23DF,llbracepiece,cmbracepiece,urbracepiece,ulbracepiece,cmbracepiece,lrbracepiece)
+ builders.brace(main,0x23DE,ulbracepiece,cmbracepiece,lrbracepiece,llbracepiece,cmbracepiece,urbracepiece,"top")
+ builders.brace(main,0x23DF,llbracepiece,cmbracepiece,urbracepiece,ulbracepiece,cmbracepiece,lrbracepiece,"bottom")
builders.parent(main,0x23DC,ulbracepiece,umbracepiece,urbracepiece,"top")
builders.parent(main,0x23DD,llbracepiece,lmbracepiece,lrbracepiece,"bottom")
@@ -39,13 +92,25 @@ return {
builders.jointwo(main,0x21A6,ps("maps to piece"),.15,0x02192) -- \mapstochar\rightarrow
+ local srl = ps("rule left piece")
local srm = ps("rule middle piece")
local srr = ps("rule right piece")
- local srl = ps("rule left piece")
+ local drl = ps("double rule left piece")
local drm = ps("double rule middle piece")
local drr = ps("double rule right piece")
- local drl = ps("double rule left piece")
+
+ local sfl = ps("flat rule left piece")
+ local sfm = ps("flat rule middle piece")
+ local sfr = ps("flat rule right piece")
+
+ local mrl = ps("minus rule left piece")
+ local mrm = ps("minus rule middle piece")
+ local mrr = ps("minus rule right piece")
+
+ local dfl = ps("flat double rule left piece")
+ local dfm = ps("flat double rule middle piece")
+ local dfr = ps("flat double rule right piece")
local sal = ps("arrow left piece")
local sar = ps("arrow right piece")
@@ -54,34 +119,163 @@ return {
local dar = ps("double arrow right piece")
local rad = ps("radical bar extender")
+ local frc = ps("fraction bar extender")
- if characters[srm] then
+ local antykwa = characters[srm]
- builders.jointwo(main,0x27F5,sak,joinrelfactor,srr)
- builders.jointwo(main,0x27F6,srl,joinrelfactor,sar)
- builders.jointwo(main,0x27F7,sak,joinrelfactor,sar)
- builders.jointwo(main,0x27F8,dal,joinrelfactor,drr)
- builders.jointwo(main,0x27F9,drl,joinrelfactor,dar)
- builders.jointwo(main,0x27FA,dal,joinrelfactor,dar)
+ if not antykwa then
- builders.horibar(main,0x203E,srm,srl,srr,0x02212) -- overbar underbar fraction (we take 90/91/92 too!)
- -- builders.horibar(main,0x203E,srm,srl,srr,0x0002D) -- overbar underbar fraction (we take 90/91/92 too!)
+ sal = 0x02190 sar = 0x02192
+ dal = 0x021D0 dar = 0x021D2
- builders.rootbar(main,ps("radical bar extender"),srm,srr,0x02212) -- radical
+ srl = 0x0002D srr = 0x0002D
+ drl = 0x0003D drr = 0x0003D
- else
+ sfl = 0x0002D srm = 0x0002D
+ dfl = 0x0003D drm = 0x0003D
- builders.jointwo(main,0x27F5,0x02190,joinrelfactor,0x0002D) -- \leftarrow\joinrel\relbar
- builders.jointwo(main,0x27F6,0x0002D,joinrelfactor,0x02192) -- \relbar\joinrel\rightarrow
- builders.jointwo(main,0x27F7,0x02190,joinrelfactor,0x02192) -- \leftarrow\joinrel\rightarrow
- builders.jointwo(main,0x27F8,0x021D0,joinrelfactor,0x0003D) -- \Leftarrow\joinrel\Relbar
- builders.jointwo(main,0x27F9,0x0003D,joinrelfactor,0x021D2) -- \Relbar\joinrel\Rightarrow
- builders.jointwo(main,0x27FA,0x021D0,joinrelfactor,0x021D2) -- \Leftarrow\joinrel\Rightarrow
+ end
+
+ if not characters[sfm] then
- builders.horibar(main,0x203E,0xFE073) -- overbar underbar
+ local csal = characters[sal] local sheight = csal.height local sdepth = csal.depth
+ local cdal = characters[dal] local dheight = cdal.height local ddepth = cdal.depth
+ local csfl = copytable(characters[srl]) characters[sfl] = csfl csfl.height = sheight csfl.depth = sdepth csfl.italic = nil
+ local csfm = copytable(characters[srm]) characters[sfm] = csfm csfm.height = sheight csfm.depth = sdepth csfm.italic = nil
+ local csfr = copytable(characters[srr]) characters[sfr] = csfr csfr.height = sheight csfr.depth = sdepth csfr.italic = nil
+ local cdfl = copytable(characters[drl]) characters[dfl] = cdfl cdfl.height = dheight cdfl.depth = ddepth cdfl.italic = nil
+ local cdfm = copytable(characters[drm]) characters[dfm] = cdfm cdfm.height = dheight cdfm.depth = ddepth cdfm.italic = nil
+ local cdfr = copytable(characters[drr]) characters[dfr] = cdfr cdfr.height = dheight cdfr.depth = ddepth cdfr.italic = nil
+
+ end
+
+ builders.jointwo(main,0x27F5,sal,joinrelfactor,srr)
+ builders.jointwo(main,0x27F6,srl,joinrelfactor,sar)
+ builders.jointwo(main,0x27F7,sal,joinrelfactor,sar)
+ builders.jointwo(main,0x27F8,dal,joinrelfactor,drr)
+ builders.jointwo(main,0x27F9,drl,joinrelfactor,dar)
+ builders.jointwo(main,0x27FA,dal,joinrelfactor,dar)
+
+ if antykwa then
+ builders.horibar(main,0x2212,mrm,mrl,mrr,0x2212,true,srm,srl,srr) -- minus
+ builders.horibar(main,0x203E,srm,srl,srr,0x2212) -- overbar underbar fraction (we take 90/91/92 too!)
+ builders.horibar(main,frc,srm,srl,srr,0x2212) -- fraction
+ builders.rootbar(main,rad,srm,srr,0x2212) -- radical
+ else
+ builders.horibar(main,0x2212,false,false,false,0x2212,true) -- minus
+ builders.horibar(main,0x203E,false,false,false,0x02212)
end
+ local ffactor = antykwa and 1 or 1 -- check MS
+ local mfactor = antykwa and 1 or .8
+ local lfactor = antykwa and 1 or .8
+
+ builders.extension(main,0x2190,sal,sfm,sfr,ffactor,mfactor,lfactor) -- \leftarrow
+ builders.extension(main,0x2192,sfl,sfm,sar,ffactor,mfactor,lfactor) -- \rightarrow
+ builders.extension(main,0x27F5,sal,sfm,sfr,ffactor,mfactor,lfactor)
+ builders.extension(main,0x27F6,sfl,sfm,sar,ffactor,mfactor,lfactor)
+ builders.extension(main,0x27F7,sal,sfm,sar,ffactor,mfactor,lfactor)
+ builders.extension(main,0x27F8,dal,dfm,dfr,ffactor,mfactor,lfactor)
+ builders.extension(main,0x27F9,dfl,dfm,dar,ffactor,mfactor,lfactor)
+ builders.extension(main,0x27FA,dal,dfm,dar,ffactor,mfactor,lfactor)
+
+ local tfactor = antykwa and -0.8 or -1.1 -- move up check MS
+ local bfactor = antykwa and 0.1 or 0.2
+
+local tfactor = antykwa and -0.6 or -.6 -- move up check MS
+local bfactor = antykwa and 0.1 or 0.2
+
+ local left = characters[0x27F5]
+ local right = characters[0x27F6]
+ local both = characters[0x27F7]
+
+ local height = max(left.height or 0,right.height or 0,both.height or 0)
+ local depth = max(left.depth or 0,right.depth or 0,both.depth or 0)
+
+ left .height = height ; left .depth = depth
+ right.height = height ; right.depth = depth
+ both .height = height ; both .depth = depth
+
+ -- top and bottom arrows : a real mess but now we're drawn into patching it; why are these
+ -- small ones shifted in the bbox; we could do a better job on top and bottom anchors; we
+ -- also could use the bbox as in opentype (\wideoverleftarrow etc)
+
+ local rightarrow = characters[0x20D7]
+ local leftarrow = copytable(rightarrow)
+ local doublearrow = copytable(rightarrow)
+ local width = rightarrow.width
+ local height = rightarrow.height
+
+ -- top
+
+ characters[0x20D6] = leftarrow
+ characters[0x20E1] = doublearrow
+
+ rightarrow.xoffset = -.2*width
+ leftarrow.commands = {
+ { "offset", width, 0, 0x20D7, -1, 1 }
+ }
+ doublearrow.commands = {
+ { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 },
+ { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 }
+ }
+
+ -- bottom
+
+ local rightarrow = copytable(rightarrow)
+ local leftarrow = copytable(leftarrow)
+ local doublearrow = copytable(doublearrow)
+
+ characters[0x20EE] = leftarrow
+ characters[0x20EF] = rightarrow
+ characters[0x034D] = doublearrow
+
+ local bheight = .40*height -- can be tuned to match top
+ local yoffset = -.65*height -- can be tuned to match top
+
+ leftarrow .height = bheight
+ rightarrow .height = bheight
+ doublearrow.height = bheight
+
+ rightarrow .yoffset = yoffset
+ leftarrow .yoffset = yoffset
+ doublearrow.yoffset = yoffset
+
+ leftarrow.commands = {
+ { "offset", width, 0, 0x20D7, -1, 1 }
+ }
+ doublearrow.commands = {
+ { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 },
+ { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 }
+ }
+
+ -- extensibles
+
+ local tl = copytable(left) ; characters[fake20D6] = tl ; characters[0x20D6].next = fake20D6 -- over
+ local tm = copytable(right) ; characters[fake20D7] = tm ; characters[0x20D7].next = fake20D7
+ local tr = copytable(both) ; characters[fake20E1] = tr ; characters[0x20E1].next = fake20E1
+
+ tl.inneryoffset = tfactor*height ; tl.innerlocation = "top" ; tl.next = nil ; tl.italic = nil
+ tm.inneryoffset = tfactor*height ; tm.innerlocation = "top" ; tm.next = nil ; tm.italic = nil
+ tr.inneryoffset = tfactor*height ; tr.innerlocation = "top" ; tr.next = nil ; tr.italic = nil
+
+ local bl = copytable(left) ; characters[fake20EE] = bl ; characters[0x20EE].next = fake20EE -- under
+ local bm = copytable(right) ; characters[fake20EF] = bm ; characters[0x20EF].next = fake20EF
+ local br = copytable(both) ; characters[fake034D] = br ; characters[0x034D].next = fake034D
+
+ bl.inneryoffset = bfactor*height bl.innerlocation = "bottom" ; bl.next = nil ; bl.italic = nil
+ bm.inneryoffset = bfactor*height bm.innerlocation = "bottom" ; bm.next = nil ; bm.italic = nil
+ br.inneryoffset = bfactor*height br.innerlocation = "bottom" ; br.next = nil ; br.italic = nil
+
+ --
+
+ local tfactor = antykwa and -15 or -15
+ local bfactor = antykwa and 1 or 1
+
+ local t = copytable(characters[0x203E]) characters[0x0305] = t t.inneryoffset = tfactor*t.height t.innerlocation = "top" t.next = nil t.italic = nil
+ local t = copytable(characters[0x203E]) characters[0x0332] = t t.inneryoffset = bfactor*t.height t.innerlocation = "bottom" t.next = nil t.italic = nil
+
builders.jointwo(main,0x2016,0x007C,0.20,0x007C)
builders.jointwo(main,0x2980,0x007C,0.20,0x007C,0.20,0x007C)
@@ -92,6 +286,8 @@ return {
characters[0x2980].extensible = true
characters[0x2980].varianttemplate = 0x5B
+-- characters[0x0302].keepbase = true -- can also be a tweak
+
-- 21CB leftrightharpoon
-- 21CC rightleftharpoon
@@ -105,7 +301,9 @@ return {
builders.overlaytwo(main,0x2285,0x00338,notshiftfactor,0x02283) -- \not\supset
builders.overlaytwo(main,0x2209,0x00338,notshiftfactor,0x02208) -- \not\in
- builders.jointwo(main,0x2254,0x03A,0,0x03D) -- := (≔)
+ -- builders.jointwo (main,0x2254,0x03A,0,0x03D) -- :=
+ -- builders.jointhree(main,0x2A74,0x03A,0,0x03A,0,0x03D) -- ::=
+ -- builders.jointwo (main,0x2A75,0x03D,0,0x03D) -- ==
builders.repeated(main,0x222B,0x222B,1,1/2)
builders.repeated(main,0x222C,0x222B,2,1/2)
@@ -113,6 +311,11 @@ return {
characters[0x02B9] = characters[0x2032] -- we're nice
+ -- some things are done automatically:
+
+ -- add primes
+ -- add equals and alike
+
end
}
}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg
index 45e46d865b6..5c7ade3fbee 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg
@@ -301,6 +301,17 @@ return {
},
}
end,
+ smalldigits = function(parameters)
+ return {
+ tweak = "dimensions",
+ feature = "smalldigits",
+ list = {
+ ["digitsnormal"] = {
+ factor = parameters.factor or 0.9,
+ },
+ },
+ }
+ end,
},
},
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg
index b69ee0103b4..3c8f363916b 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg
@@ -35,6 +35,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x002F] = { topleft = -0.2, bottomright = -0.2 },
@@ -74,6 +77,12 @@ return {
},
},
{
+ tweak = "extendaccents",
+ },
+ {
+ tweak = "flattenaccents",
+ },
+ {
tweak = "radicaldegreeanchors",
list = {
["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.075 },
@@ -87,6 +96,20 @@ return {
advance = 0.6,
},
{
+ tweak = "replacerules",
+ -- minus = {
+ -- leftoffset = 0,
+ -- rightoffset = 0,
+ -- },
+ minus = true,
+ fraction = { height = .2, yoffset = .8 },
+ -- Hans, add option not to cut off first piece
+ -- Hans, check height.
+ radical = { height = .2, yoffset = .585, leftoffset = .085, rightoffset = .085, leftoverlap = 0.03, yscale = 0.8 },
+ -- radical = { height = .2, yoffset = .75, leftoffset = .085, rightoffset = .085, leftoverlap = 0.039 },
+ stacker = { height = .2, yoffset = .8 },
+ },
+ {
tweak = "addactuarian",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg
index 03f86928812..bd355c3b56f 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg
@@ -57,6 +57,9 @@ return {
-- because once the advance is set the move is blocked and the ic stil wiped. So,
-- we kern. Actually the upright (ascii) f has italic correction.
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x1D453] = { bottomright = -.2 },
@@ -106,19 +109,22 @@ return {
}
},
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "fixaccents",
},
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+ -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+ -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+ -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here.
{
@@ -145,6 +151,12 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ fraction = { height = .254, yoffset = .746 },
+ radical = { height = .17, leftoffset = .1, rightoffset = .1, yoffset = .485, yscale = .65 },
+ stacker = { height = .254, yoffset = .746 },
+ },
+ {
tweak = "wipecues",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg
new file mode 100644
index 00000000000..ba6458eafd3
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg
@@ -0,0 +1,58 @@
+return {
+ name = "dejavu-text",
+ version = "1.00",
+ comment = "Goodies that complement dejavu.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "DejaVuSerif",
+ "DejaVuSerif-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 100,
+ ["}"] = 100,
+ ["]"] = 100,
+ ["|"] = 150,
+ ["\\"] = 175,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "DejaVuSerif-Italic",
+ "DejaVuSerif-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 140,
+ ["}"] = 140,
+ ["]"] = 140,
+ ["|"] = 100,
+ ["\\"] = 200,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 250,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg
index 812430525d5..20bf48460d0 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg
@@ -12,8 +12,9 @@ return {
FractionRuleThickness = 60,
OverbarRuleThickness = 60,
UnderbarRuleThickness = 60,
- AccentTopShiftUp = -75,
- FlattenedAccentTopShiftUp = -75,
+ AccentTopShiftUp = -25, -- was 075
+ FlattenedAccentBaseHeight = 620, -- 420 in font (maybe some misunderstanding in the font regarding accents and heights)
+ FlattenedAccentTopShiftUp = -25, -- was 075
AccentBaseDepth = 75,
DelimiterPercent = 90,
DelimiterShortfall = 400,
@@ -50,6 +51,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "simplifykerns",
},
{
@@ -82,9 +86,9 @@ return {
[0x27EB] = { topright = -0.1, bottomright = -0.1 },
["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 },
- [0x51] = { bottomright = 0.25 }, -- Upright Q
- [0x211A] = { bottomright = 0.2 }, -- Blackboard bold Q
- [0x1D410] = { bottomright = 0.2 }, -- Bold Q
+ [0x00051] = { bottomright = 0.25 }, -- Upright Q
+ [0x0211A] = { bottomright = 0.2 }, -- Blackboard bold Q
+ [0x1D410] = { bottomright = 0.2 }, -- Bold Q
[0x1D478] = { bottomright = 0.05 }, -- Bold Q
[0x1D5B0] = { bottomright = 0.05 }, -- Sans Q
},
@@ -146,8 +150,11 @@ return {
tweak = "extendaccents",
},
{
- tweak = "radicaldegreeanchors",
- list = {
+ tweak = "flattenaccents",
+ },
+ {
+ tweak = "radicaldegreeanchors",
+ list = {
["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.0 },
}
},
@@ -173,6 +180,29 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ minus = {
+ leftoffset = .075,
+ rightoffset = .075,
+ },
+ fraction = {
+ height = .2,
+ yoffset = .8,
+ },
+ radical = {
+ height = .2,
+ yoffset = .66,
+ leftoverlap = .020,
+ leftoffset = .075, -- todo
+ rightoffset = .075, -- todo
+ yscale = .84,
+ },
+ stacker = {
+ height = .2,
+ yoffset = .8,
+ },
+ },
+ {
tweak = "addbars",
advance = 0.6,
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg
new file mode 100644
index 00000000000..824728460d5
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg
@@ -0,0 +1,59 @@
+return {
+ name = "ebgaramond-text",
+ version = "1.00",
+ comment = "Goodies that complement ebgaramond.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "EBGaramond-Regular",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 80,
+ ["}"] = 100,
+ ["]"] = 100,
+ ["|"] = 100,
+ ["\\"] = 120,
+ ["!"] = 100,
+ ["?"] = 100,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "EBGaramond-Italic",
+ "EBGaramond-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 120,
+ ["}"] = 120,
+ ["]"] = 120,
+ ["|"] = 120,
+ ["\\"] = 120,
+ ["!"] = 75,
+ ["?"] = 75,
+ ["*"] = 120,
+ },
+ ["("] = {
+ ["f"] = 120,
+ },
+ ["{"] = {
+ ["f"] = 120,
+ },
+ ["["] = {
+ ["f"] = 120,
+ },
+ ["|"] = {
+ ["f"] = 120,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg
index 54cc687fab6..91f084e9b64 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg
@@ -53,6 +53,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x002F] = { topleft = -0.15, bottomright = -0.15 },
@@ -73,6 +76,9 @@ return {
},
},
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "radicaldegreeanchors",
list = {
["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.025 },
@@ -90,6 +96,29 @@ return {
{
tweak = "addrules",
},
+{
+ tweak = "replacerules",
+ -- minus = {
+ -- height = 0.188,
+ -- yoffset = 0.812,
+ -- leftoffset = 0.2,
+ -- rightoffset = 0.2,
+ -- },
+ fraction = {
+ height = .188,
+ yoffset = .812,
+ },
+ radical = {
+ height = .188,
+ yoffset = .812,
+ leftoffset = 0.12,
+ rightoffset = 0.12,
+ },
+ stacker = {
+ height = .188,
+ yoffset = .812,
+ },
+},
{
tweak = "addactuarian",
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg
new file mode 100644
index 00000000000..46a3aa84228
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg
@@ -0,0 +1,81 @@
+return {
+ name = "erewhon-text",
+ version = "1.00",
+ comment = "Goodies that complement erewhon.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "Erewhon-Regular",
+ -- "Erewhon-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 100,
+ ["}"] = 100,
+ ["]"] = 100,
+ ["|"] = 100,
+ ["\\"] = 75,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "Erewhon-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 25,
+ ["}"] = 50,
+ ["]"] = 25,
+ ["|"] = 50,
+ ["\\"] = 75,
+ ["!"] = 50,
+ ["?"] = 50,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "Erewhon-Italic",
+ "Erewhon-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg
index 1c4659786fa..23d92b0479d 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg
@@ -78,6 +78,9 @@ return {
-- add the accent fixes
-- fixslashes?
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "checkspacing",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg
index 815b9e1207b..2754e15777a 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg
@@ -29,6 +29,82 @@ local uglyones = {
vextenddouble = true,
}
+local recipes = {
+ ["iwona-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona", main = true, parameters = false },
+ --
+ { name = "rm-iwonar.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-iwonari.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-iwonari.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-iwonami.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonam.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["iwona-light-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-light", main = true, parameters = false },
+ --
+ { name = "rm-iwonal.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-iwonali.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-iwonali.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-iwonari.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonar.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["iwona-medium-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-medium", main = true, parameters = false },
+ --
+ { name = "rm-iwonam.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-iwonami.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-iwonami.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-iwonabi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonab.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["iwona-heavy-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-heavy", main = true, parameters = false },
+ --
+ { name = "rm-iwonah.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-iwonahi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-iwonahi.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-iwonahi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonah.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+}
+
+local tweaks = nil
+local common = fonts.goodies.load("common-math-jmn.lfg")
+
+if common then
+
+ tweaks = {
+ {
+ tweak = "addmissing",
+ action = common.mathematics.helpers.addmissing,
+ },
+ {
+ tweak = "setoptions",
+ set = { "ignorekerndimensions" }
+ }, -- we have dp > ht fences
+ {
+ tweak = "fixprimes",
+ factor = 1.0, -- accent base height
+ fake = 0.9, -- replace multiples with this width proportion
+ },
+ {
+ tweak = "addequals",
+ force = true,
+ },
+ }
+
+ common.mathematics.helpers.copyrecipes(recipes)
+
+end
+
return {
name = "iwona-math",
version = "1.00",
@@ -44,51 +120,15 @@ return {
-- "mkiv-base.map",
},
virtuals = {
- ["iwona-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-iwona", main = true, parameters = false },
- --
- { name = "rm-iwonar.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-iwonari.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-iwonari.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-iwonami.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-iwonam.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["iwona-light-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-iwona-light", main = true, parameters = false },
- --
- { name = "rm-iwonal.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-iwonali.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-iwonali.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-iwonari.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-iwonar.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["iwona-medium-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-iwona-medium", main = true, parameters = false },
- --
- { name = "rm-iwonam.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-iwonami.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-iwonami.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-iwonabi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-iwonab.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["iwona-heavy-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-iwona-heavy", main = true, parameters = false },
- --
- { name = "rm-iwonah.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-iwonahi.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-iwonahi.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-iwonahi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-iwonah.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- }
+ ["iwona-math"] = { recipe = recipes["iwona-math"], tweaks = tweaks },
+ ["iwona-light-math"] = { recipe = recipes["iwona-light-math"], tweaks = tweaks },
+ ["iwona-medium-math"] = { recipe = recipes["iwona-medium-math"], tweaks = tweaks },
+ ["iwona-heavy-math"] = { recipe = recipes["iwona-heavy-math"], tweaks = tweaks },
+
+ ["iwona-math-nt"] = { recipe = common and recipes["iwona-math-nt"] or nil },
+ ["iwona-light-math-nt"] = { recipe = common and recipes["iwona-light-math-nt"] or nil },
+ ["iwona-medium-math-nt"] = { recipe = common and recipes["iwona-medium-math-nt"] or nil },
+ ["iwona-heavy-math-nt"] = { recipe = common and recipes["iwona-heavy-math-nt"] or nil },
},
- addmissing = helpers.addmissing,
}
}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg
deleted file mode 100644
index 74bf2dd4966..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg
+++ /dev/null
@@ -1,16 +0,0 @@
-return {
- name = "koeielettersot",
- version = "1.00",
- comment = "Goodies that complement koeielettersot",
- author = "Hans Hagen",
- copyright = "ConTeXt development team",
- mathematics = {
- rules = {
- ["radical.extender"] = "radical.extender",
- ["radical.end"] = "radical.end",
- ["hrule.begin"] = "rule.begin",
- ["hrule.extender"] = "rule.ex",
- ["hrule.end"] = "rule.end",
- }
- }
-}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
index 67ad3841f95..628dd13b657 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
@@ -26,6 +26,9 @@ return {
expected = "Version 0.40",
},
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "dimensions",
list = {
[0x2A3F] = { factor = 0.84625 }
@@ -102,7 +105,9 @@ return {
["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 0.65 },
}
},
-
+ {
+ tweak = "flattenaccents",
+ },
{
tweak = "addscripts",
},
@@ -112,6 +117,29 @@ return {
{
tweak = "addrules",
},
+{
+ tweak = "replacerules",
+ -- minus = {
+ -- height = 0.1818,
+ -- yoffset = 0.818,
+ -- leftoffset = 0.2,
+ -- rightoffset = 0.2,
+ -- },
+ fraction = {
+ height = .1818,
+ yoffset = .818,
+ },
+ radical = {
+ height = .1818,
+ yoffset = .818,
+ leftoffset = 0.08,
+ rightoffset = 0.08,
+ },
+ stacker = {
+ height = .1818,
+ yoffset = .818,
+ },
+},
{
-- This will be fixed. Check if new version comes out!
tweak = "addbars",
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg
new file mode 100644
index 00000000000..6a14bec54f6
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg
@@ -0,0 +1,57 @@
+return {
+ name = "kpfonts-text",
+ version = "1.00",
+ comment = "Goodies that complement kpfonts.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "KpRoman-Regular",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "KpRoman-Italic",
+ "KpRoman-SemiboldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 150,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg
index 22199251855..a7290d0cafb 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg
@@ -29,6 +29,82 @@ local uglyones = {
vextenddouble = true,
}
+local recipes = {
+ ["kurier-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier", main = true, parameters = false },
+ --
+ { name = "rm-kurierr.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierm.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["kurier-light-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-light", main = true, parameters = false },
+ --
+ { name = "rm-kurierl.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierli.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierli.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["kurier-medium-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-medium", main = true, parameters = false },
+ --
+ { name = "rm-kurierm.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kuriermz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierm.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ },
+ ["kurier-heavy-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-heavy", main = true, parameters = false },
+ --
+ { name = "rm-kurierh.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierhz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierh.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
+ }
+}
+
+local tweaks = nil
+local common = fonts.goodies.load("common-math-jmn.lfg")
+
+if common then
+
+ tweaks = {
+ {
+ tweak = "addmissing",
+ action = common.mathematics.helpers.addmissing,
+ },
+ {
+ tweak = "setoptions",
+ set = { "ignorekerndimensions" }
+ }, -- we have dp > ht fences
+ {
+ tweak = "fixprimes",
+ factor = 1.0, -- accent base height
+ fake = 0.9, -- replace multiples with this width proportion
+ },
+ {
+ tweak = "addequals",
+ force = true,
+ },
+ }
+
+ common.mathematics.helpers.copyrecipes(recipes)
+
+end
+
return {
name = "kurier-math",
version = "1.00",
@@ -44,51 +120,15 @@ return {
-- "mkiv-base.map",
},
virtuals = {
- ["kurier-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-kurier", main = true, parameters = false },
- --
- { name = "rm-kurierr.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-kurierri.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-kurierri.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-kuriermi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-kurierm.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-kurierrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-kurierr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["kurier-light-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-kurier-light", main = true, parameters = false },
- --
- { name = "rm-kurierl.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-kurierli.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-kurierli.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-kurierri.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-kurierr.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-kurierlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-kurierl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["kurier-medium-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-kurier-medium", main = true, parameters = false },
- --
- { name = "rm-kurierm.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-kuriermi.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-kuriermi.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-kuriermz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-kurierm.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- },
- ["kurier-heavy-math"] = {
- { name = "file:LatinModern-Math", features = "virtualmath-kurier-heavy", main = true, parameters = false },
- --
- { name = "rm-kurierh.tfm", vector = "tex-mr", skewchar=0x7F },
- { name = "mi-kurierhi.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "mi-kurierhi.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
- { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
- { name = "sy-kurierhz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "ex-kurierh.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones },
- }
+ ["kurier-math"] = { recipe = recipes["kurier-math"], tweaks = tweaks },
+ ["kurier-light-math"] = { recipe = recipes["kurier-light-math"], tweaks = tweaks },
+ ["kurier-medium-math"] = { recipe = recipes["kurier-medium-math"], tweaks = tweaks },
+ ["kurier-heavy-math"] = { recipe = recipes["kurier-heavy-math"], tweaks = tweaks },
+
+ ["kurier-math-nt"] = { recipe = common and recipes["kurier-math-nt"] or nil },
+ ["kurier-light-math-nt"] = { recipe = common and recipes["kurier-light-math-nt"] or nil },
+ ["kurier-medium-math-nt"] = { recipe = common and recipes["kurier-medium-math-nt"] or nil },
+ ["kurier-heavy-math-nt"] = { recipe = common and recipes["kurier-heavy-math-nt"] or nil },
},
- addmissing = helpers.addmissing,
- }
+ },
}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg
index 6f707ed2b8f..02afa0e90b4 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg
@@ -58,6 +58,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "simplifykerns",
},
{
@@ -87,19 +90,22 @@ return {
tweak = "extendaccents",
},
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "fixaccents",
},
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.8, anchor = 1.40, xoffset = .20 }, -- widehat
- [0x00303] = { width = 2.0, anchor = 1.50, xoffset = .30 }, -- widetilde
- [0x00306] = { width = 1.6, anchor = 1.30, xoffset = .15 }, -- widebreve
- [0x0030C] = { width = 1.3, anchor = 1.15, xoffset = .075 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.8, anchor = 1.40, xoffset = .20 }, -- widehat
+ -- [0x00303] = { width = 2.0, anchor = 1.50, xoffset = .30 }, -- widetilde
+ -- [0x00306] = { width = 1.6, anchor = 1.30, xoffset = .15 }, -- widebreve
+ -- [0x0030C] = { width = 1.3, anchor = 1.15, xoffset = .075 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here. None in libertinus.
-- We now copy these to the not wide slots so that we can set these to stretch as well,
@@ -139,6 +145,30 @@ return {
advance = 0.5,
},
{
+ tweak = "replacerules",
+ minus = {
+ height = .176,
+ yoffset = .825,
+ leftoffset = .065,
+ rightoffset = .065,
+ },
+ fraction = {
+ height = .176,
+ yoffset = .825,
+ },
+ radical = {
+ height = .140,
+ yoffset = .6575,
+ leftoffset = .075,
+ rightoffset = .075,
+ yscale = .8,
+ },
+ stacker = {
+ height = .176,
+ yoffset = .825,
+ },
+ },
+ {
tweak = "addactuarian",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg
new file mode 100644
index 00000000000..76afb51cd3c
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg
@@ -0,0 +1,59 @@
+return {
+ name = "libertinus-text",
+ version = "1.00",
+ comment = "Goodies that complement libertinus.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "LibertinusSerif-Regular",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 100,
+ ["\\"] = 50,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "LibertinusSerif-Italic",
+ "LibertinusSerif-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg
deleted file mode 100644
index 64f53dc33f8..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg
+++ /dev/null
@@ -1,225 +0,0 @@
-local common = fonts.goodies.load("common-math.lfg")
-local presets = common.mathematics.tweaks.presets
-
-local integral_variants = { bottomright = -0.20 }
------ integral_top = { topright = 0.05 }
-local integral_bottom = { bottomright = -0.45 }
-
-return {
- name = "lucida-opentype-math",
- version = "1.00",
- comment = "Goodies that complement lucida opentype.",
- author = "Hans Hagen & Mikael Sundqvist",
- copyright = "ConTeXt development team",
- mathematics = {
- parameters = {
- FractionRuleThickness = 55,
- AccentBaseDepth = 250,
- DelimiterPercent = 90,
- DelimiterShortfall = 400,
- SuperscriptBottomMaxWithSubscript = 325,
- PrimeShiftUp = "1.4*SuperscriptShiftUp",
- PrimeShiftUpCramped = "1.4*SuperscriptShiftUp",
- PrimeBaselineDropMax = "0.5*SuperscriptBaselineDropMax",
- },
- tweaks = {
- aftercopying = {
- {
- tweak = "version",
- expected = "Version 1.901",
- },
- {
- tweak = "fixoldschool",
- version = "Version 1.802",
- },
-{
- tweak = "parameters",
- feature = "boldmath",
- list = {
--- RadicalRuleThickness = 55,
- RadicalRuleThickness = 60,
--- RadicalRuleThickness = "1.09*RadicalRuleThickness",
--- FractionRuleThickness = 65,
--- OverRuleThickness = 65,
--- UnderRuleThickness = 65,
- }
-},
- {
- tweak = "addmirrors",
- },
- presets.scripttocalligraphic { },
- presets.rsfstoscript { rscale = 1 },
- presets.rsfsuprighttoscript { rscale = 1 },
- presets.moderntocalligraphic { rscale = 1 },
- presets.eulertocalligraphic { rscale = 1 },
- presets.xitsarabic { rscale = 1.05 },
- presets.fallbacks { },
- presets.moveitalics { correct = true },
- presets.moveitalics { correct = true, letters = true },
- presets.moveintegrals { factor = 1.5 },
- presets.wipeitalics { },
- {
- tweak = "replacealphabets",
- list = {
- {
- source = "uppercasescript",
- target = "uppercasecalligraphic",
- feature = "ss04",
- },
- {
- source = "lowercasescript",
- target = "lowercasecalligraphic",
- feature = "ss04",
- },
- {
- source = "uppercaseboldscript",
- target = "uppercaseboldcalligraphic",
- feature = "ss04",
- },
- -- No lowercase bold calligraphic/script in font
- },
- },
- {
- tweak = "dimensions",
- version = "Version 1.802",
- list = {
- -- The < and > are slightly too small. We scale them by 867/795
- ["0x003C"] = { scale = 1.09057, width = 1.09057, height = 1.09057 },
- ["0x003E"] = { scale = 1.09057, width = 1.09057, height = 1.09057 },
- },
- },
- {
- tweak = "dimensions",
- version = "Version 1.802",
- list = {
- -- these we fix here. Remove when we have new version of Lucida
- ["0x23DC.parts.1"] = { xoffset = -0.075, height = .4, yoffset = -0.6 },
- ["0x23DC.parts.2"] = { height = .4, yoffset = -0.6 },
- ["0x23DC.parts.3"] = { xoffset = 0.075, height = .4, yoffset = -0.6 },
- ["0x23DD.parts.1"] = { xoffset = -0.075, depth = .8, yoffset = 0.2 },
- ["0x23DD.parts.2"] = { depth = .8, yoffset = 0.2 },
- ["0x23DD.parts.3"] = { xoffset = 0.075, depth = .8, yoffset = 0.2 },
- ["0x7C.variants.3"] = { squeeze = 0.90, height = 0.90, depth = 0.90 },
- ["0x7C.variants.4"] = { squeeze = 0.80, height = 0.80, depth = 0.80 },
- },
- },
- -- Accents are a mess. We migrate the extensibles from the combiners to the base accent
- -- and then need to tweak the width (which is auto set because it was zero with a large
- -- accent anchor offset). First we copy and fix.
- {
- tweak = "extendaccents",
- },
- {
- tweak = "radicaldegreeanchors",
- list = {
- ["0x221A.variants.3"] = { location = "left", hfactor = 0, vfactor = .55 },
- ["0x221A.variants.4"] = { location = "left", hfactor = 0, vfactor = .50 },
- ["0x221A.parts.bottom"] = { location = "left", hfactor = 0, vfactor = .85 },
- }
- },
- {
- tweak = "fixaccents",
- },
- -- First we set the dimensions of the initial accent which started out as zero but we want
- -- a proper width. Not in lucida
- -- Then we deal with all offsets and heights in one go. So we treat the initial accent
- -- as well as the variants here. Not in lucida.
- -- We now copy these to the not wide slots so that we can set these to stretch as well,
- -- if only because it is less confusing and more consistent.
- {
- tweak = "copyaccents",
- },
- -- So far for the accents.
- {
- tweak = "fixslashes",
- },
- {
- tweak = "addbreve",
- },
- {
- tweak = "kerns",
- list = {
- [0x002F] = { topleft = -0.2, bottomright = -0.2 },
- ["0x7D.parts.top"] = { topright = -0.15 }, -- right brace top
- ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom
- ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants
- ["0x29.parts.top"] = { topright = -0.25 }, -- right parenthesis top
- ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom
- ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants
- ["0x221A.parts.top"] = { topright = 0.2 }, -- right radical top
- ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom
- ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants
- [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angle
- ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 },
- [0x27EB] = { topright = -0.2, bottomright = -0.2 },
- ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 },
- },
- },
- {
- tweak = "fixprimes",
- factor = 0.7, -- accent base height
- fake = 0.65, -- replace multiples with this width proportion
- },
- {
- tweak = "checkspacing",
- },
- {
- tweak = "addscripts",
- },
- {
- tweak = "accentdimensions",
- },
- {
- tweak = "addrules",
- },
- {
- tweak = "addactuarian",
- },
- {
- tweak = "addfourier",
- variant = 1,
- },
- {
- tweak = "addprimed",
- },
- {
- tweak = "addarrows",
- left = 0.1,
- right = 0.1,
- slack = 0.20,
- list = {
- [0x21A9] = false,
- [0x21AA] = false,
- [0x2190] = false,
- [0x2192] = false,
- [0x219E] = false,
- [0x21A0] = false,
- }
- },
- -- this is the mkiv section
- {
- tweak = "emulatelmtx",
- feature = "emulatelmtx",
- comment = "this is for mkiv",
- },
- },
- },
- alternates = {
- textitalic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" },
- arrow = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Smaller Arrows" },
- operator = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Smaller Operators" },
- calligraphic = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Calligraphic Characters" },
- zero = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Zero" },
- multipledots = { feature = 'ss06', value = 1, comment = "Mathematical Alternative Multiple Dots" },
- ldots = { feature = 'ss07', value = 1, comment = "Mathematical Alternative Ellipsis" },
- },
- bigslots = {
- 1, 2, 3, 4
- },
- --
- -- experimental fixes for mkiv:
- --
- dimensions = dimensions,
- kerns = kerns,
- },
-}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg
deleted file mode 100644
index 82ba589cd48..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg
+++ /dev/null
@@ -1,348 +0,0 @@
-local mathencodings = fonts.encodings.math
-
-mathencodings["lbr-ma"] = {
- [0x025CB] = 0x00, -- circle
- [0x025CF] = 0x01, -- blackcircle
- [0x025A1] = 0x02, -- square
- [0x025A0] = 0x03, -- blacksquare
- [0x025B3] = 0x04, -- triangleup
- [0x025B2] = 0x05, -- blacktriangleup
- [0x025BD] = 0x06, -- triangledown
- [0x025BC] = 0x07, -- blacktriangledown
- [0x02B28] = 0x08, -- lozenge
- [0x02B27] = 0x09, -- blacklozenge
- [0x02B29] = 0x0A, -- blackdiamond
- [0x02571] = 0x0B, -- upright
- [0x02572] = 0x0C, -- downright
- [0x022E4] = 0x0D, -- squareimageofnoteq
- [0x022E5] = 0x0E, -- squareoriginalofnoteq
- [0x02A4F] = 0x0F, -- dblsquareunion
- [0x02A4E] = 0x10, -- dblsquareintersection
- [0x02A64] = 0x11, -- zdomainantirestriction
- [0x02A65] = 0x12, -- zrangeantirestriction
- [0x022EE] = 0x13, -- verticalellipsis
- [0x022EF] = 0x14, -- ellipsis
- [0x022F0] = 0x15, -- uprightellipsis
- [0x022F1] = 0x16, -- downrightellipsis
- [0x022D5] = 0x17, -- equalparallel
-
- [0x0225B] = 0x1A, -- stareq
- [0x00127] = 0x1B, -- hbar
- [0x022F6] = 0x1C, -- barelementof
- [0x02209] = 0x1D, -- notelementof
- [0x022FD] = 0x1E, -- barcontains
- [0x0220C] = 0x1F, -- notcontain
- [0x02204] = 0x20, -- nexists
- [0x02194] = 0x21, -- leftrightarrow
- [0x02195] = 0x22, -- updownarrow
- [0x0219E] = 0x23, -- leftleftarrow
- [0x0219F] = 0x24, -- upuparrow
- [0x021A0] = 0x25, -- rightrightarrow
--- [0x00026] = 0x26, -- amperand
- [0x021A1] = 0x27, -- downdownarrow
- [0x021A2] = 0x28, -- leftarrowtail
- [0x021A3] = 0x29, -- rightarrowtail
- [0x021A4] = 0x2A, -- leftarrowbar
- [0x021A6] = 0x2B, -- rightarrowbar
- [0x021A5] = 0x2C, -- uparrowbar
--- [0x02212] = 0x2D, -- minus
--- [0x0002D] = 0x2D, -- minus
- [0x021A7] = 0x2E, -- downarrowbar
- [0x021E4] = 0x2F, -- barleftarrow
- [0x021E5] = 0x30, -- barrightarrow
-
- [0x021E0] = 0x38, -- dashleftarrow
- [0x021E1] = 0x39, -- dashuparrow
- [0x021E2] = 0x3A, -- dashrightarrow
- [0x021E3] = 0x3B, -- dashdownarrow
- [0x021A9] = 0x3C, -- hookleftarrow
--- [0x0003D] = 0x3D, -- equalto
- [0x021AA] = 0x3E, -- hookrightarrow
- [0x021AB] = 0x3F, -- looparrowleft
- [0x021AC] = 0x40, -- looparrowright
- [0x1D538] = 0x41, -- A (blackboard A)
- [0x1D539] = 0x42, -- B
- [0x02102] = 0x43, -- C
- [0x1D53B] = 0x44, -- D
- [0x1D53C] = 0x45, -- E
- [0x1D53D] = 0x46, -- F
- [0x1D53E] = 0x47, -- G
- [0x0210D] = 0x48, -- H
- [0x1D540] = 0x49, -- I
- [0x1D541] = 0x4A, -- J
- [0x1D542] = 0x4B, -- K
- [0x1D543] = 0x4C, -- L
- [0x1D544] = 0x4D, -- M
- [0x02115] = 0x4E, -- N
- [0x1D546] = 0x4F, -- O
- [0x02119] = 0x50, -- P
- [0x0211A] = 0x51, -- Q
- [0x0211D] = 0x52, -- R
- [0x1D54A] = 0x53, -- S
- [0x1D54B] = 0x54, -- T
- [0x1D54C] = 0x55, -- U
- [0x1D54D] = 0x56, -- V
- [0x1D54E] = 0x57, -- W
- [0x1D54F] = 0x58, -- X
- [0x1D550] = 0x59, -- Y
- [0x02124] = 0x5A, -- Z (blackboard Z)
- [0x0231C] = 0x5B, -- ulcorner
- [0x0231D] = 0x5C, -- urcorner
- [0x0231E] = 0x5D, -- llcorner
- [0x0231F] = 0x5E, -- lrcorner
- [0x02225] = 0x5F, -- parallel, Vert, lVert, rVert, arrowvert
- [0x021D5] = 0x60, -- Updownarrow
- [0x021D4] = 0x61, -- Leftrightarrow
- [0x021D6] = 0x62, -- Upleftarrow
- [0x021D7] = 0x63, -- Uprightarrow
- [0x021D9] = 0x64, -- Downleftarrow
- [0x021D8] = 0x65, -- Downrightarrow
- [0x021CD] = 0x66, -- nLeftarrow
- [0x021CE] = 0x67, -- nLeftrightarrow
- [0x021CF] = 0x68, -- nRightarrow
--- [0x021CE] = 0x69, -- nLeftrightarrow -- what's the difference between this and 0x0067[0x021CE]
- [0x021DA] = 0x6A, -- Lleftarrow
- [0x1D55C] = 0x6B, -- k \Bbbk (blackboard k)
- [0x021DB] = 0x6C, -- Rrightarrow
- [0x021C4] = 0x6D, -- rlarrow
- [0x021C6] = 0x6E, -- lrarrow
- [0x021C5] = 0x6F, -- udarrow
--- [0x021C5] = 0x70, -- duarrow
- [0x021C7] = 0x71, -- llarrow
- [0x021C8] = 0x72, -- uuarrow
- [0x021C9] = 0x73, -- rrarrow
- [0x021CA] = 0x74, -- ddarrow
- [0x021BE] = 0x75, -- rupharpoon
- [0x021BF] = 0x76, -- lupharpoon
- [0x021C2] = 0x77, -- rdownharpoon
- [0x021C3] = 0x78, -- ldownharpoon
- [0x021CB] = 0x79, -- lrharpoon
- [0x021CC] = 0x7A, -- rlharpoon
- [0x021B0] = 0x7B, -- upthenleftarrow
--- [0x00000] = 0x7C, -- part
- [0x021B1] = 0x7D, -- upthenrightarrow
--- [0x00000] = 0x7E, -- part
- [0x02276] = 0x7F, -- ltgt
- [0x021B2] = 0x81, -- downthenleftarrow
- [0x021B3] = 0x82, -- downthenrightarrow
- [0x02B0E] = 0x83, -- rightthendownarrow
- [0x02B10] = 0x84, -- leftthendownarrow
- [0x02B0F] = 0x85, -- rightthenuparrow
- [0x02B11] = 0x86, -- leftthenuparrow
- [0x021B6] = 0x87, -- leftarcarrow
- [0x021B7] = 0x88, -- rightarcarrow
- [0x0293D] = 0x89, -- leftarcarrowplus
- [0x0293C] = 0x8A, -- rightarcarrowminus
- [0x021BA] = 0x8B, -- anticlockwise
- [0x021BB] = 0x8C, -- clockwise
-
- [0x02260] = 0x94, -- noteq
- [0x02262] = 0x95, -- notidentical
- [0x02241] = 0x96, -- nottilde
- [0x02244] = 0x97, -- notasymptoticallyequal
- [0x02249] = 0x98, -- notalmostequal
- [0x02247] = 0x99, -- notapproximatelyeq
- [0x0226E] = 0x9A, -- nless
- [0x0226F] = 0x9B, -- ngtr
- [0x02270] = 0x9C, -- nleq
- [0x02271] = 0x9D, -- ngeq
- [0x022E6] = 0x9E, -- lnsim
- [0x022E7] = 0x9F, -- gnsim
- [0x02605] = 0xAB, -- black star
- [0x02713] = 0xAC, -- check
- [0x02277] = 0xC5, -- gtlt
- [0x02284] = 0xC6, -- nsubsetof
- [0x02285] = 0xC7, -- nsupsetof
- [0x02288] = 0xC8, -- nsubseteq
- [0x02289] = 0xC9, -- nsupseteq
-
- [0x0228A] = 0xCC, -- subsetneq
- [0x0228B] = 0xCD, -- supsetneq
-
--- [0x0228A] = 0xD0, -- subsetneq
--- [0x0228B] = 0xD1, -- supsetneq
-
- [0x02270] = 0xD6, -- nleq
- [0x02271] = 0xD7, -- ngeq
-
- [0x02268] = 0xDC, -- lneqq
- [0x02269] = 0xDD, -- gneqq
-
- [0x022E6] = 0xE0, -- lnsim
- [0x02219] = 0xE1, -- bullet
- [0x022E7] = 0xE2, -- gnsim
-
- [0x02280] = 0xE5, -- nprec
- [0x02281] = 0xE6, -- nsucc
-
- [0x022E8] = 0xEB, -- precnsim
- [0x022E9] = 0xEC, -- succnsim
-
- [0x022EA] = 0xEF, -- nnormalsub
- [0x022EB] = 0xF0, -- ncontainnormalsub
- [0x022EC] = 0xF1, -- nnormalsubeq
- [0x022ED] = 0xF2, -- ncontainnormalsubeq
-
- [0x02226] = 0xF7, -- nparallel
- [0x022AC] = 0xF8, -- nvdash
- [0x022AE] = 0xF9, -- nVdash
- [0x022AD] = 0xFA, -- nvDash
- [0x022AF] = 0xFB, -- nVDash
-}
-
-mathencodings["lbr-mb"] = {
- [0x00393] = 0x00, -- Gamma
- [0x00394] = 0x01, -- Delta
- [0x00398] = 0x02, -- Theta
- [0x0039B] = 0x03, -- Lambda
- [0x0039E] = 0x04, -- Xi
- [0x003A0] = 0x05, -- Pi
- [0x003A3] = 0x06, -- Sigma
- [0x003A5] = 0x07, -- Upsilon
- [0x003A6] = 0x08, -- Phi
- [0x003A8] = 0x09, -- Psi
- [0x003A9] = 0x0A, -- Omega
- [0x0210F] = 0x9D, -- hslash
- [0x02127] = 0x92, -- mho
- [0x02132] = 0x90, -- Finv
- [0x02136] = 0x95, -- beth
- [0x02137] = 0x96, -- gimel
- [0x02138] = 0x97, -- daleth
- [0x02141] = 0x91, -- Game
- [0x02201] = 0x94, -- complement
- [0x0226C] = 0xF2, -- between
- [0x0227C] = 0xE4, -- preccurlyeq
- [0x0227D] = 0xE5, -- succcurlyeq
- [0x0229D] = 0xCC, -- circleddash
- [0x022A8] = 0xD6, -- vDash
- [0x022AA] = 0xD3, -- Vvdash
- [0x022B8] = 0xC7, -- multimap
- [0x022BB] = 0xD2, -- veebar
- [0x022C7] = 0xF7, -- divideontimes
- [0x022C9] = 0xCF, -- ltimes
- [0x022CA] = 0xCE, -- rtimes
- [0x022CB] = 0xD0, -- leftthreetimes
- [0x022CC] = 0xD1, -- rightthreetimes
- [0x022D6] = 0xDC, -- lessdot
- [0x022D7] = 0xDD, -- gtrdot
- [0x022D8] = 0xDE, -- lll
- [0x022D9] = 0xDF, -- ggg
- [0x022DA] = 0xE8, -- lesseqgtr
- [0x022DB] = 0xE9, -- gtreqless
- [0x022DE] = 0xE6, -- curlyeqprec
- [0x022DF] = 0xE7, -- curlyeqsucc
- [0x024C7] = 0xC9, -- circledR
- [0x024C8] = 0xCA, -- circledS
- [0x025B6] = 0xF1, -- blacktriangleright
- [0x025B8] = 0xF0, -- blacktriangleleft
- [0x02720] = 0xCB, -- maltese
- [0x02A7D] = 0xE0, -- leqslant
- [0x02A7E] = 0xE1, -- geqslant
- [0x02A85] = 0xDA, -- lessapprox
- [0x02A86] = 0xDB, -- gtrapprox
- [0x02A8B] = 0xEA, -- lesseqqgtr
- [0x02A8C] = 0xEB, -- gtreqqless
- [0x02A95] = 0xE2, -- eqslantless
- [0x02A96] = 0xE3, -- eqslantgtr
- [0x02AB7] = 0xEC, -- precapprox
- [0x02AB8] = 0xED, -- succapprox
- [0x02AC5] = 0xEE, -- subseteqq
- [0x02AC6] = 0xEF, -- supseteqq
- [0x12035] = 0xC8, -- backprime
- [0x1D718] = 0x9B, -- varkappa
-}
-
-
-mathencodings["lbr-sy"] = {
-
- -- [0x022C5] = 0x01, -- cdot,
-
- [0x0002B] = 0x82, -- plus
- [0x0003D] = 0x83, -- equal
-
- [0x021CB] = 0x8D, -- leftrightharpoons
- [0x021CC] = 0x8E, -- rightleftharpoons
- [0x02214] = 0x89, -- dotplus
- [0x02220] = 0x8B, -- angle
- [0x02221] = 0x8C, -- measuredangle
- [0x02222] = 0x8D, -- sphericalangle
- [0x02234] = 0x90, -- therefore
- [0x02235] = 0x91, -- because
- [0x0223D] = 0x24, -- backsim
- [0x02242] = 0x99, -- eqsim
- [0x02245] = 0x9B, -- cong
- [0x0224A] = 0x9D, -- approxeq
- [0x0224E] = 0xC7, -- Bumpeq
- [0x02252] = 0xCB, -- fallingdotseq
- [0x02253] = 0xCC, -- risingdotseq
- [0x02256] = 0xCF, -- eqcirc
- [0x02257] = 0xD0, -- circeq
- [0x0225C] = 0xD5, -- triangleq
- [0x02266] = 0xDA, -- leqq
- [0x02267] = 0xDB, -- geqq
- [0x02272] = 0xDC, -- lesssim
- [0x02273] = 0xDD, -- gtrsim
- [0x02276] = 0xDE, -- lessgtr
- [0x02277] = 0xDF, -- gtrless
- [0x0227E] = 0xE0, -- precsim
- [0x0227F] = 0xE1, -- succsim
- [0x0228F] = 0xE4, -- sqsubset
- [0x02290] = 0xE5, -- sqsupset
- [0x0229A] = 0xE6, -- circledcirc
- [0x0229B] = 0xE7, -- circledast
- [0x0229E] = 0xEA, -- boxplus
- [0x0229F] = 0xEB, -- boxminus
- [0x022A0] = 0xEC, -- boxtimes
- [0x022A1] = 0xED, -- boxdot
- [0x022A7] = 0xEE, -- models
- [0x022A9] = 0xF0, -- Vdash
- [0x022BC] = 0xF6, -- barwedge
- [0x022CE] = 0x85, -- curlyvee
- [0x022CF] = 0x84, -- curlywedge
- [0x022D0] = 0xF8, -- Subset
- [0x022D1] = 0xF9, -- Supset
- [0x02300] = 0x53, -- varnothing
- [0x025CA] = 0x05, -- lozenge
-}
-
-
-mathencodings["lbr-sy"] = table.merged(mathencodings["tex-sy"],mathencodings["lbr-sy"])
-
-mathencodings["lbr-fraktur"] = { }
-
-fonts.handlers.vf.math.setletters(mathencodings, "lbr-fraktur", 0x1D504, 0x1D51E)
-
-return {
- name = "lucida-math",
- version = "1.00",
- comment = "Goodies that complement lucida math.",
- author = "Aditya, Hans, Mojca with help from Zhichu Chen",
- copyright = "ConTeXt development team",
- mathematics = {
- mapfiles = {
- "lucida.map",
- },
- virtuals = {
- ["lucida-math"] = {
- { name = "file:lbr.afm", features = "virtualmath", main = true },
- { name = "hlcrim.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "hlcrim.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "hlcry.tfm", vector = "lbr-sy", skewchar=0x30, parameters = true },
- { name = "hlcrv.tfm", vector = "tex-ex", extension = true },
- { name = "hlcra.tfm", vector = "lbr-ma" },
- { name = "hlcrm.tfm", vector = "lbr-mb" },
- -- { name = "hlcrim.tfm", vector = "lbr-mb" }, -- LucidaNewMath-Italic <-> AltItalic
- -- { name = "hlcdim.tfm", vector = "lbr-mb" }, -- LucidaNewMath-DemiItalic <-> AltDemiItalic
- -- { name = "hlcrima.tfm", vector = "lbr-mb" }, -- LucidaNewMath-AltItalic <-> Italic
- { name = "file:lbd.afm", vector = "tex-bf" },
- { name = "file:lbdi.afm", vector = "tex-bi" } ,
- { name = "file:lsr.afm", vector = "tex-ss" },
- { name = "file:lstr.afm", vector = "tex-tt" },
- { name = "file:lbl.afm", vector = "lbr-fraktur" }, -- more complete
- },
- },
- variables = {
- joinrelfactor = 4, -- default is 3
- }
- }
-}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg
index 4af740789f5..ef99513b960 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg
@@ -56,6 +56,9 @@ return {
presets.wipeanchors { },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "dimensions",
list = {
[0x1D487] = { anchor = 0.9 }, -- bold italic f
@@ -144,25 +147,28 @@ return {
tweak = "extendaccents",
},
{
+ tweak = "flattenaccents",
+ },
+ {
+ tweak = "fixaccents",
+ },
+ {
tweak = "radicaldegreeanchors",
list = {
["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.05 },
}
},
- {
- tweak = "fixaccents",
- },
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+-- {
+-- tweak = "dimensions",
+-- list = {
+-- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+-- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+-- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+-- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+-- },
+-- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here.
{
@@ -324,6 +330,15 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ -- minus = true, -- we have an extensible
+ fraction = { height = .15, yoffset = .85 },
+ radical = { height = .15, yoffset = .85, leftoffset = .065, rightoffset = .065, leftoverlap = 0.023,
+rightoverlap = 0.023
+},
+ stacker = { height = .15, yoffset = .85 },
+ },
+ {
tweak = "addbars",
advance = 0.52,
},
@@ -346,6 +361,8 @@ return {
feature = "emulatelmtx",
comment = "this is for mkiv",
},
+-- { tweak = "inspect", slot = 0x2212 },
+-- { tweak = "inspect", slot = 0x003D },
},
},
bigslots = {
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg
new file mode 100644
index 00000000000..20bdcc60b05
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg
@@ -0,0 +1,62 @@
+return {
+ name = "modern-text",
+ version = "1.00",
+ comment = "Goodies that complement latin modern.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ -- "LMRoman-Regular",
+ "LMRoman10-Regular",
+ "LMRoman10-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 100,
+ ["\\"] = 50,
+ ["?"] = 50,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "LMRoman-Italic",
+ "LMRoman-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg
index cae69aecc12..12c6e8b23b3 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg
@@ -1,3 +1,5 @@
+local common = fonts.goodies.load("common-math.lfg")
+local presets = common.mathematics.tweaks.presets
-- In order to be able to use beta math fonts, we use our own file name and
-- always remap. As this font is experimental we don't spend too much time
-- on it now. Even then, we migth stick to design sizes only.
@@ -66,10 +68,12 @@ return {
end
return o * target.parameters.factor
end,
- NoLimitSupFactor = 0,
- NoLimitSubFactor = 1200,
- DelimiterPercent = 90,
- DelimiterShortfall = 400,
+ NoLimitSupFactor = 0,
+ NoLimitSubFactor = 1200,
+ DelimiterPercent = 90,
+ DelimiterShortfall = 400,
+ AccentTopShiftUp = -60,
+ FlattenedAccentTopShiftUp = -60,
SubscriptBaselineDropMin = 50, -- 200 in font (multiplied by 0.59999/2.39868)
SubscriptShiftDown = 150, -- 247 in font (multiplied to be consistent with cm)
SubscriptShiftDownWithSuperscript = 247, -- relates to the previous one (see math-act)
@@ -91,6 +95,21 @@ return {
smaller = true,
fake = 0.6,
},
+ presets.scripttocalligraphic { },
+ presets.rsfstoscript { },
+ presets.rsfsuprighttoscript { },
+ presets.moderntocalligraphic { },
+ presets.eulertocalligraphic { },
+ presets.xitsarabic { rscale = 0.80 },
+ presets.fallbacks { },
+ presets.moveitalics { correct = true },
+ presets.moveitalics { correct = true, letters = true },
+ presets.moveintegrals { factor = 1.4, icfactor = 0.8 }, -- the icfactor is due to the very slanted integral.
+ presets.wipeanchors { },
+ presets.wipeitalics { },
+ {
+ tweak = "checkaccents",
+ },
{
tweak = "kerns",
list = {
@@ -113,7 +132,10 @@ return {
["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 },
},
- },
+ },
+ {
+ tweak = "flattenaccents",
+ },
{
tweak = "checkspacing",
},
@@ -130,6 +152,13 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ -- minus = true, -- we have an extensible
+ fraction = { height = .15, yoffset = .85 },
+ radical = { height = .15, yoffset = .823, leftoffset = .065, rightoffset = .065, leftoverlap = 0.03 },
+ stacker = { height = .15, yoffset = .85 },
+ },
+ {
tweak = "addfourier",
variant = 1,
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg
new file mode 100644
index 00000000000..24991642a60
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg
@@ -0,0 +1,63 @@
+return {
+ name = "newcomputermodern-text",
+ version = "1.00",
+ comment = "Goodies that complement newcomputermodern.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "NewCM10-Book",
+ "NewCM10",
+ "NewCM10-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 100,
+ ["\\"] = 75,
+ ["?"] = 50,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "NewCM10-BookItalic",
+ "NewCM10-BoldItalic",
+ "NewCM10-Italic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 100,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 50,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg
index c1d0c7dd5c2..05e6fad814a 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg
@@ -40,9 +40,26 @@ return {
feature = "euleroverpagella",
filename = "euler-math.otf",
list = {
- { source = { first = 0x02100, last = 0x02BFF } },
- { source = { first = 0x1D400, last = 0x1D7FF } },
- { source = { first = 0x1D538, last = 0x1D550 } },
+ { source = "lowercasenormal", target = "lowercaseitalic" },
+ { source = "lowercasebold", target = "lowercasebolditalic" },
+ { source = "lowercasegreeknormal", target = "lowercasegreekitalic" },
+ { source = "lowercasegreekbold", target = "lowercasegreekbolditalic" },
+ { source = "uppercasenormal", target = "uppercaseitalic" },
+ { source = "uppercasebold", target = "uppercasebolditalic" },
+ { source = "uppercasegreeknormal", target = "uppercasegreekitalic" },
+ { source = "uppercasegreekbold", target = "uppercasegreekbolditalic" },
+ { source = "lowercasenormal", target = "lowercasenormal" },
+ { source = "lowercasebold", target = "lowercasebold" },
+ { source = "lowercasegreeknormal", target = "lowercasegreeknormal" },
+ { source = "lowercasegreekbold", target = "lowercasegreekbold" },
+ { source = "uppercasenormal", target = "uppercasenormal" },
+ { source = "uppercasebold", target = "uppercasebold" },
+ { source = "uppercasegreeknormal", target = "uppercasegreeknormal" },
+ { source = "uppercasegreekbold", target = "uppercasegreekbold" },
+ { source = "digitsnormal", target = "digitsnormal" },
+ --
+ { source = { first = 0x02100, last = 0x02BFF } }, -- symbols
+ { source = { first = 0x1D400, last = 0x1D7FF } }, -- various alphabets
},
},
{
@@ -66,6 +83,9 @@ return {
presets.wipeanchors { },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "parameters",
feature = "euleroverpagella",
list = {
@@ -94,28 +114,25 @@ return {
tweak = "extendaccents",
},
{
- tweak = "radicaldegreeanchors",
- list = {
- ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.0, vfactor = 1.1 },
- }
+ tweak = "flattenaccents",
},
{
tweak = "fixaccents",
},
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00300] = { width = 0.9 }, -- widegrave
- [0x00301] = { width = 0.9 }, -- wideacute
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+-- {
+-- tweak = "dimensions",
+-- list = {
+-- [0x00300] = { width = 0.9 }, -- widegrave
+-- [0x00301] = { width = 0.9 }, -- wideacute
+-- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+-- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+-- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+-- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one
+-- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+-- },
+-- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here.
{
@@ -132,6 +149,12 @@ return {
},
-- So far for the accents.
{
+ tweak = "radicaldegreeanchors",
+ list = {
+ ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.0, vfactor = 1.1 },
+ }
+ },
+ {
tweak = "fixslashes",
},
{
@@ -154,7 +177,7 @@ return {
[0x27EB] = { topright = -0.2, bottomright = -0.2 },
["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 },
--
- [0x00393] = { bottomright = -0.20, }, -- upright Gamma
+ [0x0393] = { bottomright = -0.20, }, -- upright Gamma
--
["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int
["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint
@@ -185,6 +208,20 @@ return {
advance = 0.2,
},
{
+ tweak = "replacerules",
+ fraction = { height = .215, yoffset = .785 },
+ radical = { height = .215, yoffset = .785, leftoffset = .1, rightoffset = .1 },
+ stacker = { height = .215, yoffset = .785 },
+ },
+ -- on the radical we adapt the offset and give some extra height (prevent clipping)
+ {
+ tweak = "replacerules",
+ feature = "euleroverpagella",
+ fraction = { height = .15, yoffset = .85 },
+ radical = { height = .22, yoffset = .8, leftoffset = .05, rightoffset = .05, leftoverlap = .01 },
+ stacker = { height = .15, yoffset = .85 },
+ },
+ {
tweak = "addactuarian",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg
index e4a3ad39796..42c2bbcc21b 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg
@@ -47,6 +47,9 @@ return {
presets.moveintegrals { },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x002F] = { topleft = -0.2, bottomright = -0.2 },
@@ -78,25 +81,28 @@ return {
tweak = "extendaccents",
},
{
- tweak = "radicaldegreeanchors",
- list = {
+ tweak = "radicaldegreeanchors",
+ list = {
["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 },
}
},
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "fixaccents",
},
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+ -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+ -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+ -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here. Not in schola
-- We now copy these to the not wide slots so that we can set these to stretch as well,
@@ -117,6 +123,12 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ fraction = { height = .25, yoffset = .7625 },
+ radical = { height = .25, leftoffset = .1, rightoffset = .1, yoffset = .7625 },
+ stacker = { height = .25, yoffset = .7625 },
+ },
+ {
tweak = "addbars",
advance = 0.27,
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg
index b6b1757b6c1..881de752381 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg
@@ -13,7 +13,11 @@ return {
copyright = "ConTeXt development team",
mathematics = {
alternates = {
- calligraphic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Calligraphic Characters" },
+ lambdabar = { feature = 'cv01', value = 1, comment = "Mathematical Alternative Lambda Bar" },
+ ramshorn = { feature = 'cv02', value = 1, comment = "Mathematical Alternative Rams Horn" },
+ emptyset = { feature = 'cv03', value = 1, comment = "Mathematical Alternative Empty Set" },
+ setminus = { feature = 'cv04', value = 1, comment = "Mathematical Alternative Setminus" },
+ calligraphic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, -- We do this differently
italic = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Lowercase Italic" },
barred = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Barred Characters" }, -- hbar, lambdabar etc
primes = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Primes" }, -- larger/lower primes, minute etc
@@ -23,9 +27,26 @@ return {
upright = { feature = 'ss08', value = 1, comment = "Mathematical Alternative Upright Symbols" }, -- upright integrals etc.
negated = { feature = 'ss09', value = 1, comment = "Mathematical Alternative Negated Symbols" },
relation = { feature = 'ss10', value = 1, comment = "Mathematical Alternative Relations" },
- negatedset = { feature = 'ss09', value = 1, comment = "Mathematical Alternative Negated Set Symbols" },
- -- todo = { feature = 'ss14', value = 1, comment = "" },
+ negatedset = { feature = 'ss11', value = 1, comment = "Mathematical Alternative Negated Set Symbols" },
+ propfrown = { feature = 'ss12', value = 1, comment = "Mathematical Alternative Proportional and Frown" },
+ negsine = { feature = 'ss13', value = 1, comment = "Mathematical Alternative Negated Sine Wave" },
+ intprod = { feature = 'ss14', value = 1, comment = "Mathematical Alternative Interior Products" },
+ capcup = { feature = 'ss15', value = 1, comment = "Mathematical Alternative Intersection and Union with serif" },
circled = { feature = 'ss16', value = 1, comment = "Mathematical Alternative Circled Operators" },
+ simvar = { feature = 'ss20', value = 1, comment = "Mathematical Alternative Similar and some more unrelated" },
+ -- demo features:
+ negated8774 = {
+ feature = 'ss09',
+ value = 1,
+ comment = "Mathematical Alternative Negated 8774",
+ list = { [8774] = true },
+ },
+ negated8775 = {
+ feature = 'ss09',
+ value = 1,
+ comment = "Mathematical Alternative Negated 8775",
+ list = { [8775] = true },
+ },
},
parameters = {
AccentBaseDepth = 30,
@@ -78,6 +99,19 @@ return {
presets.moveintegrals { },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ -- Extensibles use .s1 (variant 1), so we cannot wipe all
+ {
+ tweak = "wipevariants",
+ list = {
+ [0x20D6] = 3,
+ [0x20D7] = 3,
+ [0x20EE] = 3,
+ [0x20EF] = 3,
+ },
+ },
+ {
tweak = "simplifykerns",
},
{
@@ -115,21 +149,23 @@ return {
["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.00 },
}
},
-
+ {
+ tweak = "flattenaccents",
+ },
{
tweak = "fixaccents",
},
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat
+ -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+ -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+ -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here.
{
@@ -168,6 +204,29 @@ return {
advance = 0.4,
},
{
+ tweak = "replacerules",
+ minus = {
+ height = .233,
+ yoffset = .768,
+ leftoffset = .08,
+ rightoffset = .08,
+ },
+ fraction = {
+ height = .233,
+ yoffset = .768,
+ },
+ radical = {
+ height = .233,
+ yoffset = .768,
+ leftoffset = .08,
+ rightoffset = .08,
+ },
+ stacker = {
+ height = .233,
+ yoffset = .768,
+ },
+ },
+ {
tweak = "addactuarian",
},
{
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg
new file mode 100644
index 00000000000..2a3b46a78fa
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg
@@ -0,0 +1,60 @@
+return {
+ name = "stixtwo-text",
+ version = "1.00",
+ comment = "Goodies that complement stix two.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "STIXTwoText-Regular",
+ "STIXTwoText-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 100,
+ ["\\"] = 100,
+ ["*"] = 50,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "STIXTwoText-Italic",
+ "STIXTwoText-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 50,
+ ["}"] = 50,
+ ["]"] = 50,
+ ["|"] = 125,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 100,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg
index d9c53ee2830..7dfc73207ab 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg
@@ -49,6 +49,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x002F] = { topleft = -0.2, bottomright = -0.2 },
@@ -81,6 +84,12 @@ return {
tweak = "extendaccents",
},
{
+ tweak = "flattenaccents",
+ },
+ {
+ tweak = "fixaccents",
+ },
+ {
tweak = "radicaldegreeanchors",
list = {
[0x221A] = { location = "left", hfactor = 0.0, vfactor = 0.6 },
@@ -88,20 +97,17 @@ return {
["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 },
}
},
- {
- tweak = "fixaccents",
- },
-- First we set the dimensions of the initial accent which started out as zero but we want
-- a proper width.
- {
- tweak = "dimensions",
- list = {
- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
- },
- },
+ -- {
+ -- tweak = "dimensions",
+ -- list = {
+ -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
+ -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
+ -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
+ -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
+ -- },
+ -- },
-- Then we deal with all offsets and heights in one go. So we treat the initial accent
-- as well as the variants here. Not in termes.
-- We now copy these to the not wide slots so that we can set these to stretch as well,
@@ -123,6 +129,19 @@ return {
tweak = "addrules",
},
{
+ tweak = "replacerules",
+ fraction = { height = .2, xleftoffset = .115, xrightoffset = .115, yoffset = .81 },
+ radical = { height = .2, leftoffset = .115, rightoffset = .115, yoffset = .81 },
+ stacker = { height = .2, xleftoffset = .115, xrightoffset = .115, yoffset = .81 },
+ },
+ -- {
+ -- tweak = "replacerules",
+ -- -- minus = true, -- we have an extensible
+ -- fraction = { height = .2, yoffset = .8 },
+ -- radical = { height = .2, yoffset = .8 },
+ -- stacker = { height = .2, yoffset = .8 },
+ -- },
+ {
tweak = "addbars",
advance = 0.3,
},
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg
new file mode 100644
index 00000000000..947d730cd5f
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg
@@ -0,0 +1,185 @@
+return {
+ name = "texgyre-text",
+ version = "1.00",
+ comment = "Goodies that complement the texgyre fonts.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ -- we have three optional methods for filtering:
+ fonts = {
+ "TeXGyreBonum-Regular",
+ "TeXGyreBonum-Bold",
+ },
+ -- fonts = {
+ -- ["TeXGyreBonum-Regular"] = true,
+ -- },
+ -- fonts = "TeXGyreBonum-*",
+ data = {
+ ["f"] = {
+ [")"] = 100,
+ ["}"] = 100,
+ ["]"] = 100,
+ ["|"] = 100,
+ ["\\"] = 120,
+ ["!"] = 100,
+ ["?"] = 100,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "TeXGyreBonum-Italic",
+ "TeXGyreBonum-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 140,
+ ["}"] = 140,
+ ["]"] = 140,
+ ["|"] = 100,
+ ["\\"] = 150,
+ ["!"] = 100,
+ ["?"] = 100,
+ },
+ ["("] = {
+ ["f"] = 190,
+ },
+ ["{"] = {
+ ["f"] = 190,
+ },
+ ["["] = {
+ ["f"] = 190,
+ },
+ }
+ },
+ {
+ name = "kern",
+ type = "kern",
+ fonts = {
+ "TeXGyreTermes-Regular",
+ "TeXGyreTermes-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 75,
+ ["}"] = 75,
+ ["]"] = 75,
+ ["|"] = 75,
+ ["\\"] = 110,
+ ["!"] = 75,
+ ["?"] = 75,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "TeXGyreTermes-Italic",
+ "TeXGyreTermes-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 75,
+ ["}"] = 75,
+ ["]"] = 75,
+ ["|"] = 75,
+ ["\\"] = 200,
+ ["!"] = 75,
+ ["?"] = 75,
+ },
+ ["("] = {
+ ["f"] = 75,
+ },
+ ["{"] = {
+ ["f"] = 75,
+ },
+ ["["] = {
+ ["f"] = 75,
+ },
+ ["|"] = {
+ ["f"] = 150,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "TeXGyrePagella-Italic",
+ "TeXGyrePagella-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 120,
+ ["}"] = 120,
+ ["]"] = 120,
+ ["|"] = 120,
+ ["\\"] = 120,
+ ["!"] = 75,
+ ["?"] = 75,
+ ["*"] = 120,
+ },
+ ["("] = {
+ ["f"] = 120,
+ },
+ ["{"] = {
+ ["f"] = 120,
+ },
+ ["["] = {
+ ["f"] = 120,
+ },
+ ["|"] = {
+ ["f"] = 120,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "TeXGyreSchola-Regular",
+ "TeXGyreSchola-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 120,
+ ["}"] = 120,
+ ["]"] = 120,
+ -- ["|"] = 50,
+ ["\\"] = 100,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 75,
+ ["@"] = 75,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "TeXGyreSchola-Italic",
+ "TeXGyreSchola-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 120,
+ ["}"] = 120,
+ ["]"] = 120,
+ ["|"] = 120,
+ ["\\"] = 120,
+ ["!"] = 75,
+ ["?"] = 75,
+ ["*"] = 120,
+ ["@"] = 75,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
index f5e3158f4ee..413223df1b2 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
@@ -14,14 +14,7 @@
\starttypescriptcollection[antykwa-torunska]
\startsetups[antykwa]
- % \setupmathfraction[\c!rule=\v!symbol,\c!middle="0203E]%
- % \setupmathradical [\c!rule=\v!symbol,\c!top ="FE010]%
- % \setupmathfence [\c!alternative=1]%
- \letmathfractionparameter\c!rule\v!symbol
- \setmathfractionparameter\c!middle{"203E}%
- \letmathradicalparameter \c!rule\v!symbol
- \setmathradicalparameter \c!top{\radicalbarextenderuc}%
- \setmathfenceparameter \c!alternative{1}%
+ \setmathfenceparameter\c!alternative{1}%
\stopsetups
% cond => -cont as in iwona
@@ -35,20 +28,27 @@
\startsetups[antykwa-torunska-cond] \directsetup{antykwa}\stopsetups
\startsetups[antykwa-torunska-light-cond]\directsetup{antykwa}\stopsetups
- \definefontfeature[virtualmath-antykwa] [virtualmath][virtualweight=antykwa]
- \definefontfeature[virtualmath-antykwa-cond] [virtualmath][virtualweight=antykwa-cond]
- \definefontfeature[virtualmath-antykwa-light] [virtualmath][virtualweight=antykwa-light]
- \definefontfeature[virtualmath-antykwa-light-cond][virtualmath][virtualweight=antykwa-light-cond]
+ % these fetaures make the loaded base font unique:
- \starttypescript [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-light-cond,antykwa-torunska-light-cond]
- \definetypeface[\typescriptone][\s!rm][\s!serif][\typescriptone] [\s!default]
- \definetypeface[\typescriptone][\s!ss][\s!sans] [modern] [\s!default] [\s!rscale=1.05]
- \definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default] [\s!rscale=1.05]
- \definetypeface[\typescriptone][\s!mm][\s!math] [\typescriptone] [\s!default]
+ \definefontfeature[virtualmath-antykwa] [virtualmath][virtualweight=antykwa]
+ \definefontfeature[virtualmath-antykwa-cond] [virtualmath][virtualweight=antykwa-cond]
+ \definefontfeature[virtualmath-antykwa-light] [virtualmath][virtualweight=antykwa-light]
+ \definefontfeature[virtualmath-antykwa-light-cond] [virtualmath][virtualweight=antykwa-light-cond]
+
+ \definefontfeature[virtualmath-antykwa-nt] [virtualmath][virtualweight=antykwa-nt]
+ \definefontfeature[virtualmath-antykwa-cond-nt] [virtualmath][virtualweight=antykwa-cond-nt]
+ \definefontfeature[virtualmath-antykwa-light-nt] [virtualmath][virtualweight=antykwa-light-nt]
+ \definefontfeature[virtualmath-antykwa-light-cond-nt][virtualmath][virtualweight=antykwa-light-cond-nt]
+
+ \starttypescript [antykwa,antykwa-nt,antykwa-torunska,antykwa-light,antykwa-light-nt,antykwa-torunska-light,antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond,antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond]
+ \definetypeface[\typescriptone][\s!rm][\s!serif][\typescriptone][\s!default]
+ \definetypeface[\typescriptone][\s!ss][\s!sans] [modern] [\s!default][\s!rscale=1.05]
+ \definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default][\s!rscale=1.05]
+ \definetypeface[\typescriptone][\s!mm][\s!math] [\typescriptone][\s!default]
\quittypescriptscanning
\stoptypescript
- \starttypescript [\s!serif] [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-light-cond,antykwa-torunska-light-cond]
+ \starttypescript [\s!serif] [antykwa,antykwa-nt,antykwa-torunska,antykwa-light,antykwa-light-nt,antykwa-torunska-light,antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond,antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond]
\definefontsynonym [AntykwaTorunska-Regular] [\s!file:AntykwaTorunska-Regular] [\s!features=\s!default]
\definefontsynonym [AntykwaTorunska-Italic] [\s!file:AntykwaTorunska-Italic] [\s!features=\s!default]
\definefontsynonym [AntykwaTorunska-Bold] [\s!file:AntykwaTorunska-Bold] [\s!features=\s!default]
@@ -71,23 +71,37 @@
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwamath@antykwa-math]
\stoptypescript
-
\starttypescript [\s!math][antykwa-light,antykwa-torunska-light][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwalightmath@antykwa-light-math]
\stoptypescript
-
\starttypescript [\s!math][antykwa-cond,antykwa-torunska-cond][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwacondmath@antykwa-cond-math]
\stoptypescript
-
\starttypescript [\s!math][antykwa-light-cond,antykwa-torunska-light-cond][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwalightcondmath@antykwa-light-cond-math]
\stoptypescript
- \starttypescript [\s!serif] [antykwa,antykwa-torunska] [\s!name]
+ \starttypescript [\s!math][antykwa-nt][\s!all]
+ \loadfontgoodies[antykwa-math]
+ \definefontsynonym[\s!MathRoman][antykwamathnt@antykwa-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][antykwa-light-nt][\s!all]
+ \loadfontgoodies[antykwa-math]
+ \definefontsynonym[\s!MathRoman][antykwalightmathnt@antykwa-light-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][antykwa-cond-nt][\s!all]
+ \loadfontgoodies[antykwa-math]
+ \definefontsynonym[\s!MathRoman][antykwacondmathnt@antykwa-cond-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][antykwa-light-cond-nt][\s!all]
+ \loadfontgoodies[antykwa-math]
+ \definefontsynonym[\s!MathRoman][antykwacondmathnt@antykwa-light-cond-math-nt]
+ \stoptypescript
+
+ \starttypescript [\s!serif] [antykwa,antykwa-nt,antykwa-torunska] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif] [AntykwaTorunska-Regular]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-Bold]
@@ -95,7 +109,7 @@
\definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-BoldItalic]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-light,antykwa-torunska-light] [\s!name]
+ \starttypescript [\s!serif] [antykwa-light,antykwa-light-nt,antykwa-torunska-light] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif] [AntykwaTorunska-Light]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-Medium]
@@ -103,7 +117,7 @@
\definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-MediumItalic]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-cond,antykwa-torunska-cond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif] [AntykwaTorunska-CondRegular]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondBold]
@@ -111,7 +125,7 @@
\definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-CondBoldItalic]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-light-cond,antykwa-torunska-light-cond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif] [AntykwaTorunska-CondLight]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondMedium]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv
index ff4033f8154..c383a27fe6d 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=type-imp-erewhon,
+%D [ file=type-imp-concrete,
%D version=2022.30.09, % a bit older
%D title=\CONTEXT\ Typescript Macros,
%D subtitle=\TEX Gyre Fonts,
@@ -11,9 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%\loadtypescriptfile[texgyre]
-%\resetfontfallback [concrete-euler-fix]
-%\definefontfallback[concrete-euler-fix][texgyrepagella-math] [0x022EE,0x022F0,0x022F1,0x02661,0x02220][force=yes]
+% lm is already preloaded so we can actually move this to lm
\starttypescriptcollection[concrete]
@@ -21,33 +19,35 @@
%\definefontfeature[none-slanted-concrete] [none] [slant=.2]
\doifunknownfontfeature {concrete-math-bold} {\definefontfeature[concrete-math-bold][boldened]}
+ \doifunknownfontfeature {concrete-text-bold} {\definefontfeature[concrete-text-bold][boldened-10]}
\starttypescript [\s!serif] [concrete]
- \definefontsynonym [\s!Serif] [\s!file:cmunorm] [\s!features=\s!default]
- \definefontsynonym [\s!SerifItalic] [\s!file:cmunoti] [\s!features=\s!default]
- \definefontsynonym [\s!SerifSlanted] [\s!file:cmunorm] [\s!features=default-slanted-concrete]
- \definefontsynonym [\s!SerifBold] [\s!file:cmunobx] [\s!features=\s!default]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:cmunobi] [\s!features=\s!default]
- \definefontsynonym [\s!SerifBoldSlanted] [\s!file:cmunobx] [\s!features=default-slanted-concrete]
+ \definefontsynonym [\s!Serif] [LMTypewriterVarWd-Regular] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SerifBold] [LMTypewriterVarWd-Dark] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SerifItalic] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SerifSlanted] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SerifBoldItalic] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SerifBoldSlanted] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}]
\stoptypescript
\starttypescript [\s!sans] [concrete]
- \definefontsynonym [\s!Sans] [\s!file:cmunss] [\s!features=\s!default]
- \definefontsynonym [\s!SansItalic] [\s!file:cmunsi] [\s!features=\s!default]
- \definefontsynonym [\s!SansSlanted] [\s!file:cmunss] [\s!features=default-slanted-concrete]
- \definefontsynonym [\s!SansBold] [\s!file:cmunsx] [\s!features=\s!default]
- \definefontsynonym [\s!SansBoldItalic] [\s!file:cmunso] [\s!features=\s!default]
- \definefontsynonym [\s!SansBoldSlanted] [\s!file:cmunsx] [\s!features=default-slanted-concrete]
+ \definefontsynonym [\s!Sans] [LMTypewriterVarWd-Regular] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SansItalic] [LMTypewriterVarWd-Dark] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SansSlanted] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SansBold] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SansBoldItalic] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}]
+ \definefontsynonym [\s!SansBoldSlanted] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}]
\stoptypescript
\starttypescript [\s!mono] [concrete]
- \definefontsynonym [\s!Mono] [\s!file:cmuntt] [\s!features=\s!none]
- \definefontsynonym [\s!MonoItalic] [\s!file:cmunit] [\s!features=\s!none]
- \definefontsynonym [\s!MonoSlanted] [\s!file:cmunst] [\s!features=\s!none]
- \definefontsynonym [\s!MonoBold] [\s!file:cmuntb] [\s!features=\s!none]
- \definefontsynonym [\s!MonoBoldItalic] [\s!file:cmuntx] [\s!features=\s!none]
- \definefontsynonym [\s!MonoBoldSlanted] [\s!file:cmuntb] [\s!features=none-slanted-concrete]
- \stoptypescript
+ \loadfontgoodies[lm]
+ \definefontsynonym [\s!Mono] [LMTypewriter-Regular] [\s!features={\s!none,concrete-text-bold}]
+ \definefontsynonym [\s!MonoBold] [LMTypewriter-Dark] [\s!features={\s!none,concrete-text-bold}]
+ \definefontsynonym [\s!MonoItalic] [LMTypewriter-Italic] [\s!features={\s!none,concrete-text-bold}]
+ \definefontsynonym [\s!MonoSlanted] [LMTypewriter-Oblique] [\s!features={\s!none,concrete-text-bold}]
+ \definefontsynonym [\s!MonoBoldItalic] [LMTypewriter-DarkOblique] [\s!features={\s!none,concrete-text-bold}]
+ \definefontsynonym [\s!MonoBoldSlanted] [LMTypewriter-DarkOblique] [\s!features={\s!none,concrete-text-bold}]
+ \stoptypescript
\starttypescript [\s!math] [concrete]
\checkedmapfontsize[\typescripttwo][\s!script] [.76]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv
index 49b788a734e..70fc8ae8d58 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv
@@ -16,16 +16,16 @@
\definefontfeature[dejavu-condensed-mono][extend=.8]
-\starttypescriptcollection[xxdejavu]
+\starttypescriptcollection[dejavu]
\doifunknownfontfeature {dejavu-math-bold} {\definefontfeature[dejavu-math-bold][boldened]}
\starttypescript [\s!serif] [dejavu] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=\s!default,\s!fallbacks=\s!Serif]
- \definefontsynonym [\s!SerifBold] [\s!name:dejavuserifbold] [\s!features=\s!default,\s!fallbacks=\s!SerifBold]
- \definefontsynonym [\s!SerifItalic] [\s!name:dejavuserifitalic] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic]
- \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifbolditalic] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic]
+ \definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=dejavu-text]
+ \definefontsynonym [\s!SerifBold] [\s!name:dejavuserifbold] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=dejavu-text]
+ \definefontsynonym [\s!SerifItalic] [\s!name:dejavuserifitalic] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=dejavu-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifbolditalic] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=dejavu-text]
\stoptypescript
\starttypescript [\s!sans] [dejavu] [\s!name]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
index 31026df5b21..46c73956f39 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
@@ -65,26 +65,28 @@
\starttypescriptcollection[ebgaramond]
+% \startsetups[ebgaramond]
+% % \setmathfenceparameter \c!alternative{1}%
+% \stopsetups
+
\doifunknownfontfeature {ebgaramond-math-bold} {\definefontfeature[ebgaramond-math-bold][boldened]}
\starttypescript [\s!serif] [ebgaramond]
\setups[font:fallback:serif]
- \definefontsynonym [\s!Serif] [\s!file:ebgaramond-regular] [\s!features=eb-garamond-normal]
- \definefontsynonym [\s!SerifItalic] [\s!file:ebgaramond-italic] [\s!features=eb-garamond-normal]
- \definefontsynonym [\s!SerifBold] [\s!file:ebgaramond-bold] [\s!features=eb-garamond-normal]
- \definefontsynonym [\s!SerifBoldItalic][\s!file:ebgaramond-bolditalic][\s!features=eb-garamond-normal]
+ \definefontsynonym [\s!Serif] [\s!file:ebgaramond-regular] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:ebgaramond-italic] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text]
+ \definefontsynonym [\s!SerifBold] [\s!file:ebgaramond-bold] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text]
+ \definefontsynonym [\s!SerifBoldItalic][\s!file:ebgaramond-bolditalic][\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text]
\definefontsynonym [\s!SerifCaps] [\s!Serif] [\s!features=eb-garamond-smallcaps]
\stoptypescript
-
-
- \starttypescript [\s!sans] [ysabeau]
- % \setups[font:fallback:sans]
- \definefontsynonym [\s!Sans] [\s!file:ysabeau-regular] [\s!features=\s!default]
- \definefontsynonym [\s!SansItalic] [\s!file:ysabeau-italic] [\s!features=\s!default]
- \definefontsynonym [\s!SansBold] [\s!file:ysabeau-bold] [\s!features=\s!default]
- \definefontsynonym [\s!SansBoldItalic][\s!file:ysabeau-bolditalic] [\s!features=\s!default]
- \definefontsynonym [\s!SansCaps] [\s!Sans] [\s!features=ysabeau-smallcaps]
+ \starttypescript [\s!sans] [ysabeau]
+ % \setups[font:fallback:sans]
+ \definefontsynonym [\s!Sans] [\s!file:ysabeau-regular] [\s!features=\s!default]
+ \definefontsynonym [\s!SansItalic] [\s!file:ysabeau-italic] [\s!features=\s!default]
+ \definefontsynonym [\s!SansBold] [\s!file:ysabeau-bold] [\s!features=\s!default]
+ \definefontsynonym [\s!SansBoldItalic][\s!file:ysabeau-bolditalic] [\s!features=\s!default]
+ \definefontsynonym [\s!SansCaps] [\s!Sans] [\s!features=ysabeau-smallcaps]
\stoptypescript
\starttypescript [\s!math] [ebgaramond,ebgaramond-nt]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv
index c536caa0eb7..660b4c58a06 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv
@@ -23,11 +23,11 @@
\doifunknownfontfeature {erewhon-math-bold} {\definefontfeature[erewhon-math-bold][boldened]}
\starttypescript [\s!serif] [erewhon]
- \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default]
- \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default]
+ \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default,\s!goodies=erewhon-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default,\s!goodies=erewhon-text]
\definefontsynonym [\s!SerifSlanted] [\s!file:Erewhon-RegularSlanted][\s!features=\s!default]
- \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default,\s!goodies=erewhon-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default,\s!goodies=erewhon-text]
\definefontsynonym [\s!SerifBoldSlanted][\s!file:Erewhon-BoldSlanted] [\s!features=\s!default]
\stoptypescript
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv
index f4373125083..e682622652d 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv
@@ -14,13 +14,7 @@
\starttypescriptcollection[iwona]
\startsetups[iwona]
- % \setupmathfence [\c!alternative=1]%
- \setmathfenceparameter \c!alternative{1}%
-% \letmathfractionparameter\c!rule\v!symbol
-% \setmathfractionparameter\c!middle{"203E}%
-% \letmathradicalparameter \c!rule\v!symbol
-% \setmathradicalparameter \c!top{\radicalbarextenderuc}%
-% \setmathfenceparameter \c!alternative{1}%
+ \setmathfenceparameter\c!alternative{1}%
\stopsetups
\startsetups[iwona-light] \directsetup{antykwa}\stopsetups
@@ -31,12 +25,17 @@
\startsetups[iwona-medium-cond]\directsetup{antykwa}\stopsetups
\startsetups[iwona-heavy-cond] \directsetup{antykwa}\stopsetups
- \definefontfeature[virtualmath-iwona] [virtualmath][virtualweight=iwona]
- \definefontfeature[virtualmath-iwona-light] [virtualmath][virtualweight=iwona-light]
- \definefontfeature[virtualmath-iwona-medium][virtualmath][virtualweight=iwona-medium]
- \definefontfeature[virtualmath-iwona-heavy] [virtualmath][virtualweight=iwona-heavy]
+ \definefontfeature[virtualmath-iwona] [virtualmath][virtualweight=iwona]
+ \definefontfeature[virtualmath-iwona-light] [virtualmath][virtualweight=iwona-light]
+ \definefontfeature[virtualmath-iwona-medium] [virtualmath][virtualweight=iwona-medium]
+ \definefontfeature[virtualmath-iwona-heavy] [virtualmath][virtualweight=iwona-heavy]
- \starttypescript [\s!sans] [iwona,iwona-light,iwona-medium,iwona-heavy,iwona-cond,iwona-light-cond,iwona-medium-cond,iwona-heavy-cond]
+ \definefontfeature[virtualmath-iwona-nt] [virtualmath][virtualweight=iwona-nt]
+ \definefontfeature[virtualmath-iwona-light-nt] [virtualmath][virtualweight=iwona-light-nt]
+ \definefontfeature[virtualmath-iwona-medium-nt][virtualmath][virtualweight=iwona-medium-nt]
+ \definefontfeature[virtualmath-iwona-heavy-nt] [virtualmath][virtualweight=iwona-heavy-nt]
+
+ \starttypescript [\s!sans] [iwona,iwona-light,iwona-medium,iwona-heavy,iwona-cond,iwona-light-cond,iwona-medium-cond,iwona-heavy-cond,iwona,iwona-light-nt,iwona-medium-nt,iwona-heavy-nt,iwona-cond-nt,iwona-light-cond-nt,iwona-medium-cond-nt,iwona-heavy-cond-nt]
\definefontsynonym [Iwona-Regular] [\s!file:Iwona-Regular] [\s!features=\s!default]
\definefontsynonym [Iwona-Italic] [\s!file:Iwona-Italic] [\s!features=\s!default]
@@ -66,22 +65,41 @@
\starttypescript [\s!math][iwona][\s!all]
\definefontsynonym[\s!MathRoman] [iwonamath@iwona-math]
+ \definefontsynonym[\s!MathRomanBold][iwonamediummath@iwona-medium-math]
\stoptypescript
\starttypescript [\s!math][iwona-light][\s!all]
\definefontsynonym[\s!MathRoman] [iwonalightmath@iwona-light-math]
+ \definefontsynonym[\s!MathRomanBold][iwonamath@kurier-medium-math]
\stoptypescript
\starttypescript [\s!math][iwona-medium][\s!all]
\definefontsynonym[\s!MathRoman] [iwonamediummath@iwona-medium-math]
+ \definefontsynonym[\s!MathRomanBold][kurierheavymath@kurier-heavy-math]
\stoptypescript
\starttypescript [\s!math][iwona-heavy][\s!all]
\definefontsynonym[\s!MathRoman][iwonaheavymath@iwona-heavy-math]
\stoptypescript
- \starttypescript [\s!math] [iwona,iwona-light,iwona-medium,iwona-heavy] [\s!all]
+ \starttypescript [\s!math][iwona-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [iwonamathnt@iwona-math-nt]
+ \definefontsynonym[\s!MathRomanBold][iwonamediummathnt@iwona-medium-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][iwona-light-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [iwonalightmathnt@iwona-light-math-nt]
+ \definefontsynonym[\s!MathRomanBold][iwonamathnt@kurier-medium-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][iwona-medium-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [iwonamediummathnt@iwona-medium-math-nt]
+ \definefontsynonym[\s!MathRomanBold][kurierheavymathnt@kurier-heavy-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][iwona-heavy-nt][\s!all]
+ \definefontsynonym[\s!MathRoman][iwonaheavymathnt@iwona-heavy-math-nt]
+ \stoptypescript
+
+ \starttypescript [\s!math] [iwona,iwona-light,iwona-medium,iwona-heavy-nt,iwona-nt,iwona-light-nt,iwona-medium-nt,iwona-heavy-nt] [\s!all]
\loadfontgoodies[iwona-math]
\stoptypescript
- \starttypescript [\s!sans] [iwona-light] [\s!name]
+ \starttypescript [\s!sans] [iwona-light,iwona-light-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-Light-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-Light-Italic]
@@ -89,7 +107,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-Medium-Italic]
\stoptypescript
- \starttypescript [\s!sans] [iwona] [\s!name]
+ \starttypescript [\s!sans] [iwona,iwona-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-Italic]
@@ -97,7 +115,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-BoldItalic]
\stoptypescript
- \starttypescript [\s!sans] [iwona-medium] [\s!name]
+ \starttypescript [\s!sans] [iwona-medium,iwona-medium-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-Medium-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-Medium-Italic]
@@ -105,7 +123,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic]
\stoptypescript
- \starttypescript [\s!sans] [iwona-heavy] [\s!name]
+ \starttypescript [\s!sans] [iwona-heavy,iwona-heavy-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-Heavy-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-Heavy-Italic]
@@ -113,7 +131,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic]
\stoptypescript
- \starttypescript [\s!sans] [iwona-light-cond] [\s!name]
+ \starttypescript [\s!sans] [iwona-light-cond,iwona-light-cond-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-CondLight-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-CondLight-Italic]
@@ -122,7 +140,7 @@
\stoptypescript
- \starttypescript [\s!sans] [iwona-cond] [\s!name]
+ \starttypescript [\s!sans] [iwona-cond,iwona-cond-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-CondRegular]
\definefontsynonym [\s!SansItalic] [Iwona-CondItalic]
@@ -130,7 +148,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-CondBoldItalic]
\stoptypescript
- \starttypescript [\s!sans] [iwona-medium-cond] [\s!name]
+ \starttypescript [\s!sans] [iwona-medium-cond,iwona-medium-cond-nt] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Iwona-CondMedium-Regular]
\definefontsynonym [\s!SansItalic] [Iwona-CondMedium-Italic]
@@ -138,7 +156,7 @@
\definefontsynonym [\s!SansBoldItalic] [Iwona-CondHeavy-Italic]
\stoptypescript
- \starttypescript [iwona,iwona-light,iwona-heavy,iwona-medium]
+ \starttypescript [iwona,iwona-light,iwona-heavy,iwona-medium,iwona-nt,iwona-light-nt,iwona-heavy-nt,iwona-medium-nt]
\definetypeface[\typescriptone][\s!ss][\s!sans] [\typescriptone] [\s!default]
\definetypeface[\typescriptone][\s!rm][\s!serif][modern] [\s!default]
\definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv
deleted file mode 100644
index da04010166a..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv
+++ /dev/null
@@ -1,179 +0,0 @@
-%D \module
-%D [ file=type-cowotf,
-%D version=2016.09.16,
-%D title=\CONTEXT\ Typescript Macros,
-%D subtitle=Cow Fonts (otf version),
-%D author={Taco Hoekwater \& Hans Hagen},
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%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 cow fonts are a project of Duane Bibby, Hans Hagen and Taco
-%D Hoekwater.
-
-\unprotect
-
-\definefontfeature
- [sheepdigits]
- [mode=node,
- script=latn,
- ss01=yes]
-
-\definefontfeature
- [mathsheepdigits]
- [sheepdigits]
- [mode=base]
-
-\definefontfeature
- [cowslogos]
- [mode=node,
- script=latn,
- ss02=yes,
- dlig=yes]
-
-\definefontfeature
- [cowsligatures]
- [mode=node,
- script=latn,
- dlig=yes]
-
-\definefontfeature
- [cowscolors]
- [mode=node,
- colr=yes,
- ss02=yes,
- dlig=yes]
-
-\definefontfeature
- [cowsdefault]
- [default]
- [mode=node,
- compose=yes]
-
-\definefontfeature
- [sheepdefault]
- [cowsdefault,sheepdigits]
-
-\definefontfeature
- [cowscolored]
- [cowsdefault,cowscolors]
-
-\definefontfeature
- [sheepcolored]
- [sheepdefault,cowscolors]
-
-\starttypescriptcollection[koeielettersot]
-
- \loadfontgoodies[koeielettersot]
-
- \starttypescript [\s!all] [cowsotf]
- \definefontsynonym [Cows] [koeielettersot][\s!features=cowsdefault]
- \definefontsynonym [CowsLogo] [koeielettersot][\s!features=cowslogos]
- \definefontsynonym [CowsMathRoman][koeielettersot][\s!features=mathextra,\s!goodies=koeielettersot]
- \stoptypescript
-
- \starttypescript [\s!all] [koeielettersotf,sheepotf]
- \definefontsynonym [Sheep] [koeielettersot][\s!features=sheepdefault]
- \definefontsynonym [SheepLogo] [koeielettersot][\s!features=cowslogos]
- \definefontsynonym [SheepMathRoman][koeielettersot][\s!features={mathsheepdigits,mathextra},\s!goodies=koeielettersot]
- \stoptypescript
-
-% \definefontsynonym[\s!MathRoman][file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math]
-
- \starttypescript [\s!all] [coloredcowsotf]
- \definefontsynonym [Cows] [koeielettersot][\s!features=cowscolored]
- \definefontsynonym [CowsLogo] [koeielettersot][\s!features=cowslogos]
- \definefontsynonym [CowsMathRoman][koeielettersot][\s!features=mathextra,\s!goodies=koeielettersot]
- \stoptypescript
-
- \starttypescript [\s!all] [coloredsheepotf]
- \definefontsynonym [Sheep] [koeielettersot][\s!features=sheepcolored]
- \definefontsynonym [SheepLogo] [koeielettersot][\s!features=cowslogos]
- \definefontsynonym [SheepMathRoman][koeielettersot][\s!features={mathsheepdigits,mathextra},\s!goodies=koeielettersot]
- \stoptypescript
-
- \starttypescript [\s!serif] [cowsotf,coloredcowsotf]
- \setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [Cows]
- \definefontsynonym [\s!Serif Logo][CowsLogo]
- \stoptypescript
-
- \starttypescript [\s!serif] [koeielettersotf,sheepotf,coloredsheepotf]
- \setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [Sheep]
- \definefontsynonym [\s!Serif Logo][SheepLogo]
- \stoptypescript
-
- \starttypescript [\s!math] [cowsotf,coloredcowsotf]
- \definefontsynonym [\s!MathRoman][CowsMathRoman]
- \enablemathrules % uses \fontclass, for now this way
- \stoptypescript
-
- \starttypescript [\s!math] [koeielettersotf,sheepotf,coloredsheepotf]
- \definefontsynonym [\s!MathRoman][SheepMathRoman]
- \enablemathrules % uses \fontclass, for now this way
- \stoptypescript
-
- \starttypescript [koeieletters,cows,sheep,coloredcows,coloredsheep]
- \definetypeface [\typescriptone][\s!rm][\s!serif][\typescriptone otf][\s!default]
- \definetypeface [\typescriptone][\s!ss][\s!serif][\typescriptone otf][\s!default]
- \definetypeface [\typescriptone][\s!mm][\s!math] [\typescriptone otf][\s!default]
- \definetypeface [\typescriptone][\s!tt][\s!mono] [modern] [\s!default][\s!rscale=0.85]
- \stoptypescript
-
-\stoptypescriptcollection
-
-\protect
-
-\continueifinputfile{type-imp-koeielettersot.mkiv}
-
-\starttext
-
-\setupbodyfont[cows]
-
-% \input tufte
-
-% \stoptext
-
-% \starttext
-
-\loadtypescriptfile[cowotf]
-
-\definecolor[cowred] [r=.50]
-\definecolor[cowgreen] [g=.50]
-\definecolor[cowblue] [b=.50]
-\definecolor[cowyellow][y=.25]
-
-\definefontcolorpalette[cows][cowgreen,cowyellow,cowblue,cowred]
-
-\startluacode
- fonts.handlers.otf.registerpalette("cows", {
- { g = .5 },
- { r = .75, g = .75 },
- { b = .5 },
- { r = .5 },
- })
-\stopluacode
-
-\adaptfontfeature[cowscolored] [colr=cows]
-
-\setupbodyfont[coloredcows,12pt]
-
-\input zapf
-
-\definefontsynonym
- [CowsColored]
- [koeielettersot]
-
-\showotfcomposition
- {koeielettersot*default,cowscolors}
- {1}
- {context}
-
-\scale[width=\textwidth]{\getnamedglyphdirect{CowsColored*default,cowscolors}{contextlogo}}
-\scale[width=\textwidth]{\definedfont[CowsColored*default,cowscolors]context}
-
-\stoptext
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv
index 472619cd953..bc7de3ae75a 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv
@@ -34,10 +34,10 @@
\stoptypescript
\starttypescript [\s!serif] [kpfonts,kpfonts-sans,kpfonts-nt]
- \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf]
- \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-SemiBold.otf]
- \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-SemiboldItalic.otf]
+ \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf][\s!goodies=kpfonts-text]
+ \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-SemiBold.otf][\s!goodies=kpfonts-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf][\s!goodies=kpfonts-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-SemiboldItalic.otf][\s!goodies=kpfonts-text]
\definefontsynonym [\s!SerifSlanted] [\s!SerifItalic]
\definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic]
\stoptypescript
@@ -68,14 +68,14 @@
\starttypescript [\s!serif] [kpfonts-bold]
\setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf]
+ \definefontsynonym [\s!Serif] [\s!file:KpRoman-SemiBold.otf]
\definefontsynonym [\s!SerifBold] [\s!file:KpRoman-Bold.otf]
- \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf]
+ \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-SemiboldItalic.otf]
\definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-BoldItalic.otf]
\stoptypescript
\starttypescript [\s!math] [kpfonts-bold]
- \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Regular.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math]
+ \definefontsynonym [\s!MathRoman] [\s!file:KpMath-SemiBold.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math]
\definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Bold.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math]
\stoptypescript
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv
index 0bf1a43cae0..3f68cbfadd3 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv
@@ -13,12 +13,29 @@
\starttypescriptcollection [kurier]
- \definefontfeature[virtualmath-kurier] [virtualmath][virtualweight=kurier]
- \definefontfeature[virtualmath-kurier-light] [virtualmath][virtualweight=kurier-light]
- \definefontfeature[virtualmath-kurier-medium][virtualmath][virtualweight=kurier-medium]
- \definefontfeature[virtualmath-kurier-heavy] [virtualmath][virtualweight=kurier-heavy]
+ \startsetups[kurier]
+ \setmathfenceparameter\c!alternative{1}%
+ \stopsetups
- \starttypescript [\s!sans] [kurier-light,kurier,kurier-medium]
+ \startsetups[kurier-light] \directsetup{antykwa}\stopsetups
+ \startsetups[kurier-medium] \directsetup{antykwa}\stopsetups
+ \startsetups[kurier-heavy] \directsetup{antykwa}\stopsetups
+ \startsetups[kurier-cond] \directsetup{antykwa}\stopsetups
+ \startsetups[kurier-light-cond] \directsetup{antykwa}\stopsetups
+ \startsetups[kurier-medium-cond]\directsetup{antykwa}\stopsetups
+ \startsetups[kurier-heavy-cond] \directsetup{antykwa}\stopsetups
+
+ \definefontfeature[virtualmath-kurier] [virtualmath][virtualweight=kurier]
+ \definefontfeature[virtualmath-kurier-light] [virtualmath][virtualweight=kurier-light]
+ \definefontfeature[virtualmath-kurier-medium] [virtualmath][virtualweight=kurier-medium]
+ \definefontfeature[virtualmath-kurier-heavy] [virtualmath][virtualweight=kurier-heavy]
+
+ \definefontfeature[virtualmath-kurier-nt] [virtualmath][virtualweight=kurier-nt]
+ \definefontfeature[virtualmath-kurier-light-nt] [virtualmath][virtualweight=kurier-light-nt]
+ \definefontfeature[virtualmath-kurier-medium-nt][virtualmath][virtualweight=kurier-medium-nt]
+ \definefontfeature[virtualmath-kurier-heavy-nt] [virtualmath][virtualweight=kurier-heavy-nt]
+
+ \starttypescript [\s!sans] [kurier-light,kurier,kurier-medium,kurier-heavy,kurier-light-nt,kurier-nt,kurier-medium-nt,kurier-heavy-nt]
\definefontsynonym [Kurier-Light] [\s!file:kurierlightregular] [\s!features=\s!default]
\definefontsynonym [Kurier-LightItalic] [\s!file:kurierlightitalic] [\s!features=\s!default]
\definefontsynonym [Kurier-Regular] [\s!file:kurierregular] [\s!features=\s!default]
@@ -31,7 +48,7 @@
\definefontsynonym [Kurier-HeavyItalic] [\s!file:kurierheavyitalic] [\s!features=\s!default]
\stoptypescript
- \starttypescript [\s!sans] [kurier-lightcond,kurier-cond,kurier-mediumcond]
+ \starttypescript [\s!sans] [kurier-lightcond,kurier-cond,kurier-mediumcond,kurier-lightcond-nt,kurier-cond-nt,kurier-mediumcond-nt]
\definefontsynonym [Kurier-CondLight] [\s!file:kuriercondlightregular] [\s!features=\s!default]
\definefontsynonym [Kurier-CondLightItalic] [\s!file:kuriercondlightitalic] [\s!features=\s!default]
\definefontsynonym [Kurier-CondRegular] [\s!file:kuriercondregular] [\s!features=\s!default]
@@ -49,7 +66,7 @@
\definefontsynonym[\s!MathRomanBold][kuriermediummath@kurier-medium-math]
\stoptypescript
\starttypescript [\s!math][kurier-light][\s!all]
- \definefontsynonym[\s!MathRoman][kurierlightmath@kurier-light-math]
+ \definefontsynonym[\s!MathRoman] [kurierlightmath@kurier-light-math]
\definefontsynonym[\s!MathRomanBold][kuriermath@kurier-math]
\stoptypescript
\starttypescript [\s!math][kurier-medium][\s!all]
@@ -60,11 +77,27 @@
\definefontsynonym[\s!MathRoman][kurierheavymath@kurier-heavy-math]
\stoptypescript
- \starttypescript [\s!math] [kurier,kurier-light,kurier-medium,kurier-heavy] [\s!all]
+ \starttypescript [\s!math][kurier-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [kuriermathnt@kurier-math-nt]
+ \definefontsynonym[\s!MathRomanBold][kuriermediummathnt@kurier-medium-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-light-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [kurierlightmathnt@kurier-light-math-nt]
+ \definefontsynonym[\s!MathRomanBold][kuriermathnt@kurier-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-medium-nt][\s!all]
+ \definefontsynonym[\s!MathRoman] [kuriermediummathnt@kurier-medium-math-nt]
+ \definefontsynonym[\s!MathRomanBold][kurierheavymathnt@kurier-heavy-math-nt]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-heavy-nt][\s!all]
+ \definefontsynonym[\s!MathRoman][kurierheavymathnt@kurier-heavy-math-nt]
+ \stoptypescript
+
+ \starttypescript [\s!math] [kurier,kurier-light,kurier-medium,kurier-heavy,kurier-nt,kurier-light-nt,kurier-medium-nt,kurier-heavy-nt] [\s!all]
\loadfontgoodies[kurier-math]
\stoptypescript
- \starttypescript [\s!sans] [kurier-light]
+ \starttypescript [\s!sans] [kurier-light,kurier-light-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-Light]
\definefontsynonym [\s!SansItalic] [Kurier-LightItalic]
@@ -72,7 +105,7 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-MediumItalic]
\stoptypescript
- \starttypescript [\s!sans] [kurier]
+ \starttypescript [\s!sans] [kurier,kurier-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-Regular]
\definefontsynonym [\s!SansItalic] [Kurier-Italic]
@@ -80,7 +113,7 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-BoldItalic]
\stoptypescript
- \starttypescript [\s!sans] [kurier-medium]
+ \starttypescript [\s!sans] [kurier-medium,kurier-medium-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-Medium]
\definefontsynonym [\s!SansItalic] [Kurier-MediumItalic]
@@ -88,7 +121,15 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-HeavyItalic]
\stoptypescript
- \starttypescript [\s!sans] [kurier-lightcond]
+ \starttypescript [\s!sans] [kurier-heavy,kurier-heavy-nt]
+ \setups[\s!font:\s!fallback:\s!sans]
+ \definefontsynonym [\s!Sans] [Kurier-Heavy]
+ \definefontsynonym [\s!SansItalic] [Kurier-HeavyItalic]
+ \definefontsynonym [\s!SansBold] [Kurier-Heavy]
+ \definefontsynonym [\s!SansBoldItalic] [Kurier-Heavy]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [kurier-lightcond,kurier-lightcond-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-CondLight]
\definefontsynonym [\s!SansItalic] [Kurier-CondLightItalic]
@@ -96,7 +137,7 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-CondMediumItalic]
\stoptypescript
- \starttypescript [\s!sans] [kurier-cond]
+ \starttypescript [\s!sans] [kurier-cond,kurier-cond-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-CondRegular]
\definefontsynonym [\s!SansItalic] [Kurier-CondItalic]
@@ -104,7 +145,7 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-CondBoldItalic]
\stoptypescript
- \starttypescript [\s!sans] [kurier-mediumcond]
+ \starttypescript [\s!sans] [kurier-mediumcond,kurier-mediumcond-nt]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-CondMedium]
\definefontsynonym [\s!SansItalic] [Kurier-CondMediumItalic]
@@ -112,7 +153,7 @@
\definefontsynonym [\s!SansBoldItalic] [Kurier-CondHeavyItalic]
\stoptypescript
- \starttypescript [kurier-light,kurier,kurier-medium,kurier-lightcond,kurier-cond,kurier-mediumcond]
+ \starttypescript [kurier-light,kurier,kurier-medium,kurier-heavy,kurier-lightcond,kurier-cond,kurier-mediumcond,kurier-light,kurier-nt,kurier-medium-nt,kurier-heavy-nt,kurier-lightcond-nt,kurier-cond-nt,kurier-mediumcond-nt]
\definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default]
\definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default]
\definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv
index f5082f7840a..a995bc42fc2 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv
@@ -121,12 +121,12 @@
\starttypescript [\s!serif] [modern,latin-modern]
\loadfontgoodies[lm]
- \definefontsynonym [LMRoman-Regular] [\s!file:lmroman10-regular] [\s!features=\s!default]
- \definefontsynonym [LMRoman-Bold] [\s!file:lmroman10-bold] [\s!features=\s!default]
+ \definefontsynonym [LMRoman-Regular] [\s!file:lmroman10-regular] [\s!features=\s!default,\s!goodies=modern-text]
+ \definefontsynonym [LMRoman-Bold] [\s!file:lmroman10-bold] [\s!features=\s!default,\s!goodies=modern-text]
\definefontsynonym [LMRoman-Demi] [\s!file:lmromandemi10-regular] [\s!features=\s!default]
- \definefontsynonym [LMRoman-Italic] [\s!file:lmroman10-italic] [\s!features=\s!default]
+ \definefontsynonym [LMRoman-Italic] [\s!file:lmroman10-italic] [\s!features=\s!default,\s!goodies=modern-text]
\definefontsynonym [LMRoman-Oblique] [\s!file:lmromanslant10-regular] [\s!features=\s!default]
- \definefontsynonym [LMRoman-BoldItalic] [\s!file:lmroman10-bolditalic] [\s!features=\s!default]
+ \definefontsynonym [LMRoman-BoldItalic] [\s!file:lmroman10-bolditalic] [\s!features=\s!default,\s!goodies=modern-text]
\definefontsynonym [LMRoman-BoldOblique] [\s!file:lmromanslant10-bold] [\s!features=\s!default]
\definefontsynonym [LMRoman-DemiOblique] [\s!file:lmromandemi10-oblique] [\s!features=\s!default]
\definefontsynonym [LMRoman-CapsRegular] [\s!file:lmroman10-CapsRegular] [\s!features=\s!default]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv
index 97e3b3493f3..36d2666f724 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv
@@ -24,11 +24,11 @@
\doifunknownfontfeature {libertinus-math-bold} {\definefontfeature[libertinus-math-bold][boldened]}
\starttypescript [\s!serif] [libertinus]
- \definefontsynonym [LibertinusSerif-Regular] [\s!file:libertinusserif-regular]
- \definefontsynonym [LibertinusSerif-Italic] [\s!file:libertinusserif-italic]
+ \definefontsynonym [LibertinusSerif-Regular] [\s!file:libertinusserif-regular][\s!goodies=libertinus-text]
+ \definefontsynonym [LibertinusSerif-Italic] [\s!file:libertinusserif-italic][\s!goodies=libertinus-text]
\definefontsynonym [LibertinusSerif-Slanted] [\s!file:libertinusserif-italic]
- \definefontsynonym [LibertinusSerif-Bold] [\s!file:libertinusserif-bold]
- \definefontsynonym [LibertinusSerif-BoldItalic] [\s!file:libertinusserif-bolditalic]
+ \definefontsynonym [LibertinusSerif-Bold] [\s!file:libertinusserif-bold][\s!goodies=libertinus-text]
+ \definefontsynonym [LibertinusSerif-BoldItalic] [\s!file:libertinusserif-bolditalic][\s!goodies=libertinus-text]
\definefontsynonym [LibertinusSerif-BoldSlanted] [\s!file:libertinusserif-bolditalic]
\stoptypescript
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv
deleted file mode 100644
index 59d167a1bbf..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv
+++ /dev/null
@@ -1,136 +0,0 @@
-%D \module
-%D [ file=type-imp-lucida-typeone,
-%D version=2010.06.21,
-%D title=\CONTEXT\ Typescript Macros,
-%D subtitle=Lucida,
-%D author=Mojca Miklavec \& Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%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{fonts}{Lucida Type 1 support can be broken due to wrong files!}
-
-\starttypescriptcollection[lucida-typeone]
-
- \starttypescript [\s!serif] [lucida]
- \definefontsynonym [LucidaBright] [\s!name:LucidaBright]
- \definefontsynonym [LucidaBright-Demi] [\s!name:LucidaBright-Demi]
- \definefontsynonym [LucidaBright-Italic] [\s!name:LucidaBright-Italic]
- \definefontsynonym [LucidaBright-DemiItalic] [\s!name:LucidaBright-DemiItalic]
- \definefontsynonym [LucidaBright-Oblique] [\s!name:LucidaBright-Oblique]
- \definefontsynonym [LucidaBrightSmallcaps] [\s!name:LucidaBrightSmallcaps]
- \definefontsynonym [LucidaBrightSmallcaps-Demi] [\s!name:LucidaBrightSmallcaps-Demi]
- \stoptypescript
-
- \starttypescript [\s!sans] [lucida]
- \definefontsynonym [LucidaSans] [\s!name:LucidaSans]
- \definefontsynonym [LucidaSans-Demi] [\s!name:LucidaSans-Demi]
- \definefontsynonym [LucidaSans-Bold] [\s!name:LucidaSans-Bold]
- \definefontsynonym [LucidaSans-Italic] [\s!name:LucidaSans-Italic]
- \definefontsynonym [LucidaSans-DemiItalic] [\s!name:LucidaSans-DemiItalic]
- \definefontsynonym [LucidaSans-BoldItalic] [\s!name:LucidaSans-BoldItalic]
- \stoptypescript
-
- \starttypescript [\s!mono] [lucida]
- \definefontsynonym [LucidaTypewriter] [\s!name:LucidaTypewriter]
- \definefontsynonym [LucidaTypewriterBold] [\s!name:LucidaTypewriterBold]
- \definefontsynonym [LucidaTypewriterOblique] [\s!name:LucidaTypewriterOblique]
- \definefontsynonym [LucidaTypewriterBoldOblique] [\s!name:LucidaTypewriterBoldOblique]
- \stoptypescript
-
- \starttypescript [\s!mono] [lucida]
- \definefontsynonym [LucidaSans-Typewriter] [\s!name:LucidaSans-Typewriter]
- \definefontsynonym [LucidaSans-TypewriterBold] [\s!name:LucidaSans-TypewriterBold]
- \definefontsynonym [LucidaSans-TypewriterOblique] [\s!name:LucidaSans-TypewriterOblique]
- \definefontsynonym [LucidaSans-TypewriterBoldOblique] [\s!name:LucidaSans-TypewriterBoldOblique]
- \stoptypescript
-
- \starttypescript [calligraphy] [lucida]
- \definefontsynonym [LucidaCalligraphy-Italic] [\s!name:LucidaCalligraphy-Italic]
- \stoptypescript
-
- \starttypescript [casual] [lucida]
- \definefontsynonym [LucidaCasual] [\s!name:LucidaCasual]
- \definefontsynonym [LucidaCasual-Italic] [\s!name:LucidaCasual-Italic]
- \stoptypescript
-
- \starttypescript [handwriting] [lucida]
- \definefontsynonym [LucidaHandwriting-Italic] [\s!name:LucidaHandwriting-Italic]
- \stoptypescript
-
- \starttypescript [fax] [lucida]
- \definefontsynonym [LucidaFax] [\s!name:LucidaFax]
- \definefontsynonym [LucidaFax-Demi] [\s!name:LucidaFax-Demi]
- \definefontsynonym [LucidaFax-Italic] [\s!name:LucidaFax-Italic]
- \definefontsynonym [LucidaFax-DemiItalic] [\s!name:LucidaFax-DemiItalic]
- \stoptypescript
-
- \starttypescript [blackletter] [lucida]
- \definefontsynonym [LucidaBlackletter] [\s!name:LucidaBlackletter]
- \stoptypescript
-
- \starttypescript [\s!math] [lucida]
- \loadfontgoodies[lucida-typeone-math]
- \definefontsynonym[\s!MathRoman][lucidamath@lucida-math]
- \stoptypescript
-
- \starttypescript [\s!serif] [lucida] [\s!name]
- \definefontsynonym [\s!Serif] [LucidaBright]
- \definefontsynonym [\s!SerifBold] [LucidaBright-Demi]
- \definefontsynonym [\s!SerifItalic] [LucidaBright-Italic]
- \definefontsynonym [\s!SerifBoldItalic] [LucidaBright-DemiItalic]
- \definefontsynonym [\s!SerifSlanted] [LucidaBright-Oblique]
- \definefontsynonym [\s!SerifBoldSlanted] [LucidaBright-DemiItalic]
- \definefontsynonym [SerifCaps] [LucidaBrightSmallcaps]
- \definefontsynonym [SerifBoldCaps] [LucidaBrightSmallcaps-Demi]
- \stoptypescript
-
- % Lucida Bright Sans
-
- \starttypescript [\s!sans] [lucida] [\s!name]
- \definefontsynonym [\s!Sans] [LucidaSans]
- \definefontsynonym [\s!SansBold] [LucidaSans-Demi]
- \definefontsynonym [\s!SansItalic] [LucidaSans-Italic]
- \definefontsynonym [\s!SansBoldItalic] [LucidaSans-DemiItalic]
- \definefontsynonym [\s!SansSlanted] [LucidaSans-Italic]
- \definefontsynonym [\s!SansBoldSlanted] [LucidaSans-DemiItalic]
- \definefontsynonym [SansCaps] [LucidaSans]
- \stoptypescript
-
- % Lucida Bright Sans Typewriter
-
- \starttypescript [\s!mono] [lucida] [\s!name]
- \definefontsynonym [\s!Mono] [LucidaSans-Typewriter]
- \definefontsynonym [\s!MonoBold] [LucidaSans-TypewriterBold]
- \definefontsynonym [\s!MonoItalic] [LucidaSans-TypewriterOblique]
- \definefontsynonym [\s!MonoBoldItalic] [LucidaSans-TypewriterBoldOblique]
- \definefontsynonym [\s!MonoSlanted] [LucidaSans-TypewriterOblique]
- \definefontsynonym [\s!MonoBoldSlanted] [LucidaSans-TypewriterBoldOblique]
- \definefontsynonym [MonoCaps] [LucidaSans-Typewriter]
- \stoptypescript
-
- % Lucida Calligraphy
-
- \starttypescript [calligraphy] [lucida] [\s!name]
- \definefontsynonym [Calligraphy] [LucidaCalligraphy-Italic]
- \stoptypescript
-
- % Lucida Handwriting
-
- \starttypescript [handwriting] [lucida] [\s!name]
- \definefontsynonym [Handwriting] [LucidaHandwriting-Italic]
- \stoptypescript
-
- \starttypescript [lucida]
- \definetypeface [lucida] [\s!rm] [\s!serif] [lucida] [\s!default] [\s!features=\s!default]
- \definetypeface [lucida] [\s!ss] [\s!sans] [lucida] [\s!default] [\s!features=\s!default]
- \definetypeface [lucida] [\s!tt] [\s!mono] [lucida] [\s!default] [\s!features=\s!none]
- \definetypeface [lucida] [\s!hw] [\s!handwriting] [lucida] [\s!default] [\s!features=\s!default]
- \definetypeface [lucida] [\s!cg] [\s!calligraphy] [lucida] [\s!default] [\s!features=\s!default]
- \definetypeface [lucida] [\s!mm] [\s!math] [lucida] [\s!default]
- \stoptypescript
-
-\stoptypescriptcollection
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv
deleted file mode 100644
index 186854efcf3..00000000000
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv
+++ /dev/null
@@ -1,100 +0,0 @@
-%D \module
-%D [ file=type-lucida-opentype,
-%D version=2011.05.18,
-%D title=\CONTEXT\ Typescript Macros,
-%D subtitle=Lucida Nova Opentype,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% NOTA BENE: class features and goodies get expanded!
-
-\definefontfeature[mathlucida][copymathscripts=yes] % see lfg file
-
-% \definefontfeature[mathlucida][mathlucida][ss04=yes] % now we swap
-
-% \definefontfeature[mathlucida][ss03=yes]
-
-\starttypescriptcollection[lucida-opentype]
-
- \doifunknownfontfeature {lucida-math-bold} {\definefontfeature[lucida-math-bold][boldened][boldmath=yes]}
-
- \starttypescript [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt]
- \loadfontgoodies[lucida-opentype-math]
- \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] [\s!features=\s!default]
- \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] [\s!features=\s!default]
- \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] [\s!features=\s!none]
- \definetypeface [\typescriptone] [\s!hw] [\s!handwriting] [\typescriptone] [\s!default] [\s!features=\s!default]
- \definetypeface [\typescriptone] [\s!cg] [\s!calligraphy] [\typescriptone] [\s!default] [\s!features=\s!default]
- \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default]
- \quittypescriptscanning
- \stoptypescript
-
- \starttypescript [\s!serif] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Serif] [\s!file:LucidaBrightOT.otf]
- \definefontsynonym [\s!SerifBold] [\s!file:LucidaBrightOT-Demi.otf]
- \definefontsynonym [\s!SerifItalic] [\s!file:LucidaBrightOT-Italic.otf]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:LucidaBrightOT-DemiItalic.otf]
- \definefontsynonym [\s!SerifSlanted] [\s!SerifItalic]
- \definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!sans] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Sans] [\s!file:LucidaSansOT.otf]
- \definefontsynonym [\s!SansBold] [\s!file:LucidaSansOT-Demi.otf]
- \definefontsynonym [\s!SansItalic] [\s!file:LucidaSansOT-Italic.otf]
- \definefontsynonym [\s!SansBoldItalic] [\s!file:LucidaSansOT-DemiItalic.otf]
- \definefontsynonym [\s!SansSlanted] [\s!SansItalic]
- \definefontsynonym [\s!SansBoldSlanted] [\s!SansBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!mono] [lucida,lucidaot,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Mono] [\s!file:LucidaSansTypewriterOT.otf]
- \definefontsynonym [\s!MonoBold] [\s!file:LucidaSansTypewriterOT-Bold.otf]
- \definefontsynonym [\s!MonoItalic] [\s!file:LucidaSansTypewriterOT-Oblique.otf]
- \definefontsynonym [\s!MonoBoldItalic] [\s!file:LucidaSansTypewriterOT-BoldOblique.otf]
- \definefontsynonym [\s!MonoSlanted] [\s!MonoItalic]
- \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!mono] [lucidadk,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Mono] [\s!file:LucidaGrandeMonoDK.otf]
- \definefontsynonym [\s!MonoBold] [\s!file:LucidaGrandeMonoDK-Bold.otf]
- \definefontsynonym [\s!MonoItalic] [\s!file:LucidaGrandeMonoDK-Oblique.otf]
- \definefontsynonym [\s!MonoBoldItalic] [\s!file:LucidaGrandeMonoDK-BoldOblique.otf]
- \definefontsynonym [\s!MonoSlanted] [\s!MonoItalic]
- \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!math] [lucida,lucida-nt,lucidaot,lucidaot-nt,lucidadk]
- \checkedmapfontsize[\typescripttwo][\s!script] [.70]
- \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50]
- \stoptypescript
-
- \starttypescript [\s!math] [lucida,lucidaot,lucidadk]
- \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math]
- % \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math]
- \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math]
- \stoptypescript
-
- \starttypescript [\s!math] [lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,lucida:mathextra,mathextra}]
-% \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra}]
- \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra}]
- \stoptypescript
-
- \starttypescript [\s!handwriting] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Handwriting] [\s!file:LucidaHandwritingOT.otf]
- \stoptypescript
-
- \starttypescript [\s!calligraphy] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt]
- \definefontsynonym [\s!Calligraphy] [\s!file:LucidaCalligraphyOT.otf]
- \stoptypescript
-
-\stoptypescriptcollection
-
-\endinput
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv
index 65a84ec5fe2..b6bb26c7690 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv
@@ -25,10 +25,10 @@
\starttypescript [\s!serif] [newcomputermodern] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [\s!file:newcm10-regular.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif]
- \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold]
- \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-italic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic]
+ \definefontsynonym [\s!Serif] [\s!file:newcm10-regular.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-italic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=newcomputermodern-text]
\stoptypescript
\starttypescript [\s!sans] [newcomputermodern] [\s!name]
@@ -55,10 +55,10 @@
\starttypescript [\s!serif] [newcomputermodern-book] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym [\s!Serif] [\s!file:newcm10-book.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif]
- \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold]
- \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-bookitalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic]
+ \definefontsynonym [\s!Serif] [\s!file:newcm10-book.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-bookitalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=newcomputermodern-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=newcomputermodern-text]
\stoptypescript
\starttypescript [\s!sans] [newcomputermodern-book] [\s!name]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv
index 3ac0b72572d..d1bad9a2e9a 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv
@@ -58,10 +58,10 @@
\starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
- \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.ttf] [\s!features=\s!default]
- \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.ttf] [\s!features=\s!default]
- \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.ttf] [\s!features=\s!default]
- \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default]
+ \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text]
+ \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text]
+ \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text]
+ \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default,\s!goodies=stixtwo-text]
\stoptypescript
\starttypescript[stix,stixtwo,xits,stix-nt,stixtwo-nt]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
index a3f3952c787..c4f28fcc4a9 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
@@ -67,10 +67,10 @@
\definetypescriptprefix [n:chancery] [TeXGyreChorus]
\starttypescript [\s!serif,\s!sans] [adventor,bonum,bookman,heros,helvetica,pagella,palatino,schola,schoolbook,termes,times]
- \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Regular] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!default]
- \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Italic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!default]
- \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Bold] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!default]
- \definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldItalic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bolditalic] [\s!features=\s!default]
+ \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Regular] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!default,\s!goodies=texgyre-text]
+ \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Italic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!default,\s!goodies=texgyre-text]
+ \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Bold] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!default,\s!goodies=texgyre-text]
+ \definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldItalic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bolditalic] [\s!features=\s!default,\s!goodies=texgyre-text]
\definefontsynonym [\typescriptprefix{n:\typescripttwo}-Caps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!smallcaps]
\definefontsynonym [\typescriptprefix{n:\typescripttwo}-ItalicCaps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!smallcaps]
\definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldCaps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!smallcaps]
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv
index 6b6e5fc4e5f..7d1a88241bd 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv
@@ -19,11 +19,11 @@
\doifunknownfontfeature {xcharter-math-bold} {\definefontfeature[xcharter-math-bold][boldened]}
\starttypescript [\s!serif] [xcharter] [\s!name]
- \definefontsynonym [\s!Serif] [\s!file:XCharter-Roman] [\s!features=\s!default]
- \definefontsynonym [\s!SerifItalic] [\s!file:XCharter-Italic] [\s!features=\s!default]
+ \definefontsynonym [\s!Serif] [\s!file:XCharter-Roman] [\s!features=\s!default,\s!goodies=xcharter-text]
+ \definefontsynonym [\s!SerifItalic] [\s!file:XCharter-Italic] [\s!features=\s!default,\s!goodies=xcharter-text]
\definefontsynonym [\s!SerifSlanted] [\s!file:XCharter-Slanted] [\s!features=\s!default]
- \definefontsynonym [\s!SerifBold] [\s!file:XCharter-Bold] [\s!features=\s!default]
- \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifBold] [\s!file:XCharter-Bold] [\s!features=\s!default,\s!goodies=xcharter-text]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default,\s!goodies=xcharter-text]
\definefontsynonym [\s!SerifBoldSlanted][\s!file:XCharter-BoldSlanted][\s!features=\s!default]
\stoptypescript
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg
index 1ff5d41d8b6..cc4e992d465 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg
@@ -39,6 +39,9 @@ return {
presets.moveintegrals { factor = 1.5 },
presets.wipeitalics { },
{
+ tweak = "checkaccents",
+ },
+ {
tweak = "kerns",
list = {
[0x002F] = { topleft = -0.15, bottomright = -0.15 },
@@ -66,6 +69,9 @@ return {
}
},
{
+ tweak = "flattenaccents",
+ },
+ {
tweak = "checkspacing",
},
{
@@ -77,6 +83,31 @@ return {
{
tweak = "addrules",
},
+{
+ tweak = "replacerules",
+ -- minus = {
+ -- height = 0.188,
+ -- yoffset = 0.812,
+ -- leftoffset = 0.2,
+ -- rightoffset = 0.2,
+ -- },
+ fraction = {
+ height = .188,
+ yoffset = .812,
+ },
+ radical = {
+ height = .188,
+ yoffset = .812,
+ leftoffset = 0.95,
+ rightoffset = 0.95,
+ -- leftoverlap = 0.1, -- Daniel will fix(!)
+ -- yscale = 0.8, -- no scaling
+ },
+ stacker = {
+ height = .188,
+ yoffset = .812,
+ },
+},
{
tweak = "addactuarian",
},
@@ -86,6 +117,9 @@ return {
{
tweak = "addprimed",
},
+-- {
+-- tweak = "addarrows",
+-- },
{
tweak = "addfourier",
variant = 2,
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg
new file mode 100644
index 00000000000..a836695fd24
--- /dev/null
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg
@@ -0,0 +1,62 @@
+return {
+ name = "xcharter-text",
+ version = "1.00",
+ comment = "Goodies that complement Xcharter.",
+ author = "Mikael Sundqvist & Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "XCharter-Roman",
+ "XCharter-Bold",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 125,
+ ["}"] = 125,
+ ["]"] = 125,
+ -- ["|"] = 100,
+ ["\\"] = 50,
+ ["*"] = 50,
+ ["?"] = 50,
+ ["!"] = 50,
+ ["\\"] = 125,
+ },
+ }
+ },
+ {
+ name = "kern", -- adds to kerns
+ type = "kern",
+ fonts = {
+ "XCharter-Italic",
+ "XCharter-BoldItalic",
+ },
+ data = {
+ ["f"] = {
+ [")"] = 150,
+ ["}"] = 150,
+ ["]"] = 150,
+ ["\\"] = 125,
+ ["!"] = 100,
+ ["?"] = 100,
+ ["*"] = 100,
+ ["@"] = 100,
+ },
+ ["("] = {
+ ["f"] = 100,
+ },
+ ["{"] = {
+ ["f"] = 150,
+ },
+ ["["] = {
+ ["f"] = 100,
+ },
+ ["|"] = {
+ ["f"] = 130,
+ },
+ }
+ },
+ }
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-bengali.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-bengali.mkxl
index 84a0b6402f0..84a0b6402f0 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-bengali.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-bengali.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-braille.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-braille.mkxl
index 17209d50c17..17209d50c17 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-braille.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-braille.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-devanagari.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-devanagari.mkxl
index 4fb082094eb..4fb082094eb 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-devanagari.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-devanagari.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-euler.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-euler.mkxl
index a2e066f6b36..a2e066f6b36 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-euler.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-euler.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-gujarati.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-gujarati.mkxl
index d7f3f707284..d7f3f707284 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-gujarati.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-gujarati.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-indic.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-indic.mkxl
index aeda0833768..aeda0833768 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-indic.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-indic.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-kannada.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-kannada.mkxl
index 4838075b2e6..4838075b2e6 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-kannada.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-kannada.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-malayalam.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-malayalam.mkxl
index 67a35d47258..67a35d47258 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-malayalam.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-malayalam.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-tamil.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-tamil.mkxl
index 90516365efa..90516365efa 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-tamil.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-tamil.mkxl
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-telugu.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-telugu.mkxl
index 33d07664c75..33d07664c75 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-telugu.mkxl
+++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-telugu.mkxl
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv
index 221c074adca..61df89cfd0a 100644
--- a/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv
+++ b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv
@@ -39,9 +39,10 @@
\permanent\protected\def\starttikzinput
{\pushcatcodetable
\setcatcodetable\texcatcodes
- \catcode`\@=11
- \catcode`\|=12
- \catcode`\!=12
+ \catcode`\@=11\relax
+ \catcode`\|=12\relax
+ \catcode`\!=12\relax
+ \catcode`\~=13\relax
\relax}
\permanent\protected\def\stoptikzinput
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex b/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex
index ab2b98a56fe..d04706ca635 100644
--- a/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex
+++ b/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex
@@ -177,10 +177,16 @@
\logo [LMX] {lmx}
\logo [LPEG] {lpeg}
\logo [LUA] {Lua}
-\logo [LUAJIT] {Lua\wordboundary JIT}
-\logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix}
-\logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix}
-\logo [LUATEX] {Lua\wordboundary\TeXsuffix}
+% \logo [LUAJIT] {Lua\wordboundary JIT}
+% \logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix}
+% \logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix}
+% \logo [LUATEX] {Lua\wordboundary\TeXsuffix}
+% \logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun}
+\logo [LUAJIT] {Lua\-JIT}
+\logo [LUAJITTEX] {Lua\-jit\-\TeXsuffix}
+\logo [LUAMETATEX] {\Lua\-Meta\-\TeXsuffix}
+\logo [LUATEX] {Lua\-\TeXsuffix}
+\logo [LUAMETAFUN] {\Lua\-\MetaFun}
\logo [LUATOOLS] {luatools}
\logo [MACOSX] {MacOSX}
%logo [MACROTEX] {Macro\TeXsuffix}
@@ -189,7 +195,6 @@
\logo [MAPS] {Maps}
\logo [MATHML] {MathML}
\logo [METAFONT] {\MetaFont}
-\logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun}
\logo [METAFUN] {\MetaFun}
\logo [METAPOST] {\MetaPost}
\logo [METATEX] {Meta\TeXsuffix}
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua
index 65725594bcc..ed034b882e6 100644
--- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua
+++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['s-fonts-tables'] = {
license = "see context related readme files"
}
+-- Thsi file needs to be updated to LMTX!
+
moduledata.fonts = moduledata.fonts or { }
moduledata.fonts.tables = moduledata.fonts.tables or { }
@@ -29,7 +31,7 @@ local setlink = nodes.setlink
local hpack = nodes.hpack
local applyvisuals = nodes.applyvisuals
-local lefttoright_code = nodes.dirvalues.lefttoright
+local lefttoright_code = (tex.directioncodes and tex.directioncodes.lefttoright) or nodes.dirvalues.lefttoright -- LMTX
local handle_positions = fonts.handlers.otf.datasetpositionprocessor
local handle_injections = nodes.injections.handler
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv
index d061179eb90..16ce91748d4 100644
--- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -132,8 +132,11 @@
% \showfontvariations[font=file:goldmansanscdvf_wght.ttf]
% \stoptext
-\showfontvariations
- [font=file:nupuram-vf.otf,features=malayalam-two,sample=test നൂപുരം]
+% \showfontvariations
+% [font=file:nupuram-vf.otf,features=malayalam-two,sample=test നൂപുരം]
% [font=file:nupuram-vf.ttf,features=malayalam-two,sample=test നൂപുരം]
+\showfontvariations
+ [font=file:robotoflex.ttf]
+
\stoptext
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua b/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua
index fdcab141c37..f158065aaa8 100644
--- a/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua
+++ b/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua
@@ -6,15 +6,14 @@ if not modules then modules = { } end modules ['x-asciimath'] = {
license = "see context related readme files"
}
---[[ldx--
-<p>Some backgrounds are discussed in <t>x-asciimath.mkiv</t>. This is a third version. I first
-tried a to make a proper expression parser but it's not that easy. First we have to avoid left
-recursion, which is not that trivial (maybe a future version of lpeg will provide that), and
-second there is not really a syntax but a mix of expressions and sequences with some fuzzy logic
-applied. Most problematic are fractions and we also need to handle incomplete expressions. So,
-instead we (sort of) tokenize the string and then do some passes over the result. Yes, it's real
-ugly and unsatisfying code mess down here. Don't take this as an example.</p>
---ldx]]--
+-- Some backgrounds are discussed in 'x-asciimath.mkiv'. This is a third version. I
+-- first tried a to make a proper expression parser but it's not that easy. First we
+-- have to avoid left recursion, which is not that trivial (maybe a future version
+-- of lpeg will provide that), and second there is not really a syntax but a mix of
+-- expressions and sequences with some fuzzy logic applied. Most problematic are
+-- fractions and we also need to handle incomplete expressions. So, instead we (sort
+-- of) tokenize the string and then do some passes over the result. Yes, it's real
+-- ugly and unsatisfying code mess down here. Don't take this as an example.
-- todo: spaces around all elements in cleanup?
-- todo: filter from files listed in tuc file
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex
index 1dd06b8b221..666f6b00b79 100644
--- a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex
+++ b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex
@@ -4,6 +4,8 @@
\writestatus{loading}{ConTeXt User Module / Pgfplots}
+\usemodule[tikz]
+
\tikzinputfile{pgfplots.revision.tex}
\usetikzlibrary[plotmarks]
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
index 21544d14e59..29ef764c982 100644
--- a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
+++ b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
@@ -36,15 +36,36 @@
\protect
\fi
+\newcatcodetable \tikzcatcodes
+
+\startcatcodetable \tikzcatcodes
+ \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\atsignasciicode \lettercatcode
+ \catcode\exclamationmarkasciicode \othercatcode
+ \catcode\questionmarkasciicode \lettercatcode
+ \catcode\tildeasciicode \activecatcode
+ \catcode\barasciicode \othercatcode
+\stopcatcodetable
+
\permanent\protected\def\starttikzinput
{\pushoverloadmode
\pushcatcodetable
- \setcatcodetable\texcatcodes
+ \setcatcodetable\tikzcatcodes
\pushmacro\meaning
\let\meaning\meaningless
- \catcode`\@=11
- \catcode`\|=12
- \catcode`\!=12
\autoparagraphmode\zerocount}
\permanent\protected\def\stoptikzinput
@@ -87,6 +108,7 @@
\permanent\protected\def\starttikzpicture
{\dontleavehmode
\hcontainer\bgroup
+ \setcatcodetable\tikzcatcodes
\the\everytikzpicture
\autoparagraphmode\zerocount
\pushmacro\meaning
@@ -123,8 +145,9 @@
\let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture
\let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox
-\let\normalusepgfmodule\usepgfmodule
-\let\normalusepgflibrary\usepgflibrary
+\let\normalusepgfmodule \usepgfmodule
+\let\normalusepgflibrary \usepgflibrary
+\let\normalusetikzlibrary\usetikzlibrary
\tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used
{\starttikzinput
@@ -136,6 +159,11 @@
\normalusepgflibrary[#1#2]%
\stoptikzinput}
+\tolerant\protected\def\usetikzlibrary[#1]#;#2% somehow both variants are used
+ {\starttikzinput
+ \normalusetikzlibrary[#1#2]%
+ \stoptikzinput}
+
\usepgfmodule[shapes]
\usepgfmodule[plot]
\usepgfmodule[matrix]
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl
index 1b5ebed416e..ab54dd29177 100644
--- a/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl
+++ b/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl
@@ -1,5 +1,5 @@
%D \module
-%D [ file=s-math-atoms.mksl,
+%D [ file=s-math-atoms.mkxl,
%D version=2022.02.13,
%D title=\CONTEXT\ Style File,
%D subtitle=Show Math Atom Spacing,
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl
new file mode 100644
index 00000000000..35f2a6248db
--- /dev/null
+++ b/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl
@@ -0,0 +1,112 @@
+%D \module
+%D [ file=s-math-tests.mkxl,
+%D version=2023.04.03,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Some Math Tests,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\continueifinputfile{s-math-tests.mkxl}
+
+%D Here we collect some tests that later will become proper macros.
+
+\starttext
+
+\startbuffer
+ \ruledhbox \bgroup \im {
+ \dostepwiserecurse{`A}{`Z}{1}{
+ \blackrule[color=darkgray,height=\the\Umathflattenedaccentbaseheight\textstyle,depth=0pt,width=0.05ts]
+ \hat{\char#1}
+ }
+ }\egroup
+\stopbuffer
+
+\startTEXpage[offset=1ts]
+ \showglyphs
+% \switchtobodyfont[modern] \getbuffer\par
+% \blank
+% \switchtobodyfont[pagella] \getbuffer\par
+% \switchtobodyfont[termes] \getbuffer\par
+% \switchtobodyfont[schola] \getbuffer\par
+% \blank
+% \switchtobodyfont[ebgaramon-nt]\getbuffer\par
+% \switchtobodyfont[ebgaramond] \getbuffer\par
+% \blank
+% \switchtobodyfont[erewhon] \getbuffer\par
+% \switchtobodyfont[kpfonts] \getbuffer\par
+% \switchtobodyfont[xcharter] \getbuffer\par
+% \switchtobodyfont[concrete] \getbuffer\par
+% \switchtobodyfont[libertinus] \getbuffer\par
+% \switchtobodyfont[stixtwo] \getbuffer\par
+% \switchtobodyfont[lucida-nt] \getbuffer\par
+ \switchtobodyfont[lucida]
+ % 8.67123pt default
+ \bgroup
+ \bitwiseflip\mathfontcontrol\ignoreflataccentsmathcontrolcode
+ \appendtoks
+ \Umathflattenedaccentbaseheight\textstyle8.67123pt
+ \to\everymathematics
+ \getbuffer\par
+ \egroup
+ \bgroup
+ \appendtoks
+ \Umathflattenedaccentbaseheight\textstyle8.67123pt
+ \to\everymathematics
+ \getbuffer\par
+ \egroup
+ % 8.51532pt fixed
+ \bgroup
+ \appendtoks
+ \Umathflattenedaccentbaseheight\textstyle8.51532pt
+ \to\everymathematics
+ \getbuffer\par
+ \egroup
+% \switchtobodyfont[libertinus] \getbuffer\par
+\stopTEXpage
+
+\startTEXpage[offset=1ts]
+
+ \definefontfeature[mathextra][]
+% \definefontfeature[mathextra][ss10=yes,ss06=yes]
+
+ \setupbodyfont[ebgaramond]
+
+ \bgroup
+ \setupmathematics[stylealternative=]
+ \im{\hbar^{\hbar^{\hbar}}}
+ \egroup
+ \bgroup
+ \setupmathematics[stylealternative={hbar}]
+ \im{\hbar^{\hbar^{\hbar}}}
+ \egroup
+ \bgroup
+ \setupmathematics[stylealternative={hbar,outbendingh}]
+ \im{\hbar^{\hbar^{\hbar}}}
+ \egroup
+ \bgroup
+ \setupmathematics[stylealternative={outbendingh}]
+ \im{\hbar^{\hbar^{\hbar}}}
+ \egroup
+
+ \definefontfeature[mathextra][]
+% \definefontfeature[mathextra][cv03=yes]
+
+ \setupbodyfont[stixtwo]
+
+ \bgroup
+ \setupmathematics[stylealternative=]
+ \im{\emptyset^{\emptyset^{\emptyset}}}
+ \egroup
+ \bgroup
+ \setupmathematics[stylealternative={emptyset}]
+ \im{\emptyset^{\emptyset^{\emptyset}}}
+ \egroup
+
+\stopTEXpage
+
+\stoptext
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl
index 6058590004f..597af1a7b20 100644
--- a/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl
+++ b/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl
@@ -27,6 +27,8 @@
% todo: and how about metapost ... i need a mp.hashtokens in order to do that and I also
% need to think about protection there (tricky as we use an avl hash there)
%
+% todo: when possible replace \p_whatever_key by \p_key
+%
% public undefined : SmallCaps scitebuffer sciteinlinebuffer
% single todos : \ \- \\ \_
@@ -48,20 +50,24 @@
[A4,landscape]
[A4,landscape]
+\bitwiseflip \normalizelinemode \discardzerotabskipsnormalizecode
+
\starttext
\startluacode
if tex.modes.texmacros then
- local context = context
- local ctx_NC = context.NC
- local ctx_NR = context.NR
- local ctx_bold = context.bold
- local ctx_verb = context.verbatim
+ local context = context
+ local ctx_NC = context.NC
+ local ctx_NR = context.NR
+ local ctx_bold = context.bold
+ local ctx_verb = context.verbatim
+ local ctx_escaped = context.escaped
local find = string.find
local gsub = string.gsub
+ local gmatch = string.gmatch
local create = tokens.create
local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]"
@@ -109,26 +115,82 @@
local data = scripts.interface.editor("data")
local files = data and data.common and data.common.filenames or { }
local macros = { }
+ local registers = { }
+ local implements = { }
local flagged = 0
local total = 0
local list = tex.hashtokens()
local all = not tex.modes.notmarked
local everything = tex.modes.everything
+ local getmacro = token.getmacro
local fmtname = resolvers.locateformat("cont-en.fmt")
if fmtname then
local logname = file.replacesuffix(fmtname,"log")
- for filename in string.gmatch(io.loaddata(logname),"fullname=(%S+)") do
+ for filename in gmatch(io.loaddata(logname),"fullname=(%S+)") do
local s = file.suffix(filename)
local b = file.basename(filename)
if s ~= "lua" and s ~= "lmt" then
local d = io.loaddata(filename)
- for m in string.gmatch(d,"\n[\\a-z]*[exg]*def\\([a-zA-Z_]+)") do
+ -- we could make a nice lpeg
+ for m in gmatch(d,"\n[\\a-z]*[exg]*def\\([a-zA-Z_]+)") do
+ macros[m] = b
+ end
+ for m in gmatch(d,"\n[\\a-z]*[g]*let\\([a-zA-Z_]+)") do
+ macros[m] = b
+ end
+ for m in gmatch(d,"\n\\lettonothing\\([a-zA-Z_]+)") do
+ macros[m] = b
+ end
+ for m in gmatch(d,"\n\\integerdef\\([a-zA-Z_]+)") do
+ macros[m] = b
+ end
+ for m in gmatch(d,"\n\\dimensiondef\\([a-zA-Z_]+)") do
+ macros[m] = b
+ end
+ for m in gmatch(d,"\n\\gluespecdef\\([a-zA-Z_]+)") do
macros[m] = b
end
- for m in string.gmatch(d,"\n[\\a-z]*[g]*let\\([a-zA-Z_]+)") do
+ for m in gmatch(d,"\n\\mugluespecdef\\([a-zA-Z_]+)") do
macros[m] = b
end
+ for m in gmatch(d,"\n\\newinteger\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newdimension\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newgluespec\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newmugluespec\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newconditional\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newtoks\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newcount\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newdimen\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newskip\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ for m in gmatch(d,"\n\\newmuskip\\([a-zA-Z_]+)") do
+ registers[m] = b
+ end
+ elseif b ~= "char-def.lua" then
+ local d = io.loaddata(filename)
+ -- maybe inside implement { }
+ -- maybe get file from debug interface
+ for m in gmatch(d,'\n +name += +"([a-zA-Z_]+)",') do
+ implements[m] = b
+ end
end
end
end
@@ -136,8 +198,7 @@
table.sort(list)
local function show(visible, check)
- -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" }
- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" }
+ context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|l|l|l|" }
for i=1,#list do
local k = list[i]
if check(k) then
@@ -148,6 +209,8 @@
local permanent = v.permanent and "permanent"
local primitive = v.primitive and "primitive"
local instance = v.instance and "instance"
+ local constant = v.constant and "constant"
+ local untraced = v.untraced and "untraced"
local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations
local whatever = find(k,"^[a-z][a-z][a-z]+_")
local cscommand = gsub(v.cmdname or "","_"," ")
@@ -156,7 +219,7 @@
if everything or ((all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]")) then
local parameters = v.parameters
local noaligned = v.noaligned and "noaligned"
- local filename = files[k] or macros[k]
+ local filename = files[k] or macros[k] or implements[k] or registers[k] or implements[gsub(k,"^clf_","")]
local csname = context.escape(k)
if undefined then
marked = "?"
@@ -165,7 +228,7 @@
ctx_NC() if primitive then ctx_bold(csname) else
ctx_verb(csname) end
ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end
- ctx_NC() if undefined then context.red(false) end
+ ctx_NC() if undefined then context.red(false) end
context(cscommand)
ctx_NC() if primitive then context(primitive) end
ctx_NC() if permanent then context(permanent) end
@@ -174,7 +237,10 @@
ctx_NC() if mutable then context(mutable) end
ctx_NC() if instance then context(instance) end
ctx_NC() if noaligned then context(noaligned) end
+ ctx_NC() if constant then context(constant) end
+ ctx_NC() if untraced then context(untraced) end
ctx_NC() if filename then context(hashnames[filename]) end
+ ctx_NC() if parameters then if parameters > 0 then ctx_escaped(getmacro(csname,false,true)) end end
ctx_NC() ctx_NR()
end
if visible then
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl
new file mode 100644
index 00000000000..6766a7a0927
--- /dev/null
+++ b/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl
@@ -0,0 +1,72 @@
+%D \module
+%D [ file=s-text-tests.mkxl,
+%D version=2023.04.11,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Some Text Tests,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\continueifinputfile{s-text-tests.mkxl}
+
+%D Here we collect some tests that later will become proper macros.
+
+\usebodyfont[bonum]
+\usebodyfont[cambria]
+\usebodyfont[concrete]
+\usebodyfont[dejavu]
+\usebodyfont[ebgaramond]
+\usebodyfont[erewhon]
+\usebodyfont[kpfonts]
+\usebodyfont[libertinus]
+\usebodyfont[lucida]
+\usebodyfont[minion]
+\usebodyfont[modern]
+\usebodyfont[newcomputermodern-book]
+\usebodyfont[pagella]
+\usebodyfont[schola]
+\usebodyfont[stixtwo]
+\usebodyfont[termes]
+\usebodyfont[xcharter]
+
+\starttext
+
+\startbuffer
+(a) (f) [f] \{f\} f: f; f! f? f\textbar f* f@ f& f/ f\textbackslash
+\stopbuffer
+
+\starttexdefinition ugly #1
+ \startsubject[title=#1]
+ \start
+ \switchtobodyfont[#1]
+ {\tf \getbuffer}\blank[small]
+ {\bf \getbuffer}\blank[small]
+ {\it \getbuffer}\blank[small]
+ {\bi \getbuffer}\blank[big]
+ \stop
+ \stopsubject
+\stoptexdefinition
+
+\ugly{bonum}
+\ugly{cambria}
+\ugly{concrete}
+\ugly{dejavu}
+\ugly{ebgaramond}
+\ugly{erewhon}
+\ugly{kpfonts}
+\ugly{libertinus}
+\ugly{lucida}
+\ugly{minion}
+\ugly{modern}
+\ugly{newcomputermodern-book}
+\ugly{pagella}
+\ugly{schola}
+\ugly{stixtwo}
+\ugly{termes}
+\ugly{xcharter}
+
+\stoptext
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua
index 614793314d7..5441fa0043b 100644
--- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2023-03-10 12:15
+-- merge date : 2023-05-05 18:36
do -- begin closure to overcome local limits and interference
@@ -21334,7 +21334,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
-otf.version=3.132
+otf.version=3.133
otf.cache=containers.define("fonts","otl",otf.version,true)
otf.svgcache=containers.define("fonts","svg",otf.version,true)
otf.pngcache=containers.define("fonts","png",otf.version,true)
@@ -31740,7 +31740,11 @@ local function addfeature(data,feature,specifications,prepareonly)
local list=askedsteps[i]
local coverage=nil
local format=nil
- if featuretype=="substitution" then
+if type(list)=="function" then
+ list=list(data,specification,list,i)
+end
+ if not list then
+ elseif featuretype=="substitution" then
category="gsub"
coverage=(mapping and list) or prepare_substitution(list,featuretype,nocheck)
elseif featuretype=="ligature" then
@@ -37807,7 +37811,7 @@ local fonts=fonts
local otf=fonts.handlers.otf
local registerotffeature=otf.features.register
local addotffeature=otf.addfeature
-local specification={
+local tlig={
type="ligature",
order={ "tlig" },
prepend=true,
@@ -37816,12 +37820,17 @@ local specification={
[0x2014]={ 0x002D,0x002D,0x002D },
},
}
-addotffeature("tlig",specification)
-registerotffeature {
- name="tlig",
- description="tex ligatures",
+local tquo={
+ type="ligature",
+ order={ "tquo" },
+ prepend=true,
+ data={
+ [0x201C]={ 0x0060,0x0060 },
+ [0x201D]={ 0x0027,0x0027 },
+ [0x201E]={ 0x002C,0x002C },
+ },
}
-local specification={
+local trep={
type="substitution",
order={ "trep" },
prepend=true,
@@ -37829,11 +37838,12 @@ local specification={
[0x0027]=0x2019,
},
}
-addotffeature("trep",specification)
-registerotffeature {
- name="trep",
- description="tex replacements",
-}
+addotffeature("trep",trep)
+addotffeature("tlig",tlig)
+addotffeature("tquo",tquo)
+registerotffeature { name="tlig",description="tex ligatures" }
+registerotffeature { name="tquo",description="tex quotes" }
+registerotffeature { name="trep",description="tex replacements" }
local anum_arabic={
[0x0030]=0x0660,
[0x0031]=0x0661,
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua
index 1839c44ee00..99a23b03c54 100644
--- a/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua
+++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua
@@ -6,19 +6,14 @@ if not modules then modules = { } end modules ['luatex-mplib'] = {
license = "public domain",
}
---[[ldx--
-<p>This module is a stripped down version of libraries that are used
-by <l n='context'/>. It can be used in other macro packages and/or
-serve as an example. Embedding in a macro package is upto others and
-normally boils down to inputting <t>supp-mpl.tex</t>.</p>
---ldx]]--
+-- This module is a stripped down version of libraries that are used by ConTeXt. It
+-- can be used in other macro packages and/or serve as an example. Embedding in a
+-- macro package is upto others and normally boils down to inputting 'supp-mpl.tex'.
if metapost and metapost.version then
- --[[ldx--
- <p>Let's silently quit and make sure that no one loads it
- manually in <l n='context'/>.</p>
- --ldx]]--
+ -- Let's silently quit and make sure that no one loads it manually in
+ -- ConTeXt.
else
@@ -29,27 +24,25 @@ else
local mplib = require ('mplib')
local kpse = require ('kpse')
- --[[ldx--
- <p>We create a namespace and some variables to it. If a namespace is
- already defined it wil not be initialized. This permits hooking
- in code beforehand.</p>
+ -- We create a namespace and some variables to it. If a namespace is already
+ -- defined it wil not be initialized. This permits hooking in code beforehand.
- <p>We don't make a format automatically. After all, distributions
- might have their own preferences and normally a format (mem) file will
- have some special place in the <l n='tex'/> tree. Also, there can already
- be format files, different memort settings and other nasty pitfalls that
- we don't want to interfere with. If you want, you can define a function
- <t>metapost.make(name,mem_name) that does the job.</t></p>
- --ldx]]--
+ -- We don't make a format automatically. After all, distributions might have
+ -- their own preferences and normally a format (mem) file will have some
+ -- special place in the TeX tree. Also, there can already be format files,
+ -- different memort settings and other nasty pitfalls that we don't want to
+ -- interfere with. If you want, you can define a function
+ --
+ -- metapost.make (name,mem_name)
+ --
+ -- that does the job.
metapost = metapost or { }
metapost.version = 1.00
metapost.showlog = metapost.showlog or false
metapost.lastlog = ""
- --[[ldx--
- <p>A few helpers, taken from <t>l-file.lua</t>.</p>
- --ldx]]--
+ -- A few helpers, taken from 'l-file.lua'.
local file = file or { }
@@ -61,10 +54,7 @@ else
return (string.gsub(filename,"%.[%a%d]+$",""))
end
- --[[ldx--
- <p>We use the <l n='kpse'/> library unless a finder is already
- defined.</p>
- --ldx]]--
+ -- We use the KPSE library unless a finder is already defined.
local mpkpse = kpse.new("luatex","mpost")
@@ -76,10 +66,9 @@ else
end
end
- --[[ldx--
- <p>You can use your own reported if needed, as long as it handles multiple
- arguments and formatted strings.</p>
- --ldx]]--
+ -- You can use your own reported if needed, as long as it handles multiple
+ -- arguments and formatted strings.
+
metapost.report = metapost.report or function(...)
if logs.report then
@@ -89,11 +78,9 @@ else
end
end
- --[[ldx--
- <p>The rest of this module is not documented. More info can be found in the
- <l n='luatex'/> manual, articles in user group journals and the files that
- ship with <l n='context'/>.</p>
- --ldx]]--
+ -- The rest of this module is not documented. More info can be found in the
+ -- LuaTeX manual, articles in user group journals and the files that ship
+ -- with ConTeXt.
function metapost.resetlastlog()
metapost.lastlog = ""
@@ -329,9 +316,8 @@ else
return true -- done
end
- --[[ldx--
- <p>We removed some message and tracing code. We might even remove the flusher</p>
- --ldx]]--
+ -- We removed some message and tracing code. We might even remove the
+ -- flusher.
local function pdf_startfigure(n,llx,lly,urx,ury)
tex.sprint(format("\\startMPLIBtoPDF{%s}{%s}{%s}{%s}",llx,lly,urx,ury))
@@ -443,9 +429,7 @@ else
return t
end
- --[[ldx--
- <p>Support for specials has been removed.</p>
- --ldx]]--
+ -- Support for specials has been removed.
function metapost.flush(result,flusher)
if result then
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua
index 8faa0b47e69..b1debcd5c0b 100644
--- a/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua
+++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua
@@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luatex-preprocessor'] = {
license = "see context related readme files"
}
---[[ldx
-<p>This is a stripped down version of the preprocessor. In
-<l n='context'/> we have a bit more, use a different logger, and
-use a few optimizations. A few examples are shown at the end.</p>
---ldx]]
+-- This is a stripped down version of the preprocessor. In ConTeXt we have a bit
+-- more, use a different logger, and use a few optimizations. A few examples are
+-- shown at the end.
local rep, sub, gmatch = string.rep, string.sub, string.gmatch
local insert, remove = table.insert, table.remove
@@ -99,10 +97,6 @@ local parser = lpeg.Cs { "converter",
converter = (lpeg.V("definition") + anything)^1,
}
---[[ldx
-<p>We provide a few commands.</p>
---ldx]]
-
-- local texkpse
local function find_file(...)
diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex
new file mode 100644
index 00000000000..467cdc67044
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex
@@ -0,0 +1,10 @@
+% name : PPCHTEX / german interface
+% version : 1997.03.05
+% author : J. Hagen
+% copyright : J. Hagen, A.F. Otten
+
+\chardef\interfacenumber=2
+
+\input ppchtex.noc
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex
new file mode 100644
index 00000000000..6bd4353199b
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex
@@ -0,0 +1,10 @@
+% name : PPCHTEX / english interface
+% version : 1997.03.05
+% author : J. Hagen
+% copyright : J. Hagen, A.F. Otten
+
+\chardef\interfacenumber=0
+
+\input ppchtex.noc
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex
new file mode 100644
index 00000000000..c9d77733ac5
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex
@@ -0,0 +1,10 @@
+% name : PPCHTEX / english interface
+% version : 1997.03.05
+% author : J. Hagen
+% copyright : J. Hagen, A.F. Otten
+
+\chardef\interfacenumber=1
+
+\input ppchtex.noc
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc b/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc
new file mode 100644
index 00000000000..99d073255cb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc
@@ -0,0 +1,212 @@
+%D \module
+%D [ file=ppchtex (m-chemie),
+%D version=1997.03.19,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX),
+%D author=Hans Hagen,
+%D date=\huidigedatum,
+%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 licen-en.pdf for
+%C details.
+
+%D This module facilitates the use of \PPCHTEX\ in macro
+%D packages other than \CONTEXT. One of the features of
+%D \CONTEXT\ is that the user interface can be in any
+%D language. This language is defined at loading time.
+%D
+%D This module is indeed a surrogate one and is only a poor
+%D man's alternative to the more extensive \type{mult-***}
+%D modules of \CONTEXT. The extra overhead in terms of macros
+%D and functionality that these modules offer is only useful
+%D in \CONTEXT.
+%D
+%D Two interfaces are supported here, but others can easily be
+%D defined. This module expects the general system macros to be
+%D loaded as wel as a interface switch \type{\ifalternativeinterface}
+%D to be set.
+
+%D First we load some auxiliary macro's:
+
+\input supp-mis.mkii \let\writestatus\undefined
+\input syst-gen.mkii
+\input syst-fnt.mkii
+
+%D after which we can go on with:
+
+\unprotect
+
+%D 0 = english
+%D 1 = dutch
+%D 2 = german
+
+\ifx\interfacenumber\undefined
+ \chardef\interfacenumber=0
+\fi
+
+\def\definesystemvariable #1 %
+ {\setvalue{??#1}{@@#1}}
+
+\def\definesystemconstant #1 %
+ {\setvalue{s!#1}{#1}}
+
+\def\definevariable #1 #2 #3 % en nl de
+ {\ifcase\interfacenumber
+ \setvalue{v!#1}{#1}
+ \or
+ \setvalue{v!#1}{#2}
+ \or
+ \setvalue{v!#1}{#3}
+ \fi}
+
+\def\defineconstant #1 #2 #3 % en nl de
+ {\ifcase\interfacenumber
+ \setvalue{c!#1}{#1}
+ \setvalue{c!#2}{#1}
+ \or
+ \setvalue{c!#1}{#1}
+ \or
+ \setvalue{c!#1}{#1}
+ \setvalue{c!#3}{#1}
+ \fi}
+
+\def\definecommand #1 #2 #3 %
+ {\ifcase\interfacenumber
+ % core commands are english
+ \or
+ \doifnot{#1}{#2}{\setvalue{#2}{\getvalue{#1}}}
+ \or
+ \doifnot{#1}{#3}{\setvalue{#3}{\getvalue{#1}}}
+ \fi}
+
+\long\def\startcommands#1\stopcommands
+ {}
+
+\def\dosetvalue#1#2#3%
+ {\p!doifundefined{\c!prefix!#2}%
+ \let\donottest=\doprocesstest
+ \@EA\def\csname#1#2\endcsname{#3}%
+ \else
+ \let\donottest=\doprocesstest
+ \@EA\def\csname#1\csname\c!prefix!#2\endcsname\endcsname{#3}%
+ \fi}
+
+\def\dosetevalue#1#2#3%
+ {\p!doifundefined{\c!prefix!#2}%
+ \let\donottest=\doprocesstest
+ \@EA\edef\csname#1#2\endcsname{#3}%
+ \else
+ \let\donottest=\doprocesstest
+ \@EA\edef\csname#1\csname\c!prefix!#2\endcsname\endcsname{#3}%
+ \fi}
+
+\def\docopyvalue#1#2#3%
+ {\p!doifundefined{\c!prefix!#3}%
+ \let\donottest=\doprocesstest
+ \@EA\def\csname#1#3\endcsname%
+ {\csname#2#3\endcsname}%
+ \else
+ \let\donottest=\doprocesstest
+ \@EA\def\csname#1\csname\c!prefix!#3\endcsname\endcsname%
+ {\csname#2\csname\c!prefix!#3\endcsname\endcsname}%
+ \fi}
+
+\def\doresetvalue#1#2%
+ {\dosetvalue{#1}{#2}{}}
+
+\def\dogetvalue#1#2%
+ {\csname#1\csname\c!prefix!#2\endcsname\endcsname}
+
+\defineconstant axis assenstelsel achsen
+\defineconstant top boven oben
+\defineconstant width breedte breite
+\defineconstant size formaat groesse
+\defineconstant number getal nummer
+\defineconstant height hoogte hoehe
+\defineconstant factor factor faktor
+\defineconstant frame kader rahmen
+%defineconstant framecolor kaderkleur rahmenfarbe
+\defineconstant color kleur farbe
+\defineconstant bodyfont korps fliesstext
+\defineconstant style letter schriftstil
+\defineconstant rulethickness lijndikte liniendicke
+\defineconstant rulecolor lijnkleur linienfarbe
+\defineconstant left links links
+\defineconstant offset offset offset
+\defineconstant bottom onder unten
+\defineconstant option optie option
+\defineconstant location plaats platz
+\defineconstant right rechts rechts
+\defineconstant resolution resolutie aufloesung
+\defineconstant scale schaal format
+\defineconstant state status status
+\defineconstant text tekst text
+\defineconstant textcolor tekstkleur tekstfarbe
+\defineconstant textsize tekstformaat textgroesse
+\defineconstant alternative variant alternative
+\defineconstant x x x
+\defineconstant y y y
+
+\definevariable on aan an
+\definevariable big groot gross
+\definevariable intext intekst imtext
+\definevariable small klein klein
+\definevariable medium middel mittel
+\definevariable fit passend passend
+\definevariable start start start
+\definevariable stop stop stop
+\definevariable test test test
+\definevariable off uit aus
+
+\definecommand definechemical definieerchemie definierechemie
+\definecommand setupchemical stelchemiein stellechemieein
+\definecommand chemical chemie chemie
+\definecommand tochemical naarchemie zurchemie
+\definecommand startchemical startchemie startchemie
+\definecommand stopchemical stopchemie stopchemie
+\definecommand toptext boventekst textueber
+\definecommand bottext ondertekst textunter
+\definecommand midtext middentekst textmitte
+
+\protect
+
+%D After those definitions we actually load \PPCHTEX:
+
+\input ppchtex.mkii
+
+%D We also change some setup values. Let's hope that the next
+%D setups forever suits \LATEX.
+
+\unprotect
+
+\ifx\bodyfontsize\undefined
+ \ifx\f@size\undefined
+ \ifx\@ptsize\undefined
+ \setupchemical[\c!bodyfont=11pt]
+ \else
+ \setupchemical[\c!bodyfont=1\@ptsize pt]
+ \fi
+ \else
+ \setupchemical[\c!bodyfont=\f@size pt]
+ \fi
+\else
+ \setupchemical[\c!bodyfont=\bodyfontsize]
+\fi
+
+\ifx\mathrm\undefined
+ \setupchemical[\c!style=\rm]
+\else
+ \setupchemical[\c!style=\mathrm]
+\fi
+
+\ifx\outputresolution\undefined
+ \setupchemical[\c!resolution=300]
+\else
+ \setupchemical[\c!resolution=\outputresolution]
+\fi
+
+\let\unexpanded\normalunexpanded
+
+\protect \endinput
diff --git a/Master/tlpkg/bin/tl-update-lmtx-bin b/Master/tlpkg/bin/tl-update-lmtx-bin
new file mode 100755
index 00000000000..66621c67d72
--- /dev/null
+++ b/Master/tlpkg/bin/tl-update-lmtx-bin
@@ -0,0 +1,46 @@
+#!/bin/sh
+# $Id$
+# Public domain. Originally written 2023, Karl Berry.
+# Download new luametatex binaries from the garden.
+
+real0=`realpath $0`
+mydir=`cd \`dirname "$real0"\` && pwd` # Master/tlpkg/bin
+Master=`cd $mydir/../.. && pwd`
+test -z "$Master" && exit 1
+
+cg=https://dl.contextgarden.net/build/luametatex/main
+
+# leaving out x86_64-linux for now because Mojca doesn't have the
+# centos7 vhost set up.
+
+for cgplat in \
+ aarch64-linux \
+ amd64-freebsd \
+ armhf-linux \
+ i386-freebsd \
+ i386-linux \
+ i386-solaris \
+ win64 \
+ x86_64-darwinlegacy \
+ x86_64-linuxmusl \
+ x86_64-solaris \
+; do
+ if test $cgplat = win64; then
+ tlplat=windows
+ exeext=.exe
+ else
+ tlplat=$cgplat
+ exeext=
+ fi
+ cd $Master/bin/$tlplat || exit 1
+ binfile=luametatex$exeext
+ url=$cg/$cgplat/$binfile
+ if wget -nv $url -O lmtx.new; then
+ mv lmtx.new $binfile || exit 1
+ echo "$tlplat/$binfile updated"
+ else
+ echo "$0: goodbye, wget failed: $url" >&2
+ exit 1
+ fi
+done
+
diff --git a/Master/tlpkg/doc/releng.txt b/Master/tlpkg/doc/releng.txt
index 29baf164344..35fcf0bca2c 100644
--- a/Master/tlpkg/doc/releng.txt
+++ b/Master/tlpkg/doc/releng.txt
@@ -547,12 +547,28 @@ cd /home/texlive
rm -rf branch # when starting a new year on tug
mkdir branch
cd branch
-svn co svn://tug.org/texlive/branches/branch$this/Build/source . >&out
-
- Edit (inside the branch) as desired.
- Do a test build, commit when successful.
- Ask for rebuilds,
- When (enough) rebuilds are done, commit to the branch and make another tag:
+nice svn co svn://tug.org/texlive/branches/branch$this/Build/source . >&out
+tail out
+
+ Edit (inside the branch) as needed.
+ For example, to diff luatex:
+ cd /home/texlive/branch/texk/web2c/luatexdir
+ diff -u2r . /home/texlive/trunk/Build/source/texk/web2c/luatexdir >/tmp/u
+ # of course check that diffs include all and only the desired changes.
+ # when good:
+ patch -p0 </tmp/u
+ Do a test build:
+ cd /home/texlive/branch
+ ./Build
+ # test resulting binaries as needed.
+ Commit revised sources to branch:
+ svn commit -m'sync to branch: luatex 1.17.0 post-release fix for safety.
+ Ask for rebuilds, e.g.,
+ https://tug.org/pipermail/tlbuild/2021q2/004885.html
+ https://tug.org/pipermail/tlbuild/2021q2/004920.html
+ Commit new binaries and anything else needed to trunk.
+ When (enough) rebuilds are done that the changes are stable,
+ make another tag:
brev=nnnnn # branch commit revision, e.g., 51236
btag=yyyy.n # next branch tag, e.g., 2021.3
#svn copy -r $brev -m"texlive-$btag tag based on r$brev, with <whatever> fix" \
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index dcff1297c51..16ef84ff144 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -4140,7 +4140,7 @@ sub xsystem {
#
sub exeext {
my ($platform) = @_;
- my $ext = $platform =~ /^(win[0-9]+|.*-cygwin)$/ ? ".exe" : "";
+ my $ext = $platform =~ /^(windows.*|.*-cygwin)$/ ? ".exe" : "";
return $ext;
}
@@ -6597,66 +6597,87 @@ sub POSTcontext {
print "POST$package - rearrange, remove\n";
&xchdir ($DEST);
+ # put files in context subdirs.
+ &mv_with_mkdir ("colors/icc/context", "tex/context/colors/icc");
+ &mv_with_mkdir ("README.adoc", "doc/context");
+
# clean up files Hans wants in his distribution but are confusing or
# problematic in TeX Live.
- &mv_with_mkdir ("colors/icc/context", "tex/context/colors/icc");
&SYSTEM ("$RM -rf colors"); # nonfree
&SYSTEM ("$RM -rf fonts/truetype/hoekwater/lm/");# lmtypewriter10-regular.ttf
&SYSTEM ("$RM -rf fonts/data/tests/"); # texmfhome.otf
+ &SYSTEM ("$RM -rf source"); # entire engine source
&SYSTEM ("$RM -rf web2c/"); # context*cnf*, texlive*cnf.lua
- &SYSTEM ("find -name koeiel\* -o -name jmn | xargs rm -rf");
+ # nonfree (first two) and unused (jmn) fonts.
+ &SYSTEM ("find -name \*koeiel\* -o -name \*lucida\* -o -name jmn"
+ . "| xargs rm -rfv");
- # remove mptopdf files, since they are in a separate package.
+ # mkii removals
+ &SYSTEM ("$RM -rf doc/context/scripts/mkii/");
+ &SYSTEM ("$RM -rf fonts/enc/");
+ &SYSTEM ("$RM -rf fonts/map/");
+ &SYSTEM ("$RM -rf scripts/context/ruby/");
+ &SYSTEM ("$RM -rf scripts/context/stubs/");
+ &SYSTEM ("$RM -rf tex/context/*/mkii/"); # base, fonts, etc.
+ &SYSTEM ("$RM -rf metapost/context/base/mpii/");
+
+ # mptopdf removals, since that is a separate package.
+ print "still POST$package - removing mptopdf since separate package\n";
chomp (my @mptopdf_files = `tlpfiles mptopdf | sed 's,[^/]*/,,'`);
&SYSTEM ("$RM -f @mptopdf_files ");
&SYSTEM ("$RM doc/context/scripts/mkii/mptopdf.man");
-
- print "still POST$package - user-level executables\n";
- # executables go in both the Master bin dir and the
- # Build linked_scripts dir. The executables are cherry-picked from
- # ConTeXt's stubs directory.
- my $w32_bindir = "$TOPDEST/bin/windows";
- &xmkdir ($w32_bindir);
- #
- my $pkg_subdir = "stubs/unix"; # where hans keeps them
- &xchdir ("$DEST/scripts/$package/$pkg_subdir");
- my @exec = ();
- for my $exec (qw(context contextjit luatools
- mtxrun mtxrunjit texexec texmfstart)) {
- &SYSTEM ("chmod a+x $exec");
- &bindirs_symlink ($exec);
- &build_scripts_copy ($exec, $pkg_subdir);
- &SYSTEM ("$CP ../mswin/$exec.exe $w32_bindir/");
- push (@exec, $exec);
+
+ print "still POST$package - copy user-level .lua to windows\n";
+ my $w_bindir = "$TOPDEST/bin/windows";
+ &xmkdir ($w_bindir);
+ # because bindirs_symlink uses cwd to determine the link:
+ &xchdir ("$DEST/scripts/$package/lua");
+ my @exec = qw(context mtxrun);
+ for my $exec (@exec) {
+ my $luafile = "$exec.lua";
+ # these should exist.
+ die "POSTcontext: no context lua file $luafile" unless -s $luafile;
+ &SYSTEM ("$CP $luafile $w_bindir/");
+ &bindirs_symlink ($luafile, $luafile);
}
- # mtxrun on Windows needs more than just the .exe.
- &xchdir ("../mswin");
- &SYSTEM ("$CP mtxrun.dll mtxrun.lua $w32_bindir/");
+ # but i386-netbsd is not supported.
+ my $i386_netbsd_bindir = "$TOPDEST/bin/i386-netbsd";
+ &SYSTEM ("$RM $i386_netbsd_bindir/context.lua");
+ &SYSTEM ("$RM $i386_netbsd_bindir/mtxrun.lua");
- print "still POST$package - man pages\n";
+ print "still POST$package - user-level executable man pages\n";
&xchdir ("$DEST/doc/$package/scripts");
my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
&xmkdir ($mandest);
for my $exec (@exec) {
- # man pages might be under mkii or mkiv, just check both.
- my $mansrc = (-r "mkii/$exec.man" ? "mkii/$exec.man" : "mkiv/$exec.man");
+ # we only want mkiv man pages
+ my $mansrc = "mkiv/$exec.man";
&SYSTEM ("$CP $mansrc $mandest/$exec.1");
}
+
+ print "still POST$package - mtx-*.man pages\n";
# In addition, there is mtx-*.man for subcommands in mkiv.
- &xchdir ("mkiv");
+ &xchdir ("$DEST/doc/$package/scripts/mkiv");
for my $mtxman (<mtx-*.man>) {
(my $mtxmanbase = $mtxman) =~ s/\.man$//;
&SYSTEM ("$CP $mtxman $mandest/$mtxmanbase.1");
}
&tl_man_to_pdf ();
+
+ # do last so man pages are there.
+ print "still POST$package - preserving binaries\n";
+ &POST_preserve_bin ("luametatex", "context", "mtxrun");
}
# Called for the ConTeXt scripts, though conceivably could be used for
# other things. Make a symlink in each Unix bindir (Windows is not
-# handled here) to EXEC, assuming its location is relative to pwd.
+# handled here) to EXEC, assuming its location is relative to cwd.
+#
+# If LINKNAME is not given, the symlink is named as the basename of EXEC
+# with any extension removed.
#
sub bindirs_symlink {
- my ($exec) = @_;
+ my ($exec,$linkname) = @_;
chomp (my $pwd = `pwd`);
(my $intermediate_dirs = $pwd) =~ s,^.*/$DEST_TREE/,,;
@@ -6664,11 +6685,16 @@ sub bindirs_symlink {
my $linktarget = "../../$DEST_TREE";
$linktarget .= "/$intermediate_dirs";
$linktarget .= "/$exec";
+ print ("\t bindirs_symlink: linktarget = $linktarget\n");
#
- (my $linkname = $exec) =~ s,.*/,,; # just the basename
- $linkname =~ s,\.[^./]+$,,; # rm extension too
+ if (! $linkname) {
+ ($linkname = $exec) =~ s,.*/,,; # just the basename
+ $linkname =~ s,\.[^./]+$,,; # rm extension too
+ }
+ print ("\t bindirs_symlink: linkname = $linkname\n");
chomp (my @platforms = `cd $Master/bin && ls`);
+ print ("\t bindirs_symlink: platforms = @platforms\n");
for my $p (@platforms) {
next if $p =~ /win32|windows/; # windows handled separately
next if $p eq "man"; # non-platform pain
@@ -6678,11 +6704,12 @@ sub bindirs_symlink {
}
}
-# Called both for ConTeXt and from doscripts: Update copy of EXEC under
-# Build/.../linked_scripts. If second arg INTERMEDIATE_DIRS is given
-# (done by ConTeXt), that path is appended under linked_scripts/. In
-# any case, just the basename of EXEC is used in the destination, and
-# the full EXEC, whatever it is, is used for the source of the copy.
+# Called both from doscripts and could be used for ConTeXt: Update copy
+# of EXEC under Build/.../linked_scripts. If second arg
+# INTERMEDIATE_DIRS is given (used to be done by ConTeXt), that path is
+# appended under linked_scripts/. In any case, just the basename of EXEC
+# is used in the destination, and the full EXEC, whatever it is, is used
+# for the source of the copy.
#
sub build_scripts_copy {
my ($exec,$intermediate_dirs) = @_;
@@ -7671,12 +7698,13 @@ sub POST_preserve_man {
&preserve_man_pages ($package);
}
-# Move .1 and .5 files from source dir to man dir (if needed), and make
-# our pdfs from them.
+# Move .1 and .5 files from SRC_MANDIR to installed man dir (if needed),
+# and make our pdfs from them.
#
-# has to be post instead of specialman when we use the tds.zip.
+# Has to be post instead of specialman when we use the tds.zip.
# Optional argument is directory where the man pages are as distributed
-# on CTAN, else doc/*/$package.
+# on CTAN, else doc/*/$package or similar.
+#
sub POST_do_man {
my ($src_mandir) = @_;
print "POST_do_man - src_mandir = $src_mandir\n";
@@ -7690,7 +7718,7 @@ sub POST_do_man {
} elsif (<$DEST/doc/$package/*.1>) {
$src_mandir = "doc/$package";
} else {
- warn ("$0: could not find man pages starting from " . `pwd`);
+ warn ("$0: POST_do_man: could not find man pages starting from " . `pwd`);
}
#
my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
@@ -7713,10 +7741,10 @@ sub POST_do_man {
sub POST_preserve_bin {
print "POST_preserve_bin - binaries = @_\n";
- # the pmx package, among others, includes binaries made from Build,
- # and normal scripts and support files. The latter can get updated
- # without needing to update the former, so we support it. Which means
- # preserving the binaries from the Build.
+ # The ConTeXt and pmx packages, among others, includes binaries made
+ # from Build, and normal scripts and support files. The latter can get
+ # updated without needing to update the former, so we support it.
+ # Which means preserving the binaries from the Build.
#
# The ctan2tds output will look weird since all the binaries will show
# up as new files, since they are in <pkg>.<platform> subpackages. And
@@ -7730,7 +7758,11 @@ sub POST_preserve_bin {
&xmkdir ($platdir);
my $exeext = &exeext ($p);
for my $b (@binaries) {
- &SYSTEM ("$CP $Master/bin/$p/$b$exeext $platdir/");
+ # use -a so we'll copy symlinks (context, mtxrun) without dereferencing.
+ # but on cygwin, no exeext for symlinks.
+ my $src = "$Master/bin/$p/$b";
+ $src .= "$exeext" unless -l $src;
+ &SYSTEM ("$CP -a $src $platdir/");
}
}
diff --git a/Master/tlpkg/tlpsrc/context.tlpsrc b/Master/tlpkg/tlpsrc/context.tlpsrc
index cf411a4f86d..a960b3c5ab8 100644
--- a/Master/tlpkg/tlpsrc/context.tlpsrc
+++ b/Master/tlpkg/tlpsrc/context.tlpsrc
@@ -44,7 +44,6 @@ runpattern +!d texmf-dist/tex/context/texlive
srcpattern +!d texmf-dist/source/context/third
#
docpattern +!d texmf-dist/doc/context/third
-docpattern +f texmf-dist/doc/man/man1/luatools.*
docpattern +f texmf-dist/doc/man/man1/context.*
docpattern +f texmf-dist/doc/man/man1/mtx-*
docpattern +f texmf-dist/doc/man/man1/mtxrun.*