summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-09-09 14:55:35 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-09-09 14:55:35 +0200
commit438b065a2337ee587442f25ddc587c4762f4d0b0 (patch)
treed18c8f7e51dd7e96b8e774f94d3f8862a6c38f73
parentfca2d946bc4d3ef525c3a2c9016e3b88d6d09812 (diff)
downloadcontext-438b065a2337ee587442f25ddc587c4762f4d0b0.tar.gz
2019-09-09 13:52:00
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-metafun.lua2
-rw-r--r--context/data/scite/context/lexers/scite-context-lexer-sas.lua102
-rw-r--r--context/data/scite/context/lexers/scite-context-lexer.lua4
-rw-r--r--context/data/scite/context/scite-context-data-metafun.properties31
-rw-r--r--context/data/textadept/context/data/scite-context-data-metafun.lua2
-rw-r--r--context/data/textadept/context/lexers/lexer.lua4
-rw-r--r--context/data/textadept/context/lexers/scite-context-lexer-sas.lua102
-rw-r--r--context/data/textadept/context/lexers/scite-context-lexer.lua4
-rw-r--r--context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json2
-rw-r--r--doc/context/documents/general/qrcs/setup-cs.pdfbin919178 -> 887560 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-de.pdfbin889160 -> 889369 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-en.pdfbin917677 -> 893468 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-fr.pdfbin916916 -> 885539 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-it.pdfbin920898 -> 891213 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-cs.pdfbin329449 -> 383749 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-de.pdfbin471354 -> 471623 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-en.pdfbin327336 -> 380397 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-fr.pdfbin328450 -> 384090 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-it.pdfbin328857 -> 383244 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-nl.pdfbin327986 -> 382226 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-ro.pdfbin537640 -> 620287 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-nl.pdfbin914112 -> 881168 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-ro.pdfbin916929 -> 885510 bytes
-rw-r--r--metapost/context/base/mpiv/mp-lmtx.mpxl606
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpxl2
-rw-r--r--metapost/context/base/mpiv/mp-mlib.mpiv1
-rw-r--r--scripts/context/lua/mtx-context.lua9
-rw-r--r--scripts/context/lua/mtx-install.lua16
-rw-r--r--scripts/context/lua/mtxrun.lua66
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua66
-rw-r--r--scripts/context/stubs/unix/mtxrun66
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua66
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/colo-ini.lua6
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl2
-rw-r--r--tex/context/base/mkiv/font-ocl.lua30
-rw-r--r--tex/context/base/mkiv/font-sty.mklx9
-rw-r--r--tex/context/base/mkiv/font-sty.mkvi11
-rw-r--r--tex/context/base/mkiv/grph-bmp.lua3
-rw-r--r--tex/context/base/mkiv/grph-fil.lua26
-rw-r--r--tex/context/base/mkiv/grph-img.lua5
-rw-r--r--tex/context/base/mkiv/grph-rul.lua2
-rw-r--r--tex/context/base/mkiv/l-pdfview.lua2
-rw-r--r--tex/context/base/mkiv/l-table.lua31
-rw-r--r--tex/context/base/mkiv/lpdf-img.lua93
-rw-r--r--tex/context/base/mkiv/lpdf-pde.lua162
-rw-r--r--tex/context/base/mkiv/luat-fmt.lua3
-rw-r--r--tex/context/base/mkiv/mlib-ctx.mkiv2
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua446
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua5
-rw-r--r--tex/context/base/mkiv/mlib-pdf.mkxl40
-rw-r--r--tex/context/base/mkiv/mlib-scn.lua37
-rw-r--r--tex/context/base/mkiv/mult-fun.lua2
-rw-r--r--tex/context/base/mkiv/pack-bck.mkvi5
-rw-r--r--tex/context/base/mkiv/pack-rul.mkiv10
-rw-r--r--tex/context/base/mkiv/pack-rul.mkxl10
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26096 -> 26704 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin230173 -> 268937 bytes
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/syst-ini.mkxl2
-rw-r--r--tex/context/base/mkiv/trac-log.lua10
-rw-r--r--tex/context/base/mkiv/trac-set.lua2
-rw-r--r--tex/context/base/mkiv/util-tab.lua20
-rw-r--r--tex/context/base/mkiv/util-tpl.lua66
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin917677 -> 893468 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin24422 -> 61165 bytes
-rw-r--r--tex/context/modules/common/s-abbreviations-logos.tex1
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv10
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua22
72 files changed, 1779 insertions, 457 deletions
diff --git a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
index af1da89ee..5fa6ddc01 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
@@ -1,4 +1,4 @@
return {
- ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex" },
+ ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "nodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex" },
["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode" },
} \ No newline at end of file
diff --git a/context/data/scite/context/lexers/scite-context-lexer-sas.lua b/context/data/scite/context/lexers/scite-context-lexer-sas.lua
new file mode 100644
index 000000000..e36569911
--- /dev/null
+++ b/context/data/scite/context/lexers/scite-context-lexer-sas.lua
@@ -0,0 +1,102 @@
+local info = {
+ version = 1.001,
+ comment = "scintilla lpeg lexer for sas",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+-- todo: make this ok for the sas syntax as now it's sql
+
+local P, R, S = lpeg.P, lpeg.R, lpeg.S
+
+local lexer = require("scite-context-lexer")
+local context = lexer.context
+local patterns = context.patterns
+
+local token = lexer.token
+local exact_match = lexer.exact_match
+
+local saslexer = lexer.new("sas","scite-context-lexer-sAs")
+local whitespace = saslexer.whitespace
+
+local keywords_standard = {
+ "anova" , "data", "run", "proc",
+}
+
+local keywords_dialects = {
+ "class" , "do", "end" , "int" , "for" , "model" , "rannor" , "to" , "output"
+}
+
+local space = patterns.space -- S(" \n\r\t\f\v")
+local any = patterns.any
+local restofline = patterns.restofline
+local startofline = patterns.startofline
+
+local squote = P("'")
+local dquote = P('"')
+local bquote = P('`')
+local escaped = P("\\") * P(1)
+
+local begincomment = P("/*")
+local endcomment = P("*/")
+
+local decimal = patterns.decimal
+local float = patterns.float
+local integer = P("-")^-1 * decimal
+
+local spacing = token(whitespace, space^1)
+local rest = token("default", any)
+
+local shortcomment = token("comment", (P("#") + P("--")) * restofline^0)
+local longcomment = token("comment", begincomment * (1-endcomment)^0 * endcomment^-1)
+
+local identifier = token("default",lexer.helpers.utfidentifier)
+
+local shortstring = token("quote", dquote) -- can be shared
+ * token("string", (escaped + (1-dquote))^0)
+ * token("quote", dquote)
+ + token("quote", squote)
+ * token("string", (escaped + (1-squote))^0)
+ * token("quote", squote)
+ + token("quote", bquote)
+ * token("string", (escaped + (1-bquote))^0)
+ * token("quote", bquote)
+
+local p_keywords_s = exact_match(keywords_standard,nil,true)
+local p_keywords_d = exact_match(keywords_dialects,nil,true)
+local keyword_s = token("keyword", p_keywords_s)
+local keyword_d = token("command", p_keywords_d)
+
+local number = token("number", float + integer)
+local operator = token("special", S("+-*/%^!=<>;:{}[]().&|?~"))
+
+saslexer._tokenstyles = context.styleset
+
+saslexer._foldpattern = P("/*") + P("*/") + S("{}") -- separate entry else interference
+
+saslexer._foldsymbols = {
+ _patterns = {
+ "/%*",
+ "%*/",
+ },
+ ["comment"] = {
+ ["/*"] = 1,
+ ["*/"] = -1,
+ }
+}
+
+saslexer._rules = {
+ { "whitespace", spacing },
+ { "keyword-s", keyword_s },
+ { "keyword-d", keyword_d },
+ { "identifier", identifier },
+ { "string", shortstring },
+ { "longcomment", longcomment },
+ { "shortcomment", shortcomment },
+ { "number", number },
+ { "operator", operator },
+ { "rest", rest },
+}
+
+return saslexer
diff --git a/context/data/scite/context/lexers/scite-context-lexer.lua b/context/data/scite/context/lexers/scite-context-lexer.lua
index 234b03c05..8451abc85 100644
--- a/context/data/scite/context/lexers/scite-context-lexer.lua
+++ b/context/data/scite/context/lexers/scite-context-lexer.lua
@@ -2240,6 +2240,10 @@ do
local utf8three = R("\224\239") * utf8next * utf8next
local utf8four = R("\240\244") * utf8next * utf8next * utf8next
+ local utfidentifier = utf8two + utf8three + utf8four
+ helpers.utfidentifier = (R("AZ","az","__") + utfidentifier)
+ * (R("AZ","az","__","09") + utfidentifier)^0
+
helpers.utfcharpattern = P(1) * utf8next^0 -- unchecked but fast
helpers.utfbytepattern = utf8one / byte
+ utf8two / function(s) local c1, c2 = byte(s,1,2) return c1 * 64 + c2 - 12416 end
diff --git a/context/data/scite/context/scite-context-data-metafun.properties b/context/data/scite/context/scite-context-data-metafun.properties
index 2ea557d0c..318d7b773 100644
--- a/context/data/scite/context/scite-context-data-metafun.properties
+++ b/context/data/scite/context/scite-context-data-metafun.properties
@@ -58,21 +58,22 @@ draworiginoptions drawboundoptions drawpathoptions resetdrawoptions undashed \
pencilled decorated redecorated undecorated passvariable \
passarrayvariable tostring topair format formatted \
quotation quote startpassingvariable stoppassingvariable eofill \
-eoclip nofill fillup eofillup area \
-addbackground shadedup shadeddown shadedleft shadedright \
-sortlist copylist shapedlist listtocurves listtolines \
-listsize listlast uniquelist circularpath squarepath \
-linearpath theoffset texmode systemmode texvar \
-texstr isarray prefix dimension getmacro \
-getdimen getcount gettoks setmacro setdimen \
-setcount settoks positionpath positioncurve positionxy \
-positionpxy positionwhd positionpage positionregion positionbox \
-positionanchor positioninregion positionatanchor wdpart htpart \
-dppart texvar texstr inpath pointof \
-leftof rightof utflen utfsub newhash \
-disposehash inhash tohash isarray prefix \
-isobject comment report lua mp \
-MP luacall mirrored mirroredabout scriptindex
+eoclip nofill fillup eofillup nodraw \
+area addbackground shadedup shadeddown shadedleft \
+shadedright sortlist copylist shapedlist listtocurves \
+listtolines listsize listlast uniquelist circularpath \
+squarepath linearpath theoffset texmode systemmode \
+texvar texstr isarray prefix dimension \
+getmacro getdimen getcount gettoks setmacro \
+setdimen setcount settoks positionpath positioncurve \
+positionxy positionpxy positionwhd positionpage positionregion \
+positionbox positionanchor positioninregion positionatanchor wdpart \
+htpart dppart texvar texstr inpath \
+pointof leftof rightof utflen utfsub \
+newhash disposehash inhash tohash isarray \
+prefix isobject comment report lua \
+mp MP luacall mirrored mirroredabout \
+scriptindex
keywordclass.metafun.internals=\
nocolormodel greycolormodel graycolormodel rgbcolormodel \
diff --git a/context/data/textadept/context/data/scite-context-data-metafun.lua b/context/data/textadept/context/data/scite-context-data-metafun.lua
index af1da89ee..5fa6ddc01 100644
--- a/context/data/textadept/context/data/scite-context-data-metafun.lua
+++ b/context/data/textadept/context/data/scite-context-data-metafun.lua
@@ -1,4 +1,4 @@
return {
- ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex" },
+ ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "nodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex" },
["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode" },
} \ No newline at end of file
diff --git a/context/data/textadept/context/lexers/lexer.lua b/context/data/textadept/context/lexers/lexer.lua
index 234b03c05..8451abc85 100644
--- a/context/data/textadept/context/lexers/lexer.lua
+++ b/context/data/textadept/context/lexers/lexer.lua
@@ -2240,6 +2240,10 @@ do
local utf8three = R("\224\239") * utf8next * utf8next
local utf8four = R("\240\244") * utf8next * utf8next * utf8next
+ local utfidentifier = utf8two + utf8three + utf8four
+ helpers.utfidentifier = (R("AZ","az","__") + utfidentifier)
+ * (R("AZ","az","__","09") + utfidentifier)^0
+
helpers.utfcharpattern = P(1) * utf8next^0 -- unchecked but fast
helpers.utfbytepattern = utf8one / byte
+ utf8two / function(s) local c1, c2 = byte(s,1,2) return c1 * 64 + c2 - 12416 end
diff --git a/context/data/textadept/context/lexers/scite-context-lexer-sas.lua b/context/data/textadept/context/lexers/scite-context-lexer-sas.lua
new file mode 100644
index 000000000..e36569911
--- /dev/null
+++ b/context/data/textadept/context/lexers/scite-context-lexer-sas.lua
@@ -0,0 +1,102 @@
+local info = {
+ version = 1.001,
+ comment = "scintilla lpeg lexer for sas",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+-- todo: make this ok for the sas syntax as now it's sql
+
+local P, R, S = lpeg.P, lpeg.R, lpeg.S
+
+local lexer = require("scite-context-lexer")
+local context = lexer.context
+local patterns = context.patterns
+
+local token = lexer.token
+local exact_match = lexer.exact_match
+
+local saslexer = lexer.new("sas","scite-context-lexer-sAs")
+local whitespace = saslexer.whitespace
+
+local keywords_standard = {
+ "anova" , "data", "run", "proc",
+}
+
+local keywords_dialects = {
+ "class" , "do", "end" , "int" , "for" , "model" , "rannor" , "to" , "output"
+}
+
+local space = patterns.space -- S(" \n\r\t\f\v")
+local any = patterns.any
+local restofline = patterns.restofline
+local startofline = patterns.startofline
+
+local squote = P("'")
+local dquote = P('"')
+local bquote = P('`')
+local escaped = P("\\") * P(1)
+
+local begincomment = P("/*")
+local endcomment = P("*/")
+
+local decimal = patterns.decimal
+local float = patterns.float
+local integer = P("-")^-1 * decimal
+
+local spacing = token(whitespace, space^1)
+local rest = token("default", any)
+
+local shortcomment = token("comment", (P("#") + P("--")) * restofline^0)
+local longcomment = token("comment", begincomment * (1-endcomment)^0 * endcomment^-1)
+
+local identifier = token("default",lexer.helpers.utfidentifier)
+
+local shortstring = token("quote", dquote) -- can be shared
+ * token("string", (escaped + (1-dquote))^0)
+ * token("quote", dquote)
+ + token("quote", squote)
+ * token("string", (escaped + (1-squote))^0)
+ * token("quote", squote)
+ + token("quote", bquote)
+ * token("string", (escaped + (1-bquote))^0)
+ * token("quote", bquote)
+
+local p_keywords_s = exact_match(keywords_standard,nil,true)
+local p_keywords_d = exact_match(keywords_dialects,nil,true)
+local keyword_s = token("keyword", p_keywords_s)
+local keyword_d = token("command", p_keywords_d)
+
+local number = token("number", float + integer)
+local operator = token("special", S("+-*/%^!=<>;:{}[]().&|?~"))
+
+saslexer._tokenstyles = context.styleset
+
+saslexer._foldpattern = P("/*") + P("*/") + S("{}") -- separate entry else interference
+
+saslexer._foldsymbols = {
+ _patterns = {
+ "/%*",
+ "%*/",
+ },
+ ["comment"] = {
+ ["/*"] = 1,
+ ["*/"] = -1,
+ }
+}
+
+saslexer._rules = {
+ { "whitespace", spacing },
+ { "keyword-s", keyword_s },
+ { "keyword-d", keyword_d },
+ { "identifier", identifier },
+ { "string", shortstring },
+ { "longcomment", longcomment },
+ { "shortcomment", shortcomment },
+ { "number", number },
+ { "operator", operator },
+ { "rest", rest },
+}
+
+return saslexer
diff --git a/context/data/textadept/context/lexers/scite-context-lexer.lua b/context/data/textadept/context/lexers/scite-context-lexer.lua
index 234b03c05..8451abc85 100644
--- a/context/data/textadept/context/lexers/scite-context-lexer.lua
+++ b/context/data/textadept/context/lexers/scite-context-lexer.lua
@@ -2240,6 +2240,10 @@ do
local utf8three = R("\224\239") * utf8next * utf8next
local utf8four = R("\240\244") * utf8next * utf8next * utf8next
+ local utfidentifier = utf8two + utf8three + utf8four
+ helpers.utfidentifier = (R("AZ","az","__") + utfidentifier)
+ * (R("AZ","az","__","09") + utfidentifier)^0
+
helpers.utfcharpattern = P(1) * utf8next^0 -- unchecked but fast
helpers.utfbytepattern = utf8one / byte
+ utf8two / function(s) local c1, c2 = byte(s,1,2) return c1 * 64 + c2 - 12416 end
diff --git a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json
index c2f6b96c1..d99045786 100644
--- a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json
+++ b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json
@@ -60,7 +60,7 @@
"name" : "context.extra"
},
"helper" : {
- "match" : "(zmod|ystretched|ysized|xysized|xyscaled|xstretched|xsized|withtransparency|withshadevector|withshadetransform|withshadestep|withshaderadius|withshadeorigin|withshademethod|withshadefraction|withshadefactor|withshadedomain|withshadedirection|withshadecolors|withshadecenter|withshade|withproperties|withmask|withlinearshade|withgrey|withgray|withcircularshade|whitecolor|wdpart|visualizepaths|visualizedfill|visualizeddraw|verbatim|utfsub|utflen|urtriangle|urmoved|urenlarged|urcircle|uptriangle|unspiked|unitvector|unittriangle|unitdiamond|unitcircle|uniquelist|undrawfill|undecorated|undashed|uncolored|ultriangle|ulmoved|ulenlarged|ulcircle|tripled|triangle|transparent|transparency|tostring|topenlarged|topboundary|topath|topair|tolist|tohash|tocycle|thetextext|thetexbox|theoffset|thelabel|texvar|texvar|textextoffset|textext|texstr|texstr|texmode|texbox|tensecircle|tcircle|tanh|tand|tan|systemmode|superellipsed|strut|stretched|straightpath|straightpairs|straightfunction|stoppassingvariable|startpassingvariable|squeezed|squarepath|sqr|spotcolor|space|sortlist|softened|snapped|smoothed|sized|sinh|sin|simplified|shownshadevector|shownshadeorigin|shortened|shapedlist|shadedup|shadedright|shadedleft|shadedinto|shadeddown|shaded|settoks|setmacro|setdimen|setcount|scriptindex|rule|roundedsquare|righttriangle|rightof|rightenlarged|rightboundary|rightarrow|resolvedcolor|resetdrawoptions|resetarrows|report|register|redecorated|readfile|rcircle|rawtextext|rawtexbox|randomshifted|randomizedcontrols|randomized|radian|quote|quotation|pushcurrentpicture|pushboundingbox|punked|property|properties|prefix|prefix|pow|positionxy|positionwhd|positionregion|positionpxy|positionpath|positionpage|positioninregion|positioncurve|positionbox|positionatanchor|positionanchor|popcurrentpicture|popboundingbox|pointof|pi|perpendicular|percent|penpoint|pencilled|peepholed|pathconnectors|passvariable|passarrayvariable|paralleled|paired|outsideof|outlinetexttopath|outlinetext|outerboundingbox|originpath|onlayer|oddly|nothing|notcached|normalfill|normaldraw|nofill|newhash|naturalizepaths|namedcolor|multitonecolor|mp|mirroredabout|mirrored|luacall|lua|lrtriangle|lrmoved|lrenlarged|lrcircle|log|loadmodule|loadimage|loadfile|loadfigure|ln|lltriangle|llmoved|llenlarged|llcircle|listtolines|listtocurves|listsize|listlast|linearpath|lefttriangle|leftof|leftenlarged|leftboundary|leftarrow|lcircle|laddered|label|keepcached|istextext|isobject|isarray|isarray|invtan|invsin|inverted|invcos|inv|intersection_point|intersection_found|interpolated|insideof|inpath|innerboundingbox|inhash|infont|infinite|htpart|greyscale|greyed|grayscale|grayed|graphictext|gettoks|getmacro|getdimen|getcount|function|fulltriangle|fullsquare|fulldiamond|formatted|format|fillup|filloutlinetext|figure|externalfigure|exp|evenly|epsed|eofillup|eofill|eoclip|enlonged|enlarged|drawwholepath|drawpoints|drawpointoptions|drawpointlabels|drawpoint|drawpathoptions|drawpathonly|drawpath|drawoutlinetext|draworiginoptions|draworigin|drawlineoptions|drawlabeloptions|drawfill|drawdoublearrows|drawcontrolpoints|drawcontroloptions|drawcontrollines|drawboundoptions|drawboundingbox|drawboundary|dquote|dppart|downtriangle|disposehash|dispose|dimension|detailpaths|detaileddraw|defineshade|decorated|ddecimal|dddecimal|ddddecimal|cutends|curvedpath|curvedpairs|curvedfunction|curved|crossingunder|crossed|crlf|cotd|cot|cosh|cos|cornered|copylist|constructedpath|constructedpairs|constructedfunction|condition|complemented|complementary|comment|colortype|colorpart|colorlike|colordecimalslist|colordecimals|cmyk|clearxy|circularpath|checkedbounds|checkbounds|centerarrow|center|break|boundingradius|boundingpoint|boundingcircle|boundingbox|bottomenlarged|bottomboundary|blownup|blackcolor|bitmapimage|bcircle|bbwidth|bbheight|basiccolors|autoalign|atan|asinh|asin|asgroup|arrowpath|area|anchored|along|addbackground|acosh|acos|SPACE|PERCENT|MP|DQUOTE|CRLF)(?=[^a-zA-Z\u005C_@!?-ÿ])",
+ "match" : "(zmod|ystretched|ysized|xysized|xyscaled|xstretched|xsized|withtransparency|withshadevector|withshadetransform|withshadestep|withshaderadius|withshadeorigin|withshademethod|withshadefraction|withshadefactor|withshadedomain|withshadedirection|withshadecolors|withshadecenter|withshade|withproperties|withmask|withlinearshade|withgrey|withgray|withcircularshade|whitecolor|wdpart|visualizepaths|visualizedfill|visualizeddraw|verbatim|utfsub|utflen|urtriangle|urmoved|urenlarged|urcircle|uptriangle|unspiked|unitvector|unittriangle|unitdiamond|unitcircle|uniquelist|undrawfill|undecorated|undashed|uncolored|ultriangle|ulmoved|ulenlarged|ulcircle|tripled|triangle|transparent|transparency|tostring|topenlarged|topboundary|topath|topair|tolist|tohash|tocycle|thetextext|thetexbox|theoffset|thelabel|texvar|texvar|textextoffset|textext|texstr|texstr|texmode|texbox|tensecircle|tcircle|tanh|tand|tan|systemmode|superellipsed|strut|stretched|straightpath|straightpairs|straightfunction|stoppassingvariable|startpassingvariable|squeezed|squarepath|sqr|spotcolor|space|sortlist|softened|snapped|smoothed|sized|sinh|sin|simplified|shownshadevector|shownshadeorigin|shortened|shapedlist|shadedup|shadedright|shadedleft|shadedinto|shadeddown|shaded|settoks|setmacro|setdimen|setcount|scriptindex|rule|roundedsquare|righttriangle|rightof|rightenlarged|rightboundary|rightarrow|resolvedcolor|resetdrawoptions|resetarrows|report|register|redecorated|readfile|rcircle|rawtextext|rawtexbox|randomshifted|randomizedcontrols|randomized|radian|quote|quotation|pushcurrentpicture|pushboundingbox|punked|property|properties|prefix|prefix|pow|positionxy|positionwhd|positionregion|positionpxy|positionpath|positionpage|positioninregion|positioncurve|positionbox|positionatanchor|positionanchor|popcurrentpicture|popboundingbox|pointof|pi|perpendicular|percent|penpoint|pencilled|peepholed|pathconnectors|passvariable|passarrayvariable|paralleled|paired|outsideof|outlinetexttopath|outlinetext|outerboundingbox|originpath|onlayer|oddly|nothing|notcached|normalfill|normaldraw|nofill|nodraw|newhash|naturalizepaths|namedcolor|multitonecolor|mp|mirroredabout|mirrored|luacall|lua|lrtriangle|lrmoved|lrenlarged|lrcircle|log|loadmodule|loadimage|loadfile|loadfigure|ln|lltriangle|llmoved|llenlarged|llcircle|listtolines|listtocurves|listsize|listlast|linearpath|lefttriangle|leftof|leftenlarged|leftboundary|leftarrow|lcircle|laddered|label|keepcached|istextext|isobject|isarray|isarray|invtan|invsin|inverted|invcos|inv|intersection_point|intersection_found|interpolated|insideof|inpath|innerboundingbox|inhash|infont|infinite|htpart|greyscale|greyed|grayscale|grayed|graphictext|gettoks|getmacro|getdimen|getcount|function|fulltriangle|fullsquare|fulldiamond|formatted|format|fillup|filloutlinetext|figure|externalfigure|exp|evenly|epsed|eofillup|eofill|eoclip|enlonged|enlarged|drawwholepath|drawpoints|drawpointoptions|drawpointlabels|drawpoint|drawpathoptions|drawpathonly|drawpath|drawoutlinetext|draworiginoptions|draworigin|drawlineoptions|drawlabeloptions|drawfill|drawdoublearrows|drawcontrolpoints|drawcontroloptions|drawcontrollines|drawboundoptions|drawboundingbox|drawboundary|dquote|dppart|downtriangle|disposehash|dispose|dimension|detailpaths|detaileddraw|defineshade|decorated|ddecimal|dddecimal|ddddecimal|cutends|curvedpath|curvedpairs|curvedfunction|curved|crossingunder|crossed|crlf|cotd|cot|cosh|cos|cornered|copylist|constructedpath|constructedpairs|constructedfunction|condition|complemented|complementary|comment|colortype|colorpart|colorlike|colordecimalslist|colordecimals|cmyk|clearxy|circularpath|checkedbounds|checkbounds|centerarrow|center|break|boundingradius|boundingpoint|boundingcircle|boundingbox|bottomenlarged|bottomboundary|blownup|blackcolor|bitmapimage|bcircle|bbwidth|bbheight|basiccolors|autoalign|atan|asinh|asin|asgroup|arrowpath|area|anchored|along|addbackground|acosh|acos|SPACE|PERCENT|MP|DQUOTE|CRLF)(?=[^a-zA-Z\u005C_@!?-ÿ])",
"name" : "context.command.metafun.helper.mps"
},
"identifier" : {
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf
index 28b72fd56..7a4693947 100644
--- a/doc/context/documents/general/qrcs/setup-cs.pdf
+++ b/doc/context/documents/general/qrcs/setup-cs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf
index 7eb7d581c..420abff39 100644
--- a/doc/context/documents/general/qrcs/setup-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf
index b4bc1a04e..a695ee7ff 100644
--- a/doc/context/documents/general/qrcs/setup-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf
index 975fb72ce..c7e6c6cbf 100644
--- a/doc/context/documents/general/qrcs/setup-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf
index 65fdba70f..cea823ad8 100644
--- a/doc/context/documents/general/qrcs/setup-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
index 5cccfa40d..0e13f126e 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
index c432b9e6b..65e3302ef 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
index 2362842b1..c76f369ed 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
index ba0ba43f5..8a8c57623 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
index d58c2077a..e62bcd178 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
index 3f540be02..80726bae9 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
index 7b58461ff..aec3cafd7 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf
index 22cf3e16f..069f87a33 100644
--- a/doc/context/documents/general/qrcs/setup-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf
index 79c905423..36d5f9d14 100644
--- a/doc/context/documents/general/qrcs/setup-ro.pdf
+++ b/doc/context/documents/general/qrcs/setup-ro.pdf
Binary files differ
diff --git a/metapost/context/base/mpiv/mp-lmtx.mpxl b/metapost/context/base/mpiv/mp-lmtx.mpxl
index 9026255b3..deeba988f 100644
--- a/metapost/context/base/mpiv/mp-lmtx.mpxl
+++ b/metapost/context/base/mpiv/mp-lmtx.mpxl
@@ -27,6 +27,7 @@ presetparameters "text" [
anchor = "",
format = "",
position = origin,
+ trace = false,
] ;
def lmt_text = applyparameters "text" "lmt_do_text" enddef ;
@@ -45,16 +46,19 @@ vardef lmt_do_text =
if fmt <> "" :
txt := "\formatone{" & fmt & "}{" & txt & "}"
fi ;
- if strt == "yes" :
+ if strt = "yes" :
txt := "\strut " & txt ;
- elseif strt == "auto" :
+ elseif strt = "auto" :
txt := "\setstrut\strut " & txt ;
fi ;
if style <> "" :
txt := "\style[" & style & "]{" & txt & "}" ;
fi ;
+ if getparameter "trace" :
+ txt := "\ruledhbox{\showstruts" & txt & "}" ;
+ fi ;
draw
- if anchor == "" : thetextext else : scantokens("thetextext." & anchor) fi (
+ if anchor = "" : thetextext else : scantokens("thetextext." & anchor) fi (
txt,
getparameter "position"
)
@@ -102,6 +106,7 @@ presetparameters "axis" [
vardef lmt_do_axis =
image (
+
pushparameters "axis" ;
save nx, ny, dx, dy, tx, ty ;
save c, startx, starty ; string c ;
@@ -116,32 +121,32 @@ vardef lmt_do_axis =
starty := getparameter "starty" ;
draw (startx,starty) -- (startx,ny) withcolor c ;
draw (startx,starty) -- (nx,starty) withcolor c ;
- for i = 0 step dx until nx :
+ for i = startx step dx until nx :
if (i > startx) or (startx = 0) :
draw ((0,0) -- (0,-2)) shifted (i,starty) withcolor c ;
fi ;
endfor ;
- for i = 0 step dy until ny :
+ for i = starty step dy until ny :
if (i > starty) or (starty = 0) :
draw ((0,0) -- (-2,0)) shifted (startx,i) withcolor c ;
fi ;
endfor ;
if tx <> 0 :
c := getparameter "textcolor" ;
- for i = 0 step tx until nx :
+ for i = startx step tx until nx :
if (i > startx) or (startx = 0) :
draw
- textext("\strut " & decimal i) ysized 2 shifted (i,-4+starty)
+ textext("\strut " & decimal (i)) ysized 2 shifted (i,-4+starty)
withcolor c;
fi ;
endfor ;
fi ;
if ty <> 0 :
c := getparameter "textcolor" ;
- for i = 0 step ty until ny :
+ for i = starty step ty until ny :
if (i > starty) or (starty = 0) :
draw
- textext.lft("\strut " & decimal i) ysized 2 shifted (-3+startx,i)
+ textext.lft("\strut " & decimal (i)) ysized 2 shifted (-3+startx,i)
withcolor c;
fi ;
endfor ;
@@ -680,17 +685,17 @@ vardef lmt_do_function =
option := getparameter "xarrow" ;
if option = "yes" :
-save ahlength ; ahlength := tl ;
-% save ahangle ; ahangle := 100/sy ;
+ save ahlength ; ahlength := tl ;
+ % save ahangle ; ahangle := 100/sy ;
drawarrow (xmin,0) -- (xmax,0) ;
- else
+ else :
draw (xmin,0) -- (xmax,0) ;
fi ;
option := getparameter "yarrow" ;
if option = "yes" :
-save ahlength ; ahlength := tl ;
-% save ahangle ; ahangle := 100/sx ;
+ save ahlength ; ahlength := tl ;
+ % save ahangle ; ahangle := 100/sx ;
drawarrow (0,ymin) -- (0,ymax) ;
else :
draw (0,ymin) -- (0,ymax) ;
@@ -1063,7 +1068,7 @@ vardef lmt_do_chart_circle =
first := last ;
endfor ;
if linewidth > 0 :
- if drawcolor == "" :
+ if drawcolor = "" :
drawcolor := backgroundcolor ;
fi ;
for i = 1 upto nofsamples :
@@ -1362,3 +1367,574 @@ vardef lmt_do_shade =
popparameters ;
)
enddef ;
+
+% This is very experimental and will first be tested by a few users who
+% are interested in this.
+
+presetparameters "contour" [
+ xmin = 0,
+ xmax = 0,
+ ymin = 0,
+ ymax = 0,
+ xstep = 0,
+ ystep = 0,
+ levels = 10,
+ % colors = { }, % used when set
+ preamble = "",
+ function = "x + y",
+ color = "lin(l)", % l/n
+ background = "bitmap", % bitmap | shape | band
+ foreground = "auto", % cell| edge | shape | auto: bitmap/edge shape/shape
+ linewidth = .25,
+ backgroundcolor = "black",
+ linecolor = "gray",
+ xformat = "@0.2N",
+ yformat = "@0.2N",
+ zformat = "@0.2N",
+ xstyle = "",
+ ystyle = "",
+ zstyle = "",
+
+ width = 0, % auto when 0
+ height = 0, % auto when 0
+
+ trace = false,
+ checkresult = false,
+ defaultnan = 0,
+ defaultinf = 0,
+
+ legend = "all", % x | y | z | function | range | all (but range)
+ legendheight = LineHeight,
+ legendwidth = LineHeight,
+ legendgap = 0,
+ legenddistance = EmWidth,
+ textdistance = 2EmWidth/3,
+ functiondistance = ExHeight,
+ functionstyle = "",
+
+ level = 4096, % for selecting one (can't be too large for scaled)
+
+ axisdistance = ExHeight,
+ axislinewidth = .25,
+ axisoffset = ExHeight/4,
+ axiscolor = "black",
+ ticklength = ExHeight,
+
+ xtick = 5,
+ ytick = 5,
+ xlabel = 5,
+ ylabel = 5,
+
+] ;
+
+% we can as well push ...
+
+def lmt_contour = applyparameters "contour" "lmt_do_contour" enddef ;
+
+boolean lmx_contour_loaded ; lmx_contour_loaded := false ;
+
+def mfun_only_draw = addto currentpicture doublepath enddef ;
+def mfun_only_fill = addto currentpicture contour enddef ;
+def mfun_only_nodraw text t = addto currentpicture doublepath t withpostscript "collect" enddef ;
+def mfun_only_nofill text t = addto currentpicture contour t withpostscript "collect" enddef ;
+
+def lmt_do_contour_shortcuts =
+ save D ; let D = mfun_only_draw ;
+ save F ; let F = mfun_only_fill ;
+ save d ; let d = mfun_only_nodraw ;
+ save f ; let f = mfun_only_nofill ;
+ save C ; let C = cycle ;
+enddef ;
+
+def lmt_do_contour_band =
+ lua.mp.lmt_contours_edge_set_by_band() ;
+ for v=1 upto lua.mp.lmt_contours_nofvalues() :
+ draw image (
+ lua.mp.lmt_contours_edge_get_band(v) ;
+ )
+ withcolor lua.mp.lmt_contours_color(v) ;
+ endfor ;
+enddef;
+
+def lmt_do_contour_cell(expr dx,dy) =
+ lua.mp.lmt_contours_edge_set_by_cell() ;
+ draw image (
+ if level = 4096 :
+ for v=1+1 upto lua.mp.lmt_contours_nofvalues() :
+ lua.mp.lmt_contours_edge_get_cell(v) ;
+ endfor ;
+ else :
+ lua.mp.lmt_contours_edge_get_cell(level) ;
+ fi
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withcolor getparameter "linecolor"
+ withpen pencircle scaled getparameter "linewidth" ;
+enddef ;
+
+def lmt_do_contour_edge(expr dx, dy) =
+ lua.mp.lmt_contours_edge_set() ;
+ draw image (
+ if level = 4096 :
+ for v=1+1 upto lua.mp.lmt_contours_nofvalues() :
+ lua.mp.lmt_contours_edge_paths(v);
+ endfor ;
+ else :
+ lua.mp.lmt_contours_edge_paths(level);
+ fi
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withcolor getparameter "linecolor"
+ withpen pencircle scaled getparameter "linewidth" ;
+enddef ;
+
+def lmt_do_contour_edges(expr dx, dy) =
+ lua.mp.lmt_contours_edge_set() ;
+ if level = 4096 :
+ for v=1+1 upto lua.mp.lmt_contours_nofvalues() :
+ draw image (
+ lua.mp.lmt_contours_edge_paths(v);
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withpen pencircle scaled getparameter "linewidth"
+ withcolor lua.mp.lmt_contours_color(v) ;
+ endfor ;
+ else :
+ draw image (
+ lua.mp.lmt_contours_edge_paths(level);
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withpen pencircle scaled getparameter "linewidth"
+ withcolor lua.mp.lmt_contours_color(level) ;
+ fi ;
+enddef ;
+
+def lmt_do_contour_cells(expr dx, dy) =
+ lua.mp.lmt_contours_edge_set_by_cell() ;
+ if level = 4096 :
+ for v=1+1 upto lua.mp.lmt_contours_nofvalues() :
+ draw image (
+ lua.mp.lmt_contours_edge_get_cell(v) ;
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withpen pencircle scaled getparameter "linewidth"
+ withcolor lua.mp.lmt_contours_color(v) ;
+ endfor ;
+ else :
+ draw image (
+ lua.mp.lmt_contours_edge_get_cell(level) ;
+ )
+ if offset : shifted (-1/2,-1/2) fi
+ withpen pencircle scaled getparameter "linewidth"
+ withcolor lua.mp.lmt_contours_color(v) ;
+ fi ;
+enddef ;
+
+def lmt_do_contour_shape(expr dx, dy) =
+ draw image (
+ if level = 4096 :
+ for v=1+1 upto lua.mp.lmt_contours_nofvalues() :
+ lua.mp.lmt_contours_shape_paths(v);
+ endfor ;
+ else :
+ lua.mp.lmt_contours_shape_paths(level);
+ lua.mp.lmt_contours_shape_paths(1);
+ fi
+ )
+ if (dx <>0) or (dy <> 0) : shifted (dx,dy) fi
+ withcolor getparameter "linecolor"
+ withpen pencircle scaled getparameter "linewidth" ;
+enddef ;
+
+def lmt_do_contour_bitmap =
+ lua.mp.lmt_contours_bitmap_set() ;
+ lua.mp.lmt_contours_bitmap_get() ;
+enddef ;
+
+def lmt_do_contour_shades(expr outlines) =
+ lua.mp.lmt_contours_shade_set(outlines) ;
+ if level = 4096 :
+ for v=1 upto lua.mp.lmt_contours_nofvalues() : % no + 1 here
+ draw image (
+ lua.mp.lmt_contours_shade_paths(v) ;
+ )
+ withpen pencircle scaled 0
+ withcolor lua.mp.lmt_contours_color(v) ;
+ endfor ;
+ else :
+ draw image (
+ lua.mp.lmt_contours_shade_paths(level);
+ )
+ withpen pencircle scaled 0
+ withcolor lua.mp.lmt_contours_color(level) ;
+ fi ;
+enddef ;
+
+vardef lmt_do_contour =
+ image (
+
+ if not lmx_contour_loaded :
+ lmx_contour_loaded := true ;
+ runscript("lua.registercode('mlib-cnt')");
+ extra_beginfig := extra_beginfig & % todo: use different hook
+ "runscript(" & ditto & "mp.lmt_contours_cleanup()" & ditto & ")" ;
+ fi
+
+ pushparameters "contour" ;
+
+ lua.mp.lmt_contours_start() ;
+
+ % graphic
+
+ save bg, fg, nx, ny, trace, level, b, done ; string bg, fg ; boolean trace, done ; path b ;
+
+ bg := getparameter "background" ;
+ fg := getparameter "foreground" ;
+ nx := lua.mp.lmt_contours_nx() ;
+ ny := lua.mp.lmt_contours_ny() ;
+ trace := getparameter "trace" ;
+ level := getparameter "level" ;
+ done := true ;
+
+ begingroup ;
+
+ lmt_do_contour_shortcuts ;
+
+ if bg = "band" :
+ lmt_do_contour_band ;
+ b := boundingbox currentpicture ;
+ if (fg = "auto") or (fg = "cell") :
+ lmt_do_contour_cell(0,0) ;
+ elseif (fg = "edge") :
+ lmt_do_contour_edge(0,0) ; % true ?
+ fi ;
+
+ elseif bg = "bitmap" :
+
+ lmt_do_contour_bitmap ;
+ b := boundingbox currentpicture ;
+ if (fg = "auto") or (fg = "cell") :
+ lmt_do_contour_cell(-1/2,-1/2) ;
+ elseif (fg = "edge") :
+ lmt_do_contour_edge(-1/2,-1/2) ;
+ fi ;
+
+ elseif bg = "shape" :
+
+ lmt_do_contour_shades((fg = "auto") or (fg = "shape")) ;
+ b := boundingbox currentpicture ;
+ if (fg == "auto") or (fg = "shape") :
+ lmt_do_contour_shape(0,0) ;
+ elseif fg == "cell" :
+ lmt_do_contour_cell(-1,-1) ;
+ elseif fg == "edge" :
+ lmt_do_contour_edge(-1,-1) ;
+ fi ;
+
+ % currentpicture := currentpicture reflectedabout ( (0, ny/2), (nx,ny/2) ) ;
+
+ elseif fg = "cell" :
+
+ lmt_do_contour_shortcuts ;
+ lmt_do_contour_cells(0,0) ;
+ b := boundingbox currentpicture ;
+
+ elseif fg = "edge" :
+
+ lmt_do_contour_shortcuts ;
+ lmt_do_contour_edges(0,0) ;
+ b := boundingbox currentpicture ;
+
+ else :
+
+ done := false ;
+
+ fi ;
+
+ endgroup ;
+
+ if done :
+
+ save w, h, cx, cy ;
+
+ cx := - bbwidth (b)/(nx - 1) ;
+ cy := - bbheight(b)/(ny - 1) ;
+ clip currentpicture to b
+ leftenlarged cx rightenlarged cx
+ topenlarged cy bottomenlarged cy ;
+ currentpicture := currentpicture
+ shifted (cx,cy) ;
+
+ w := getparameter "width" ;
+ h := getparameter "height" ;
+
+ % axis
+
+ save xtic, ytic, auto ; boolean auto ;
+
+ xtic := getparameter "xtick" ;
+ ytic := getparameter "ytick" ;
+ auto := (w = 0) and (h = 0) ;
+
+ % resize
+
+ if w <> 0 :
+ if h <> 0 :
+ currentpicture := currentpicture xysized (w,h) ;
+ else :
+ currentpicture := currentpicture xsized w ;
+ fi ;
+ elseif h <> 0 :
+ currentpicture := currentpicture ysized h ;
+ fi ;
+ if w = 0 :
+ w := bbwidth(currentpicture) ;
+ fi ;
+ if h = 0 :
+ h := bbheight(currentpicture) ;
+ fi ;
+
+ % legend
+
+ if hasoption "legend" "all,x,y,z,range" :
+
+ save u, s, sx, sy, ax, ay, ao, al, at, tl, ox, oy, lg, tx, ty, wx, hx, ry, fmt, pmin, pmax ; string fmt; picture pmin, pmax ;
+
+ % move some in the ifs
+
+ if hasoption "legend" "all,z" :
+
+ % colorbar
+
+ fmt := lua.mp.lmt_contours_format() ;
+ pmin := lmt_text [ format = fmt, text = decimal lua.mp.lmt_contours_minmean() ] ;
+ pmax := lmt_text [ format = fmt, text = decimal lua.mp.lmt_contours_maxmean() ] ;
+ wx := max(bbwidth(pmin),bbwidth(pmax)) ;
+ hx := bbheight(pmin) ;
+
+ else :
+
+ hx := 0;
+
+ fi ;
+
+ if auto :
+ % u := 1 ;
+ u := lua.mp.lmt_contours_ny() / 100 ;
+ ry := 4u ;
+ sy := 5u ;
+ sx := 5u ;
+ lg := 0 ;
+ ox := 5u ;
+ oy := - sy/2 + ry/2 ;
+ tx := 2u ;
+ ty := 1u ;
+ ax := 1u ;
+ ay := 1u ;
+ ao := u ;
+ al := u/8 ;
+ at := 3u/2 ;
+ al := u/4 ;
+ else :
+ ry := 0 ;
+ sy := getparameter "legendheight" ;
+ sx := getparameter "legendwidth" ;
+ lg := getparameter "legendgap" ;
+ ox := getparameter "legenddistance" ;
+ oy := - sy/2 + hx/2 ;
+ tx := getparameter "textdistance" ;
+ ty := getparameter "functiondistance" ;
+ ax := getparameter "axisdistance" ;
+ ay := ax ;
+ ao := getparameter "axisoffset" ;
+ at := getparameter "ticklength" ;
+ al := getparameter "axislinewidth" ;
+ fi ;
+
+ if hasoption "legend" "all,z" :
+
+ save dy ; dy := h ;
+
+ for v=1 upto lua.mp.lmt_contours_nofvalues() :
+ dy := dy - sy ;
+ fill unitsquare xyscaled (sx,sy)
+ shifted (w+ox,dy)
+ withcolor lua.mp.lmt_contours_color(v) ;
+ draw
+ lmt_text [
+ trace = trace,
+ anchor = "llft",
+ format = fmt,
+ text = decimal lua.mp.lmt_contours_value(v),
+ style = getparameter "zstyle",
+ position = (wx,0)
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (w+ox+tx+sx,dy+sy+oy)
+ ;
+ dy := dy - lg ;
+ endfor ;
+
+ fi ;
+
+ if hasoption "legend" "x,all" :
+
+ save n, d, s, xmin, xmax, xlab ;
+
+ xmin := getparameter "xmin" ;
+ xmax := getparameter "xmax" ;
+ xlab := getparameter "xlabel" ;
+
+ draw image (
+ interim linecap := butt ;
+ draw ((0,0) -- (w,0)) ;
+ n := al/2 ; s := (w - al) / xtic ; d := (xmax - xmin) / xtic ;
+ for i=xmin step d until xmax :
+ draw (n,0) -- (n,-at) ;
+ n := n + s ;
+ endfor ;
+ ) shifted (0,-ay)
+ withpen pencircle scaled al
+ withcolor getparameter "axiscolor"
+ ;
+
+ if hasoption "legend" "label,all" :
+
+ draw image (
+ n := al/2 ; s := (w - al) / xlab ; d := (xmax - xmin) / xlab ;
+ for i=xmin step d until xmax :
+ draw lmt_text [
+ trace = trace,
+ anchor = "bot",
+ format = getparameter "xformat",
+ style = getparameter "xstyle",
+ text = decimal i
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (n,-at-ao)
+ ;
+ n := n + s ;
+ endfor ;
+ ) shifted (0,-ay) ;
+
+ fi ;
+
+ fi ;
+
+ if hasoption "legend" "y,all" :
+
+ save n, d, s, ymin, ymax, ylab ;
+
+ ymin := getparameter "ymin" ;
+ ymax := getparameter "ymax" ;
+ ylab := getparameter "ylabel" ;
+
+ draw image (
+ interim linecap := butt ;
+ draw ((0,0) -- (0,h)) ;
+ n := al/2 ; s := (h - al) / ytic ; d := (ymax - ymin) / ytic ;
+ for i=ymin step d until ymax :
+ draw (0,n) -- (-at,n) ;
+ n := n + s ;
+ endfor ;
+ ) shifted (-ax,0)
+ withpen pencircle scaled al
+ withcolor getparameter "axiscolor" ;
+ ;
+
+ if hasoption "legend" "label,all" :
+
+ draw image (
+ n := al/2 ; s := (h - al) / ylab ; d := (ymax - ymin) / ylab ;
+ for i=ymin step d until ymax :
+ draw lmt_text [
+ trace = trace,
+ anchor = "lft",
+ format = getparameter "yformat",
+ style = getparameter "ystyle",
+ text = decimal i
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (-at-ao,n)
+ ;
+ n := n + s ;
+ endfor ;
+ ) shifted (-ax,0) ;
+
+ fi ;
+
+ fi ;
+
+ if hasoption "legend" "range,all" :
+
+ % range
+
+ save d ; d := ypart llcorner currentpicture ;
+
+ draw
+ lmt_text [
+ trace = trace,
+ anchor = "bot",
+ text = lua.mp.lmt_contours_range()
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (w/2,d-ty)
+ ;
+
+ % minmax
+
+ draw
+ lmt_text [
+ trace = trace,
+ anchor = "lrt",
+ text = lua.mp.lmt_contours_xrange()
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (0,d-ty)
+ ;
+
+ draw
+ lmt_text [
+ trace = trace,
+ anchor = "llft",
+ text = lua.mp.lmt_contours_yrange()
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (w,d-ty)
+ ;
+
+ fi ;
+
+ if hasoption "legend" "function,all" :
+
+ % formula
+
+ draw
+ lmt_text [
+ trace = trace,
+ anchor = "bot",
+ style = getparameter "functionstyle",
+ text = lua.mp.lmt_contours_function()
+ ]
+ if ry <> 0 : ysized (ry) fi
+ shifted (w/2,ypart llcorner currentpicture - ty)
+ ;
+
+ fi ;
+
+ if trace :
+ draw boundingbox currentpicture
+ dashed evenly
+ withpen pencircle scaled al ;
+ fi ;
+
+ fi ;
+
+ fi ;
+
+ lua.mp.lmt_contours_stop() ;
+
+ popparameters ;
+ )
+enddef ;
+
diff --git a/metapost/context/base/mpiv/mp-luas.mpxl b/metapost/context/base/mpiv/mp-luas.mpxl
index 23c76ab40..a4c921b72 100644
--- a/metapost/context/base/mpiv/mp-luas.mpxl
+++ b/metapost/context/base/mpiv/mp-luas.mpxl
@@ -203,6 +203,7 @@ vardef utfsub(expr s,f,t) = lua.mp.utfsub(s,f,t) enddef ;
newinternal mfid_getparameters ; mfid_getparameters := scriptindex "getparameters" ;
newinternal mfid_presetparameters ; mfid_presetparameters := scriptindex "presetparameters" ;
newinternal mfid_hasparameter ; mfid_hasparameter := scriptindex "hasparameter" ;
+newinternal mfid_hasoption ; mfid_hasoption := scriptindex "hasoption" ;
newinternal mfid_getparameter ; mfid_getparameter := scriptindex "getparameter" ;
newinternal mfid_getparameterdefault ; mfid_getparameterdefault := scriptindex "getparameterdefault" ;
newinternal mfid_getparametercount ; mfid_getparametercount := scriptindex "getparametercount" ;
@@ -217,6 +218,7 @@ newinternal mfid_popparameters ; mfid_popparameters := scriptindex
def getparameters = runscript mfid_getparameters enddef ;
def presetparameters = runscript mfid_presetparameters enddef ;
def hasparameter = runscript mfid_hasparameter enddef ;
+def hasoption = runscript mfid_hasoption enddef ;
def getparameter = runscript mfid_getparameter enddef ;
def getparameterdefault = runscript mfid_getparameterdefault enddef ;
def getparametercount = runscript mfid_getparametercount enddef ;
diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv
index 8ccb6a695..a651d2270 100644
--- a/metapost/context/base/mpiv/mp-mlib.mpiv
+++ b/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -1679,6 +1679,7 @@ def fillup text t = draw t withpostscript "both" enddef ; % we use draw bec
def eofillup text t = draw t withpostscript "eoboth" enddef ; % we use draw because we need the proper boundingbox
def eofill text t = fill t withpostscript "evenodd" enddef ;
def nofill text t = fill t withpostscript "collect" enddef ;
+def nodraw text t = draw t withpostscript "collect" enddef ;
%%% eoclip text t = clip t withpostscript "evenodd" enddef ; % no postscripts yet
% def withrule expr r =
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 381030fc5..f987416ec 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -912,6 +912,15 @@ function scripts.context.run(ctxdata,filename)
--
end
--
+ if environment.arguments["ansilog"] then
+ local logfile = file.replacesuffix(jobname,"log")
+ local logdata = io.loaddata(logfile) or ""
+ if logdata ~= "" then
+ io.savedata(logfile,(gsub(logdata,"%[.-m","")))
+ end
+ end
+ --
+ --
-- this will go away after we update luatex
--
local syncctx = fileaddsuffix(jobname,"syncctx")
diff --git a/scripts/context/lua/mtx-install.lua b/scripts/context/lua/mtx-install.lua
index bad5c8393..49a912291 100644
--- a/scripts/context/lua/mtx-install.lua
+++ b/scripts/context/lua/mtx-install.lua
@@ -174,6 +174,18 @@ function install.identify()
end
+local function disclaimer()
+ report("ConTeXt LMTX with LuaMetaTeX is still experimental and when you get a crash this")
+ report("can be due to a mismatch between Lua bytecode and the engine. In that case you can")
+ report("try the following:")
+ report("")
+ report(" - wipe the texmf-cache directory")
+ report(" - run: mtxrun --generate")
+ report(" - run: context --make")
+ report("")
+ report("When that doesn't solve the problem, ask on the mailing list (ntg-context@ntg.nl).")
+end
+
function install.update()
local function validdir(d)
@@ -523,6 +535,8 @@ function install.update()
report("%-20s : %4i files with %9i bytes installed",unpack(status[i]))
end
report("")
+ disclaimer()
+ report("")
report("update, done")
end
@@ -537,4 +551,6 @@ elseif environment.argument("exporthelp") then
application.export(environment.argument("exporthelp"),environment.files[1])
else
application.help()
+ report("")
+ disclaimer()
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 5a943fa01..997fbcaec 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -2099,7 +2099,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 41494, stripped down to: 21574
+-- original size: 42323, stripped down to: 21574
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -7361,7 +7361,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 28899, stripped down to: 16134
+-- original size: 29567, stripped down to: 16483
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -7617,7 +7617,21 @@ function table.fastserialize(t,prefix)
m=m+1
r[m]="{"
if n>0 then
- for i=0,n do
+ local v=t[0]
+ if v then
+ local tv=type(v)
+ if tv=="string" then
+ m=m+1 r[m]=f_indexed_string(0,v)
+ elseif tv=="number" then
+ m=m+1 r[m]=f_indexed_number(0,v)
+ elseif tv=="table" then
+ m=m+1 r[m]=f_indexed_table(0)
+ fastserialize(v)
+ elseif tv=="boolean" then
+ m=m+1 r[m]=f_indexed_boolean(0,v)
+ end
+ end
+ for i=1,n do
local v=t[i]
local tv=type(v)
if tv=="string" then
@@ -12488,7 +12502,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13340, stripped down to: 8826
+-- original size: 13340, stripped down to: 8832
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12727,7 +12741,7 @@ function setters.new(name)
disable=function(...) disable (setter,...) end,
reset=function(...) reset (setter,...) end,
register=function(...) register(setter,...) end,
- list=function(...) list (setter,...) end,
+ list=function(...) return list (setter,...) end,
show=function(...) show (setter,...) end,
default=function(...) return default (setter,...) end,
value=function(...) return value (setter,...) end,
@@ -12830,7 +12844,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32638, stripped down to: 20935
+-- original size: 32900, stripped down to: 21131
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12884,6 +12898,9 @@ if runningtex and texio then
if v=="--ansi" or v=="--c:ansi" then
variant="ansi"
break
+ elseif v=="--ansilog" or v=="--c:ansilog" then
+ variant="ansilog"
+ break
end
end
end
@@ -12987,6 +13004,10 @@ if runningtex and texio then
},
}
}
+ variants.ansilog={
+ formats=variants.ansi.formats,
+ targets=variants.default.targets,
+ }
logs.flush=io.flush
writer=function(...)
write_nl(target,...)
@@ -13119,7 +13140,7 @@ if runningtex and texio then
subdirect_nop=f.subdirect_nop
status_yes=f.status_yes
status_nop=f.status_nop
- if variant=="ansi" then
+ if variant=="ansi" or variant=="ansilog" then
useluawrites()
end
settarget(whereto)
@@ -14573,7 +14594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tpl"] = package.loaded["util-tpl"] or true
--- original size: 7234, stripped down to: 3887
+-- original size: 7722, stripped down to: 4212
if not modules then modules={} end modules ['util-tpl']={
version=1.001,
@@ -14589,6 +14610,7 @@ local report_template=logs.reporter("template")
local tostring,next=tostring,next
local format,sub,byte=string.format,string.sub,string.byte
local P,C,R,Cs,Cc,Carg,lpegmatch,lpegpatterns=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.match,lpeg.patterns
+local formatters=string.formatters
local replacer
local function replacekey(k,t,how,recursive)
local v=t[k]
@@ -14657,6 +14679,10 @@ local function replaceoptional(l,m,r,t,how,recurse)
local v=t[l]
return v and v~="" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
end
+local function replaceformatted(l,m,r,t,how,recurse)
+ local v=t[r]
+ return v and formatters[l](v)
+end
local single=P("%")
local double=P("%%")
local lquoted=P("%[")
@@ -14670,16 +14696,19 @@ local nolquoted=lquoted/''
local norquoted=rquoted/''
local nolquotedq=lquotedq/''
local norquotedq=rquotedq/''
+local nolformatted=P(":")/"%%"
+local norformatted=P(":")/""
local noloptional=P("%?")/''
local noroptional=P("?%")/''
local nomoptional=P(":")/''
local args=Carg(1)*Carg(2)*Carg(3)
-local key=nosingle*((C((1-nosingle )^1)*args)/replacekey )*nosingle
-local quoted=nolquotedq*((C((1-norquotedq )^1)*args)/replacekeyquoted )*norquotedq
-local unquoted=nolquoted*((C((1-norquoted )^1)*args)/replacekeyunquoted)*norquoted
+local key=nosingle*((C((1-nosingle)^1)*args)/replacekey)*nosingle
+local quoted=nolquotedq*((C((1-norquotedq)^1)*args)/replacekeyquoted)*norquotedq
+local unquoted=nolquoted*((C((1-norquoted)^1)*args)/replacekeyunquoted)*norquoted
local optional=noloptional*((C((1-nomoptional)^1)*nomoptional*C((1-noroptional)^1)*args)/replaceoptional)*noroptional
+local formatted=nosingle*((Cs(nolformatted*(1-norformatted )^1)*norformatted*C((1-nosingle)^1)*args)/replaceformatted)*nosingle
local any=P(1)
- replacer=Cs((unquoted+quoted+escape+optional+key+any)^0)
+ replacer=Cs((unquoted+quoted+formatted+escape+optional+key+any)^0)
local function replace(str,mapping,how,recurse)
if mapping and str then
return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
@@ -25447,7 +25476,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9920, stripped down to: 7476
+-- original size: 9998, stripped down to: 7540
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25492,6 +25521,9 @@ local function secondaryflags()
if arguments.ansi then
flags[#flags+1]="--c:ansi"
end
+ if arguments.ansilog then
+ flags[#flags+1]="--c:ansilog"
+ end
if arguments.strip then
flags[#flags+1]="--c:strip"
end
@@ -25701,8 +25733,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 : 1025155
--- stripped bytes : 405916
+-- original bytes : 1027480
+-- stripped bytes : 407301
-- end library merge
@@ -26843,9 +26875,9 @@ do
end
-if e_argument("ansi") then
+if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters("ansi")
+ logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 5a943fa01..997fbcaec 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -2099,7 +2099,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 41494, stripped down to: 21574
+-- original size: 42323, stripped down to: 21574
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -7361,7 +7361,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 28899, stripped down to: 16134
+-- original size: 29567, stripped down to: 16483
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -7617,7 +7617,21 @@ function table.fastserialize(t,prefix)
m=m+1
r[m]="{"
if n>0 then
- for i=0,n do
+ local v=t[0]
+ if v then
+ local tv=type(v)
+ if tv=="string" then
+ m=m+1 r[m]=f_indexed_string(0,v)
+ elseif tv=="number" then
+ m=m+1 r[m]=f_indexed_number(0,v)
+ elseif tv=="table" then
+ m=m+1 r[m]=f_indexed_table(0)
+ fastserialize(v)
+ elseif tv=="boolean" then
+ m=m+1 r[m]=f_indexed_boolean(0,v)
+ end
+ end
+ for i=1,n do
local v=t[i]
local tv=type(v)
if tv=="string" then
@@ -12488,7 +12502,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13340, stripped down to: 8826
+-- original size: 13340, stripped down to: 8832
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12727,7 +12741,7 @@ function setters.new(name)
disable=function(...) disable (setter,...) end,
reset=function(...) reset (setter,...) end,
register=function(...) register(setter,...) end,
- list=function(...) list (setter,...) end,
+ list=function(...) return list (setter,...) end,
show=function(...) show (setter,...) end,
default=function(...) return default (setter,...) end,
value=function(...) return value (setter,...) end,
@@ -12830,7 +12844,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32638, stripped down to: 20935
+-- original size: 32900, stripped down to: 21131
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12884,6 +12898,9 @@ if runningtex and texio then
if v=="--ansi" or v=="--c:ansi" then
variant="ansi"
break
+ elseif v=="--ansilog" or v=="--c:ansilog" then
+ variant="ansilog"
+ break
end
end
end
@@ -12987,6 +13004,10 @@ if runningtex and texio then
},
}
}
+ variants.ansilog={
+ formats=variants.ansi.formats,
+ targets=variants.default.targets,
+ }
logs.flush=io.flush
writer=function(...)
write_nl(target,...)
@@ -13119,7 +13140,7 @@ if runningtex and texio then
subdirect_nop=f.subdirect_nop
status_yes=f.status_yes
status_nop=f.status_nop
- if variant=="ansi" then
+ if variant=="ansi" or variant=="ansilog" then
useluawrites()
end
settarget(whereto)
@@ -14573,7 +14594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tpl"] = package.loaded["util-tpl"] or true
--- original size: 7234, stripped down to: 3887
+-- original size: 7722, stripped down to: 4212
if not modules then modules={} end modules ['util-tpl']={
version=1.001,
@@ -14589,6 +14610,7 @@ local report_template=logs.reporter("template")
local tostring,next=tostring,next
local format,sub,byte=string.format,string.sub,string.byte
local P,C,R,Cs,Cc,Carg,lpegmatch,lpegpatterns=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.match,lpeg.patterns
+local formatters=string.formatters
local replacer
local function replacekey(k,t,how,recursive)
local v=t[k]
@@ -14657,6 +14679,10 @@ local function replaceoptional(l,m,r,t,how,recurse)
local v=t[l]
return v and v~="" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
end
+local function replaceformatted(l,m,r,t,how,recurse)
+ local v=t[r]
+ return v and formatters[l](v)
+end
local single=P("%")
local double=P("%%")
local lquoted=P("%[")
@@ -14670,16 +14696,19 @@ local nolquoted=lquoted/''
local norquoted=rquoted/''
local nolquotedq=lquotedq/''
local norquotedq=rquotedq/''
+local nolformatted=P(":")/"%%"
+local norformatted=P(":")/""
local noloptional=P("%?")/''
local noroptional=P("?%")/''
local nomoptional=P(":")/''
local args=Carg(1)*Carg(2)*Carg(3)
-local key=nosingle*((C((1-nosingle )^1)*args)/replacekey )*nosingle
-local quoted=nolquotedq*((C((1-norquotedq )^1)*args)/replacekeyquoted )*norquotedq
-local unquoted=nolquoted*((C((1-norquoted )^1)*args)/replacekeyunquoted)*norquoted
+local key=nosingle*((C((1-nosingle)^1)*args)/replacekey)*nosingle
+local quoted=nolquotedq*((C((1-norquotedq)^1)*args)/replacekeyquoted)*norquotedq
+local unquoted=nolquoted*((C((1-norquoted)^1)*args)/replacekeyunquoted)*norquoted
local optional=noloptional*((C((1-nomoptional)^1)*nomoptional*C((1-noroptional)^1)*args)/replaceoptional)*noroptional
+local formatted=nosingle*((Cs(nolformatted*(1-norformatted )^1)*norformatted*C((1-nosingle)^1)*args)/replaceformatted)*nosingle
local any=P(1)
- replacer=Cs((unquoted+quoted+escape+optional+key+any)^0)
+ replacer=Cs((unquoted+quoted+formatted+escape+optional+key+any)^0)
local function replace(str,mapping,how,recurse)
if mapping and str then
return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
@@ -25447,7 +25476,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9920, stripped down to: 7476
+-- original size: 9998, stripped down to: 7540
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25492,6 +25521,9 @@ local function secondaryflags()
if arguments.ansi then
flags[#flags+1]="--c:ansi"
end
+ if arguments.ansilog then
+ flags[#flags+1]="--c:ansilog"
+ end
if arguments.strip then
flags[#flags+1]="--c:strip"
end
@@ -25701,8 +25733,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 : 1025155
--- stripped bytes : 405916
+-- original bytes : 1027480
+-- stripped bytes : 407301
-- end library merge
@@ -26843,9 +26875,9 @@ do
end
-if e_argument("ansi") then
+if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters("ansi")
+ logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 5a943fa01..997fbcaec 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -2099,7 +2099,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 41494, stripped down to: 21574
+-- original size: 42323, stripped down to: 21574
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -7361,7 +7361,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 28899, stripped down to: 16134
+-- original size: 29567, stripped down to: 16483
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -7617,7 +7617,21 @@ function table.fastserialize(t,prefix)
m=m+1
r[m]="{"
if n>0 then
- for i=0,n do
+ local v=t[0]
+ if v then
+ local tv=type(v)
+ if tv=="string" then
+ m=m+1 r[m]=f_indexed_string(0,v)
+ elseif tv=="number" then
+ m=m+1 r[m]=f_indexed_number(0,v)
+ elseif tv=="table" then
+ m=m+1 r[m]=f_indexed_table(0)
+ fastserialize(v)
+ elseif tv=="boolean" then
+ m=m+1 r[m]=f_indexed_boolean(0,v)
+ end
+ end
+ for i=1,n do
local v=t[i]
local tv=type(v)
if tv=="string" then
@@ -12488,7 +12502,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13340, stripped down to: 8826
+-- original size: 13340, stripped down to: 8832
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12727,7 +12741,7 @@ function setters.new(name)
disable=function(...) disable (setter,...) end,
reset=function(...) reset (setter,...) end,
register=function(...) register(setter,...) end,
- list=function(...) list (setter,...) end,
+ list=function(...) return list (setter,...) end,
show=function(...) show (setter,...) end,
default=function(...) return default (setter,...) end,
value=function(...) return value (setter,...) end,
@@ -12830,7 +12844,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32638, stripped down to: 20935
+-- original size: 32900, stripped down to: 21131
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12884,6 +12898,9 @@ if runningtex and texio then
if v=="--ansi" or v=="--c:ansi" then
variant="ansi"
break
+ elseif v=="--ansilog" or v=="--c:ansilog" then
+ variant="ansilog"
+ break
end
end
end
@@ -12987,6 +13004,10 @@ if runningtex and texio then
},
}
}
+ variants.ansilog={
+ formats=variants.ansi.formats,
+ targets=variants.default.targets,
+ }
logs.flush=io.flush
writer=function(...)
write_nl(target,...)
@@ -13119,7 +13140,7 @@ if runningtex and texio then
subdirect_nop=f.subdirect_nop
status_yes=f.status_yes
status_nop=f.status_nop
- if variant=="ansi" then
+ if variant=="ansi" or variant=="ansilog" then
useluawrites()
end
settarget(whereto)
@@ -14573,7 +14594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tpl"] = package.loaded["util-tpl"] or true
--- original size: 7234, stripped down to: 3887
+-- original size: 7722, stripped down to: 4212
if not modules then modules={} end modules ['util-tpl']={
version=1.001,
@@ -14589,6 +14610,7 @@ local report_template=logs.reporter("template")
local tostring,next=tostring,next
local format,sub,byte=string.format,string.sub,string.byte
local P,C,R,Cs,Cc,Carg,lpegmatch,lpegpatterns=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.match,lpeg.patterns
+local formatters=string.formatters
local replacer
local function replacekey(k,t,how,recursive)
local v=t[k]
@@ -14657,6 +14679,10 @@ local function replaceoptional(l,m,r,t,how,recurse)
local v=t[l]
return v and v~="" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
end
+local function replaceformatted(l,m,r,t,how,recurse)
+ local v=t[r]
+ return v and formatters[l](v)
+end
local single=P("%")
local double=P("%%")
local lquoted=P("%[")
@@ -14670,16 +14696,19 @@ local nolquoted=lquoted/''
local norquoted=rquoted/''
local nolquotedq=lquotedq/''
local norquotedq=rquotedq/''
+local nolformatted=P(":")/"%%"
+local norformatted=P(":")/""
local noloptional=P("%?")/''
local noroptional=P("?%")/''
local nomoptional=P(":")/''
local args=Carg(1)*Carg(2)*Carg(3)
-local key=nosingle*((C((1-nosingle )^1)*args)/replacekey )*nosingle
-local quoted=nolquotedq*((C((1-norquotedq )^1)*args)/replacekeyquoted )*norquotedq
-local unquoted=nolquoted*((C((1-norquoted )^1)*args)/replacekeyunquoted)*norquoted
+local key=nosingle*((C((1-nosingle)^1)*args)/replacekey)*nosingle
+local quoted=nolquotedq*((C((1-norquotedq)^1)*args)/replacekeyquoted)*norquotedq
+local unquoted=nolquoted*((C((1-norquoted)^1)*args)/replacekeyunquoted)*norquoted
local optional=noloptional*((C((1-nomoptional)^1)*nomoptional*C((1-noroptional)^1)*args)/replaceoptional)*noroptional
+local formatted=nosingle*((Cs(nolformatted*(1-norformatted )^1)*norformatted*C((1-nosingle)^1)*args)/replaceformatted)*nosingle
local any=P(1)
- replacer=Cs((unquoted+quoted+escape+optional+key+any)^0)
+ replacer=Cs((unquoted+quoted+formatted+escape+optional+key+any)^0)
local function replace(str,mapping,how,recurse)
if mapping and str then
return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
@@ -25447,7 +25476,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9920, stripped down to: 7476
+-- original size: 9998, stripped down to: 7540
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25492,6 +25521,9 @@ local function secondaryflags()
if arguments.ansi then
flags[#flags+1]="--c:ansi"
end
+ if arguments.ansilog then
+ flags[#flags+1]="--c:ansilog"
+ end
if arguments.strip then
flags[#flags+1]="--c:strip"
end
@@ -25701,8 +25733,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 : 1025155
--- stripped bytes : 405916
+-- original bytes : 1027480
+-- stripped bytes : 407301
-- end library merge
@@ -26843,9 +26875,9 @@ do
end
-if e_argument("ansi") then
+if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters("ansi")
+ logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 5a943fa01..997fbcaec 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -2099,7 +2099,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 41494, stripped down to: 21574
+-- original size: 42323, stripped down to: 21574
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -7361,7 +7361,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 28899, stripped down to: 16134
+-- original size: 29567, stripped down to: 16483
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -7617,7 +7617,21 @@ function table.fastserialize(t,prefix)
m=m+1
r[m]="{"
if n>0 then
- for i=0,n do
+ local v=t[0]
+ if v then
+ local tv=type(v)
+ if tv=="string" then
+ m=m+1 r[m]=f_indexed_string(0,v)
+ elseif tv=="number" then
+ m=m+1 r[m]=f_indexed_number(0,v)
+ elseif tv=="table" then
+ m=m+1 r[m]=f_indexed_table(0)
+ fastserialize(v)
+ elseif tv=="boolean" then
+ m=m+1 r[m]=f_indexed_boolean(0,v)
+ end
+ end
+ for i=1,n do
local v=t[i]
local tv=type(v)
if tv=="string" then
@@ -12488,7 +12502,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13340, stripped down to: 8826
+-- original size: 13340, stripped down to: 8832
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12727,7 +12741,7 @@ function setters.new(name)
disable=function(...) disable (setter,...) end,
reset=function(...) reset (setter,...) end,
register=function(...) register(setter,...) end,
- list=function(...) list (setter,...) end,
+ list=function(...) return list (setter,...) end,
show=function(...) show (setter,...) end,
default=function(...) return default (setter,...) end,
value=function(...) return value (setter,...) end,
@@ -12830,7 +12844,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32638, stripped down to: 20935
+-- original size: 32900, stripped down to: 21131
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12884,6 +12898,9 @@ if runningtex and texio then
if v=="--ansi" or v=="--c:ansi" then
variant="ansi"
break
+ elseif v=="--ansilog" or v=="--c:ansilog" then
+ variant="ansilog"
+ break
end
end
end
@@ -12987,6 +13004,10 @@ if runningtex and texio then
},
}
}
+ variants.ansilog={
+ formats=variants.ansi.formats,
+ targets=variants.default.targets,
+ }
logs.flush=io.flush
writer=function(...)
write_nl(target,...)
@@ -13119,7 +13140,7 @@ if runningtex and texio then
subdirect_nop=f.subdirect_nop
status_yes=f.status_yes
status_nop=f.status_nop
- if variant=="ansi" then
+ if variant=="ansi" or variant=="ansilog" then
useluawrites()
end
settarget(whereto)
@@ -14573,7 +14594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tpl"] = package.loaded["util-tpl"] or true
--- original size: 7234, stripped down to: 3887
+-- original size: 7722, stripped down to: 4212
if not modules then modules={} end modules ['util-tpl']={
version=1.001,
@@ -14589,6 +14610,7 @@ local report_template=logs.reporter("template")
local tostring,next=tostring,next
local format,sub,byte=string.format,string.sub,string.byte
local P,C,R,Cs,Cc,Carg,lpegmatch,lpegpatterns=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Cc,lpeg.Carg,lpeg.match,lpeg.patterns
+local formatters=string.formatters
local replacer
local function replacekey(k,t,how,recursive)
local v=t[k]
@@ -14657,6 +14679,10 @@ local function replaceoptional(l,m,r,t,how,recurse)
local v=t[l]
return v and v~="" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
end
+local function replaceformatted(l,m,r,t,how,recurse)
+ local v=t[r]
+ return v and formatters[l](v)
+end
local single=P("%")
local double=P("%%")
local lquoted=P("%[")
@@ -14670,16 +14696,19 @@ local nolquoted=lquoted/''
local norquoted=rquoted/''
local nolquotedq=lquotedq/''
local norquotedq=rquotedq/''
+local nolformatted=P(":")/"%%"
+local norformatted=P(":")/""
local noloptional=P("%?")/''
local noroptional=P("?%")/''
local nomoptional=P(":")/''
local args=Carg(1)*Carg(2)*Carg(3)
-local key=nosingle*((C((1-nosingle )^1)*args)/replacekey )*nosingle
-local quoted=nolquotedq*((C((1-norquotedq )^1)*args)/replacekeyquoted )*norquotedq
-local unquoted=nolquoted*((C((1-norquoted )^1)*args)/replacekeyunquoted)*norquoted
+local key=nosingle*((C((1-nosingle)^1)*args)/replacekey)*nosingle
+local quoted=nolquotedq*((C((1-norquotedq)^1)*args)/replacekeyquoted)*norquotedq
+local unquoted=nolquoted*((C((1-norquoted)^1)*args)/replacekeyunquoted)*norquoted
local optional=noloptional*((C((1-nomoptional)^1)*nomoptional*C((1-noroptional)^1)*args)/replaceoptional)*noroptional
+local formatted=nosingle*((Cs(nolformatted*(1-norformatted )^1)*norformatted*C((1-nosingle)^1)*args)/replaceformatted)*nosingle
local any=P(1)
- replacer=Cs((unquoted+quoted+escape+optional+key+any)^0)
+ replacer=Cs((unquoted+quoted+formatted+escape+optional+key+any)^0)
local function replace(str,mapping,how,recurse)
if mapping and str then
return lpegmatch(replacer,str,1,mapping,how or "lua",recurse or false) or str
@@ -25447,7 +25476,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9920, stripped down to: 7476
+-- original size: 9998, stripped down to: 7540
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25492,6 +25521,9 @@ local function secondaryflags()
if arguments.ansi then
flags[#flags+1]="--c:ansi"
end
+ if arguments.ansilog then
+ flags[#flags+1]="--c:ansilog"
+ end
if arguments.strip then
flags[#flags+1]="--c:strip"
end
@@ -25701,8 +25733,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 : 1025155
--- stripped bytes : 405916
+-- original bytes : 1027480
+-- stripped bytes : 407301
-- end library merge
@@ -26843,9 +26875,9 @@ do
end
-if e_argument("ansi") then
+if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters("ansi")
+ logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
local script = e_argument("script") or e_argument("scripts")
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index f4666bcd9..bca3721ce 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.08.24 22:42}
+\newcontextversion{2019.09.09 13:44}
%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 1663c168f..f56da6309 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.08.24 22:42}
+\edef\contextversion{2019.09.09 13:44}
%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 c7b1d4de4..d865668a5 100644
--- a/tex/context/base/mkiv/colo-ini.lua
+++ b/tex/context/base/mkiv/colo-ini.lua
@@ -1010,6 +1010,12 @@ local function complement(one,fraction,i)
return otf
end
+colors.helpers = {
+ inbetween = inbetween,
+ justone = justone,
+ complement = complement,
+}
+
defineintermediatecolor = function(name,fraction,c_one,c_two,a_one,a_two,specs,global,freeze)
fraction = tonumber(fraction) or 1
local one, two = colorvalues[c_one], colorvalues[c_two] -- beware, it uses the globals
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 47ee3650e..37364a19a 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.08.24 22:42}
+\newcontextversion{2019.09.09 13:44}
%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 a768bffde..b417e09a7 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.08.24 22:42}
+\edef\contextversion{2019.09.09 13:44}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index a6e36cfaf..aaf35d985 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.08.24 22:42}
+\edef\contextversion{2019.09.09 13:44}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index d79ed657e..29aa3eac7 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -193,11 +193,11 @@ local pop = { "pdf", "page", "Q" }
-- local goback = w ~= 0 and leftcommand[w] or nil -- needs checking: are widths the same
-- local t = {
-- start,
--- not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) }
+-- not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) },
+-- push,
-- }
--- local n = 2
+-- local n = 3
-- local l = nil
--- n = n + 1 t[n] = push
-- for i=1,s do
-- local entry = colorlist[i]
-- local v = colorvalues[entry.class] or default
@@ -220,9 +220,6 @@ local pop = { "pdf", "page", "Q" }
-- end
-- end
-- end
---
--- -- Here we have no color change in BT .. ET and more q Q pairs but even then acrobat
--- -- fails displaying the overlays correctly. Other renderers do it right.
local function initialize(tfmdata,kind,value)
if value then
@@ -271,40 +268,25 @@ local function initialize(tfmdata,kind,value)
local s = #colorlist
local goback = w ~= 0 and leftcommand[w] or nil -- needs checking: are widths the same
local t = {
- start, -- really needed
- not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) }
+ not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) },
+ push,
}
local n = 2
local l = nil
- local f = false
for i=1,s do
local entry = colorlist[i]
local v = colorvalues[entry.class] or default
if v and l ~= v then
- if f then
- n = n + 1 t[n] = pop
- end
- n = n + 1 t[n] = push
- f = true
n = n + 1 t[n] = v
l = v
- else
- if f then
- n = n + 1 t[n] = pop
- end
- f = false
- l = nil
end
n = n + 1 t[n] = charcommand[entry.slot]
if s > 1 and i < s and goback then
n = n + 1 t[n] = goback
end
end
- if f then
- n = n + 1 t[n] = pop
- end
+ n = n + 1 t[n] = pop
n = n + 1 t[n] = actuale
- -- n = n + 1 t[n] = stop -- not needed
character.commands = t
end
end
diff --git a/tex/context/base/mkiv/font-sty.mklx b/tex/context/base/mkiv/font-sty.mklx
index 385a9cdbe..81884333b 100644
--- a/tex/context/base/mkiv/font-sty.mklx
+++ b/tex/context/base/mkiv/font-sty.mklx
@@ -222,6 +222,7 @@
\installcorenamespace{style}
\installcorenamespace{stylecheck}
+\installcorenamespace{stylehack}
\installcommandhandler \??style {style} \??style
@@ -272,6 +273,8 @@
{\csname\??styleargument
\ifcsname\??stylecheck#name\endcsname
2% defined as style
+ \orelse\ifcsname\??stylehack#name\endcsname
+ 4% defined as command
\orelse\ifcsname#name\endcsname
1% defined as command
\else
@@ -294,6 +297,12 @@
\setvalue{\??styleargument3}#specification%
{\doifelseassignment{#specification}\font_styles_assignment\font_styles_direct{#specification}}
+\setvalue{\??styleargument4}#name%
+ {\expandafter\triggergroupedcommandcs\begincsname\??stylehack#name\endcsname}
+
+\setvalue{\??stylehack\s!math}% dirty trick
+ {\groupedcommand\normalstartimath\normalstopimath}
+
% \def\font_styles_assignment#specification{\groupedcommand{\font_styles_use_generic{#specification}}{}}
% \def\font_styles_direct #specification{\groupedcommand{\definedfont[#specification]}{}}
diff --git a/tex/context/base/mkiv/font-sty.mkvi b/tex/context/base/mkiv/font-sty.mkvi
index 8200aa957..a24194355 100644
--- a/tex/context/base/mkiv/font-sty.mkvi
+++ b/tex/context/base/mkiv/font-sty.mkvi
@@ -222,6 +222,7 @@
\installcorenamespace{style}
\installcorenamespace{stylecheck}
+\installcorenamespace{stylehack}
\installcommandhandler \??style {style} \??style
@@ -272,11 +273,13 @@
{\csname\??styleargument
\ifcsname\??stylecheck#name\endcsname
2% defined as style
+ \else\ifcsname\??stylehack#name\endcsname
+ 4% defined as command
\else\ifcsname#name\endcsname
1% defined as command
\else
3% specification
- \fi\fi
+ \fi\fi\fi
\endcsname{#name}}
% \setvalue{\??styleargument1}#name%
@@ -294,6 +297,12 @@
\setvalue{\??styleargument3}#specification%
{\doifelseassignment{#specification}\font_styles_assignment\font_styles_direct{#specification}}
+\setvalue{\??styleargument4}#name%
+ {\expandafter\triggergroupedcommandcs\begincsname\??stylehack#name\endcsname}
+
+\setvalue{\??stylehack\s!math}% dirty trick
+ {\groupedcommand\normalstartimath\normalstopimath}
+
% \def\font_styles_assignment#specification{\groupedcommand{\font_styles_use_generic{#specification}}{}}
% \def\font_styles_direct #specification{\groupedcommand{\definedfont[#specification]}{}}
diff --git a/tex/context/base/mkiv/grph-bmp.lua b/tex/context/base/mkiv/grph-bmp.lua
index d863b1a98..e10b01aa4 100644
--- a/tex/context/base/mkiv/grph-bmp.lua
+++ b/tex/context/base/mkiv/grph-bmp.lua
@@ -16,7 +16,7 @@ graphics.bitmaps = bitmaps
local wrapimage = images.wrap
-function bitmaps.new(xsize,ysize,colorspace,colordepth,mask)
+function bitmaps.new(xsize,ysize,colorspace,colordepth,mask,index)
if not xsize or not ysize or xsize == 0 or ysize == 0 then
report_bitmap("provide 'xsize' and 'ysize' larger than zero")
return
@@ -35,6 +35,7 @@ function bitmaps.new(xsize,ysize,colorspace,colordepth,mask)
xsize = xsize,
ysize = ysize,
mask = mask and true or nil,
+ index = index and true or nil,
}
end
diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua
index 155d4211b..b39807830 100644
--- a/tex/context/base/mkiv/grph-fil.lua
+++ b/tex/context/base/mkiv/grph-fil.lua
@@ -57,10 +57,32 @@ function jobfiles.run(name,action)
local oldchecksum = collected[usedname]
local newchecksum = checksum(usedname)
local resultfile = replacesuffix(usedname,resultsuffix)
- if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum or not isfile(resultfile) then
+ local tobedone = false
+ if jobfiles.forcerun then
+ tobedone = true
if trace_run then
- report_run("processing file, changes in %a, processing forced",name)
+ report_run("processing file, changes in %a, %s",name,"processing forced")
end
+ end
+ if not tobedone and not oldchecksum then
+ tobedone = true
+ if trace_run then
+ report_run("processing file, changes in %a, %s",name,"no checksum yet")
+ end
+ end
+ if not tobedone and oldchecksum ~= newchecksum then
+ tobedone = true
+ if trace_run then
+ report_run("processing file, changes in %a, %s",name,"checksum mismatch")
+ end
+ end
+ if not tobedone and not isfile(resultfile) then
+ tobedone = true
+ if trace_run then
+ report_run("processing file, changes in %a, %s",name,"no result file")
+ end
+ end
+ if tobedone then
local ta = type(action)
if ta == "function" then
action(name)
diff --git a/tex/context/base/mkiv/grph-img.lua b/tex/context/base/mkiv/grph-img.lua
index 55ae5a3a0..cde9c8442 100644
--- a/tex/context/base/mkiv/grph-img.lua
+++ b/tex/context/base/mkiv/grph-img.lua
@@ -677,6 +677,7 @@ do
local pixel = false
local data = specification.data
local mask = specification.mask
+ local index = specification.index
if colorspace == 1 or colorspace == "gray" then
pixel = gray
colorspace = 1
@@ -712,6 +713,9 @@ do
mask[i] = setmetatableindex(gray)
end
end
+ if index then
+ index = setmetatableindex(pixel)
+ end
local specification = {
xsize = xsize,
ysize = ysize,
@@ -721,6 +725,7 @@ do
colorspace = colorspace,
data = data,
mask = mask,
+ index = index,
}
return specification
end
diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua
index 194823161..b39fd6fdb 100644
--- a/tex/context/base/mkiv/grph-rul.lua
+++ b/tex/context/base/mkiv/grph-rul.lua
@@ -285,7 +285,7 @@ do
}
elseif method == 21 then
list = {
- "q", line, "w", xxmax, ymax, m, xmax, ymax, xmax, yymax, "y", xmin, yymax, "m",
+ "q", line, "w", xxmax, ymax, "m", xmax, ymax, xmax, yymax, "y", xmin, yymax, "m",
xmin, ymax, xxmin, ymax, "y", how, "Q",
}
elseif method == 22 then
diff --git a/tex/context/base/mkiv/l-pdfview.lua b/tex/context/base/mkiv/l-pdfview.lua
index 29dfaf81f..dc3888df5 100644
--- a/tex/context/base/mkiv/l-pdfview.lua
+++ b/tex/context/base/mkiv/l-pdfview.lua
@@ -162,7 +162,7 @@ function pdfview.close(...)
for i=1,#t do
local name = expander(fullname(t[i]))
if io.exists(name) then
- replace(closecall,{ filename = name })
+ runner(closecall,{ filename = name })
end
end
end
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index cffdcc23e..e82820386 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -287,6 +287,37 @@ local function sortedhash(t,cmp)
return nothing
end
+-- local function iterate(t,i)
+-- local i = i + 1
+-- if i <= t.n then
+-- local k = t[i]
+-- return i, k, t.t[k]
+-- end
+-- end
+--
+-- local function indexedhash(t,cmp)
+-- if t then
+-- local s
+-- if cmp then
+-- -- it would be nice if the sort function would accept a third argument (or nicer, an optional first)
+-- s = sortedhashkeys(t,function(a,b) return cmp(t,a,b) end)
+-- else
+-- s = sortedkeys(t) -- the robust one
+-- end
+-- local m = #s
+-- if m == 1 then
+-- return next, t
+-- elseif m > 0 then
+-- s.n = m
+-- s.t = t
+-- return iterate, s, 0
+-- end
+-- end
+-- return nothing
+-- end
+--
+-- -- for i, k, v in indexedhash(t) do print(k,v,s) end
+
table.sortedhash = sortedhash
table.sortedpairs = sortedhash -- obsolete
diff --git a/tex/context/base/mkiv/lpdf-img.lua b/tex/context/base/mkiv/lpdf-img.lua
index a299a023d..64ed642fa 100644
--- a/tex/context/base/mkiv/lpdf-img.lua
+++ b/tex/context/base/mkiv/lpdf-img.lua
@@ -26,6 +26,7 @@ local band, rshift = bit32.band, bit32.rshift
local loaddata = io.loaddata
local setmetatableindex = table.setmetatableindex
+local formatters = string.formatters
local streams = utilities.streams
local openstring = streams.openstring
@@ -41,6 +42,7 @@ local pdfconstant = lpdf.constant
local pdfstring = lpdf.string
local pdfflushstreamobject = lpdf.flushstreamobject
local pdfreference = lpdf.reference
+local pdfverbose = lpdf.verbose
local pdfmajorversion = lpdf.majorversion
local pdfminorversion = lpdf.minorversion
@@ -1117,37 +1119,66 @@ do
if what == "mask" then
d = specification.mask
s = 1
+ elseif what == "indexed" then
+ s = 1
+ elseif what == "index" then
+ d = specification.index
+ s = - s
end
- if s == 1 then
- for i=1,y do
- local r = d[i]
- for j=1,x do
- n = n + 1 ; t[n] = chars[r[j]]
+ if s > 0 then
+ if s == 1 then
+ for i=1,y do
+ local r = d[i]
+ for j=1,x do
+ n = n + 1 ; t[n] = chars[r[j]]
+ end
end
- end
- elseif s == 2 then
- for i=1,y do
- local r = d[i]
- for j=1,x do
- local c = r[j]
- n = n + 1 ; t[n] = chars[c[1]]
- n = n + 1 ; t[n] = chars[c[2]]
- n = n + 1 ; t[n] = chars[c[3]]
+ elseif s == 2 then
+ for i=1,y do
+ local r = d[i]
+ for j=1,x do
+ local c = r[j]
+ n = n + 1 ; t[n] = chars[c[1]]
+ n = n + 1 ; t[n] = chars[c[2]]
+ n = n + 1 ; t[n] = chars[c[3]]
+ end
+ end
+ elseif s == 3 then
+ for i=1,y do
+ local r = d[i]
+ for j=1,x do
+ local c = r[j]
+ n = n + 1 ; t[n] = chars[c[1]]
+ n = n + 1 ; t[n] = chars[c[2]]
+ n = n + 1 ; t[n] = chars[c[3]]
+ n = n + 1 ; t[n] = chars[c[4]]
+ end
end
end
- elseif s == 3 then
- for i=1,y do
- local r = d[i]
- for j=1,x do
- local c = r[j]
- n = n + 1 ; t[n] = chars[c[1]]
- n = n + 1 ; t[n] = chars[c[2]]
- n = n + 1 ; t[n] = chars[c[3]]
- n = n + 1 ; t[n] = chars[c[4]]
+ return concat(t)
+ else
+ local z = d[0] and 0 or 1
+ if s == -1 then
+ local f = formatters["%02X"]
+ for i=z,#d do
+ n = n + 1 ; t[n] = f(d[i])
+ end
+ elseif s == -2 then
+ local f = formatters["%02X%02X%02X"]
+ for i=z,#d do
+ local c = d[i]
+ n = n + 1 ; t[n] = f(c[1],c[2],c[3])
+ end
+ elseif s == -3 then
+ local f = formatters["%02X%02X%02X%02X"]
+ for i=z,#d do
+ local c = d[i]
+ n = n + 1 ; t[n] = f(c[1],c[2],c[3],c[4])
end
end
+ return "<" .. concat(t," ") .. ">"
end
- return concat(t)
+ return ""
end
function injectors.bitmap(specification)
@@ -1169,8 +1200,18 @@ do
colorspace = "DeviceCMYK"
end
local colordepth = (specification.colordepth or 2) == 16 or 8
- local content = pack(specification,"data")
+ local index = specification.index
+ local content = pack(specification,index and "indexed" or "data")
local mask = specification.mask
+ local colorspace = pdfconstant(colorspace)
+if index then
+ colorspace = pdfarray {
+ pdfconstant("Indexed"),
+ colorspace,
+ #index + (index[0] and 0 or -1), -- upper index
+ pdfverbose(pack(specification,"index"))
+ }
+end
local xobject = pdfdictionary {
Type = pdfconstant("XObject"),
Subtype = pdfconstant("Image"),
@@ -1178,7 +1219,7 @@ do
Width = xsize,
Height = ysize,
BitsPerComponent = colordepth,
- ColorSpace = pdfconstant(colorspace),
+ ColorSpace = colorspace,
Length = #content, -- specification.length
}
if mask then
diff --git a/tex/context/base/mkiv/lpdf-pde.lua b/tex/context/base/mkiv/lpdf-pde.lua
index 8c5c6ffc1..b159df24f 100644
--- a/tex/context/base/mkiv/lpdf-pde.lua
+++ b/tex/context/base/mkiv/lpdf-pde.lua
@@ -1062,92 +1062,96 @@ if images then do
local page = pdfdoc.pages[pagenumber or 1]
local pageinfo = querypdf(pdfdoc,pagenumber)
local contents = page.Contents
- local xref = pdfdoc.__xrefs__
- local copied = pdfdoc.__copied__
- if compact and lpdf_epdf.plugin then
- plugins = lpdf_epdf.plugin(pdfdoc,xref,copied,page)
- end
- local xobject = pdfdictionary {
- Type = pdfconstant("XObject"),
- Subtype = pdfconstant("Form"),
- FormType = 1,
- Group = copyobject(xref,copied,page,"Group"),
- LastModified = copyobject(xref,copied,page,"LastModified"),
- Metadata = copyobject(xref,copied,page,"Metadata"),
- PieceInfo = copyobject(xref,copied,page,"PieceInfo"),
- Resources = copyresources(pdfdoc,xref,copied,page),
- SeparationInfo = copyobject(xref,copied,page,"SeparationInfo"),
- } + attr
- if attributes then
- for k, v in expanded(attributes) do
- page[k] = v -- maybe nested
+ if contents then
+ local xref = pdfdoc.__xrefs__
+ local copied = pdfdoc.__copied__
+ if compact and lpdf_epdf.plugin then
+ plugins = lpdf_epdf.plugin(pdfdoc,xref,copied,page)
end
- end
- local content = ""
- local nolength = nil
- local ctype = contents.__type__
- -- we always recompress because image object streams can not be
- -- influenced (yet)
- if ctype == stream_object_code then
- if stripmarked then
- content = contents() -- uncompressed
- local stripped = lpdf_epdf.stripcontent(content)
- if stripped ~= content then
- -- report("%i bytes stripped on page %i",#content-#stripped,pagenumber or 1)
- content = stripped
+ local xobject = pdfdictionary {
+ Type = pdfconstant("XObject"),
+ Subtype = pdfconstant("Form"),
+ FormType = 1,
+ Group = copyobject(xref,copied,page,"Group"),
+ LastModified = copyobject(xref,copied,page,"LastModified"),
+ Metadata = copyobject(xref,copied,page,"Metadata"),
+ PieceInfo = copyobject(xref,copied,page,"PieceInfo"),
+ Resources = copyresources(pdfdoc,xref,copied,page),
+ SeparationInfo = copyobject(xref,copied,page,"SeparationInfo"),
+ } + attr
+ if attributes then
+ for k, v in expanded(attributes) do
+ page[k] = v -- maybe nested
end
- elseif recompress then
- content = contents() -- uncompressed
- else
- local Filter = copyobject(xref,copied,contents,"Filter")
- local Length = copyobject(xref,copied,contents,"Length")
- if Length and Filter then
- nolength = true
- xobject.Length = Length
- xobject.Filter = Filter
- content = contents(false) -- uncompressed
- else
+ end
+ local content = ""
+ local nolength = nil
+ local ctype = contents.__type__
+ -- we always recompress because image object streams can not be
+ -- influenced (yet)
+ if ctype == stream_object_code then
+ if stripmarked then
+ content = contents() -- uncompressed
+ local stripped = lpdf_epdf.stripcontent(content)
+ if stripped ~= content then
+ -- report("%i bytes stripped on page %i",#content-#stripped,pagenumber or 1)
+ content = stripped
+ end
+ elseif recompress then
content = contents() -- uncompressed
+ else
+ local Filter = copyobject(xref,copied,contents,"Filter")
+ local Length = copyobject(xref,copied,contents,"Length")
+ if Length and Filter then
+ nolength = true
+ xobject.Length = Length
+ xobject.Filter = Filter
+ content = contents(false) -- uncompressed
+ else
+ content = contents() -- uncompressed
+ end
end
+ elseif ctype == array_object_code then
+ content = { }
+ for i=1,#contents do
+ content[i] = contents[i]() -- uncompressed
+ end
+ content = concat(content," ")
end
- elseif ctype == array_object_code then
- content = { }
- for i=1,#contents do
- content[i] = contents[i]() -- uncompressed
+ -- still not nice: we double wrap now
+ plugins = nil
+ local rotation = pageinfo.rotation
+ local boundingbox = pageinfo.boundingbox
+ local transform = nil
+ if rotation == 90 then
+ transform = 3
+ elseif rotation == 180 then
+ transform = 2
+ elseif rotation == 270 then
+ transform = 1
+ elseif rotation > 1 and rotation < 4 then
+ transform = rotation
end
- content = concat(content," ")
- end
- -- still not nice: we double wrap now
- plugins = nil
- local rotation = pageinfo.rotation
- local boundingbox = pageinfo.boundingbox
- local transform = nil
- if rotation == 90 then
- transform = 3
- elseif rotation == 180 then
- transform = 2
- elseif rotation == 270 then
- transform = 1
- elseif rotation > 1 and rotation < 4 then
- transform = rotation
+ xobject.BBox = pdfarray {
+ boundingbox[1] * bpfactor,
+ boundingbox[2] * bpfactor,
+ boundingbox[3] * bpfactor,
+ boundingbox[4] * bpfactor,
+ }
+ -- maybe like bitmaps
+ return createimage { -- beware: can be a img.new or a dummy
+ bbox = boundingbox,
+ transform = transform,
+ nolength = nolength,
+ nobbox = true,
+ notype = true,
+ stream = content, -- todo: no compress, pass directly also length, filter etc
+ attr = xobject(),
+ kind = images.types.stream,
+ }
+ else
+ -- maybe report an error
end
- xobject.BBox = pdfarray {
- boundingbox[1] * bpfactor,
- boundingbox[2] * bpfactor,
- boundingbox[3] * bpfactor,
- boundingbox[4] * bpfactor,
- }
- -- maybe like bitmaps
- return createimage { -- beware: can be a img.new or a dummy
- bbox = boundingbox,
- transform = transform,
- nolength = nolength,
- nobbox = true,
- notype = true,
- stream = content, -- todo: no compress, pass directly also length, filter etc
- attr = xobject(),
- kind = images.types.stream,
- }
end
end
diff --git a/tex/context/base/mkiv/luat-fmt.lua b/tex/context/base/mkiv/luat-fmt.lua
index 86cf5cf9e..e56728e58 100644
--- a/tex/context/base/mkiv/luat-fmt.lua
+++ b/tex/context/base/mkiv/luat-fmt.lua
@@ -48,6 +48,9 @@ local function secondaryflags()
if arguments.ansi then
flags[#flags+1] = "--c:ansi"
end
+ if arguments.ansilog then
+ flags[#flags+1] = "--c:ansilog"
+ end
if arguments.strip then
flags[#flags+1] = "--c:strip"
end
diff --git a/tex/context/base/mkiv/mlib-ctx.mkiv b/tex/context/base/mkiv/mlib-ctx.mkiv
index 145cdb261..78a26ad1c 100644
--- a/tex/context/base/mkiv/mlib-ctx.mkiv
+++ b/tex/context/base/mkiv/mlib-ctx.mkiv
@@ -19,6 +19,8 @@
\registerctxluafile{mlib-lmp}{}
\registerctxluafile{mlib-int}{}
+\doifelsefileexists{mlib-cnt.lua}{\registerctxluafile{mlib-int}{}}{}
+
\unprotect
\protect \endinput
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index 80d893319..9e3802396 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -25,7 +25,6 @@ local report_script = logs.reporter("metapost","script")
local report_message = logs.reporter("metapost")
local trace_luarun = false trackers.register("metapost.lua",function(v) trace_luarun = v end)
-local trace_enabled = true
local be_tolerant = true directives.register("metapost.lua.tolerant", function(v) be_tolerant = v end)
@@ -134,55 +133,15 @@ end
do
- local buffer = { }
- local n = 0
- local max = 20 -- we reuse upto max
- local nesting = 0
- local runs = 0
-
- local function _f_()
- if trace_enabled and trace_luarun then
- local result = concat(buffer," ",1,n)
- if n > max then
- buffer = { } -- newtable(20,0)
- end
- n = 0
- report_luarun("%i: data: %s",nesting,result)
- return result
- else
- if n == 0 then
- return "" -- can be nil
- end
- local result
- if n == 1 then
- result = buffer[1]
- else
- result = concat(buffer," ",1,n)
- end
- if n > max then
- buffer = { } -- newtable(20,0)
- end
- n = 0
- return result
- end
- end
-
- mp._f_ = _f_ -- convenient to have it in a top module
- aux.flush = _f_
-
- ----- f_code = formatters["%s return mp._f_()"]
+ -- serializers
local f_integer = formatters["%i"]
+ local f_numeric = formatters["%F"]
-- no %n as that can produce -e notation and that is not so nice for scaled butmaybe we
-- should then switch between ... i.e. make a push/pop for the formatters here ... not now.
- -- local f_numeric = formatters["%n"] -- maybe %N
- -- local f_pair = formatters["(%n,%n)"]
- -- local f_ctrl = formatters["(%n,%n) .. controls (%n,%n) and (%n,%n)"]
- -- local f_triplet = formatters["(%n,%n,%n)"]
- -- local f_quadruple = formatters["(%n,%n,%n,%n)"]
-
+ local f_integer = formatters["%i"]
local f_numeric = formatters["%F"]
local f_pair = formatters["(%F,%F)"]
local f_ctrl = formatters["(%F,%F) .. controls (%F,%F) and (%F,%F)"]
@@ -206,6 +165,184 @@ do
mp.cleaned = function(s) return lpegmatch(p,s) or s end
+ -- management
+
+ -- sometimes we gain (e.g. .5 sec on the sync test)
+
+ local cache = table.makeweak()
+
+ local runscripts = { }
+ local runnames = { }
+ local nofscripts = 0
+
+ function metapost.registerscript(name,f)
+ nofscripts = nofscripts + 1
+ if f then
+ runscripts[nofscripts] = f
+ runnames[name] = nofscripts
+ else
+ runscripts[nofscripts] = name
+ end
+ return nofscripts
+ end
+
+ function metapost.scriptindex(name)
+ return runnames[name] or 0
+ end
+
+ -- The gbuffer sharing and such is not really needed now but make a dent when
+ -- we have a high volume of simpel calls (loops) so we keep it around for a
+ -- while.
+
+ local nesting = 0
+ local runs = 0
+ local gbuffer = { }
+ local buffer = gbuffer
+ local n = 0
+
+ local function mpdirect1(a)
+ n = n + 1 buffer[n] = a
+ end
+ local function mpdirect2(a,b)
+ n = n + 1 buffer[n] = a
+ n = n + 1 buffer[n] = b
+ end
+ local function mpdirect3(a,b,c)
+ n = n + 1 buffer[n] = a
+ n = n + 1 buffer[n] = b
+ n = n + 1 buffer[n] = c
+ end
+ local function mpdirect4(a,b,c,d)
+ n = n + 1 buffer[n] = a
+ n = n + 1 buffer[n] = b
+ n = n + 1 buffer[n] = c
+ n = n + 1 buffer[n] = d
+ end
+ local function mpdirect5(a,b,c,d,e)
+ n = n + 1 buffer[n] = a
+ n = n + 1 buffer[n] = b
+ n = n + 1 buffer[n] = c
+ n = n + 1 buffer[n] = d
+ n = n + 1 buffer[n] = e
+ end
+
+ local function mpflush(separator)
+ buffer[1] = concat(buffer,separator or "",1,n)
+ n = 1
+ end
+
+ function metapost.runscript(code)
+ nesting = nesting + 1
+ runs = runs + 1
+
+ local index = type(code) == "number"
+ local f
+ local result
+
+ if index then
+ f = runscripts[code]
+ if not f then
+ report_luarun("%i: bad index: %s",nesting,code)
+ elseif trace_luarun then
+ report_luarun("%i: index: %i",nesting,code)
+ end
+ else
+ if trace_luarun then
+ report_luarun("%i: code: %s",nesting,code)
+ end
+ f = cache[code]
+ if not f then
+ f = loadstring("return " .. code)
+ if f then
+ cache[code] = f
+ elseif be_tolerant then
+ f = loadstring(code)
+ if f then
+ cache[code] = f
+ end
+ end
+ end
+ end
+
+ -- returning nil is more efficient and a signal not to scan in mp
+
+ if f then
+
+ local lbuffer, ln
+
+ if nesting == 1 then
+ buffer = gbuffer
+ n = 0
+ else
+ lbuffer = buffer
+ ln = n
+ buffer = { }
+ n = 0
+ end
+
+ result = f()
+
+ if result then
+ local t = type(result)
+ if t == "number" then
+ result = f_numeric(result)
+ elseif t == "table" then
+ result = concat(result) -- no spaces here
+ else
+ result = tostring(result)
+ end
+ if trace_luarun then
+ report_luarun("%i: %s result: %s",nesting,t,result)
+ end
+ elseif n == 0 then
+ result = ""
+ if trace_luarun then
+ report_luarun("%i: no buffered result",nesting)
+ end
+ elseif n == 1 then
+ result = buffer[1]
+ if trace_luarun then
+ report_luarun("%i: 1 buffered result: %s",nesting,result)
+ end
+ else
+ -- the space is why we sometimes have collectors
+ if nesting == 1 then
+ result = concat(buffer," ",1,n)
+ if n > 500 or #result > 10000 then
+ gbuffer = { } -- newtable(20,0)
+ lbuffer = gbuffer
+ end
+ else
+ result = concat(buffer," ")
+ end
+ if trace_luarun then
+ report_luarun("%i: %i buffered results: %s",nesting,n,result)
+ end
+ end
+
+ if nesting == 1 then
+ n = 0
+ else
+ buffer = lbuffer
+ n = ln
+ end
+
+ else
+ report_luarun("%i: no result, invalid code: %s",nesting,code)
+ result = ""
+ end
+
+ nesting = nesting - 1
+
+ return result
+ end
+
+ function metapost.nofscriptruns()
+ return runs
+ end
+
+ -- writers
+
local function mpp(value)
n = n + 1
local t = type(value)
@@ -482,6 +619,13 @@ do
end
end
+ aux.direct = mpdirect1
+ aux.direct1 = mpdirect1
+ aux.direct2 = mpdirect2
+ aux.direct3 = mpdirect3
+ aux.direct4 = mpdirect4
+ aux.flush = mpflush
+
aux.print = mpprint
aux.vprint = mpvprint
aux.boolean = mpboolean
@@ -503,107 +647,74 @@ do
aux.quoted = mpquoted
aux.transform = mptransform
- -- we need access to the variables
-
- function metapost.nofscriptruns()
- return runs
- end
-
- -- sometimes we gain (e.g. .5 sec on the sync test)
-
- local cache = table.makeweak()
-
- local runscripts = { }
- local runnames = { }
- local nofscripts = 0
-
- function metapost.registerscript(name,f)
- nofscripts = nofscripts + 1
- if f then
- runscripts[nofscripts] = f
- runnames[name] = nofscripts
- else
- runscripts[nofscripts] = name
- end
- return nofscripts
- end
-
- function metapost.scriptindex(name)
- return runnames[name] or 0
- end
+ -- for the moment
- function metapost.runscript(code)
- nesting = nesting + 1
- local index = type(code) == "number"
- local trace = trace_enabled and trace_luarun
- runs = runs + 1
- local f
- if index then
- f = runscripts[code]
- if not f then
- report_luarun("%i: bad index: %s",nesting,code)
- elseif trace then
- report_luarun("%i: index: %i",nesting,code)
+ local function mpdraw(lines,list) -- n * 4
+ if list then
+ local c = #lines
+ for i=1,c do
+ local ci = lines[i]
+ local ni = #ci
+ n = n + 1 buffer[n] = i < c and "d(" or "D("
+ for j=1,ni,2 do
+ local l = j + 1
+ n = n + 1 buffer[n] = ci[j]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = ci[l]
+ n = n + 1 buffer[n] = l < ni and ")--(" or ");"
+ end
end
else
- if trace then
- report_luarun("%i: code: %s",nesting,code)
- end
- f = cache[code]
- if not f then
- f = loadstring(code .. " return mp._f_()")
- if f then
- cache[code] = f
- elseif be_tolerant then
- f = loadstring(code)
- if f then
- cache[code] = f
- end
- end
+ local l = #lines
+ local m = l - 4
+ for i=1,l,4 do
+ n = n + 1 buffer[n] = i < m and "d(" or "D("
+ n = n + 1 buffer[n] = lines[i]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = lines[i+1]
+ n = n + 1 buffer[n] = ")--("
+ n = n + 1 buffer[n] = lines[i+2]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = lines[i+3]
+ n = n + 1 buffer[n] = ");"
end
end
+ end
- -- returning nil is more efficient and a signel not to scan in mp
-
- if f then
- local _buffer_ = buffer
- local _n_ = n
- buffer = { }
- n = 0
- local result = f()
- if index and not result then
- result = _f_()
- end
- if result then
- local t = type(result)
- if t == "number" then
- result = f_numeric(result)
- elseif t ~= "string" then
- result = tostring(result)
+ local function mpfill(lines,list)
+ if list then
+ local c = #lines
+ for i=1,c do
+ local ci = lines[i]
+ local ni = #ci
+ n = n + 1 buffer[n] = i < c and "f(" or "F("
+ for j=1,ni,2 do
+ local l = j + 1
+ n = n + 1 buffer[n] = ci[j]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = ci[l]
+ n = n + 1 buffer[n] = l < ni and ")--(" or ")--C;"
end
- if trace then
- if #result == 0 then
- report_luarun("%i: no result",nesting)
- else
- report_luarun("%i: result: %s",nesting,result)
- end
- end
- buffer = _buffer_
- n = _n_
- nesting = nesting - 1
- return result
- elseif trace then
- report_luarun("%i: no result",nesting)
end
- buffer, n = _buffer_, _n_
else
- report_luarun("%i: no result, invalid code: %s",nesting,code)
+ local l = #lines
+ local m = l - 4
+ for i=1,l,4 do
+ n = n + 1 buffer[n] = i < m and "f(" or "F("
+ n = n + 1 buffer[n] = lines[i]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = lines[i+1]
+ n = n + 1 buffer[n] = ")--("
+ n = n + 1 buffer[n] = lines[i+2]
+ n = n + 1 buffer[n] = ","
+ n = n + 1 buffer[n] = lines[i+3]
+ n = n + 1 buffer[n] = ")--C;"
+ end
end
- nesting = nesting - 1
- return ""
end
- -- for the moment
+ aux.draw = mpdraw
+ aux.fill = mpfill
for k, v in next, aux do mp[k] = v end
@@ -1092,3 +1203,72 @@ do
end
end
+
+function mp.flatten(t)
+ local tn = #t
+
+ local t1 = t[1]
+ local t2 = t[2]
+ local t3 = t[3]
+ local t4 = t[4]
+
+ for i=1,tn-5,2 do
+ local t5 = t[i+4]
+ local t6 = t[i+5]
+ if t1 == t3 and t3 == t5 and ((t2 <= t4 and t4 <= t6) or (t6 <= t4 and t4 <= t2)) then
+ t[i+3] = t2
+ t4 = t2
+ t[i] = false
+ t[i+1] = false
+ elseif t2 == t4 and t4 == t6 and ((t1 <= t3 and t3 <= t5) or (t5 <= t3 and t3 <= t1)) then
+ t[i+2] = t1
+ t3 = t1
+ t[i] = false
+ t[i+1] = false
+ end
+ t1 = t3
+ t2 = t4
+ t3 = t5
+ t4 = t6
+ end
+
+ -- remove duplicates
+
+ local t1 = t[1]
+ local t2 = t[2]
+ for i=1,tn-2,2 do
+ local t3 = t[i+2]
+ local t4 = t[i+3]
+ if t1 == t3 and t2 == t4 then
+ t[i] = false
+ t[i+1] = false
+ end
+ t1 = t3
+ t2 = t4
+ end
+
+ -- move coordinates
+
+ local m = 0
+ for i=1,tn,2 do
+ if t[i] then
+ m = m + 1 t[m] = t[i]
+ m = m + 1 t[m] = t[i+1]
+ end
+ end
+
+ -- prune the table (not gc'd)
+
+ for i=tn,m+1,-1 do
+ t[i] = nil
+ end
+
+ -- safeguard so that we have at least one segment
+
+ if m == 2 then
+ t[3] = t[1]
+ t[4] = t[2]
+ end
+
+end
+
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index 92fde5e13..65f3b2016 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -400,6 +400,7 @@ function metapost.flush(specification,result)
local linecap = -1
local linejoin = -1
local dashed = false
+local linewidth = false
local llx = properties.llx
local lly = properties.lly
local urx = properties.urx
@@ -527,7 +528,10 @@ function metapost.flush(specification,result)
if pen then
if pen.type == "elliptical" then
transformed, penwidth = pen_characteristics(original) -- boolean, value
+if penwidth ~= linewidth then
result[#result+1] = f_w(penwidth) -- todo: only if changed
+ linewidth = penwidth
+end
if objecttype == "fill" then
objecttype = "both"
end
@@ -614,6 +618,7 @@ function metapost.flush(specification,result)
if object.grouped then
-- can be qQ'd so changes can end up in groups
miterlimit, linecap, linejoin, dashed = -1, -1, -1, "" -- was false
+linewidth = false
end
end
end
diff --git a/tex/context/base/mkiv/mlib-pdf.mkxl b/tex/context/base/mkiv/mlib-pdf.mkxl
index 113dfe129..763e7ecdd 100644
--- a/tex/context/base/mkiv/mlib-pdf.mkxl
+++ b/tex/context/base/mkiv/mlib-pdf.mkxl
@@ -58,16 +58,14 @@
\global\MPury \the\MPury
\relax}}
-% \unexpanded\def\repositionMPboxindeed
-% {\setbox\MPbox\hpack\bgroup
-% \kern-\MPllx
-% \raise-\MPlly
-% \box\MPbox
-% \egroup}
+% we need to combine these
\unexpanded\def\repositionMPboxindeed
- {\boxxmove\MPbox-\MPllx
- \boxymove\MPbox-\MPlly}
+ {\setbox\MPbox\hpack\bgroup
+ \kern-\MPllx
+ \raise-\MPlly
+ \box\MPbox
+ \egroup}
\unexpanded\def\repositionMPbox
{\ifzeropt\MPllx
@@ -80,20 +78,22 @@
\repositionMPboxindeed
\fi}
-% \unexpanded\def\finalizeMPbox
-% {\repositionMPbox
-% \setbox\MPbox\vpack to \MPheight\bgroup
-% \vfill
-% \hsize\MPwidth
-% \smashbox\MPbox
-% \box\MPbox
-% \egroup
-% \wd\MPbox\MPwidth
-% \ht\MPbox\MPheight}
-
\unexpanded\def\finalizeMPbox
{\repositionMPbox
- \boxyoffset\MPbox\dimexpr\boxyoffset\MPbox-\MPheight\relax
+ \setbox\MPbox\vpack to \MPheight\bgroup
+ \vfill
+ \hsize\MPwidth
+ \smashbox\MPbox
+ \box\MPbox
+ \egroup
+ \wd\MPbox\MPwidth
+ \ht\MPbox\MPheight}
+
+% combined
+
+\unexpanded\def\finalizeMPbox
+ {\boxxoffset\MPbox-\MPllx\relax
+ \boxyoffset\MPbox\dimexpr\boxyoffset\MPbox-\MPheight-\MPlly\relax
\wd\MPbox\MPwidth
\ht\MPbox\MPheight}
diff --git a/tex/context/base/mkiv/mlib-scn.lua b/tex/context/base/mkiv/mlib-scn.lua
index a7c1924eb..ec0f7397b 100644
--- a/tex/context/base/mkiv/mlib-scn.lua
+++ b/tex/context/base/mkiv/mlib-scn.lua
@@ -424,6 +424,40 @@ local function hasparameter()
end
end
+local function hasoption()
+ local list, n = collectnames()
+ if n > 1 then
+ local v = namespaces
+ if n > 2 then
+ for i=1,n-1 do
+ local l = list[i]
+ local vl = v[l]
+ if vl == nil then
+ return mpboolean(false)
+ end
+ v = vl
+ end
+ else
+ v = v[list[1]]
+ end
+ if type(v) == "string" then
+ -- no caching .. slow anyway
+ local o = list[n]
+ if v == o then
+ return mpboolean(true)
+ end
+ for vv in gmatch(v,"[^%s,]+") do
+ for oo in gmatch(o,"[^%s,]+") do
+ if vv == oo then
+ return mpboolean(true)
+ end
+ end
+ end
+ end
+ end
+ return mpboolean(false)
+end
+
local function getparameterdefault()
local list, n = collectnames()
local v = namespaces
@@ -620,6 +654,7 @@ metapost.registerscript("getparameters", getparameters)
metapost.registerscript("applyparameters", applyparameters)
metapost.registerscript("presetparameters", presetparameters)
metapost.registerscript("hasparameter", hasparameter)
+metapost.registerscript("hasoption", hasoption)
metapost.registerscript("getparameter", getparameter)
metapost.registerscript("getparameterdefault", getparameterdefault)
metapost.registerscript("getparametercount", getparametercount)
@@ -645,7 +680,7 @@ function metapost.getparameter(list)
end
function metapost.getparameterset(namespace)
- return namespaces[namespace]
+ return namespace and namespaces[namespace] or namespaces
end
-- goodies
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index eb5cc4f08..b652e4d44 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -137,7 +137,7 @@ return {
"passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote",
"startpassingvariable", "stoppassingvariable",
--
- "eofill", "eoclip", "nofill", "fillup", "eofillup",
+ "eofill", "eoclip", "nofill", "fillup", "eofillup", "nodraw",
"area",
--
"addbackground",
diff --git a/tex/context/base/mkiv/pack-bck.mkvi b/tex/context/base/mkiv/pack-bck.mkvi
index a87bc6994..6cbe281d9 100644
--- a/tex/context/base/mkiv/pack-bck.mkvi
+++ b/tex/context/base/mkiv/pack-bck.mkvi
@@ -105,6 +105,11 @@
\strut
\vskip-2\lineheight
\strut
+ % safeguard added
+ \ifdim\dimexpr\pagetotal+2\lineheight\relax>\pagegoal
+ \page
+ \fi
+ % till here
\egroup
\dimen2\leftskip % new **
\forgetall
diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv
index e85891680..8732c7e6b 100644
--- a/tex/context/base/mkiv/pack-rul.mkiv
+++ b/tex/context/base/mkiv/pack-rul.mkiv
@@ -255,7 +255,7 @@
\fi}
\def\pack_framed_filled_box_round
- {\frule
+ {\raise\d_framed_target_dp\hpack{\frule
type fill
width \d_framed_target_wd
height \d_framed_target_ht
@@ -263,7 +263,7 @@
line \d_framed_linewidth
radius \p_framed_backgroundradius\space
corner {\p_framed_backgroundcorner}
- \relax}
+ \relax}}
\def\pack_framed_stroked_box
{\edef\p_framed_framecorner{\framedparameter\c!framecorner}%
@@ -284,14 +284,14 @@
% \pack_framed_stroked_box_normal % later
\def\pack_framed_stroked_box_round
- {\frule
+ {\raise\d_framed_target_dp\hpack{\frule
width \d_framed_target_wd
height \d_framed_target_ht
depth \d_framed_target_dp
line \d_framed_linewidth
radius \p_framed_frameradius\space
- corner {\p_framed_backgroundcorner}
- \relax}
+ corner {\p_framed_framecorner}
+ \relax}}
% a lot of weird corners
%
diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl
index d2818b4df..4304430d1 100644
--- a/tex/context/base/mkiv/pack-rul.mkxl
+++ b/tex/context/base/mkiv/pack-rul.mkxl
@@ -256,7 +256,7 @@
\fi}
\def\pack_framed_filled_box_round
- {\frule
+ {\raise\d_framed_target_dp\hpack{\frule
type fill
width \d_framed_target_wd
height \d_framed_target_ht
@@ -264,7 +264,7 @@
line \d_framed_linewidth
radius \p_framed_backgroundradius\space
corner {\p_framed_backgroundcorner}
- \relax}
+ \relax}}
\def\pack_framed_stroked_box
{\edef\p_framed_framecorner{\framedparameter\c!framecorner}%
@@ -285,14 +285,14 @@
% \pack_framed_stroked_box_normal % later
\def\pack_framed_stroked_box_round
- {\frule
+ {\raise\d_framed_target_dp\hpack{\frule
width \d_framed_target_wd
height \d_framed_target_ht
depth \d_framed_target_dp
line \d_framed_linewidth
radius \p_framed_frameradius\space
- corner {\p_framed_backgroundcorner}
- \relax}
+ corner {\p_framed_framecorner}
+ \relax}}
% a lot of weird corners
%
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 13031a23c..274a5a155 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 640a7f161..f2e008447 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index eaea7e4cc..63e1cebab 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -710,7 +710,7 @@
\tracinggroups \plusone
\tracingifs \plusone
\tracingscantokens\plusone
- \tracingnesting \plusone
+ \tracingnesting \plustwo
\tracingassigns \plustwo}
\normalprotected\def\loggingall
diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl
index 11f82dd34..22b3ba039 100644
--- a/tex/context/base/mkiv/syst-ini.mkxl
+++ b/tex/context/base/mkiv/syst-ini.mkxl
@@ -682,7 +682,7 @@
\tracinggroups \plusone
\tracingifs \plusone
\tracingscantokens\plusone
- \tracingnesting \plusone
+ \tracingnesting \plustwo
\tracingassigns \plustwo}
\normalprotected\def\loggingall
diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua
index fd7b5016a..b35e53f2e 100644
--- a/tex/context/base/mkiv/trac-log.lua
+++ b/tex/context/base/mkiv/trac-log.lua
@@ -126,6 +126,9 @@ if runningtex and texio then
if v == "--ansi" or v == "--c:ansi" then
variant = "ansi"
break
+ elseif v == "--ansilog" or v == "--c:ansilog" then
+ variant = "ansilog"
+ break
end
end
end
@@ -246,6 +249,11 @@ if runningtex and texio then
}
}
+ variants.ansilog = {
+ formats = variants.ansi.formats,
+ targets = variants.default.targets,
+ }
+
logs.flush = io.flush
writer = function(...)
@@ -394,7 +402,7 @@ if runningtex and texio then
subdirect_nop = f.subdirect_nop
status_yes = f.status_yes
status_nop = f.status_nop
- if variant == "ansi" then
+ if variant == "ansi" or variant == "ansilog" then
useluawrites() -- because tex escapes ^^, not needed in lmtx
end
settarget(whereto)
diff --git a/tex/context/base/mkiv/trac-set.lua b/tex/context/base/mkiv/trac-set.lua
index 6311d6382..4a22282a8 100644
--- a/tex/context/base/mkiv/trac-set.lua
+++ b/tex/context/base/mkiv/trac-set.lua
@@ -278,7 +278,7 @@ function setters.new(name) -- we could use foo:bar syntax (but not used that oft
disable = function(...) disable (setter,...) end,
reset = function(...) reset (setter,...) end, -- can be dangerous
register = function(...) register(setter,...) end,
- list = function(...) list (setter,...) end,
+ list = function(...) return list (setter,...) end,
show = function(...) show (setter,...) end,
default = function(...) return default (setter,...) end,
value = function(...) return value (setter,...) end,
diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua
index f970d8ace..410292ca8 100644
--- a/tex/context/base/mkiv/util-tab.lua
+++ b/tex/context/base/mkiv/util-tab.lua
@@ -341,7 +341,21 @@ function table.fastserialize(t,prefix) -- todo, move local function out
m = m + 1
r[m] = "{"
if n > 0 then
- for i=0,n do
+ local v = t[0]
+ if v then
+ local tv = type(v)
+ if tv == "string" then
+ m = m + 1 r[m] = f_indexed_string(0,v)
+ elseif tv == "number" then
+ m = m + 1 r[m] = f_indexed_number(0,v)
+ elseif tv == "table" then
+ m = m + 1 r[m] = f_indexed_table(0)
+ fastserialize(v)
+ elseif tv == "boolean" then
+ m = m + 1 r[m] = f_indexed_boolean(0,v)
+ end
+ end
+ for i=1,n do
local v = t[i]
local tv = type(v)
if tv == "string" then
@@ -355,6 +369,8 @@ function table.fastserialize(t,prefix) -- todo, move local function out
end
end
end
+ -- hm, can't we avoid this ... lua should have a way to check if there
+ -- is a hash part
for k, v in next, t do
local tk = type(k)
if tk == "number" then
@@ -411,7 +427,7 @@ function table.deserialize(str)
return code
end
--- inspect(table.fastserialize { a = 1, b = { 4, { 5, 6 } }, c = { d = 7, e = 'f"g\nh' } })
+-- inspect(table.fastserialize { a = 1, b = { [0]=4, { 5, 6 } }, c = { d = 7, e = 'f"g\nh' } })
function table.load(filename,loader)
if filename then
diff --git a/tex/context/base/mkiv/util-tpl.lua b/tex/context/base/mkiv/util-tpl.lua
index 57d7df3a9..318f2efc3 100644
--- a/tex/context/base/mkiv/util-tpl.lua
+++ b/tex/context/base/mkiv/util-tpl.lua
@@ -20,6 +20,8 @@ local tostring, next = tostring, next
local format, sub, byte = string.format, string.sub, string.byte
local P, C, R, Cs, Cc, Carg, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.R, lpeg.Cs, lpeg.Cc, lpeg.Carg, lpeg.match, lpeg.patterns
+local formatters = string.formatters
+
-- todo: make installable template.new
local replacer
@@ -133,34 +135,42 @@ local function replaceoptional(l,m,r,t,how,recurse)
return v and v ~= "" and lpegmatch(replacer,r,1,t,how or "lua",recurse or false) or ""
end
-local single = P("%") -- test %test% test : resolves test
-local double = P("%%") -- test 10%% test : %% becomes %
-local lquoted = P("%[") -- test '%[test]%' test : resolves to test with escaped "'s
-local rquoted = P("]%") --
-local lquotedq = P("%(") -- test %(test)% test : resolves to 'test' with escaped "'s
-local rquotedq = P(")%") --
-
-local escape = double / '%%'
-local nosingle = single / ''
-local nodouble = double / ''
-local nolquoted = lquoted / ''
-local norquoted = rquoted / ''
-local nolquotedq = lquotedq / ''
-local norquotedq = rquotedq / ''
-
-local noloptional = P("%?") / ''
-local noroptional = P("?%") / ''
-local nomoptional = P(":") / ''
-
-
-local args = Carg(1) * Carg(2) * Carg(3)
-local key = nosingle * ((C((1-nosingle )^1) * args) / replacekey ) * nosingle
-local quoted = nolquotedq * ((C((1-norquotedq )^1) * args) / replacekeyquoted ) * norquotedq
-local unquoted = nolquoted * ((C((1-norquoted )^1) * args) / replacekeyunquoted) * norquoted
-local optional = noloptional * ((C((1-nomoptional)^1) * nomoptional * C((1-noroptional)^1) * args) / replaceoptional) * noroptional
-local any = P(1)
+local function replaceformatted(l,m,r,t,how,recurse)
+ local v = t[r]
+ return v and formatters[l](v)
+end
- replacer = Cs((unquoted + quoted + escape + optional + key + any)^0)
+local single = P("%") -- test %test% test : resolves test
+local double = P("%%") -- test 10%% test : %% becomes %
+local lquoted = P("%[") -- test '%[test]%' test : resolves to test with escaped "'s
+local rquoted = P("]%") --
+local lquotedq = P("%(") -- test %(test)% test : resolves to 'test' with escaped "'s
+local rquotedq = P(")%") --
+
+local escape = double / '%%'
+local nosingle = single / ''
+local nodouble = double / ''
+local nolquoted = lquoted / ''
+local norquoted = rquoted / ''
+local nolquotedq = lquotedq / ''
+local norquotedq = rquotedq / ''
+
+local nolformatted = P(":") / "%%"
+local norformatted = P(":") / ""
+
+local noloptional = P("%?") / ''
+local noroptional = P("?%") / ''
+local nomoptional = P(":") / ''
+
+local args = Carg(1) * Carg(2) * Carg(3)
+local key = nosingle * ((C((1-nosingle)^1) * args) / replacekey) * nosingle
+local quoted = nolquotedq * ((C((1-norquotedq)^1) * args) / replacekeyquoted) * norquotedq
+local unquoted = nolquoted * ((C((1-norquoted)^1) * args) / replacekeyunquoted) * norquoted
+local optional = noloptional * ((C((1-nomoptional)^1) * nomoptional * C((1-noroptional)^1) * args) / replaceoptional) * noroptional
+local formatted = nosingle * ((Cs(nolformatted * (1-norformatted )^1) * norformatted * C((1-nosingle)^1) * args) / replaceformatted) * nosingle
+local any = P(1)
+
+ replacer = Cs((unquoted + quoted + formatted + escape + optional + key + any)^0)
local function replace(str,mapping,how,recurse)
if mapping and str then
@@ -179,6 +189,8 @@ end
-- print(replace([[test %[x]% test]],{ x = [[a "x"  a]]}))
-- print(replace([[test %(x)% test]],{ x = [[a "x"  a]]}))
-- print(replace([[convert %?x: -x "%x%" ?% %?y: -y "%y%" ?%]],{ x = "yes" }))
+-- print(replace("test %:0.3N:x% test",{ x = 123.45 }))
+-- print(replace("test %:0.3N:x% test",{ x = 12345 }))
templates.replace = replace
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index b4bc1a04e..a695ee7ff 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 4bd125888..9e7b9123e 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex
index f10f42a16..c124a3a94 100644
--- a/tex/context/modules/common/s-abbreviations-logos.tex
+++ b/tex/context/modules/common/s-abbreviations-logos.tex
@@ -182,6 +182,7 @@
\logo [MATHML] {MathML}
\logo [MB] {MB}
\logo [METAFONT] {\MetaFont}
+\logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun}
\logo [METAFUN] {\MetaFun}
\logo [METAPOST] {\MetaPost}
\logo [METATEX] {Meta\TeXsuffix}
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index 4fb7ea029..5d192a5f6 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -301,6 +301,14 @@ visualizers.register("bnf", visualizer)
visualizers.register("sql", visualizer)
visualizers.register("json", visualizer)
+visualizers.register("sas", visualizer)
+
+function scite.register(name)
+ visualizers.register(name,visualizer)
+end
+
+moduledata.scite = scite
+
\stopluacode
\definetyping[TEX] [option=cld]
@@ -317,6 +325,8 @@ visualizers.register("json", visualizer)
\definetyping[JSON][option=json] % To be tested in an upcoming manual.
\definetyping[NONE][option=none]
+\definetyping[SAS] [option=sas]
+
% This is a preliminary interface.
\unprotect
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 26baa531e..e3a709a92 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 : 08/24/19 22:42:50
+-- merge date : 09/09/19 13:44:26
do -- begin closure to overcome local limits and interference
@@ -32208,38 +32208,24 @@ local function initialize(tfmdata,kind,value)
local s=#colorlist
local goback=w~=0 and leftcommand[w] or nil
local t={
- start,
- not u and actualb or { "pdf","page",(getactualtext(tounicode(u))) }
+ not u and actualb or { "pdf","page",(getactualtext(tounicode(u))) },
+ push,
}
local n=2
local l=nil
- local f=false
for i=1,s do
local entry=colorlist[i]
local v=colorvalues[entry.class] or default
if v and l~=v then
- if f then
- n=n+1 t[n]=pop
- end
- n=n+1 t[n]=push
- f=true
n=n+1 t[n]=v
l=v
- else
- if f then
- n=n+1 t[n]=pop
- end
- f=false
- l=nil
end
n=n+1 t[n]=charcommand[entry.slot]
if s>1 and i<s and goback then
n=n+1 t[n]=goback
end
end
- if f then
- n=n+1 t[n]=pop
- end
+ n=n+1 t[n]=pop
n=n+1 t[n]=actuale
character.commands=t
end