From afc6f0a4de593d7164341006a7dfc5e1add977aa Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 9 Jan 2020 12:04:00 +0100 Subject: 2020-01-09 11:26:00 --- doc/context/documents/general/manuals/evenmore.pdf | Bin 1499275 -> 1520046 bytes .../documents/general/manuals/libraries-mkiv.pdf | Bin 64761 -> 44682 bytes doc/context/documents/general/qrcs/setup-cs.pdf | Bin 888000 -> 887845 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 889982 -> 889284 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 894336 -> 893787 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 886077 -> 885837 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 891727 -> 891320 bytes .../documents/general/qrcs/setup-mapping-cs.pdf | Bin 383723 -> 383576 bytes .../documents/general/qrcs/setup-mapping-de.pdf | Bin 384005 -> 383219 bytes .../documents/general/qrcs/setup-mapping-en.pdf | Bin 380331 -> 380317 bytes .../documents/general/qrcs/setup-mapping-fr.pdf | Bin 383854 -> 383688 bytes .../documents/general/qrcs/setup-mapping-it.pdf | Bin 383368 -> 382980 bytes .../documents/general/qrcs/setup-mapping-nl.pdf | Bin 381739 -> 381917 bytes .../documents/general/qrcs/setup-mapping-ro.pdf | Bin 619938 -> 620126 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 881397 -> 881259 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 886147 -> 885714 bytes doc/context/scripts/mkii/ctxtools.man | 2 +- doc/context/scripts/mkii/imgtopdf.man | 2 +- doc/context/scripts/mkii/mptopdf.man | 2 +- doc/context/scripts/mkii/pdftools.man | 2 +- doc/context/scripts/mkii/pstopdf.man | 2 +- doc/context/scripts/mkii/rlxtools.man | 2 +- doc/context/scripts/mkii/texexec.man | 2 +- doc/context/scripts/mkii/texmfstart.man | 2 +- doc/context/scripts/mkii/textools.man | 2 +- doc/context/scripts/mkii/texutil.man | 2 +- doc/context/scripts/mkii/tmftools.man | 2 +- doc/context/scripts/mkii/xmltools.man | 2 +- doc/context/scripts/mkiv/context.man | 2 +- doc/context/scripts/mkiv/luatools.man | 2 +- doc/context/scripts/mkiv/mtx-babel.man | 2 +- doc/context/scripts/mkiv/mtx-base.man | 2 +- doc/context/scripts/mkiv/mtx-bibtex.man | 2 +- doc/context/scripts/mkiv/mtx-cache.man | 2 +- doc/context/scripts/mkiv/mtx-chars.man | 2 +- doc/context/scripts/mkiv/mtx-check.man | 2 +- doc/context/scripts/mkiv/mtx-colors.man | 2 +- doc/context/scripts/mkiv/mtx-context.man | 2 +- doc/context/scripts/mkiv/mtx-dvi.man | 2 +- doc/context/scripts/mkiv/mtx-epub.man | 2 +- doc/context/scripts/mkiv/mtx-evohome.man | 2 +- doc/context/scripts/mkiv/mtx-fcd.man | 2 +- doc/context/scripts/mkiv/mtx-flac.man | 2 +- doc/context/scripts/mkiv/mtx-fonts.man | 2 +- doc/context/scripts/mkiv/mtx-grep.man | 2 +- doc/context/scripts/mkiv/mtx-interface.man | 2 +- doc/context/scripts/mkiv/mtx-metapost.man | 2 +- doc/context/scripts/mkiv/mtx-modules.man | 2 +- doc/context/scripts/mkiv/mtx-package.man | 2 +- doc/context/scripts/mkiv/mtx-patterns.man | 2 +- doc/context/scripts/mkiv/mtx-pdf.man | 2 +- doc/context/scripts/mkiv/mtx-plain.man | 2 +- doc/context/scripts/mkiv/mtx-profile.man | 2 +- doc/context/scripts/mkiv/mtx-rsync.man | 2 +- doc/context/scripts/mkiv/mtx-scite.man | 2 +- doc/context/scripts/mkiv/mtx-server.man | 2 +- doc/context/scripts/mkiv/mtx-texworks.man | 2 +- doc/context/scripts/mkiv/mtx-timing.man | 2 +- doc/context/scripts/mkiv/mtx-tools.man | 2 +- doc/context/scripts/mkiv/mtx-unicode.man | 2 +- doc/context/scripts/mkiv/mtx-unzip.man | 2 +- doc/context/scripts/mkiv/mtx-update.man | 2 +- doc/context/scripts/mkiv/mtx-vscode.man | 2 +- doc/context/scripts/mkiv/mtx-watch.man | 2 +- doc/context/scripts/mkiv/mtx-youless.man | 2 +- doc/context/scripts/mkiv/mtxrun.man | 2 +- .../manuals/evenmore/evenmore-libraries.tex | 186 +++++++++++++ .../sources/general/manuals/evenmore/evenmore.tex | 1 + .../general/manuals/libraries/libraries-mkiv.tex | 147 +++++++--- scripts/context/lua/mtxrun.lua | 75 +++++- scripts/context/stubs/mswin/mtxrun.lua | 75 +++++- scripts/context/stubs/unix/mtxrun | 75 +++++- scripts/context/stubs/win64/mtxrun.lua | 75 +++++- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/colo-ini.lua | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 4 +- tex/context/base/mkiv/data-lst.lua | 19 +- tex/context/base/mkiv/data-res.lua | 2 +- tex/context/base/mkiv/file-lib.lua | 2 - tex/context/base/mkiv/libs-imp-curl.lua | 296 +++++++++++++++++++++ tex/context/base/mkiv/libs-imp-ghostscript.lua | 111 ++++++++ tex/context/base/mkiv/libs-imp-graphicsmagick.lua | 77 ++++++ tex/context/base/mkiv/libs-imp-mysql.lua | 196 ++++++++++++++ tex/context/base/mkiv/libs-imp-postgress.lua | 200 ++++++++++++++ tex/context/base/mkiv/libs-imp-sqlite.lua | 187 +++++++++++++ tex/context/base/mkiv/libs-imp-zint.lua | 148 +++++++++++ tex/context/base/mkiv/libs-imp-zint.mkxl | 61 +++++ tex/context/base/mkiv/libs-ini.lua | 179 +++++++++++++ tex/context/base/mkiv/libs-ini.mkxl | 31 +++ tex/context/base/mkiv/luat-cnf.lua | 7 +- tex/context/base/mkiv/luat-lib.mkiv | 4 +- tex/context/base/mkiv/m-fonts-plugins.mkiv | 1 + tex/context/base/mkiv/m-zint.mkxl | 7 + tex/context/base/mkiv/pack-rul.mkiv | 41 +-- tex/context/base/mkiv/pack-rul.mkxl | 19 +- tex/context/base/mkiv/spac-hor.mkiv | 4 +- tex/context/base/mkiv/status-files.pdf | Bin 26584 -> 26756 bytes tex/context/base/mkiv/status-lua.pdf | Bin 269667 -> 269733 bytes tex/context/base/mkiv/type-ini.lua | 2 +- tex/context/base/mkiv/util-lib.lua | 55 +++- tex/context/base/mkiv/util-sql-imp-ffi.lua | 3 - tex/context/base/mkiv/util-sql-imp-sqlite.lua | 1 + tex/context/base/mkiv/util-sql.lua | 47 +++- tex/context/interface/mkiv/i-context.pdf | Bin 894336 -> 893787 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 61165 -> 61165 bytes .../modules/common/s-abbreviations-logos.tex | 6 + tex/context/modules/mkiv/m-sql.mkiv | 5 + tex/context/modules/mkiv/s-inf-01.mkvi | 52 ++-- tex/context/modules/mkiv/s-inf-03.mkiv | 11 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 113 files changed, 2300 insertions(+), 224 deletions(-) create mode 100644 doc/context/sources/general/manuals/evenmore/evenmore-libraries.tex create mode 100644 tex/context/base/mkiv/libs-imp-curl.lua create mode 100644 tex/context/base/mkiv/libs-imp-ghostscript.lua create mode 100644 tex/context/base/mkiv/libs-imp-graphicsmagick.lua create mode 100644 tex/context/base/mkiv/libs-imp-mysql.lua create mode 100644 tex/context/base/mkiv/libs-imp-postgress.lua create mode 100644 tex/context/base/mkiv/libs-imp-sqlite.lua create mode 100644 tex/context/base/mkiv/libs-imp-zint.lua create mode 100644 tex/context/base/mkiv/libs-imp-zint.mkxl create mode 100644 tex/context/base/mkiv/libs-ini.lua create mode 100644 tex/context/base/mkiv/libs-ini.mkxl create mode 100644 tex/context/base/mkiv/m-zint.mkxl diff --git a/doc/context/documents/general/manuals/evenmore.pdf b/doc/context/documents/general/manuals/evenmore.pdf index 532d5b578..300b82c1a 100644 Binary files a/doc/context/documents/general/manuals/evenmore.pdf and b/doc/context/documents/general/manuals/evenmore.pdf differ diff --git a/doc/context/documents/general/manuals/libraries-mkiv.pdf b/doc/context/documents/general/manuals/libraries-mkiv.pdf index f5a1e27f1..9b13d7414 100644 Binary files a/doc/context/documents/general/manuals/libraries-mkiv.pdf and b/doc/context/documents/general/manuals/libraries-mkiv.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index ee2b3b6cc..ef4afbfb5 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index e754ee7d9..93f2a87fd 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index 7690ea2ae..e8ccc0a93 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index c3987be7e..02334dd64 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index dc526f59f..52852e95b 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf index 5c724789f..2fa97686b 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf and b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf index 58ffceb56..cbae3d4b2 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-de.pdf and b/doc/context/documents/general/qrcs/setup-mapping-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf index 7d4fa2fa5..044ba7d84 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-en.pdf and b/doc/context/documents/general/qrcs/setup-mapping-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf index 52b4f735f..21eb7f3fd 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf and b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf index ce36c19ef..5ed2b6bb0 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-it.pdf and b/doc/context/documents/general/qrcs/setup-mapping-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf index 0386d8aa5..d661c8706 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf and b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf index 33d681657..5c4f6955b 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf and b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index 236efcb7e..a8b6cde89 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 2cfad8b5c..0117790d3 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/doc/context/scripts/mkii/ctxtools.man b/doc/context/scripts/mkii/ctxtools.man index 8a2f5267c..b024daf66 100644 --- a/doc/context/scripts/mkii/ctxtools.man +++ b/doc/context/scripts/mkii/ctxtools.man @@ -1,4 +1,4 @@ -.TH "ctxtools" "1" "01-01-2019" "version 1.3.5" "CtxTools" +.TH "ctxtools" "1" "01-01-2020" "version 1.3.5" "CtxTools" .SH NAME ctxtools - CtxTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/imgtopdf.man b/doc/context/scripts/mkii/imgtopdf.man index c84dc62bc..9166bf114 100644 --- a/doc/context/scripts/mkii/imgtopdf.man +++ b/doc/context/scripts/mkii/imgtopdf.man @@ -1,4 +1,4 @@ -.TH "imgtopdf" "1" "01-01-2019" "version 1.1.2" "ImgToPdf" +.TH "imgtopdf" "1" "01-01-2020" "version 1.1.2" "ImgToPdf" .SH NAME imgtopdf - ImgToPdf .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/mptopdf.man b/doc/context/scripts/mkii/mptopdf.man index 0fa2fad3d..545c16fa0 100644 --- a/doc/context/scripts/mkii/mptopdf.man +++ b/doc/context/scripts/mkii/mptopdf.man @@ -1,4 +1,4 @@ -.TH "mptopdf" "1" "01-01-2019" "version 1.4.1" "convert MetaPost figures to PDF" +.TH "mptopdf" "1" "01-01-2020" "version 1.4.1" "convert MetaPost figures to PDF" .SH NAME mptopdf - convert MetaPost figures to PDF .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/pdftools.man b/doc/context/scripts/mkii/pdftools.man index 454ef5951..2258f7fd6 100644 --- a/doc/context/scripts/mkii/pdftools.man +++ b/doc/context/scripts/mkii/pdftools.man @@ -1,4 +1,4 @@ -.TH "pdftools" "1" "01-01-2019" "version 1.2.1" "PDFTools" +.TH "pdftools" "1" "01-01-2020" "version 1.2.1" "PDFTools" .SH NAME pdftools - PDFTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/pstopdf.man b/doc/context/scripts/mkii/pstopdf.man index bbd64de9e..2439d48a5 100644 --- a/doc/context/scripts/mkii/pstopdf.man +++ b/doc/context/scripts/mkii/pstopdf.man @@ -1,4 +1,4 @@ -.TH "pstopdf" "1" "01-01-2019" "version 2.0.1" "PStoPDF" +.TH "pstopdf" "1" "01-01-2020" "version 2.0.1" "PStoPDF" .SH NAME pstopdf - PStoPDF .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/rlxtools.man b/doc/context/scripts/mkii/rlxtools.man index 4b841e490..4c5a5c172 100644 --- a/doc/context/scripts/mkii/rlxtools.man +++ b/doc/context/scripts/mkii/rlxtools.man @@ -1,4 +1,4 @@ -.TH "rlxtools" "1" "01-01-2019" "version 1.0.1" "RlxTools" +.TH "rlxtools" "1" "01-01-2020" "version 1.0.1" "RlxTools" .SH NAME rlxtools - RlxTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/texexec.man b/doc/context/scripts/mkii/texexec.man index 82dfbb4d8..e783e8d6e 100644 --- a/doc/context/scripts/mkii/texexec.man +++ b/doc/context/scripts/mkii/texexec.man @@ -1,4 +1,4 @@ -.TH "texexec" "1" "01-01-2019" "version 6.2.1" "TeXExec" +.TH "texexec" "1" "01-01-2020" "version 6.2.1" "TeXExec" .SH NAME texexec - TeXExec .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/texmfstart.man b/doc/context/scripts/mkii/texmfstart.man index f6c876c00..8118c9c7f 100644 --- a/doc/context/scripts/mkii/texmfstart.man +++ b/doc/context/scripts/mkii/texmfstart.man @@ -1,4 +1,4 @@ -.TH "mtxrun" "1" "01-01-2019" "version 1.33" "ConTeXt TDS Runner Tool" +.TH "mtxrun" "1" "01-01-2020" "version 1.33" "ConTeXt TDS Runner Tool" .SH NAME mtxrun - ConTeXt TDS Runner Tool .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/textools.man b/doc/context/scripts/mkii/textools.man index c7c425633..4d5df1fa9 100644 --- a/doc/context/scripts/mkii/textools.man +++ b/doc/context/scripts/mkii/textools.man @@ -1,4 +1,4 @@ -.TH "textools" "1" "01-01-2019" "version 1.3.1" "TeXTools" +.TH "textools" "1" "01-01-2020" "version 1.3.1" "TeXTools" .SH NAME textools - TeXTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/texutil.man b/doc/context/scripts/mkii/texutil.man index f0e5fb961..d30913ad5 100644 --- a/doc/context/scripts/mkii/texutil.man +++ b/doc/context/scripts/mkii/texutil.man @@ -1,4 +1,4 @@ -.TH "texutil" "1" "01-01-2019" "version 9.1.0" "TeXUtil" +.TH "texutil" "1" "01-01-2020" "version 9.1.0" "TeXUtil" .SH NAME texutil - TeXUtil .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/tmftools.man b/doc/context/scripts/mkii/tmftools.man index 4d6970de2..731d6ed34 100644 --- a/doc/context/scripts/mkii/tmftools.man +++ b/doc/context/scripts/mkii/tmftools.man @@ -1,4 +1,4 @@ -.TH "tmftools" "1" "01-01-2019" "version 1.1.0" "TMFTools" +.TH "tmftools" "1" "01-01-2020" "version 1.1.0" "TMFTools" .SH NAME tmftools - TMFTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/xmltools.man b/doc/context/scripts/mkii/xmltools.man index 74c8c3a55..efea6a69b 100644 --- a/doc/context/scripts/mkii/xmltools.man +++ b/doc/context/scripts/mkii/xmltools.man @@ -1,4 +1,4 @@ -.TH "xmltools" "1" "01-01-2019" "version 1.2.2" "XMLTools" +.TH "xmltools" "1" "01-01-2020" "version 1.2.2" "XMLTools" .SH NAME xmltools - XMLTools .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/context.man b/doc/context/scripts/mkiv/context.man index 04e3fdc1a..9b23bd88b 100644 --- a/doc/context/scripts/mkiv/context.man +++ b/doc/context/scripts/mkiv/context.man @@ -1,4 +1,4 @@ -.TH "mtx-context" "1" "01-01-2019" "version 1.03" "ConTeXt Process Management" +.TH "mtx-context" "1" "01-01-2020" "version 1.03" "ConTeXt Process Management" .SH NAME mtx-context - ConTeXt Process Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/luatools.man b/doc/context/scripts/mkiv/luatools.man index 91bdeeb13..0d0392f39 100644 --- a/doc/context/scripts/mkiv/luatools.man +++ b/doc/context/scripts/mkiv/luatools.man @@ -1,4 +1,4 @@ -.TH "luatools" "1" "01-01-2019" "version 1.35" "ConTeXt TDS Management Tool (aka luatools)" +.TH "luatools" "1" "01-01-2020" "version 1.35" "ConTeXt TDS Management Tool (aka luatools)" .SH NAME luatools - ConTeXt TDS Management Tool (aka luatools) .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-babel.man b/doc/context/scripts/mkiv/mtx-babel.man index 547efdf0b..5ac999c66 100644 --- a/doc/context/scripts/mkiv/mtx-babel.man +++ b/doc/context/scripts/mkiv/mtx-babel.man @@ -1,4 +1,4 @@ -.TH "mtx-babel" "1" "01-01-2019" "version 1.20" "Babel Input To UTF Conversion" +.TH "mtx-babel" "1" "01-01-2020" "version 1.20" "Babel Input To UTF Conversion" .SH NAME mtx-babel - Babel Input To UTF Conversion .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-base.man b/doc/context/scripts/mkiv/mtx-base.man index 6731ce0ac..76f60696f 100644 --- a/doc/context/scripts/mkiv/mtx-base.man +++ b/doc/context/scripts/mkiv/mtx-base.man @@ -1,4 +1,4 @@ -.TH "mtx-base" "1" "01-01-2019" "version 1.35" "ConTeXt TDS Management Tool (aka luatools)" +.TH "mtx-base" "1" "01-01-2020" "version 1.35" "ConTeXt TDS Management Tool (aka luatools)" .SH NAME mtx-base - ConTeXt TDS Management Tool (aka luatools) .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-bibtex.man b/doc/context/scripts/mkiv/mtx-bibtex.man index 545dcdfbe..60bfd7e1d 100644 --- a/doc/context/scripts/mkiv/mtx-bibtex.man +++ b/doc/context/scripts/mkiv/mtx-bibtex.man @@ -1,4 +1,4 @@ -.TH "mtx-bibtex" "1" "01-01-2019" "version 1.00" "bibtex helpers" +.TH "mtx-bibtex" "1" "01-01-2020" "version 1.00" "bibtex helpers" .SH NAME mtx-bibtex - bibtex helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-cache.man b/doc/context/scripts/mkiv/mtx-cache.man index 9128bba30..e266d8da2 100644 --- a/doc/context/scripts/mkiv/mtx-cache.man +++ b/doc/context/scripts/mkiv/mtx-cache.man @@ -1,4 +1,4 @@ -.TH "mtx-cache" "1" "01-01-2019" "version 1.01" "ConTeXt & MetaTeX Cache Management" +.TH "mtx-cache" "1" "01-01-2020" "version 1.01" "ConTeXt & MetaTeX Cache Management" .SH NAME mtx-cache - ConTeXt & MetaTeX Cache Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-chars.man b/doc/context/scripts/mkiv/mtx-chars.man index 0f4234666..ad52b5b89 100644 --- a/doc/context/scripts/mkiv/mtx-chars.man +++ b/doc/context/scripts/mkiv/mtx-chars.man @@ -1,4 +1,4 @@ -.TH "mtx-chars" "1" "01-01-2019" "version 0.10" "MkII Character Table Generators" +.TH "mtx-chars" "1" "01-01-2020" "version 0.10" "MkII Character Table Generators" .SH NAME mtx-chars - MkII Character Table Generators .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-check.man b/doc/context/scripts/mkiv/mtx-check.man index 3fa1c0cd8..0525aeb69 100644 --- a/doc/context/scripts/mkiv/mtx-check.man +++ b/doc/context/scripts/mkiv/mtx-check.man @@ -1,4 +1,4 @@ -.TH "mtx-check" "1" "01-01-2019" "version 0.10" "Basic ConTeXt Syntax Checking" +.TH "mtx-check" "1" "01-01-2020" "version 0.10" "Basic ConTeXt Syntax Checking" .SH NAME mtx-check - Basic ConTeXt Syntax Checking .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-colors.man b/doc/context/scripts/mkiv/mtx-colors.man index 533aa3839..883d69573 100644 --- a/doc/context/scripts/mkiv/mtx-colors.man +++ b/doc/context/scripts/mkiv/mtx-colors.man @@ -1,4 +1,4 @@ -.TH "mtx-colors" "1" "01-01-2019" "version 0.10" "ConTeXt Color Management" +.TH "mtx-colors" "1" "01-01-2020" "version 0.10" "ConTeXt Color Management" .SH NAME mtx-colors - ConTeXt Color Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-context.man b/doc/context/scripts/mkiv/mtx-context.man index 04e3fdc1a..9b23bd88b 100644 --- a/doc/context/scripts/mkiv/mtx-context.man +++ b/doc/context/scripts/mkiv/mtx-context.man @@ -1,4 +1,4 @@ -.TH "mtx-context" "1" "01-01-2019" "version 1.03" "ConTeXt Process Management" +.TH "mtx-context" "1" "01-01-2020" "version 1.03" "ConTeXt Process Management" .SH NAME mtx-context - ConTeXt Process Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-dvi.man b/doc/context/scripts/mkiv/mtx-dvi.man index 424d40ddf..fe42cb23b 100644 --- a/doc/context/scripts/mkiv/mtx-dvi.man +++ b/doc/context/scripts/mkiv/mtx-dvi.man @@ -1,4 +1,4 @@ -.TH "mtx-dvi" "1" "01-01-2019" "version 0.01" "ConTeXt DVI Helpers" +.TH "mtx-dvi" "1" "01-01-2020" "version 0.01" "ConTeXt DVI Helpers" .SH NAME mtx-dvi - ConTeXt DVI Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-epub.man b/doc/context/scripts/mkiv/mtx-epub.man index 7facb936a..0c0e26b49 100644 --- a/doc/context/scripts/mkiv/mtx-epub.man +++ b/doc/context/scripts/mkiv/mtx-epub.man @@ -1,4 +1,4 @@ -.TH "mtx-epub" "1" "01-01-2019" "version 1.10" "ConTeXt EPUB Helpers" +.TH "mtx-epub" "1" "01-01-2020" "version 1.10" "ConTeXt EPUB Helpers" .SH NAME mtx-epub - ConTeXt EPUB Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-evohome.man b/doc/context/scripts/mkiv/mtx-evohome.man index ccd138df2..90de5613c 100644 --- a/doc/context/scripts/mkiv/mtx-evohome.man +++ b/doc/context/scripts/mkiv/mtx-evohome.man @@ -1,4 +1,4 @@ -.TH "mtx-evohome" "1" "01-01-2019" "version 1.00" "Evohome Fetcher" +.TH "mtx-evohome" "1" "01-01-2020" "version 1.00" "Evohome Fetcher" .SH NAME mtx-evohome - Evohome Fetcher .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-fcd.man b/doc/context/scripts/mkiv/mtx-fcd.man index b57c0b8f0..6bff46e0d 100644 --- a/doc/context/scripts/mkiv/mtx-fcd.man +++ b/doc/context/scripts/mkiv/mtx-fcd.man @@ -1,4 +1,4 @@ -.TH "mtx-fcd" "1" "01-01-2019" "version 1.00" "Fast Directory Change" +.TH "mtx-fcd" "1" "01-01-2020" "version 1.00" "Fast Directory Change" .SH NAME mtx-fcd - Fast Directory Change .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-flac.man b/doc/context/scripts/mkiv/mtx-flac.man index b0799b5fd..b58582f04 100644 --- a/doc/context/scripts/mkiv/mtx-flac.man +++ b/doc/context/scripts/mkiv/mtx-flac.man @@ -1,4 +1,4 @@ -.TH "mtx-flac" "1" "01-01-2019" "version 0.10" "ConTeXt Flac Helpers" +.TH "mtx-flac" "1" "01-01-2020" "version 0.10" "ConTeXt Flac Helpers" .SH NAME mtx-flac - ConTeXt Flac Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-fonts.man b/doc/context/scripts/mkiv/mtx-fonts.man index e781b087c..b137418b9 100644 --- a/doc/context/scripts/mkiv/mtx-fonts.man +++ b/doc/context/scripts/mkiv/mtx-fonts.man @@ -1,4 +1,4 @@ -.TH "mtx-fonts" "1" "01-01-2019" "version 1.00" "ConTeXt Font Database Management" +.TH "mtx-fonts" "1" "01-01-2020" "version 1.00" "ConTeXt Font Database Management" .SH NAME mtx-fonts - ConTeXt Font Database Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-grep.man b/doc/context/scripts/mkiv/mtx-grep.man index df9bdde57..4c9aa39e5 100644 --- a/doc/context/scripts/mkiv/mtx-grep.man +++ b/doc/context/scripts/mkiv/mtx-grep.man @@ -1,4 +1,4 @@ -.TH "mtx-grep" "1" "01-01-2019" "version 0.10" "Simple Grepper" +.TH "mtx-grep" "1" "01-01-2020" "version 0.10" "Simple Grepper" .SH NAME mtx-grep - Simple Grepper .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-interface.man b/doc/context/scripts/mkiv/mtx-interface.man index 59ed0a94d..d3531d456 100644 --- a/doc/context/scripts/mkiv/mtx-interface.man +++ b/doc/context/scripts/mkiv/mtx-interface.man @@ -1,4 +1,4 @@ -.TH "mtx-interface" "1" "01-01-2019" "version 0.13" "ConTeXt Interface Related Goodies" +.TH "mtx-interface" "1" "01-01-2020" "version 0.13" "ConTeXt Interface Related Goodies" .SH NAME mtx-interface - ConTeXt Interface Related Goodies .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-metapost.man b/doc/context/scripts/mkiv/mtx-metapost.man index 9102a156d..5b110d06c 100644 --- a/doc/context/scripts/mkiv/mtx-metapost.man +++ b/doc/context/scripts/mkiv/mtx-metapost.man @@ -1,4 +1,4 @@ -.TH "mtx-metapost" "1" "01-01-2019" "version 0.10" "MetaPost to PDF processor" +.TH "mtx-metapost" "1" "01-01-2020" "version 0.10" "MetaPost to PDF processor" .SH NAME mtx-metapost - MetaPost to PDF processor .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-modules.man b/doc/context/scripts/mkiv/mtx-modules.man index 6239334ba..5eaff034e 100644 --- a/doc/context/scripts/mkiv/mtx-modules.man +++ b/doc/context/scripts/mkiv/mtx-modules.man @@ -1,4 +1,4 @@ -.TH "mtx-modules" "1" "01-01-2019" "version 1.00" "ConTeXt Module Documentation Generators" +.TH "mtx-modules" "1" "01-01-2020" "version 1.00" "ConTeXt Module Documentation Generators" .SH NAME mtx-modules - ConTeXt Module Documentation Generators .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-package.man b/doc/context/scripts/mkiv/mtx-package.man index 41fb352d7..02671fa95 100644 --- a/doc/context/scripts/mkiv/mtx-package.man +++ b/doc/context/scripts/mkiv/mtx-package.man @@ -1,4 +1,4 @@ -.TH "mtx-package" "1" "01-01-2019" "version 0.10" "Distribution Related Goodies" +.TH "mtx-package" "1" "01-01-2020" "version 0.10" "Distribution Related Goodies" .SH NAME mtx-package - Distribution Related Goodies .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-patterns.man b/doc/context/scripts/mkiv/mtx-patterns.man index f2323b1e6..320a89e22 100644 --- a/doc/context/scripts/mkiv/mtx-patterns.man +++ b/doc/context/scripts/mkiv/mtx-patterns.man @@ -1,4 +1,4 @@ -.TH "mtx-patterns" "1" "01-01-2019" "version 0.20" "ConTeXt Pattern File Management" +.TH "mtx-patterns" "1" "01-01-2020" "version 0.20" "ConTeXt Pattern File Management" .SH NAME mtx-patterns - ConTeXt Pattern File Management .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-pdf.man b/doc/context/scripts/mkiv/mtx-pdf.man index 444b5bc71..df5501b95 100644 --- a/doc/context/scripts/mkiv/mtx-pdf.man +++ b/doc/context/scripts/mkiv/mtx-pdf.man @@ -1,4 +1,4 @@ -.TH "mtx-pdf" "1" "01-01-2019" "version 0.10" "ConTeXt PDF Helpers" +.TH "mtx-pdf" "1" "01-01-2020" "version 0.10" "ConTeXt PDF Helpers" .SH NAME mtx-pdf - ConTeXt PDF Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-plain.man b/doc/context/scripts/mkiv/mtx-plain.man index 9cffe103e..431db53a1 100644 --- a/doc/context/scripts/mkiv/mtx-plain.man +++ b/doc/context/scripts/mkiv/mtx-plain.man @@ -1,4 +1,4 @@ -.TH "mtx-plain" "1" "01-01-2019" "version 1.00" "Plain TeX Runner" +.TH "mtx-plain" "1" "01-01-2020" "version 1.00" "Plain TeX Runner" .SH NAME mtx-plain - Plain TeX Runner .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-profile.man b/doc/context/scripts/mkiv/mtx-profile.man index 51d90c471..f520a9e13 100644 --- a/doc/context/scripts/mkiv/mtx-profile.man +++ b/doc/context/scripts/mkiv/mtx-profile.man @@ -1,4 +1,4 @@ -.TH "mtx-profile" "1" "01-01-2019" "version 1.00" "ConTeXt MkIV LuaTeX Profiler" +.TH "mtx-profile" "1" "01-01-2020" "version 1.00" "ConTeXt MkIV LuaTeX Profiler" .SH NAME mtx-profile - ConTeXt MkIV LuaTeX Profiler .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-rsync.man b/doc/context/scripts/mkiv/mtx-rsync.man index de7403769..60b877073 100644 --- a/doc/context/scripts/mkiv/mtx-rsync.man +++ b/doc/context/scripts/mkiv/mtx-rsync.man @@ -1,4 +1,4 @@ -.TH "mtx-rsync" "1" "01-01-2019" "version 0.10" "Rsync Helpers" +.TH "mtx-rsync" "1" "01-01-2020" "version 0.10" "Rsync Helpers" .SH NAME mtx-rsync - Rsync Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-scite.man b/doc/context/scripts/mkiv/mtx-scite.man index cdae4ff23..2e83387f9 100644 --- a/doc/context/scripts/mkiv/mtx-scite.man +++ b/doc/context/scripts/mkiv/mtx-scite.man @@ -1,4 +1,4 @@ -.TH "mtx-scite" "1" "01-01-2019" "version 1.00" "Scite Helper Script" +.TH "mtx-scite" "1" "01-01-2020" "version 1.00" "Scite Helper Script" .SH NAME mtx-scite - Scite Helper Script .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-server.man b/doc/context/scripts/mkiv/mtx-server.man index 39ef6efea..ee565d416 100644 --- a/doc/context/scripts/mkiv/mtx-server.man +++ b/doc/context/scripts/mkiv/mtx-server.man @@ -1,4 +1,4 @@ -.TH "mtx-server" "1" "01-01-2019" "version 0.10" "Simple Webserver For Helpers" +.TH "mtx-server" "1" "01-01-2020" "version 0.10" "Simple Webserver For Helpers" .SH NAME mtx-server - Simple Webserver For Helpers .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-texworks.man b/doc/context/scripts/mkiv/mtx-texworks.man index ff7b37462..67e84a4d7 100644 --- a/doc/context/scripts/mkiv/mtx-texworks.man +++ b/doc/context/scripts/mkiv/mtx-texworks.man @@ -1,4 +1,4 @@ -.TH "mtx-texworks" "1" "01-01-2019" "version 1.00" "TeXworks Startup Script" +.TH "mtx-texworks" "1" "01-01-2020" "version 1.00" "TeXworks Startup Script" .SH NAME mtx-texworks - TeXworks Startup Script .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-timing.man b/doc/context/scripts/mkiv/mtx-timing.man index d735b4541..582898c1a 100644 --- a/doc/context/scripts/mkiv/mtx-timing.man +++ b/doc/context/scripts/mkiv/mtx-timing.man @@ -1,4 +1,4 @@ -.TH "mtx-timing" "1" "01-01-2019" "version 0.10" "ConTeXt Timing Tools" +.TH "mtx-timing" "1" "01-01-2020" "version 0.10" "ConTeXt Timing Tools" .SH NAME mtx-timing - ConTeXt Timing Tools .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-tools.man b/doc/context/scripts/mkiv/mtx-tools.man index e90516e2f..6626110b7 100644 --- a/doc/context/scripts/mkiv/mtx-tools.man +++ b/doc/context/scripts/mkiv/mtx-tools.man @@ -1,4 +1,4 @@ -.TH "mtx-tools" "1" "01-01-2019" "version 1.01" "Some File Related Goodies" +.TH "mtx-tools" "1" "01-01-2020" "version 1.01" "Some File Related Goodies" .SH NAME mtx-tools - Some File Related Goodies .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-unicode.man b/doc/context/scripts/mkiv/mtx-unicode.man index da3ba3215..072ff371f 100644 --- a/doc/context/scripts/mkiv/mtx-unicode.man +++ b/doc/context/scripts/mkiv/mtx-unicode.man @@ -1,4 +1,4 @@ -.TH "mtx-unicode" "1" "01-01-2019" "version 1.02" "Checker for char-dat.lua" +.TH "mtx-unicode" "1" "01-01-2020" "version 1.02" "Checker for char-dat.lua" .SH NAME mtx-unicode - Checker for char-dat.lua .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-unzip.man b/doc/context/scripts/mkiv/mtx-unzip.man index b2b954e71..d67698c59 100644 --- a/doc/context/scripts/mkiv/mtx-unzip.man +++ b/doc/context/scripts/mkiv/mtx-unzip.man @@ -1,4 +1,4 @@ -.TH "mtx-unzip" "1" "01-01-2019" "version 0.10" "Simple Unzipper" +.TH "mtx-unzip" "1" "01-01-2020" "version 0.10" "Simple Unzipper" .SH NAME mtx-unzip - Simple Unzipper .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-update.man b/doc/context/scripts/mkiv/mtx-update.man index a4ecef639..35500fb6d 100644 --- a/doc/context/scripts/mkiv/mtx-update.man +++ b/doc/context/scripts/mkiv/mtx-update.man @@ -1,4 +1,4 @@ -.TH "mtx-update" "1" "01-01-2019" "version 1.03" "ConTeXt Minimals Updater" +.TH "mtx-update" "1" "01-01-2020" "version 1.03" "ConTeXt Minimals Updater" .SH NAME mtx-update - ConTeXt Minimals Updater .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-vscode.man b/doc/context/scripts/mkiv/mtx-vscode.man index 6c1a0cd11..f1c886fa0 100644 --- a/doc/context/scripts/mkiv/mtx-vscode.man +++ b/doc/context/scripts/mkiv/mtx-vscode.man @@ -1,4 +1,4 @@ -.TH "mtx-vscode" "1" "01-01-2019" "version 1.00" "vscode extension generator" +.TH "mtx-vscode" "1" "01-01-2020" "version 1.00" "vscode extension generator" .SH NAME mtx-vscode - vscode extension generator .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-watch.man b/doc/context/scripts/mkiv/mtx-watch.man index 77458718b..185dc64bc 100644 --- a/doc/context/scripts/mkiv/mtx-watch.man +++ b/doc/context/scripts/mkiv/mtx-watch.man @@ -1,4 +1,4 @@ -.TH "mtx-watch" "1" "01-01-2019" "version 1.00" "ConTeXt Request Watchdog" +.TH "mtx-watch" "1" "01-01-2020" "version 1.00" "ConTeXt Request Watchdog" .SH NAME mtx-watch - ConTeXt Request Watchdog .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-youless.man b/doc/context/scripts/mkiv/mtx-youless.man index 3f6fe109b..6d4e8b1df 100644 --- a/doc/context/scripts/mkiv/mtx-youless.man +++ b/doc/context/scripts/mkiv/mtx-youless.man @@ -1,4 +1,4 @@ -.TH "mtx-youless" "1" "01-01-2019" "version 1.100" "youless Fetcher" +.TH "mtx-youless" "1" "01-01-2020" "version 1.100" "youless Fetcher" .SH NAME mtx-youless - youless Fetcher .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtxrun.man b/doc/context/scripts/mkiv/mtxrun.man index f6c876c00..8118c9c7f 100644 --- a/doc/context/scripts/mkiv/mtxrun.man +++ b/doc/context/scripts/mkiv/mtxrun.man @@ -1,4 +1,4 @@ -.TH "mtxrun" "1" "01-01-2019" "version 1.33" "ConTeXt TDS Runner Tool" +.TH "mtxrun" "1" "01-01-2020" "version 1.33" "ConTeXt TDS Runner Tool" .SH NAME mtxrun - ConTeXt TDS Runner Tool .SH SYNOPSIS diff --git a/doc/context/sources/general/manuals/evenmore/evenmore-libraries.tex b/doc/context/sources/general/manuals/evenmore/evenmore-libraries.tex new file mode 100644 index 000000000..35c957c99 --- /dev/null +++ b/doc/context/sources/general/manuals/evenmore/evenmore-libraries.tex @@ -0,0 +1,186 @@ +% language=us + +\startcomponent evenmore-libraries + +\environment evenmore-style + +\startchapter[title={Libraries}] + +\startsection[title={Introduction}] + +The \LUAMETATEX\ binary comes with a couple of libraries built in. These normally +provide enough functionality to get a \TEX\ job done. But take the case where +need to manipulate (or convert) an image before we can include it? It would be +nice if \CONTEXT\ does that for you so having some features in the binary that +handle it make sense. However, given that such a conversion only happens once it +makes more sense to just call an external program and let that deal with it. It +is for that reason that the \CONTEXT\ code base has hardly any library related +code: most of what one wants to do can be done by calling a program. Some callers +are built in, others can be dealt with using the Adityas filter module. The most +significant runtime exception is probably accessing \SQL\ databases where it +might be more efficient to use a library call instead of calling a client. And +even then the main reason for that interface being present is the simple fact +that I (ab)use the engine to serve requests that need some kind of database +access. Another example of where we need some external program is in generating +barcodes. Here one can argue that it does make sense to do that runtime, for +instance because they change or because one doesn't like to have dozens of cached +barcode images on disk. + +In this chapter I will explain how we deal with libraries in \LUAMETATEX. Because +libraries create a dependency an approach is chosen that tries to avoid bloating +the source tree with additional header and source files. This is made easy by the +fact that we don't need full blown interfaces to libraries where all methods are +exposed. We know what we need and most of these tasks somehow relate to +typesetting which is a limited application with known demands in terms of input, +output and performance. We don't need to serve every possible scenario. + +\stopsection + +\startsection[title={Using \LUA\ libraries}] + +One approach is to use a \LUA\ library that sits between the embedded \LUA\ instance +and the external library. Say that one does this: + +\starttyping +local mylib = require("mylib") +\stoptyping + +This can locate and load the file \type {mylib.lua} which implements a bunch of +(\LUA) functions. But, it can also load a library, for instance \type +{mylib.dll}, a binary that provides functions that themselves can call external +ones. Often such a library is also responsible for some resource management which +is then done via userdata objects. Such a connector library on the one hand +refers to \LUA\ library methods (like \type {const char * str = lua_tostring (L, +1);} for fetching a \LUA\ string variable from the argument list) and on the +other hand to those in the external library (like passing that string \type {str} +to a function and passing the result back to \LUA\ with \type {lua_pushstring (L, +result);}). If we would follow that approach in \LUAMETATEX\ it means that in +addition to the main binary (on \MSWINDOWS\ that is \type {luametatex.exe}) there +is also an extra intermediate binary (on \MSWINDOWS\ that is \type {mylib.dll}) +plus the external library (on \MSWINDOWS\ that could be \type {foolib.dll}) which +itself can depend on other libraries. + +In this approach we need to compile the extra intermediate libraries alongside +the main \LUAMETATEX\ binary. Quite likely we then need access to the header +files of the external libraries too. We might even decide to put the dependencies +in our source tree. But, this is not what we like to do: it adds extra work, we +need to keep an eye on updates and operating specific patches, we complicate the +compilation, etc. This all contradicts the fact that we want \LUAMETATEX\ to be +simple. There is no need to complicate the setup just because a very few users +want to use some library. Add to this the fact that quite likely we need to +provide a version of \LUAMETATEX\ that exposes its \LUA\ related symbols which +makes for a larger binary. So, this approach is not really an option because +at the same time we like to keep the binary (and memory footprint) as small +as possible (think of running in a container or on a low energy device). + +\stopsection + +\startsection[title=A variant] + +There are a few issues when you use \LUA\ libraries from elsewhere. First of all, +you need to get hold of one that matches the version of \LUA\ that you use. There +are not that many and some only can be set up as part of a larger framework. +Also, you can find plenty of modules that seem not to be maintained (or maybe +they are just very stable and I'm wrong here). Also, not all platforms are +supported equally well. Then there is the question to what extend libraries are +to stay. What is considered to be the standard today might not be tomorrow. Even +in the rather stable \TEX\ ecosystem we see them come and go. These are all +reasons to avoid hard coded dependencies. Ideally we like users to be able to +compile \LUAMETATEX\ in the future without too must hassle. + +A couple of years after we started the \LUATEX\ project, a solution for using +libraries was implemented, called \SWIGLIB, because it uses the swig +infrastructure. It was an attempt to come up with a more or less standard +approach, a rather one|-|to|-|one mapping so that basically any library could be +interfaced. But, probably because no one really needs libraries, it never catched +on. In \MKIV\ we still support loading libraries made that way but in \LMTX\ that +code has been removed. + +As a side note: the code that deals with this in \MKIV\ also deals with version +specific loading. When we were playing with for instance \MYSQL\ libs we found +out that it made sense to be able to support different \API s, but in the end, +given the rare usage of libraries, that made no sense either. Therefore in \LMTX\ +locating libraries has version support removes and as a consequence is much +simpler (code|-|wise). + +\stopsection + +\startsection[title=Foreign function interfaces] + +Then there is a \FFI\ interface, first introduced in \LUAJITTEX\ as it is part of +\LUAJIT, and later a similar library was built|-|in \LUATEX. But \LUAJIT\ doesn't +conceptually follow \LUA\ upgrades and its future is unsure so in \LUAMETATEX\ +there is no \JIT\ variant (the \JIT\ part was never used anyway as it only slowed +down a run; we just used the \FFI\ part plus the fact that the restricted virtual +machine performs better). The \FFI\ library used in \LUATEX\ also comes from +elsewhere and it doesn't seem to be maintained any longer, so that code is to be +kept working in the perspective of \LUATEX. Both technologies hook into the +processor architecture and are somewhat complex so when their maintenance becomes +unsure we have to reconsider using them. Not all hardware platforms are supported +\footnote {As I write this only Intel works while ARM doesn't and only on +\MSWINDOWS, \LINUX\ and \OSX\ I can compile without alignment warnings} and the +functionality can differ in details per platform. To some extend we can keep +using \FFI\ in \LUATEX\ because Luigi takes care of it, but who knows when it +becomes too problematic. Does it make sense to adopt a library that needs tweaks +depending on architectures? For now we're good for \LUATEX, so for a while we're +also okay (in \MKIV). + +The nice thing about \FFI\ is that one can define the interface at runtime. Of +course this interface has to fit the current version of the library \API, but +that is doable. It is up to a user of a library to determine where it comes from. +It can be put in the \TEX\ tree but also being taken from wherever the operating +system put it in the path. Of course that can then be a bit of an issue when +there are different versions because programs can ship their own variants, but +when you use a library you probably are aware of that and know what you're doing. +A drawback of \FFI\ is that it opens up the whole machinery pretty low level, +which can be considered a risk. Some can consider that to be a security threat. +It for these reasons that \LUAMETATEX\ doesn't provide the \FFI\ feature; users +who depend on it can of course use \MKIV\ with \LUATEX. + +\stopsection + +\startsection[title=So how to proceed?] + +When a library and its \LUA\ interface are kept external the main binary has to +be compiled in a way that permits loading libraries (read: symbols need to be +known). When we use \FFI\ that is not needed. And when a library is internal we +have the disadvantage that we mentioned at the start of this chapter. + +So, how do we combine the advantages of \FFI\ (runtime binding), external +libraries (no need to have all that code in the code base) and internal libraries +(no loading issues)? At some point it stroke me that we actually can do that with +not that much effort. The solution was probably subconsciously implanted by +noticing the fact that the \LUAMETATEX\ machinery uses function pointers in some +places and the fact that when a \LUA\ library is loaded by \LUA\ itself, a +specific initialization function is called to initialize it: by combining these +concepts we can delay the binding till when a library is needed. + +In \LUAMETATEX\ we can therefore have some optional libraries that offer a +minimal interface because after all we can do a lot at the \LUA\ end. Optional +libraries register themselves in the global \type {optional} table. We're talking +of a couple of hundred lines of \CCODE\ for a simple binding. The functions in an +optional library table can be used (accessed) without loading the library and +then just do nothing useful. So, before using them you need to load the third +party library but we can safely assume that the \LUA\ wrapper code calls an +initializer when it needs some feature. That initializer, which by the way is +located at the \LUA\ end, loads the external library, and when that is successful +the needed helpers are bound by resolving function pointers. There is no +dependency when nothing is used: the main binary stays lean and mean because the +binding normally only adds a few \KB. Users can compile without dependencies and +when used performance is quite okay (no \FFI\ overhead). + +The \LUAMETATEX\ distribution only ships a few such bindings but these can serve +as example. What is shipped has a proper \LUA\ companion file and these are then +the standard one used in the \CONTEXT\ distribution. Think of \MYSQL\ and +\SQLITE\ (for databases), \ZINT\ (for barcodes), simple \CURL\ (for fetching +stuff), \GHOSTSCRIPT\ and \GRAPHICSMAGICK\ (for some conversions) bindings . When +compiled into \LUAMETATEX\ these will add some interfacing code to the main +binary but that gets compensated by the removal of the \FFI\ library. The \LUA\ +interfaces provide just enough to get us going. At some point we can consider +providing libraries as optional part of an installation because we can generate +them using the buildbot infrastructure managed by Mojca, but the core +distribution (source code) is kept clean. + +\stopsection + +\stopcomponent diff --git a/doc/context/sources/general/manuals/evenmore/evenmore.tex b/doc/context/sources/general/manuals/evenmore/evenmore.tex index 5bd751bfd..317c1548c 100644 --- a/doc/context/sources/general/manuals/evenmore/evenmore.tex +++ b/doc/context/sources/general/manuals/evenmore/evenmore.tex @@ -18,6 +18,7 @@ \component evenmore-normalization \component evenmore-expansion \component evenmore-macros + \component evenmore-libraries \stopbodymatter \stopdocument diff --git a/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex b/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex index 67ca75966..6a322c771 100644 --- a/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex +++ b/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex @@ -107,6 +107,39 @@ StopPage ; \startsection[title=Introduction] +Since we started developing \LUATEX\ several methods have been explored with +regards to external libraries. Now, before we go into details, it must be said +that in practice this feature is hardly needed. If someone really needs it, it is +likely to be in a setting where one can also write some library interface and +compile \LUATEX\ to suit it. So, what we're talking of here is probably not of +interest for all of you. + +In the perspective of \CONTEXT\ a dependency on a library is not what we have in +mind when we advocate long term usage (and stability) of a workflow. If you see +\TEX\ as an independent component but still depend on its use of libraries you +might consider having a backup plan in case a library is no longer maintained, of +when it gets replaced by another favourite, as happens. There are several ways to +use a library, and we mention a few here. + +The first one is to use \LUA\ {\em wrapper} libraries that interface to some {\em +specific} library. This is what you do when you use \LUA\ as stand alone program. +In that case you depend on someone cooking up an efficient and reliable +interface. Then you depend on the author or others to provide the binaries. If +there is only one target platform you can wonder if you like that additional +dependency. Another aspect to keep in mind is that such a wrapper library has to +match both the used library and the version of \LUA\ that you use. When we use +this method in \LUATEX, one also has also to make sure that the \LUATEX\ binary +is compiled in a way that permits loading (this has to do with exposing symbols +that need a runtime binding). + +Because this didn't work out well in practice, already before version 1.0 showed +up we explored a flexible way to create libraries suited for \LUATEX. This +project was tagged \quotation {\SWIGLIB}. An infrastructure was created and a +couple of example library interfaces were provided. However, in practice this +never catched on and we don't expect distributions to provide libraries in +addition to the main \LUATEX\ binary, but the framework is there for those who +want to play with it. + Not long after we released \LUATEX\ 1.0, we started experimenting a bit more with so called foreign function interface: \FFI. Originally that interface to external libraries was only available in \LUAJITTEX, but a good and compatible alternative @@ -115,39 +148,43 @@ to know how it works, as long as it works. It means that in addition to \SWIGLIB we have a method that doesn't demand compilation as it uses normal (public) libraries. -Of course one needs to make sure that the right version of a library is used. -And, as there is the danger of the \API\ having been changed in an incompatible -way one can wonder if such a dependency is really what one wants. On the other -hand one can expect \CONTEXT\ to keep up. - -Do you really need libraries? For instance does it really make sense to use curl, -ghostscript or graphicmagic libraries while the command line version is -(normally) just as efficient and avoids a dependency. This is even more true if -you realizes that for instance a fetch or conversion only needs to happen once -per run or in fact only when there is some change in the resource. - -On the other hand, when accessing databases one can avoid the often slower -command line calls and save the hassle of intermediate files. Here efficiency -wins. Also, when \CONTEXT\ is used in a high performance database backend -application a distribution and the used libraries are not updated on a daily -basis. +A last alternative we mention is to just add the libraries to the \LUATEX\ +engine. In fact, this happens: the \METAPOST\ binary has been provided this way +for quite a while now. In \LUAMETATEX\ for instance some more math related +libraries were added, simply because the overhead is not that large and because +it is a way to extend \METAPOST\ beyond what it provided out of the box. + +Before we proceed, ask yourself this questions: \quotation {Do I really need more +libraries?} For instance does it really make sense to use \CURL, \GHOSTSCRIPT\ or +\GRAPHICSMAGICK\ libraries while the command line version is (normally) just as +efficient and avoids a dependency. This is even more true if you realizes that +for instance a fetch or conversion only needs to happen once per run or in fact +only when there is some change in the resource. On the other hand, when accessing +databases one can avoid the often slower command line calls and save the hassle +of intermediate files. Here efficiency wins. Also, when \CONTEXT\ is used in a +high performance database backend application a distribution and the used +libraries are not updated on a daily basis. Anyway, if the answer to the +question, and it can depend on what variant of \CONTEXT\ you use: \MKIV\ or +\LMTX, is \quotation {Yes!} then read on. \stopsection -\startsection[title=Supported] +\startsection[title=Usage in \MKIV] -Apart from some experiments we currently can use \FFI\ interfaced libraries in: +Although there are (still) some examples of \SWIGLIB\ in \MKIV\ we now assume +that the \FFI\ interface is used. Apart from some experiments we currently can +use \FFI\ interfaced libraries in: \starttabulate[|l|l|l|l|l|] \FL -\BC module \BC library \BC windows \BC unix \NC \NR +\BC module \BC library \BC windows \BC unix \NC \NR \ML -\NC util-crl \NC curl \NC libcurl \NC libcurl \NC \NR % todo: client and ffi -\NC util-sql-imp-ffi \NC mysql \NC libmysql \NC libmysqlclient \NC \NR -\NC util-sql-imp-sqlite \NC sqlite \NC sqlite3 \NC sqlite3 \NC \NR -%NC font-phb-imp-library \NC harfbuzz \NC libharfbuzz \NC libharfbuzz \NC \NR % for testing uniscribe (idris fonts) -%NC \NC ghostscript \NC \NC \NC \NR % only a few experiments -%NC \NC graphicmagick \NC \NC \NC \NR % only a few experiments +\NC util-crl \NC curl \NC libcurl \NC libcurl \NC \NR % todo: client and ffi +\NC util-sql-imp-ffi \NC mysql \NC libmysql \NC libmysqlclient \NC \NR +\NC util-sql-imp-sqlite \NC sqlite \NC sqlite3 \NC sqlite3 \NC \NR +%NC font-phb-imp-library \NC harfbuzz \NC libharfbuzz \NC libharfbuzz \NC \NR % old, for testing uniscribe (idris fonts) +%NC \NC ghostscript \NC \NC \NC \NR % only a few experiments +%NC \NC graphicsmagick \NC \NC \NC \NR % only a few experiments \LL \stoptabulate @@ -161,7 +198,7 @@ different versions. You can try to play safe and put libraries in the \TEX\ tree instance on my system they are in: \starttyping -c:/data/tex-context/tex/texmf-win64/bin/lib/luatex/lua/whatever/libwhatever.dll +c:/data/tex-context/tex/texmf-win64/bin/lib/luatex/foo/libfoo.dll \stoptyping You can trace where libraries are looked for with: @@ -179,9 +216,59 @@ trackers.enable("resolvers.ffilib") The library is first located on one of the valid \TDS\ paths (these are sort of standardized in \TEX\ distributions) and then using the normal \FFI\ loader. -As this is all still experimental in \LUATEX\ there is not much more to say about -it now. Of course this kind of specialized support to a large degree depends on -the need to use it. +\stopsection + +\startsection[title=Usage in \LMTX] + +In \CONTEXT\ \LMTX\ we only have so called \quote {optional} libraries. Actually +they are just simple interfaces that register themselves in the \type {optional} +namespace and that can load the real library at runtime. The approach is rather +lightweight in the sense that compilation of the \LUAMETATEX\ binary doesn't +depend on additional resources (there is no need to have the libraries on the +system or their source code to be present) and that at runtime there is no need +to have the libraries present. This sounds similar to delayed loading of \LUA\ +wrapper libraries but the difference is that there is no potential \LUA\ version +clash and we also still have one single (relatively small) binary. + +This approach works ok because in practice only very few users need a library and +when they do they have to compile the interface anyway. And, as they compile, +they can as well add a few lines that are needed to integrate their library to +the optional mechanism. If you depend on such extensions, you quite certainly +know what you're doing and need to maintain a code base very careful. + +There are some optional libraries present, like: + +\starttabulate[|l|l|l|l|l|] +\FL +\BC module \BC library \BC windows \BC unix \NC \NR +\ML +\NC libs-imp-curl \NC curl \NC libcurl \NC libcurl \NC \NR +\NC libs-imp-mysql \NC mysql \NC libmysql \NC libmysqlclient \NC \NR +\NC libs-imp-sqlite \NC sqlite \NC sqlite3 \NC sqlite3 \NC \NR +%NC libs-imp-postgress \NC libpg \NC libpg \NC libpg \NC \NR % untested +\NC libs-imp-zint \NC libzint \NC libzint \NC libzint \NC \NR +\NC libs-imp-ghostscript \NC ghostscript \NC gswin64 \NC libgs \NC \NR +\NC libs-imp-graphicsmagick \NC graphicsmagick \NC several \NC unknown \NC \NR +%NC font-phb-imp-internal \NC hb \NC libharfbuzz \NC libharfbuzz \NC \NR % maybe, for idris, testing uniscribe +\LL +\stoptabulate + +It is still to be decided how these will be used. An example of a library that +can be used out of the box is \ZINT\ for using barcodes: see \type {m-zint.mkxl} +for an example of its usage. The \SQL\ libraries have their own manuals and have +been around for a while. They have a common encapsulating infrastructure written +in \LUA. + +It is best to keep libraries in a place where you can keep an eye on them being +updated, like + +\starttyping +c:/data/tex-context/tex/texmf-win64/bin/lib/luametatex/foo/libfoo.dll +\stoptyping + +You could of course use the ones provided by the system or maybe use symbolic +links so that you still keep en eye on changes. The \CONTEXT\ distribution might +at some point provide the libraries that we support. \stopsection @@ -191,7 +278,7 @@ the need to use it. \NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR \NC version \NC \currentdate \NC \NR \NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR -\NC comment \NC many thanks to Luigi Scarso for taking care of ffi support in the engines \NC \NR +\NC comment \NC many thanks to Luigi Scarso for taking care of \FFI\ support in the engines \NC \NR \stoptabulate \stopsection diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index a2f38e2b4..1edb7d464 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -22117,7 +22117,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 69574, stripped down to: 44470 +-- original size: 69575, stripped down to: 44470 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -25278,7 +25278,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-lst"] = package.loaded["data-lst"] or true --- original size: 1912, stripped down to: 1591 +-- original size: 2038, stripped down to: 1696 if not modules then modules={} end modules ['data-lst']={ version=1.001, @@ -25300,15 +25300,23 @@ 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) - local unset={ "unset" } for key,value in sortedhash(result) do report_lists(key) - report_lists(" env: % | t",value.environment or unset) - report_lists(" var: % | t",value.variable or unset) - report_lists(" exp: % | t",value.expansion or unset) - report_lists(" res: % | t",value.resolved or unset) + 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() @@ -25335,7 +25343,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 16094, stripped down to: 8443 +-- original size: 17659, stripped down to: 9560 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -25387,7 +25395,7 @@ local function locate(required,version,trace,report,action) else local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false - local engine="luatex" + local engine=environment.ownmain or false if trace and not done then local list=expandpaths("lib") for i=1,#list do @@ -25497,6 +25505,7 @@ local function locate(required,version,trace,report,action) end return library or nil end +resolvers.locatelib=locate do local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false @@ -25648,6 +25657,50 @@ if FFISUPPORTED and ffi and ffi.load then end end end +do + local isfile=lfs.isfile + local report=logs.reporter("resolvers","lib") + local trace=false + trackers.register("resolvers.lib",function(v) trace=v end) + local function action(filename) + return isfile(filename) and filename or false + end + function resolvers.findlib(required) + local list=directives.value("system.librarynames" ) + local only=nameonly(required) + if type(list)=="table" then + list=list[only] + if type(list)=="table" then + if trace then + report("using lookup list for library %a: % | t",only,list) + end + else + list={ only } + end + else + list={ only } + end + for i=1,#list do + local name=list[i] + local found=locate(name,false,trace,report,action) + if found then + return found + end + end + local getpaths=resolvers.expandedpathlistfromvariable + if getpaths then + local list=getpaths("PATH") + local base=addsuffix(only,os.libsuffix) + for i=1,#list do + local full=joinfile(list[i],base) + local found=locate(full,false,trace,report,action) + if found then + return found + end + end + end + end +end end -- of closure @@ -26092,8 +26145,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1044071 --- stripped bytes : 416008 +-- original bytes : 1045763 +-- stripped bytes : 416478 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index a2f38e2b4..1edb7d464 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -22117,7 +22117,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 69574, stripped down to: 44470 +-- original size: 69575, stripped down to: 44470 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -25278,7 +25278,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-lst"] = package.loaded["data-lst"] or true --- original size: 1912, stripped down to: 1591 +-- original size: 2038, stripped down to: 1696 if not modules then modules={} end modules ['data-lst']={ version=1.001, @@ -25300,15 +25300,23 @@ 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) - local unset={ "unset" } for key,value in sortedhash(result) do report_lists(key) - report_lists(" env: % | t",value.environment or unset) - report_lists(" var: % | t",value.variable or unset) - report_lists(" exp: % | t",value.expansion or unset) - report_lists(" res: % | t",value.resolved or unset) + 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() @@ -25335,7 +25343,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 16094, stripped down to: 8443 +-- original size: 17659, stripped down to: 9560 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -25387,7 +25395,7 @@ local function locate(required,version,trace,report,action) else local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false - local engine="luatex" + local engine=environment.ownmain or false if trace and not done then local list=expandpaths("lib") for i=1,#list do @@ -25497,6 +25505,7 @@ local function locate(required,version,trace,report,action) end return library or nil end +resolvers.locatelib=locate do local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false @@ -25648,6 +25657,50 @@ if FFISUPPORTED and ffi and ffi.load then end end end +do + local isfile=lfs.isfile + local report=logs.reporter("resolvers","lib") + local trace=false + trackers.register("resolvers.lib",function(v) trace=v end) + local function action(filename) + return isfile(filename) and filename or false + end + function resolvers.findlib(required) + local list=directives.value("system.librarynames" ) + local only=nameonly(required) + if type(list)=="table" then + list=list[only] + if type(list)=="table" then + if trace then + report("using lookup list for library %a: % | t",only,list) + end + else + list={ only } + end + else + list={ only } + end + for i=1,#list do + local name=list[i] + local found=locate(name,false,trace,report,action) + if found then + return found + end + end + local getpaths=resolvers.expandedpathlistfromvariable + if getpaths then + local list=getpaths("PATH") + local base=addsuffix(only,os.libsuffix) + for i=1,#list do + local full=joinfile(list[i],base) + local found=locate(full,false,trace,report,action) + if found then + return found + end + end + end + end +end end -- of closure @@ -26092,8 +26145,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1044071 --- stripped bytes : 416008 +-- original bytes : 1045763 +-- stripped bytes : 416478 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index a2f38e2b4..1edb7d464 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -22117,7 +22117,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 69574, stripped down to: 44470 +-- original size: 69575, stripped down to: 44470 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -25278,7 +25278,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-lst"] = package.loaded["data-lst"] or true --- original size: 1912, stripped down to: 1591 +-- original size: 2038, stripped down to: 1696 if not modules then modules={} end modules ['data-lst']={ version=1.001, @@ -25300,15 +25300,23 @@ 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) - local unset={ "unset" } for key,value in sortedhash(result) do report_lists(key) - report_lists(" env: % | t",value.environment or unset) - report_lists(" var: % | t",value.variable or unset) - report_lists(" exp: % | t",value.expansion or unset) - report_lists(" res: % | t",value.resolved or unset) + 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() @@ -25335,7 +25343,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 16094, stripped down to: 8443 +-- original size: 17659, stripped down to: 9560 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -25387,7 +25395,7 @@ local function locate(required,version,trace,report,action) else local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false - local engine="luatex" + local engine=environment.ownmain or false if trace and not done then local list=expandpaths("lib") for i=1,#list do @@ -25497,6 +25505,7 @@ local function locate(required,version,trace,report,action) end return library or nil end +resolvers.locatelib=locate do local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false @@ -25648,6 +25657,50 @@ if FFISUPPORTED and ffi and ffi.load then end end end +do + local isfile=lfs.isfile + local report=logs.reporter("resolvers","lib") + local trace=false + trackers.register("resolvers.lib",function(v) trace=v end) + local function action(filename) + return isfile(filename) and filename or false + end + function resolvers.findlib(required) + local list=directives.value("system.librarynames" ) + local only=nameonly(required) + if type(list)=="table" then + list=list[only] + if type(list)=="table" then + if trace then + report("using lookup list for library %a: % | t",only,list) + end + else + list={ only } + end + else + list={ only } + end + for i=1,#list do + local name=list[i] + local found=locate(name,false,trace,report,action) + if found then + return found + end + end + local getpaths=resolvers.expandedpathlistfromvariable + if getpaths then + local list=getpaths("PATH") + local base=addsuffix(only,os.libsuffix) + for i=1,#list do + local full=joinfile(list[i],base) + local found=locate(full,false,trace,report,action) + if found then + return found + end + end + end + end +end end -- of closure @@ -26092,8 +26145,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1044071 --- stripped bytes : 416008 +-- original bytes : 1045763 +-- stripped bytes : 416478 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index a2f38e2b4..1edb7d464 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -22117,7 +22117,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 69574, stripped down to: 44470 +-- original size: 69575, stripped down to: 44470 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -25278,7 +25278,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-lst"] = package.loaded["data-lst"] or true --- original size: 1912, stripped down to: 1591 +-- original size: 2038, stripped down to: 1696 if not modules then modules={} end modules ['data-lst']={ version=1.001, @@ -25300,15 +25300,23 @@ 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) - local unset={ "unset" } for key,value in sortedhash(result) do report_lists(key) - report_lists(" env: % | t",value.environment or unset) - report_lists(" var: % | t",value.variable or unset) - report_lists(" exp: % | t",value.expansion or unset) - report_lists(" res: % | t",value.resolved or unset) + 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() @@ -25335,7 +25343,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 16094, stripped down to: 8443 +-- original size: 17659, stripped down to: 9560 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -25387,7 +25395,7 @@ local function locate(required,version,trace,report,action) else local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false - local engine="luatex" + local engine=environment.ownmain or false if trace and not done then local list=expandpaths("lib") for i=1,#list do @@ -25497,6 +25505,7 @@ local function locate(required,version,trace,report,action) end return library or nil end +resolvers.locatelib=locate do local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false @@ -25648,6 +25657,50 @@ if FFISUPPORTED and ffi and ffi.load then end end end +do + local isfile=lfs.isfile + local report=logs.reporter("resolvers","lib") + local trace=false + trackers.register("resolvers.lib",function(v) trace=v end) + local function action(filename) + return isfile(filename) and filename or false + end + function resolvers.findlib(required) + local list=directives.value("system.librarynames" ) + local only=nameonly(required) + if type(list)=="table" then + list=list[only] + if type(list)=="table" then + if trace then + report("using lookup list for library %a: % | t",only,list) + end + else + list={ only } + end + else + list={ only } + end + for i=1,#list do + local name=list[i] + local found=locate(name,false,trace,report,action) + if found then + return found + end + end + local getpaths=resolvers.expandedpathlistfromvariable + if getpaths then + local list=getpaths("PATH") + local base=addsuffix(only,os.libsuffix) + for i=1,#list do + local full=joinfile(list[i],base) + local found=locate(full,false,trace,report,action) + if found then + return found + end + end + end + end +end end -- of closure @@ -26092,8 +26145,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1044071 --- stripped bytes : 416008 +-- original bytes : 1045763 +-- stripped bytes : 416478 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index d2b57d4a6..340f7ad1b 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.12.31 11:28} +\newcontextversion{2020.01.09 11:17} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index d90c73f8d..c167e30e3 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.31 11:28} +\edef\contextversion{2020.01.09 11:17} %D For those who want to use this: diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index d39e87878..7d946c729 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -1101,7 +1101,7 @@ local function failure(name) end local function usecolors(name) - commands.uselibrary { + resolvers.uselibrary { category = "color definition", name = name, patterns = patterns, diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 59829a0de..00d450516 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2019.12.31 11:28} +\newcontextversion{2020.01.09 11:17} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 2d821e5a4..bb60e8ad3 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.31 11:28} +\edef\contextversion{2020.01.09 11:17} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index c20380d19..a2e1ef4c5 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.31 11:28} +\edef\contextversion{2020.01.09 11:17} \edef\contextkind {beta} %D Kind of special: @@ -590,6 +590,8 @@ \loadmarkfile{syst-cmp} % compatibility stuff moved here +\loadmkxlfile{libs-ini} + \loadmarkfile{cont-run} % the main runner (used in cont-yes.mkiv) \setupcurrentlanguage[\defaultlanguagetag] diff --git a/tex/context/base/mkiv/data-lst.lua b/tex/context/base/mkiv/data-lst.lua index 8e0061c4d..f349409e4 100644 --- a/tex/context/base/mkiv/data-lst.lua +++ b/tex/context/base/mkiv/data-lst.lua @@ -25,15 +25,24 @@ 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) - local unset = { "unset" } for key, value in sortedhash(result) do report_lists(key) - report_lists(" env: % | t",value.environment or unset) - report_lists(" var: % | t",value.variable or unset) - report_lists(" exp: % | t",value.expansion or unset) - report_lists(" res: % | t",value.resolved or unset) + 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 diff --git a/tex/context/base/mkiv/data-res.lua b/tex/context/base/mkiv/data-res.lua index 01b8f1aca..d8ad81656 100644 --- a/tex/context/base/mkiv/data-res.lua +++ b/tex/context/base/mkiv/data-res.lua @@ -1023,7 +1023,7 @@ function resolvers.renewcache() end local function isreadable(name) - local readable = isfile(name) -- not file.is_readable(name) asit can be a dir + local readable = isfile(name) -- not file.is_readable(name) as it can be a dir if trace_details then if readable then report_resolving("file %a is readable",name) diff --git a/tex/context/base/mkiv/file-lib.lua b/tex/context/base/mkiv/file-lib.lua index 8ef1a48d3..7fc599d00 100644 --- a/tex/context/base/mkiv/file-lib.lua +++ b/tex/context/base/mkiv/file-lib.lua @@ -93,5 +93,3 @@ function resolvers.uselibrary(specification) -- todo: reporter end end end - -commands.uselibrary = resolvers.uselibrary -- for the moment diff --git a/tex/context/base/mkiv/libs-imp-curl.lua b/tex/context/base/mkiv/libs-imp-curl.lua new file mode 100644 index 000000000..b30739794 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-curl.lua @@ -0,0 +1,296 @@ +if not modules then modules = { } end modules ['libs-imp-curl'] = { + version = 1.001, + comment = "companion to luat-lib.mkxl", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- c:/data/develop/tex-context/tex/texmf-win64/bin/lib/luametatex/lua/copies/curl/libcurl.dll + +local libname = "curl" +local libfile = "libcurl" + +local curllib = resolvers.libraries.validoptional(libname) + +if not curllib then return end + +-- We're good, so we continue. + +local next, type = next, type +local lower, gsub = string.lower, string.gsub + +local mapping = { + ["acceptencoding"] = 102, + ["accepttimeoutms"] = 212, + ["addressscope"] = 171, + ["append"] = 50, + ["autoreferer"] = 58, + ["buffersize"] = 98, + ["cainfo"] = 65, + ["capath"] = 97, + ["certinfo"] = 172, + -- ["chunkbgnfunction"] = 198, + ["chunkdata"] = 201, + -- ["chunkendfunction"] = 199, + ["closepolicy"] = 72, + ["closesocketdata"] = 209, + -- ["closesocketfunction"] = 208, + ["connectonly"] = 141, + ["connecttimeout"] = 78, + ["connecttimeoutms"] = 156, + -- ["convfromnetworkfunction"] = 142, + -- ["convfromutf8function"] = 144, + -- ["convtonetworkfunction"] = 143, + ["cookie"] = 22, + ["cookiefile"] = 31, + ["cookiejar"] = 82, + ["cookielist"] = 135, + ["cookiesessionv"] = 96, + ["copypostfields"] = 165, + ["crlf"] = 27, + ["crlfile"] = 169, + ["customrequest"] = 36, + ["debugdata"] = 95, + -- ["debugfunction"] = 94, + ["dirlistonly"] = 48, + ["dnscachetimeout"] = 92, + ["dnsinterface"] = 221, + ["dnslocalip4"] = 222, + ["dnslocalip6"] = 223, + ["dnsservers"] = 211, + ["dnsuseglobalcache"] = 91, + ["egdsocket"] = 77, + ["errorbuffer"] = 10, + ["expect100timeoutms"] = 227, + ["failonerror"] = 45, + ["file"] = 1, + ["filetime"] = 69, + ["fnmatchdata"] = 202, + -- ["fnmatchfunction"] = 200, + ["followlocation"] = 52, + ["forbidreuse"] = 75, + ["freshconnect"] = 74, + ["ftpaccount"] = 134, + ["ftpalternativetouser"] = 147, + ["ftpcreatemissingdirs"] = 110, + ["ftpfilemethod"] = 138, + ["ftpresponsetimeout"] = 112, + ["ftpskippasvip"] = 137, + ["ftpsslccc"] = 154, + ["ftpuseeprt"] = 106, + ["ftpuseepsv"] = 85, + ["ftpusepret"] = 188, + ["ftpport"] = 17, + ["ftpsslauth"] = 129, + ["gssapidelegation"] = 210, + ["header"] = 42, + ["headerdata"] = 29, + -- ["headerfunction"] = 79, + ["http200aliases"] = 104, + ["httpcontentdecoding"] = 158, + ["httptransferdecoding"] = 157, + ["httpversion"] = 84, + ["httpauth"] = 107, + ["httpget"] = 80, + ["httpheader"] = 23, + ["httppost"] = 24, + ["httpproxytunnel"] = 61, + ["ignorecontentlength"] = 136, + ["infile"] = 9, + ["infilesize"] = 14, + ["infilesizelarge"] = 115, + ["interface"] = 62, + ["interleavedata"] = 195, + -- ["interleavefunction"] = 196, + ["ioctldata"] = 131, + -- ["ioctlfunction"] = 130, + ["ipresolve"] = 113, + ["issuercert"] = 170, + ["keypasswd"] = 26, + ["krblevel"] = 63, + ["localport"] = 139, + ["localportrange"] = 140, + ["loginoptions"] = 224, + ["lowspeedlimit"] = 19, + ["lowspeedtime"] = 20, + ["mailauth"] = 217, + ["mailfrom"] = 186, + ["mailrcpt"] = 187, + ["maxrecvspeedlarge"] = 146, + ["maxsendspeedlarge"] = 145, + ["maxconnects"] = 71, + ["maxfilesize"] = 114, + ["maxfilesizelarge"] = 117, + ["maxredirs"] = 68, + ["netrc"] = 51, + ["netrcfile"] = 118, + ["newdirectoryperms"] = 160, + ["newfileperms"] = 159, + ["nobody"] = 44, + ["noprogress"] = 43, + ["noproxy"] = 177, + ["nosignal"] = 99, + ["opensocketdata"] = 164, + -- ["opensocketfunction"] = 163, + ["password"] = 174, + ["port"] = 3, + ["post"] = 47, + -- ["postfields"] = 15, + -- ["postfieldsize"] = 60, + -- ["postfieldsizelarge"] = 120, + ["postquote"] = 39, + ["postredir"] = 161, + ["prequote"] = 93, + ["private"] = 103, + ["progressdata"] = 57, + -- ["progressfunction"] = 56, + ["protocols"] = 181, + ["proxy"] = 4, + ["proxytransfermode"] = 166, + ["proxyauth"] = 111, + ["proxypassword"] = 176, + ["proxyport"] = 59, + ["proxytype"] = 101, + ["proxyusername"] = 175, + ["proxyuserpwd"] = 6, + ["put"] = 54, + ["quote"] = 28, + ["randomfile"] = 76, + ["range"] = 7, + ["readdata"] = 9, + -- ["readfunction"] = 12, + ["redirprotocols"] = 182, + ["referer"] = 16, + ["resolve"] = 203, + ["resumefrom"] = 21, + ["resumefromlarge"] = 116, + ["rtspclientcseq"] = 193, + ["rtsprequest"] = 189, + ["rtspservercseq"] = 194, + ["rtspsessionid"] = 190, + ["rtspstreamuri"] = 191, + ["rtsptransport"] = 192, + ["rtspheader"] = 23, + ["saslir"] = 218, + ["seekdata"] = 168, + -- ["seekfunction"] = 167, + ["serverresponsetimeout"] = 112, + ["share"] = 100, + ["sockoptdata"] = 149, + -- ["sockoptfunction"] = 148, + ["socks5gssapinec"] = 180, + ["socks5gssapiservice"] = 179, + ["sshauthtypes"] = 151, + ["sshhostpublickeymd5"] = 162, + ["sshkeydata"] = 185, + -- ["sshkeyfunction"] = 184, + ["sshknownhosts"] = 183, + ["sshprivatekeyfile"] = 153, + ["sshpublickeyfile"] = 152, + ["sslcipherlist"] = 83, + ["sslctxdata"] = 109, + -- ["sslctxfunction"] = 108, + ["sslenablealpn"] = 226, + ["sslenablenpn"] = 225, + ["ssloptions"] = 216, + ["sslsessionidcache"] = 150, + ["sslverifyhost"] = 81, + ["sslverifypeer"] = 64, + ["sslcert"] = 25, + ["sslcerttype"] = 86, + ["sslengine"] = 89, + ["sslenginedefault"] = 90, + ["sslkey"] = 87, + ["sslkeytype"] = 88, + ["sslversion"] = 32, + ["stderr"] = 37, + ["tcpkeepalive"] = 213, + ["tcpkeepidle"] = 214, + ["tcpkeepintvl"] = 215, + ["tcpnodelay"] = 121, + ["telnetoptions"] = 70, + ["tftpblksize"] = 178, + ["timecondition"] = 33, + ["timeout"] = 13, + ["timeoutms"] = 155, + ["timevalue"] = 34, + ["tlsauthpassword"] = 205, + ["tlsauthtype"] = 206, + ["tlsauthusername"] = 204, + ["transferencoding"] = 207, + ["transfertext"] = 53, + ["unrestrictedauth"] = 105, + ["upload"] = 46, + ["url"] = 2, + ["usessl"] = 119, + ["useragent"] = 18, + ["username"] = 173, + ["userpwd"] = 5, + ["verbose"] = 41, + ["wildcardmatch"] = 197, + ["writedata"] = 1, + -- ["writefunction"] = 11, + ["writeheader"] = 29, + ["writeinfo"] = 40, + ["xferinfodata"] = 57, + -- ["xferinfofunction"] = 219, + ["xoauth2bearer"] = 220, +} + +table.setmetatableindex(mapping,function(t,k) + local s = gsub(lower(k),"[^a-z0-9]","") + local v = rawget(t,s) or false + t[k] = v + return v +end) + +local curl_fetch = curllib.fetch +local curl_escape = curllib.escape +local curl_unescape = curllib.unescape +local curl_getversion = curllib.getversion + +local report = logs.reporter(libname) + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local function fetch(options) + if okay() then + local t = type(options) + if t == "table" then + local o = { } + for name, value in next, options do + local index = mapping[name] + if index then + o[index] = value + end + end + return curl_fetch(o) + elseif t == "string" then + return curl_fetch { [mapping.url] = options } + else + report("invalid argument") + end + end +end + +local curl = { + getversion = function () return okay() and curl_getversion() end, + escape = function (s) return okay() and curl_escape (s) end, + unescape = function (s) return okay() and curl_unescape (s) end, + fetch = fetch, +} + +-- inspect(curl.fetch("http://www.pragma-ade.com/index.html")) +-- inspect(curl.fetch { url = "http://www.pragma-ade.com/index.html" }) + +package.loaded[libname] = curl + +return curl diff --git a/tex/context/base/mkiv/libs-imp-ghostscript.lua b/tex/context/base/mkiv/libs-imp-ghostscript.lua new file mode 100644 index 000000000..b129a58c1 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-ghostscript.lua @@ -0,0 +1,111 @@ +if not modules then modules = { } end modules ['libs-imp-ghostscript'] = { + version = 1.001, + comment = "companion to luat-lib.mkxl", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local libname = "ghostscript" +local libfile = "gsdll64" -- what on unix? + +local gslib = resolvers.libraries.validoptional(libname) + +if not gslib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local insert = table.insert +local formatters = string.formatters + +local ghostscript = utilities.ghostscript or { } +utilities.ghostscript = ghostscript + +local gs_execute = gslib.execute +local nofruns = 0 +local report = logs.reporter(libname) + +function ghostscript.convert(specification) + if okay() then + -- + nofruns = nofruns + 1 + statistics.starttiming(ghostscript) + -- + local inputname = specification.inputname + if not inputname or inputname == "" then + report("invalid run %s, no inputname specified",nofruns) + statistics.stoptiming(ghostscript) + return false + end + local outputname = specification.outputname + if not outputname or outputname == "" then + outputname = file.replacesuffix(inputname,"pdf") + end + -- + if not lfs.isfile(inputname) then + report("invalid run %s, input file %a is not found",nofruns,inputname) + statistics.stoptiming(ghostscript) + return false + end + -- + local device = specification.device + if not device or device == "" then + device = "pdfwrite" + end + -- + local code = specification.code + if not code or code == "" then + code = ".setpdfwrite" + end + -- + local options = specification.options or { } + -- + insert(options,"-dNOPAUSE") + insert(options,"-dBATCH") + insert(options,"-dSAFER") + insert(options,formatters["-sDEVICE=%s"](device)) + insert(options,formatters["-sOutputFile=%s"](outputname)) + insert(options,"-c") + insert(options,code) + insert(options,"-f") + insert(options,inputname) + -- + report("run %s, input file %a, outputfile %a",nofruns,inputname,outputname) + report("") + local done = gslib_execute(options) + report("") + -- + statistics.stoptiming(ghostscript) + if done then + return outputname + else + report("run %s quit with errors",nofruns) + return false + end + end +end + +function ghostscript.statistics(report) + local runtime = statistics.elapsedtime(ghostscript) + if report then + report("nofruns %s, runtime %s",nofruns,runtime) + else + return { + runtime = runtime, + nofruns = nofruns, + } + end +end + +-- for i=1,100 do +-- ghostscript.convert { inputname = "temp.eps" } +-- ghostscript.convert { inputname = "t:/escrito/tiger.eps" } +-- end +-- ghostscript.statistics(true) diff --git a/tex/context/base/mkiv/libs-imp-graphicsmagick.lua b/tex/context/base/mkiv/libs-imp-graphicsmagick.lua new file mode 100644 index 000000000..6f5d1d967 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-graphicsmagick.lua @@ -0,0 +1,77 @@ +if not modules then modules = { } end modules ['libs-imp-graphicsmagick'] = { + version = 1.001, + comment = "companion to luat-lib.mkxl", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local libname = "graphicsmagick" +local libfile = { "CORE_RL_magick_", "CORE_RL_wand_" } + +local gmlib = resolvers.libraries.validoptional(libname) + +if not gmlib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local graphicsmagick = utilities.graphicsmagick or { } +utilities.graphicsmagick = graphicsmagick +utilities.graphicmagick = graphicsmagick + +local gm_execute = gmlib.execute +local nofruns = 0 +local report = logs.reporter(libname) + +function graphicsmagick.convert(specification) + if okay() then + -- + nofruns = nofruns + 1 + statistics.starttiming(graphicsmagick) + -- + local inputname = specification.inputname + if not inputname or inputname == "" then + report("invalid run %s, no inputname specified",nofruns) + statistics.stoptiming(graphicsmagick) + return false + end + local outputname = specification.outputname + if not outputname or outputname == "" then + outputname = file.replacesuffix(inputname,"pdf") + end + -- + if not lfs.isfile(inputname) then + report("invalid run %s, input file %a is not found",nofruns,inputname) + statistics.stoptiming(graphicsmagick) + return false + end + -- + report("run %s, input file %a, outputfile %a",nofruns,inputname,outputname) + -- + gm_execute { inputfile = inputname, outputfile = outputname } + -- + statistics.stoptiming(graphicsmagick) + end +end + +function graphicsmagick.statistics(report) + local runtime = statistics.elapsedtime(graphicsmagick) + if report then + report("nofruns %s, runtime %s",nofruns,runtime) + else + return { + runtime = runtime, + nofruns = nofruns, + } + end +end + +-- graphicsmagick.convert { inputname = "t:/sources/hacker.jpg", outputname = "e:/tmp/hacker.png" } +-- graphicsmagick.statistics(true) diff --git a/tex/context/base/mkiv/libs-imp-mysql.lua b/tex/context/base/mkiv/libs-imp-mysql.lua new file mode 100644 index 000000000..b3896acd4 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-mysql.lua @@ -0,0 +1,196 @@ +if not modules then modules = { } end modules ['libs-imp-mysql'] = { + version = 1.001, + comment = "companion to util-sql.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- c:/data/develop/tex-context/tex/texmf-win64/bin/lib/luametatex/lua/copies/mysql/libmysql.dll + +local libname = "mysql" +local libfile = "libmysql" + +local mysqllib = resolvers.libraries.validoptional(libname) + +if not mysqllib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local lpegmatch = lpeg.match +local setmetatable = setmetatable + +local sql = utilities.sql or require("util-sql") +local report = logs.reporter(libname) + +local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) +local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) + +local mysql_open = mysqllib.open +local mysql_close = mysqllib.close +local mysql_execute = mysqllib.execute +local mysql_getmessage = mysqllib.getmessage + +local helpers = sql.helpers +local methods = sql.methods +local validspecification = helpers.validspecification +local preparetemplate = helpers.preparetemplate +local querysplitter = helpers.querysplitter +local cache = { } + +local function connect(specification) + return mysql_open( + specification.database or "", + specification.username or "", + specification.password or "", + specification.host or "", + specification.port + ) +end + +local function execute_once(specification,retry) + if okay() then + if trace_sql then + report("executing mysql") + end + if not validspecification(specification) then + report("error in specification") + end + local query = preparetemplate(specification) + if not query then + report("error in preparation") + return + else + query = lpegmatch(querysplitter,query) + end + local base = specification.database -- or specification.presets and specification.presets.database + if not base then + report("no database specified") + return + end + local result = { } + local keys = { } + local id = specification.id + local db = nil + if id then + local session = cache[id] + if session then + db = session.db + else + db = connect(specification) + if not db then + report("no session database specified") + else + cache[id] = { + specification = specification, + db = db, + } + end + end + else + db = connect(specification) + end + if not db then + report("no database opened") + else + local converter = specification.converter + local nofrows = 0 + local callback = nil + if converter then + local convert = converter.mysql + callback = function(nofcolumns,values,fields) + nofrows = nofrows + 1 + result[nofrows] = convert(values) + end + else + local column = { } + callback = function(nofcolumns,values,fields) + for i=1,nofcolumns do + local field + if fields then + field = fields[i] + keys[i+1] = field + else + field = keys[i] + end + if field then + column[field] = values[i] + end + end + nofrows = nofrows + 1 + result[nofrows] = column + end + end + for i=1,#query do + local okay = mysql_execute(db,query[i],callback) + if not okay then + if id and option == "retry" and i == 1 then + report("error: %s, retrying to connect",mysql_getmessage(db)) + mysql_close(db) + cache[id] = nil + return execute_once(specification,false) + else + report("error: %s",mysql_getmessage(db)) + end + end + end + end + if db and not id then + mysql_close(db) + end + -- bonus + local one = result[1] + if one then + setmetatable(result,{ __index = one } ) + end + -- + return result, keys + else + report("error: ","no library loaded") + end +end + +local function execute(specification) + return execute_once(specification,true) +end + +-- Here we build the dataset stepwise so we don't use the data hack that +-- is used in the client variant. + +local wraptemplate = [[ +local converters = utilities.sql.converters +local deserialize = utilities.sql.deserialize + +local tostring = tostring +local tonumber = tonumber +local booleanstring = string.booleanstring + +%s + +return function(cells) + -- %s (not needed) + -- %s (not needed) + return { + %s + } +end +]] + +local celltemplate = "cells[%s]" + +methods.mysql = { + execute = execute, + usesfiles = false, + wraptemplate = wraptemplate, + celltemplate = celltemplate, +} + +package.loaded["util-sql-imp-mysql"] = methods.mysql +package.loaded[libname] = methods.mysql diff --git a/tex/context/base/mkiv/libs-imp-postgress.lua b/tex/context/base/mkiv/libs-imp-postgress.lua new file mode 100644 index 000000000..5cd04e03b --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-postgress.lua @@ -0,0 +1,200 @@ +if not modules then modules = { } end modules ['libs-imp-postgress'] = { + version = 1.001, + comment = "companion to util-sql.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Not yet untested ! + +-- c:/data/develop/tex-context/tex/texmf-win64/bin/lib/luametatex/lua/copies/postgress/libpq.dll + +-- we can now share the code between mysql, postgress, sqlite ... todo + +local libname = "postgress" +local libfile = "libpq" + +local postgresslib = resolvers.libraries.validoptional(libname) + +if not postgresslib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local lpegmatch = lpeg.match +local setmetatable = setmetatable + +local sql = utilities.sql or require("util-sql") +local report = logs.reporter(libname) + +local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) +local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) + +local postgress_open = postgresslib.open +local postgress_close = postgresslib.close +local postgress_execute = postgresslib.execute +local postgress_getmessage = postgresslib.getmessage + +local helpers = sql.helpers +local methods = sql.methods +local validspecification = helpers.validspecification +local preparetemplate = helpers.preparetemplate +local querysplitter = helpers.querysplitter -- not needed +local cache = { } + +local function connect(specification) + return postgress_open( + specification.database or "", + specification.username or "", + specification.password or "", + specification.host or "", + specification.port + ) +end + +local function execute_once(specification,retry) + if okay() then + if trace_sql then + report("executing postgress") + end + if not validspecification(specification) then + report("error in specification") + end + local query = preparetemplate(specification) + if not query then + report("error in preparation") + return + else + query = lpegmatch(querysplitter,query) -- not needed + end + local base = specification.database -- or specification.presets and specification.presets.database + if not base then + report("no database specified") + return + end + local result = { } + local keys = { } + local id = specification.id + local db = nil + if id then + local session = cache[id] + if session then + db = session.db + else + db = connect(specification) + if not db then + report("no session database specified") + else + cache[id] = { + specification = specification, + db = db, + } + end + end + else + db = connect(specification) + end + if not db then + report("no database opened") + else + local converter = specification.converter + local nofrows = 0 + local callback = nil + if converter then + local convert = converter.postgress + callback = function(nofcolumns,values,fields) + nofrows = nofrows + 1 + result[nofrows] = convert(values) + end + else + local column = { } + callback = function(nofcolumns,values,fields) + for i=1,nofcolumns do + local field + if fields then + field = fields[i] + keys[i+1] = field + else + field = keys[i] + end + if field then + column[field] = values[i] + end + end + nofrows = nofrows + 1 + result[nofrows] = column + end + end + for i=1,#query do + local okay = postgress_execute(db,query[i],callback) + if not okay then + if id and option == "retry" and i == 1 then + report("error: %s, retrying to connect",postgress_getmessage(db)) + postgress_close(db) + cache[id] = nil + return execute_once(specification,false) + else + report("error: %s",postgress_getmessage(db)) + end + end + end + end + if db and not id then + postgress_close(db) + end + -- bonus + local one = result[1] + if one then + setmetatable(result,{ __index = one } ) + end + -- + return result, keys + else + report("error: ","no library loaded") + end +end + +local function execute(specification) + return execute_once(specification,true) +end + +-- Here we build the dataset stepwise so we don't use the data hack that +-- is used in the client variant. + +local wraptemplate = [[ +local converters = utilities.sql.converters +local deserialize = utilities.sql.deserialize + +local tostring = tostring +local tonumber = tonumber +local booleanstring = string.booleanstring + +%s + +return function(cells) + -- %s (not needed) + -- %s (not needed) + return { + %s + } +end +]] + +local celltemplate = "cells[%s]" + +methods.postgress = { + execute = execute, + usesfiles = false, + wraptemplate = wraptemplate, + celltemplate = celltemplate, +} + +package.loaded["util-sql-imp-postgress"] = methods.postgress +package.loaded[libname] = methods.postgress diff --git a/tex/context/base/mkiv/libs-imp-sqlite.lua b/tex/context/base/mkiv/libs-imp-sqlite.lua new file mode 100644 index 000000000..15c3222ea --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-sqlite.lua @@ -0,0 +1,187 @@ +if not modules then modules = { } end modules ['libs-imp-sqlite'] = { + version = 1.001, + comment = "companion to util-sql.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- c:/data/develop/tex-context/tex/texmf-win64/bin/lib/luametatex/lua/copies/sqlite/sqlite3.dll + +local libname = "sqlite" +local libfile = "sqlite3" + +local sqlitelib = resolvers.libraries.validoptional(libname) + +if not sqlitelib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local next, tonumber = next, tonumber +local setmetatable = setmetatable +local formatters = string.formatters + +local sql = utilities.sql or require("util-sql") +local report = logs.reporter(libname) + +local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) +local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) + +local sqlite_open = sqlitelib.open +local sqlite_close = sqlitelib.close +local sqlite_execute = sqlitelib.execute +local sqlite_getmessage = sqlitelib.getmessage + +local helpers = sql.helpers +local methods = sql.methods +local validspecification = helpers.validspecification +local preparetemplate = helpers.preparetemplate +local cache = { } + +-- synchronous journal_mode locking_mode 1000 logger inserts +-- +-- normal normal normal 6.8 +-- off off normal 0.1 +-- normal off normal 2.1 +-- normal persist normal 5.8 +-- normal truncate normal 4.2 +-- normal truncate exclusive 4.1 + +local f_preamble = formatters[ [[ +ATTACH `%s` AS `%s` ; +PRAGMA `%s`.synchronous = normal ; +]] ] + +local function execute(specification) + if okay() then + if trace_sql then + report("executing sqlite") + end + if not validspecification(specification) then + report("error in specification") + end + local query = preparetemplate(specification) + if not query then + report("error in preparation") + return + end + local base = specification.database -- or specification.presets and specification.presets.database + if not base then + report("no database specified") + return + end + local filename = file.addsuffix(base,"db") + local result = { } + local keys = { } + local id = specification.id + local db = nil + local preamble = nil + if id then + local session = cache[id] + if session then + db = session.db + else + db = sqlite_open(filename) + preamble = f_preamble(filename,base,base) + if not db then + report("no session database specified") + else + cache[id] = { + name = filename, + db = db, + } + end + end + else + db = open_db(filename) + preamble = f_preamble(filename,base,base) + end + if not db then + report("no database opened") + else + local converter = specification.converter + local nofrows = 0 + local callback = nil + if preamble then + query = preamble .. query -- only needed in open + end + if converter then + local convert = converter.sqlite + callback = function(nofcolumns,values,fields) + nofrows = nofrows + 1 + result[nofrows] = convert(values) + end + else + local column = { } + callback = function(nofcolumns,values,fields) + for i=1,nofcolumns do + local field + if fields then + field = fields[i] + keys[i+1] = field + else + field = keys[i] + end + if field then + column[field] = values[i] + end + end + nofrows = nofrows + 1 + result[nofrows] = column + end + end + local okay = sqlite_execute(db,query,callback) + if not okay then + report("error: %s",sqlite_getmessage(db)) + -- elseif converter then + -- result = converter.sqlite(result) + end + end + if db and not id then + sqlite_close(db) + end + return result, keys + else + report("error: ","no library loaded") + end +end + +local wraptemplate = [[ +local converters = utilities.sql.converters +local deserialize = utilities.sql.deserialize + +local tostring = tostring +local tonumber = tonumber +local booleanstring = string.booleanstring + +%s + +return function(cells) + -- %s (not needed) + -- %s (not needed) + return { + %s + } +end +]] + +local celltemplate = "cells[%s]" + +methods.sqlite = { + execute = execute, + usesfiles = false, + wraptemplate = wraptemplate, + celltemplate = celltemplate, +} + +package.loaded["util-sql-imp-sqlite"] = methods.sqlite +package.loaded[libname] = methods.sqlite + +return methods.sqlite diff --git a/tex/context/base/mkiv/libs-imp-zint.lua b/tex/context/base/mkiv/libs-imp-zint.lua new file mode 100644 index 000000000..eef2cd605 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-zint.lua @@ -0,0 +1,148 @@ +if not modules then modules = { } end modules ['libs-imp-ghostscript'] = { + version = 1.001, + comment = "companion to luat-lib.mkxl", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local libname = "zint" +local libfile = "libzint" -- what on unix? +-- local libfile = "/usr/local/lib/libzint.so" + +local zintlib = resolvers.libraries.validoptional(libname) + +if not zintlib then return end + +local function okay() + if resolvers.libraries.optionalloaded(libname,libfile) then + okay = function() return true end + else + okay = function() return false end + end + return okay() +end + +local zint = utilities.zint or { } +utilities.zint = zint + +local zintlib_execute = zintlib.execute + +local next, type, unpack = next, type, unpack +local lower, gsub = string.lower, string.gsub + +local mapping = { + ["code 11"] = 1, ["pharma one-track"] = 51, ["aztec code"] = 92, + ["standard 2of5"] = 2, ["pzn"] = 52, ["daft code"] = 93, + ["interleaved 2of5"] = 3, ["pharma two-track"] = 53, ["micro qr code"] = 97, + ["iata 2of5"] = 4, ["pdf417"] = 55, ["hibc code 128"] = 98, + ["data logic"] = 6, ["pdf417 trunc"] = 56, ["hibc code 39"] = 99, + ["industrial 2of5"] = 7, ["maxicode"] = 57, ["hibc data matrix"] = 102, + ["code 39"] = 8, ["qr code"] = 58, ["hibc qr code"] = 104, + ["extended code 39"] = 9, ["code 128-b"] = 60, ["hibc pdf417"] = 106, + ["ean"] = 13, ["ap standard customer"] = 63, ["hibc micropdf417"] = 108, + ["ean + check"] = 14, ["ap reply paid"] = 66, ["hibc codablock-f"] = 110, + ["gs1-128"] = 16, ["ap routing"] = 67, ["hibc aztec code"] = 112, + ["codabar"] = 18, ["ap redirection"] = 68, ["dotcode"] = 115, + ["code 128"] = 20, ["isbn"] = 69, ["han xin code"] = 116, + ["leitcode"] = 21, ["rm4scc"] = 70, ["rm mailmark"] = 121, + ["identcode"] = 22, ["data matrix"] = 71, ["aztec runes"] = 128, + ["code 16k"] = 23, ["ean-14"] = 72, ["code 32"] = 129, + ["code 49"] = 24, ["vin (north america)"] = 73, ["comp ean"] = 130, + ["code 93"] = 25, ["codablock-f"] = 74, ["comp gs1-128"] = 131, + ["flattermarken"] = 28, ["nve-18"] = 75, ["comp databar omni"] = 132, + ["gs1 databar omni"] = 29, ["japanese post"] = 76, ["comp databar ltd"] = 133, + ["gs1 databar ltd"] = 30, ["korea post"] = 77, ["comp databar expom"] = 134, + ["gs1 databar expom"] = 31, ["gs1 databar stack"] = 79, ["comp upc-a"] = 135, + ["telepen alpha"] = 32, ["gs1 databar stack omni"] = 80, ["comp upc-e"] = 136, + ["upc-a"] = 34, ["gs1 databar eso"] = 81, ["comp databar stack"] = 137, + ["upc-a + check"] = 35, ["planet"] = 82, ["comp databar stack omni"] = 138, + ["upc-e"] = 37, ["micropdf"] = 84, ["comp databar eso"] = 139, + ["upc-e + check"] = 38, ["usps onecode"] = 85, ["channel code"] = 140, + ["postnet"] = 40, ["uk plessey"] = 86, ["code one"] = 141, + ["msi plessey"] = 47, ["telepen numeric"] = 87, ["grid matrix"] = 142, + ["fim"] = 49, ["itf-14"] = 89, ["upnqr"] = 143, + ["logmars"] = 50, ["kix code"] = 90, ["rmqr"] = 145, +} + +table.setmetatableindex(mapping,function(t,k) + local s = gsub(lower(k),"[^a-z0-9]","") + local v = rawget(t,s) or false + t[k] = v + return v +end) + +local report = logs.reporter("zint") +local context = context +local shown = false + +----- f_rectangle = string.formatters["%sofill unitsquare xysized (%N,%N) shifted (%N,%N);"] + +function zint.execute(specification) + if okay() then + local code = specification.code + local text = specification.text + if code then + local id = mapping[code] + if id then + specification.code = id + local result = zintlib_execute(specification) + if result then + -- not that fast but if needed we can speed it up + context.startMPcode() + local rectangles = result.rectangles + local hexagons = result.hexagons + local circles = result.circles + local strings = result.strings + if rectangles then + local n = #rectangles + for i=1,n do + local r = rectangles[i] + context("%sofill unitsquare xysized (%N,%N) shifted (%N,%N);", + i == n and "d" or "n",r[3],r[4],r[1],r[2]) + -- rectangles[i] = f_rectangle(i == n and "d" or "n",r[3],r[4],r[1],r[2]) + end + -- context("% t",rectangles) + end + if hexagons then + local n = #hexagons + for i=1,#hexagons do + context("%sofill (%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle;", + i == n and "d" or "n",unpack(hexagons[i])) + end + end + if circles then + local n = #circles + for i=1,#circles do + local c = circles[i] + context("%sofill unitcircle scaled %N shifted (%N,%N);", + i == n and "d" or "n",c[3],c[1],c[2]) + end + end + if strings then + -- We set the font at the encapsulating level. + for i=1,#strings do + local s = strings[i] + context('draw textext("%s") scaled (%N/10) shifted (%N,%N);', + s[4],s[3],s[1],s[2]) + end + end + context.stopMPcode() + end + else + report("unknown barcode alternative %a",code) + if not shown then + report("") + report("valid barcode alternatives:") + report("") + local list = table.sortedkeys(mapping) + for i=1,#list do + report(" %s", list[i]) + end + report("") + shown = true + end + end + end + end +end diff --git a/tex/context/base/mkiv/libs-imp-zint.mkxl b/tex/context/base/mkiv/libs-imp-zint.mkxl new file mode 100644 index 000000000..d7436a4a4 --- /dev/null +++ b/tex/context/base/mkiv/libs-imp-zint.mkxl @@ -0,0 +1,61 @@ +%D \module +%D [ file=m-zint, +%D version=2010.12.07, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Zint Barcode Generator, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA 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 Using \type {zint} seems to be the easiest way to generate +%D (PDF417) barcodes so therefore we now have this module. There +%D are proper (also windows) binaries at: +%D +%D \starttyping +%D http://www.zint.org.uk +%D \stoptyping +%D +%D There is a bit more code than needed as we want to be able to +%D feed names. + +\registerctxluafile{libs-imp-zint}{} + +\unprotect + +\definefont[usedzintfont][dejavusansmono at 10bp] + +\unexpanded\def\barcode[#1]% [alternative=,text=] + {\bgroup + \usedzintfont + \getdummyparameters + [\c!alternative=,\c!text=,#1]% + \scale + [#1]% + {\ctxlua{utilities.zint.execute{code="\dummyparameter\c!alternative",text=\!!bs\dummyparameter\c!text\!!es}}}% + \egroup} + +\protect + +\continueifinputfile{libs-imp-zint.mkxl} + +\starttext + +% \dorecurse{1000}{ + \startTEXpage + \barcode[alternative=PDF417,text={Hans Hagen}]% + \blank + \barcode[alternative=PDF417,text={Ton Otten}]% + \blank + \barcode[alternative=ISBN,text=9789490688011]% + \blank + \barcode[alternative=isbn,text=9789490688011,width=3cm]% + \stopTEXpage +% } + +\stoptext + + diff --git a/tex/context/base/mkiv/libs-ini.lua b/tex/context/base/mkiv/libs-ini.lua new file mode 100644 index 000000000..2422305f0 --- /dev/null +++ b/tex/context/base/mkiv/libs-ini.lua @@ -0,0 +1,179 @@ +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" +} + +-- This is a loader for optional libraries in luametatex with context lmtx. It's +-- kind of experimental. We also use a different locator than in mkiv because we +-- don't support loading lua libraries and swiglibs any more. Of course one can +-- try the regular lua loaders but we just assume that a user then knows what (s)he +-- is doing. + +local type, unpack = type, unpack + +-- here we implement the resolver + +local type = type + +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 + +trackers.register("resolvers.lib", function(v) trace = v end) + +local function findlib(required) -- todo: cache + 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 + +-- here we implement the loader + +local libraries = { } +resolvers.libraries = libraries + +local report = logs.reporter("optional") + +function libraries.validoptional(name) + local thelib = optional and optional[name] + if not thelib then + -- forget about it, no message here + 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 initialized then + report("using library '% + t'",libnames) + else + report("unable to initialize library '% + t'",libnames) + end + return initialized + end + end + end +end + +-- local patterns = { +-- "libs-imp-%s.mkxl", +-- "libs-imp-%s.mklx", +-- } +-- +-- local function action(name,foundname) +-- -- could be one command +-- context.startreadingfile() +-- context.input(foundname) +-- context.stopreadingfile() +-- end +-- +-- interfaces.implement { +-- name = "uselibrary", +-- arguments = "string" +-- actions = function(name) +-- resolvers.uselibrary { +-- category = "color definition", +-- name = name, +-- patterns = patterns, +-- action = action, +-- onlyonce = true, +-- } +-- end +-- } diff --git a/tex/context/base/mkiv/libs-ini.mkxl b/tex/context/base/mkiv/libs-ini.mkxl new file mode 100644 index 000000000..18163beed --- /dev/null +++ b/tex/context/base/mkiv/libs-ini.mkxl @@ -0,0 +1,31 @@ +%D \module +%D [ file=libs-ini, +%D version=2020.01.02, +%D title=\CONTEXT\ Lua Macros, +%D subtitle=Libraries, +%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. + +\registerctxluafile{libs-ini}{} + +\registerctxluafile{libs-imp-curl}{} +\registerctxluafile{libs-imp-ghostscript}{} +\registerctxluafile{libs-imp-graphicsmagick}{} + +% These are loaded on demand: + +% \registerctxluafile{libs-imp-mysql}{} +% \registerctxluafile{libs-imp-sqlite}{} +% \registerctxluafile{libs-imp-postgress}{} + +\unprotect + +% \unexpanded\def\uselibrary[#1]% +% {\clf_uselibrary{#1}} + +\protect \endinput diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua index ebda6e8cd..a39106744 100644 --- a/tex/context/base/mkiv/luat-cnf.lua +++ b/tex/context/base/mkiv/luat-cnf.lua @@ -157,7 +157,12 @@ function texconfig.init() local i = start local t = os.clock() while true do - local b = callbytecode(i) + -- local b = callbytecode(i) + local e, b = pcall(callbytecode,i) + if not e then + print("\nfatal error : unable to load bytecode, maybe wipe the cache first\n") + os.exit() + end if b then setbytecode(i,nil) ; i = i + 1 diff --git a/tex/context/base/mkiv/luat-lib.mkiv b/tex/context/base/mkiv/luat-lib.mkiv index 8c80072e5..c3bbd8e19 100644 --- a/tex/context/base/mkiv/luat-lib.mkiv +++ b/tex/context/base/mkiv/luat-lib.mkiv @@ -73,7 +73,9 @@ \registerctxluafile{data-use}{} \registerctxluafile{data-aux}{} -\registerctxluafile{util-lib}{} +\ifcase\contextlmtxmode + \registerctxluafile{util-lib}{} +\fi \registerctxluafile{luat-cbk}{} \registerctxluafile{luat-run}{} diff --git a/tex/context/base/mkiv/m-fonts-plugins.mkiv b/tex/context/base/mkiv/m-fonts-plugins.mkiv index 154e47804..255a2ac72 100644 --- a/tex/context/base/mkiv/m-fonts-plugins.mkiv +++ b/tex/context/base/mkiv/m-fonts-plugins.mkiv @@ -193,6 +193,7 @@ [mode=plug, features=harfbuzz, % method=binary, +% method=internal, script=arab,language=dflt, % ccmp=yes, % init=yes,medi=yes,fina=yes,isol=yes, diff --git a/tex/context/base/mkiv/m-zint.mkxl b/tex/context/base/mkiv/m-zint.mkxl new file mode 100644 index 000000000..7135126ba --- /dev/null +++ b/tex/context/base/mkiv/m-zint.mkxl @@ -0,0 +1,7 @@ +% this is a stub: + +% \uselibrary[zint] + +\input libs-imp-zint.mkxl + +\endinput diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index f44f547c0..8732c7e6b 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -468,40 +468,25 @@ {\def\pack_framed_define_overlay_indeed##1{\setvalue{\??overlay##1}{\executedefinedoverlay{##1}{#2}}}% \processcommalist[#1]\pack_framed_define_overlay_indeed} -% \unexpanded\def\executedefinedoverlay#1#2% we can share the definitions -% {\bgroup % redundant grouping -% \setbox\scratchbox\hbox\bgroup -% \ifzeropt\d_framed_target_dp -% \the\everyoverlay#2% saves wrapping (and lua call) -% \else -% \lower\d_framed_target_dp -% \hbox{\the\everyoverlay#2}% -% \fi -% \egroup -% \setlayoutcomponentattribute{\v!overlay:#1}% -% \setbox\scratchbox\hpack \layoutcomponentboxattribute -% {\kern -.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax % was \d_overlay_width -% \raise-.5\dimexpr\ht\scratchbox-\d_framed_target_ht\relax % not \d_overlay_height ! -% \box\scratchbox}% -% \wd\scratchbox\d_framed_target_wd -% \ht\scratchbox\d_framed_target_ht -% \dp\scratchbox\d_framed_target_dp -% \box\scratchbox -% \egroup} - -% 20191231: moved from cont-exp: - \unexpanded\def\executedefinedoverlay#1#2% we can share the definitions {\bgroup % redundant grouping + \setbox\scratchbox\hbox\bgroup + \ifzeropt\d_framed_target_dp + \the\everyoverlay#2% saves wrapping (and lua call) + \else + \lower\d_framed_target_dp + \hbox{\the\everyoverlay#2}% + \fi + \egroup \setlayoutcomponentattribute{\v!overlay:#1}% - \setbox\scratchbox\hbox{\the\everyoverlay#2}% - \hpack to \d_framed_target_wd \layoutcomponentboxattribute - {\hskip-.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax - \box\scratchbox - \hss}% + \setbox\scratchbox\hpack \layoutcomponentboxattribute + {\kern -.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax % was \d_overlay_width + \raise-.5\dimexpr\ht\scratchbox-\d_framed_target_ht\relax % not \d_overlay_height ! + \box\scratchbox}% \wd\scratchbox\d_framed_target_wd \ht\scratchbox\d_framed_target_ht \dp\scratchbox\d_framed_target_dp + \box\scratchbox \egroup} %D \macros diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl index f0dc7de1b..8fd23fbb1 100644 --- a/tex/context/base/mkiv/pack-rul.mkxl +++ b/tex/context/base/mkiv/pack-rul.mkxl @@ -491,26 +491,13 @@ % \egroup} % 20191231: moved from cont-exp: -% -% % this is like the old: -% -% \unexpanded\def\executedefinedoverlay#1#2% we can share the definitions -% {\bgroup % redundant grouping -% \setlayoutcomponentattribute{\v!overlay:#1}% -% \setbox\scratchbox\hbox \layoutcomponentboxattribute{\the\everyoverlay#2}% -% \boxxoffset\scratchbox-.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax % was \d_overlay_width -% % \boxyoffset\scratchbox-.5\dimexpr\ht\scratchbox-\d_framed_target_ht+\d_framed_target_dp\relax % not \d_overlay_height ! -% \wd\scratchbox\d_framed_target_wd -% \ht\scratchbox\d_framed_target_ht -% \dp\scratchbox\d_framed_target_dp -% \box\scratchbox -% \egroup} \unexpanded\def\executedefinedoverlay#1#2% we can share the definitions {\bgroup % redundant grouping \setlayoutcomponentattribute{\v!overlay:#1}% - \setbox\scratchbox\layoutcomponentboxattribute\hbox{\the\everyoverlay#2}% - \boxxoffset\scratchbox-.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax + \setbox\scratchbox\hbox \layoutcomponentboxattribute{\the\everyoverlay#2}% + \boxxoffset\scratchbox-.5\dimexpr\wd\scratchbox-\d_framed_target_wd\relax % was \d_overlay_width + \boxyoffset\scratchbox-.5\dimexpr\ht\scratchbox-\d_framed_target_ht+\d_framed_target_dp\relax % not \d_overlay_height ! \wd\scratchbox\d_framed_target_wd \ht\scratchbox\d_framed_target_ht \dp\scratchbox\d_framed_target_dp diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv index 1a13b39af..0f65eea33 100644 --- a/tex/context/base/mkiv/spac-hor.mkiv +++ b/tex/context/base/mkiv/spac-hor.mkiv @@ -66,7 +66,9 @@ \ifzeropt\parindent\else \doifemptytoks\everypar\spac_indentation_set_everypar \fi - \ifconditional\c_spac_indentation_indent_first\else + \ifconditional\c_spac_indentation_indent_first + \spac_indentation_variant_yes % better than: \let\checkindentation\relax + \else \spac_indentation_variant_no \fi \spac_indentation_check_toggle} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 5ec34ac15..9344f8692 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index a036e1f44..11bf6a7cd 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/type-ini.lua b/tex/context/base/mkiv/type-ini.lua index cd5b32d3e..798b9a894 100644 --- a/tex/context/base/mkiv/type-ini.lua +++ b/tex/context/base/mkiv/type-ini.lua @@ -81,7 +81,7 @@ local patterns = { -- elseif name_two == name then -- report("unknown library %a",name_one) -- else --- commands.uselibrary { +-- resolvers.uselibrary { -- name = name_two, -- patterns = patterns, -- action = action, diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua index fb65a566e..a49507c60 100644 --- a/tex/context/base/mkiv/util-lib.lua +++ b/tex/context/base/mkiv/util-lib.lua @@ -120,7 +120,8 @@ local function locate(required,version,trace,report,action) -- initialize a few variables local required_name = required_base .. "." .. os.libsuffix local version = type(version) == "string" and version ~= "" and version or false - local engine = "luatex" -- environment.ownmain or false +-- local engine = "luatex" -- environment.ownmain or false + local engine = environment.ownmain or false -- if trace and not done then local list = expandpaths("lib") -- fresh, no reuse @@ -240,6 +241,8 @@ local function locate(required,version,trace,report,action) return library or nil end +resolvers.locatelib = locate -- for now + do local report_swiglib = logs.reporter("swiglib") @@ -458,3 +461,53 @@ ffilib("libmysql","5.6.14") -- Watch out, the last one is less explicit and lacks the swiglib prefix. ]]-- + +do + + local isfile = lfs.isfile + local report = logs.reporter("resolvers","lib") + local trace = false + + trackers.register("resolvers.lib", function(v) trace = v end) + + local function action(filename) + return isfile(filename) and filename or false + end + + function resolvers.findlib(required) -- todo: cache + local list = directives.value("system.librarynames" ) + local only = nameonly(required) + if type(list) == "table" then + list = list[only] + if type(list) == "table" then + if trace then + report("using lookup list for library %a: % | t",only,list) + end + else + list = { only } + end + else + list = { only } + end + for i=1,#list do + local name = list[i] + local found = locate(name,false,trace,report,action) + if found then + return found + end + end + local getpaths = resolvers.expandedpathlistfromvariable + if getpaths then + local list = getpaths("PATH") + local base = addsuffix(only,os.libsuffix) + for i=1,#list do + local full = joinfile(list[i],base) + local found = locate(full,false,trace,report,action) + if found then + return found + end + end + end + end + +end diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua index 2b9f113af..f44069502 100644 --- a/tex/context/base/mkiv/util-sql-imp-ffi.lua +++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua @@ -66,9 +66,6 @@ ffi.cdef [[ void *extension; } MYSQL_field; - void free(void*ptr); - void * malloc(size_t size); - MYSQL_instance * mysql_init ( MYSQL_instance *mysql ); diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua index cf4a3a8b0..a88035f68 100644 --- a/tex/context/base/mkiv/util-sql-imp-sqlite.lua +++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua @@ -66,6 +66,7 @@ ffi.cdef [[ const char *sqlite3_errmsg ( sqlite3* ); + ]] local ffi_tostring = ffi.string diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua index 2f8c862ad..61f1f19fa 100644 --- a/tex/context/base/mkiv/util-sql.lua +++ b/tex/context/base/mkiv/util-sql.lua @@ -109,16 +109,43 @@ local defaults = { __index = }, } -setmetatableindex(sql.methods,function(t,k) - if type(k) == "string" then - report_state("start loading method %a",k) - require("util-sql-imp-"..k) - report_state("loading method %a done",k) - return rawget(t,k) - else - report_state("invalid method %a",tostring(k)) - end -end) +if optional then + + local methods = { + ffi = "mysql", + library = "mysql", + swiglib = "mysql", + postgress = "postgress", + sqlite = "sqlite" + sqlite3 = "sqlite" + } + + setmetatableindex(sql.methods,function(t,k) + local m = methods[k + if m then + report_state("start loading method %a as %a",k,m) + require("libs-imp-" .. m) + report_state("loading method %a done",k) + return rawget(t,m) + else + report_state("invalid method %a",tostring(k)) + end + end) + +else + + setmetatableindex(sql.methods,function(t,k) + if type(k) == "string" then + report_state("start loading method %a",k) + require("util-sql-imp-" .. k) + report_state("loading method %a done",k) + return rawget(t,k) + else + report_state("invalid method %a",tostring(k)) + end + end) + +end -- converters diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 7690ea2ae..e8ccc0a93 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 7c07d9996..af101f6ed 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex index 5dc37abcc..cafc296b5 100644 --- a/tex/context/modules/common/s-abbreviations-logos.tex +++ b/tex/context/modules/common/s-abbreviations-logos.tex @@ -73,6 +73,7 @@ \logo [CSV] {csv} \logo [CTAN] {ctan} \logo [CTXTOOLS] {ctxtools} +\logo [CURL] {Curl} \logo [CWEB] {cweb} \logo [DAC] {dac} \logo [DARWIN] {Darwin} @@ -132,6 +133,7 @@ \logo [GIF] {gif} \logo [GNU] {gnu} \logo [GNUPLOT] {gnuplot} +\logo [GRAPHICSMAGICK]{GraphicsMagick} \logo [GS] {Ghost\-Script} \logo [GUST] {Gust} \logo [GWTEX] {gw\TeXsuffix} @@ -152,6 +154,7 @@ \logo [JAVA] {Java} \logo [JAVASCRIPT] {Java\-Script} \logo [JBIG] {jbig} +\logo [JIT] {jit} \logo [JPEG] {jpeg} \logo [JPG] {jpg} \logo [JSON] {json} @@ -239,6 +242,7 @@ \logo [PLAIN] {Plain} \logo [PNG] {png} \logo [POSIX] {posix} +\logo [POSTGRESS] {Post\-gress} \logo [POSTSCRIPT] {Post\-Script} \logo [PPCHTEX] {\PPCHTeX} \logo [PRAGMA] {Pragma ADE} @@ -272,6 +276,7 @@ \logo [SWIG] {swig} \logo [SWIGLIB] {SwigLib} \logo [SYNCTEX] {Sync\TeX} +\logo [SQLITE] {SQLite} \logo [TABLE] {\TaBlE} \logo [TCPIP] {tcp/ip} \logo [TDS] {tds} % no sc te @@ -357,6 +362,7 @@ \logo [YandY] {y\&y} \logo [YOUTUBE] {YouTube} \logo [ZIP] {zip} +\logo [ZINT] {zint} \logo [KB] {KB} \logo [MB] {MB} diff --git a/tex/context/modules/mkiv/m-sql.mkiv b/tex/context/modules/mkiv/m-sql.mkiv index f1df2833a..ed9dae99a 100644 --- a/tex/context/modules/mkiv/m-sql.mkiv +++ b/tex/context/modules/mkiv/m-sql.mkiv @@ -16,6 +16,11 @@ \registerctxluafile{util-tpl}{} \registerctxluafile{util-sql}{} +\ifcase\contextlmtxmode\else + \registerctxluafile{libs-imp-mysql}{} + \registerctxluafile{libs-imp-sqlite}{} +\fi + \setupmodule \doifsomething {\currentmoduleparameter{method}}{ diff --git a/tex/context/modules/mkiv/s-inf-01.mkvi b/tex/context/modules/mkiv/s-inf-01.mkvi index 2fda9997a..67fc45d46 100644 --- a/tex/context/modules/mkiv/s-inf-01.mkvi +++ b/tex/context/modules/mkiv/s-inf-01.mkvi @@ -26,8 +26,13 @@ \startluacode local format, gsub, find, match = string.format, string.gsub, string.find, string.match + local setmetatableindex = table.setmetatableindex - local list, size, comp, used, nope = { }, { }, { }, { mkii = { }, mkiv = { }, mkvi = { } }, { 0, 0, 0, 0, 0 } + local list = { } + local size = { } + local comp = { } + local used = setmetatableindex("table") + local nope = setmetatableindex("number") local omit = { "char%-def%.lua", @@ -39,7 +44,7 @@ "colo%-pan.tex", ".*test.*" } local types = { - "tex", "mkii", "mkiv", "mkvi", "lua", -- "mpiv" + "tex", "mkii", "mkiv", "mkvi", "mkxl", "mklx", "lua", -- "mpiv" } local patterns = { "^([a-z][a-z][a-z][a-z])%-[a-z0-9%-]+%.[a-z]+", @@ -64,10 +69,16 @@ end end if okay then - local lm, sm, cm = list[category], size[category], comp[category] + local lm = list[category] + local sm = size[category] + local cm = comp[category] if not lm then - lm, sm, cm = { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } - list[category], size[category], comp[category] = lm, sm, cm + lm = setmetatableindex("number") + sm = setmetatableindex("number") + cm = setmetatableindex("number") + list[category] = lm + size[category] = sm + comp[category] = cm end lm[n] = lm[n] + 1 local done = true @@ -90,7 +101,7 @@ logs.report("error","unknown file %a",name) data = "" end - sm[n+5] = sm[n+5] + #data + sm[n+#types] = sm[n+#types] + #data if done then sm[n] = sm[n] + #data else @@ -121,7 +132,7 @@ end local max, what = 0, (what == "size" and size) or list for k, v in table.sortedpairs(what) do - for i=1,5 do if v[i] > max then max = v[i] end end + for i=1,7 do if v[i] > max then max = v[i] end end end return max, what, function(n) return (max == 0 and 0) or (n == 0 and 0) or n/max end end @@ -130,14 +141,15 @@ function document.context_state_1(what) local max, what, norm = prepare(what) - context.starttabulate { "|Tl|T|T|T|T|T|" } + context.starttabulate { "|Tl|T|T|T|T|T|T|T|" } context.NC() context(category) context.NC() for i=1,#types do local n, m = 0, 0 for k, v in next, list do - local nn, mm = what[k][i], what[k][i+5] + local nn = what[k][i] + local mm = what[k][i+#types] n = n + nn m = m + (mm or nn) end @@ -150,18 +162,14 @@ for k, v in table.sortedpairs(what) do local c = what == size and comp[k] or nope context.NC() - context("\\bf %s~%s~~%s~~%s", + context("\\bf %s~%s~~%s~~%s~~%s~~%s", (used.mkii[k] and "ii") or "~~", (used.mkiv[k] and "iv") or "~~", (used.mkvi[k] and "vi") or "~~", + (used.mkiv[k] and "xl") or "~~", + (used.mkvi[k] and "lx") or "~~", k ) - -- context("%s\\enspace %s\\quad %s\\quad %s", - -- (used.mkii[k] and "ii") or "\\quad", - -- (used.mkiv[k] and "iv") or "\\quad", - -- (used.mkvi[k] and "vi") or "\\quad", - -- k - -- ) context.NC() for i=1,#types do context.Bar(types[i],v[i],c[i],f_norm(norm(v[i]))) @@ -190,19 +198,21 @@ \definecolor[bar:mkii][middleblue] \definecolor[bar:mkiv][middlered] \definecolor[bar:mkvi][middleyellow] +\definecolor[bar:mkxl][middlemagenta] +\definecolor[bar:mklx][middlecyan] \definecolor[bar:lua] [middlegray] \newcount\UpCounter \starttexdefinition Top #what#fraction#total#bigones - \hbox to 5em{\hss#total}% + \hbox to 7em{\hss#total}% \enspace \hbox {{\bf#what}\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% \stoptexdefinition \starttexdefinition Bar #color#size#nobigones#fraction \ifcase#size\else - \hbox to 5em{\hss\ifcase#nobigones\else\llap{-~}\fi#size}% + \hbox to 7em{\hss\ifcase#nobigones\else\llap{-~}\fi#size}% \enspace \blackrule[color=bar:#color,width=#fraction\dimexpr 20em\relax,height=.8\strutht]% \fi @@ -214,7 +224,7 @@ \stoptexdefinition \starttexdefinition StopUp - \par\nointerlineskip\blackrule[height=1pt,width=5em,depth=0pt,color=darkgray] + \par\nointerlineskip\blackrule[height=1pt,width=7em,depth=0pt,color=darkgray] \par\tttf\strut\UpName\par \egroup \ifnum\UpCounter=17 @@ -259,9 +269,9 @@ {The size of (core) files used in ConTeXt (- : large data files excluded; + : large data files included; comment and spaces removed)} {1}{size} \Show - {The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).} + {The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, mkxl, mklx, lua).} {2}{number} \Show - {The relative size of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).} + {The relative size of files used in ConTeXt (tex, mkii, mkiv, mkvi, mkxl, mklx, lua).} {2}{size} \stoptext diff --git a/tex/context/modules/mkiv/s-inf-03.mkiv b/tex/context/modules/mkiv/s-inf-03.mkiv index d2acb7341..8bd7b3699 100644 --- a/tex/context/modules/mkiv/s-inf-03.mkiv +++ b/tex/context/modules/mkiv/s-inf-03.mkiv @@ -58,11 +58,18 @@ \quad\pagenumber\quad \rlap{\goto{\hbox to 5cm{next\hss}}[nextpage]}] +\ifcase\contextlmtxmode + \setupinteraction + [title={ConTeXt MkIV}] +\else + \setupinteraction + [title={ConTeXt LMTX}] +\fi + \setupinteraction [state=start, style=, color=, - title={ConTeXt MkIV}, subtitle={Lua modules and functions}, author={Hans Hagen - automatically generated}, contrastcolor=] @@ -128,7 +135,7 @@ end \stopnarrower \vfill \vfill - \hskip10mm\scale[width=\dimexpr\paperwidth-20mm\relax]{\ttbf\white\ConTeXt\ MkIV} + \hskip10mm\scale[width=\dimexpr\paperwidth-20mm\relax]{\ttbf\white\ConTeXt\ \ifcase\contextlmtxmode MkIV\else LMTX\fi} \par % \hskip10mm\scale[width=\dimexpr\paperwidth-20mm\relax]{\white \strut Lua infrastructure \emdash\ \currentdate} \vfill diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 3cddb3944..0884d743b 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/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 : 12/31/19 11:28:43 +-- merge date : 01/09/20 11:17:13 do -- begin closure to overcome local limits and interference -- cgit v1.2.3