summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-07 02:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-07 02:15:04 +0100
commit9f639e93850762b4169cbe7db9cfa7a8edb5a856 (patch)
tree3bc9d1d6891c00193bd7230d441a9daf5418a92e
parentbc608dc7157ffbb10f2901a8eca115d03641f7a2 (diff)
downloadcontext-9f639e93850762b4169cbe7db9cfa7a8edb5a856.tar.gz
2015-01-07 01:34:00
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-metafun.lua2
-rw-r--r--context/data/scite/context/scite-context-data-metafun.properties2
-rw-r--r--metapost/context/base/mp-tool.mpiv10
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4383 -> 4389 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/mlib-lua.lua162
-rw-r--r--tex/context/base/mult-fun.lua1
-rw-r--r--tex/context/base/s-youless.mkiv11
-rw-r--r--tex/context/base/status-files.pdfbin24943 -> 24912 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin356820 -> 356993 bytes
-rw-r--r--tex/context/base/strc-itm.mkvi4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 142 insertions, 56 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 0ac74198a..a22aa0832 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"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshading", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "shadedinto", "withshade", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "set_linear_vector", "set_circular_vector", "linear_shade", "circular_shade", "define_linear_shade", "define_circular_shade", "define_circular_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip" },
+ ["commands"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshading", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "shadedinto", "withshade", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "set_linear_vector", "set_circular_vector", "linear_shade", "circular_shade", "define_linear_shade", "define_circular_shade", "define_circular_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "area" },
["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "metapostversion", "maxdimensions" },
} \ No newline at end of file
diff --git a/context/data/scite/context/scite-context-data-metafun.properties b/context/data/scite/context/scite-context-data-metafun.properties
index 3cebb1017..5941c8afc 100644
--- a/context/data/scite/context/scite-context-data-metafun.properties
+++ b/context/data/scite/context/scite-context-data-metafun.properties
@@ -47,7 +47,7 @@ drawpointlabels drawlineoptions drawpointoptions drawcontroloptions drawlabelopt
draworiginoptions drawboundoptions drawpathoptions resetdrawoptions undashed \
decorated redecorated undecorated passvariable passarrayvariable \
tostring format formatted startpassingvariable stoppassingvariable \
-eofill eoclip
+eofill eoclip area
keywordclass.metafun.internals=\
nocolormodel greycolormodel graycolormodel rgbcolormodel \
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 17bb0e9c2..f1d9ecaf6 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -2289,6 +2289,15 @@ primarydef p snapped s =
p
enddef ;
+%D Newer:
+
+vardef area expr p =
+ % we could calculate the boundingbox once
+ (xpart llcorner boundingbox p,0) -- p --
+ (xpart lrcorner boundingbox p,0) -- cycle
+enddef ;
+
+
% vardef somecolor = (1,1,0,0) enddef ;
% fill OverlayBox withcolor (rcomponent somecolor,gcomponent somecolor,bcomponent somecolor) ;
@@ -2335,7 +2344,6 @@ vardef undecorated (text imagedata) text decoration =
currentpicture
enddef ;
-
if metapostversion < 1.770 :
vardef decorated (text imagedata) text decoration =
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 38ca75c44..3fe1d0a44 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2015.01.05 22:24}
+\newcontextversion{2015.01.07 01:32}
%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/context-version.pdf b/tex/context/base/context-version.pdf
index ac84004b0..c50e09b5b 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index e32ab9575..72b90c8c8 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.01.05 22:24}
+\edef\contextversion{2015.01.07 01:32}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mlib-lua.lua b/tex/context/base/mlib-lua.lua
index fae915c98..d4af70a58 100644
--- a/tex/context/base/mlib-lua.lua
+++ b/tex/context/base/mlib-lua.lua
@@ -11,10 +11,13 @@ if not modules then modules = { } end modules ['mlib-pdf'] = {
-- maybe we need mplib.model, but how with instances
local type, tostring, select, loadstring = type, tostring, select, loadstring
-local formatters = string.formatters
local find, gsub = string.find, string.gsub
-local concat = table.concat
-local lpegmatch = lpeg.match
+
+local formatters = string.formatters
+local concat = table.concat
+local lpegmatch = lpeg.match
+
+local P, S, Ct = lpeg.P, lpeg.S, lpeg.Ct
local report_luarun = logs.reporter("metapost","lua")
@@ -55,6 +58,8 @@ function mp._f_()
end
end
+local f_code = formatters["%s return mp._f_()"]
+
local f_numeric = formatters["%.16f"]
local f_pair = formatters["(%.16f,%.16f)"]
local f_triplet = formatters["(%.16f,%.16f,%.16f)"]
@@ -70,13 +75,20 @@ function mp.print(...)
buffer[n] = f_numeric(value)
elseif t == "string" then
buffer[n] = value
- else
+ elseif t == "table" then
+ buffer[n] = "(" .. concat(value,",") .. ")"
+ else -- boolean or whatever
buffer[n] = tostring(value)
end
end
end
end
+function mp.numeric(n)
+ n = n + 1
+ buffer[n] = n and f_numeric(n) or "0"
+end
+
function mp.pair(x,y)
n = n + 1
if type(x) == "table" then
@@ -104,6 +116,55 @@ function mp.quadruple(w,x,y,z)
end
end
+function mp.path(t,connector,cycle)
+ if type(t) == "table" then
+ local tn = #t
+ if tn > 0 then
+ if connector == true then
+ connector = "--"
+ cycle = true
+ elseif not connector then
+ connector = "--"
+ end
+ local ti = t[1]
+ n = n + 1 ; buffer[n] = f_pair(ti[1],ti[2])
+ for i=2,tn do
+ local ti = t[i]
+ n = n + 1 ; buffer[n] = connector
+ n = n + 1 ; buffer[n] = f_pair(ti[1],ti[2])
+ end
+ if cycle then
+ n = n + 1 ; buffer[n] = connector
+ n = n + 1 ; buffer[n] = "cycle"
+ end
+ end
+ end
+end
+
+function mp.size(t)
+ n = n + 1
+ buffer[n] = type(t) == "table" and f_numeric(#t) or "0"
+end
+
+-- experiment: names can change
+
+local datasets = { }
+mp.datasets = datasets
+
+function datasets.load(tag,filename)
+ if not filename then
+ tag, filename = file.basename(tag), tag
+ end
+ local data = mp.dataset(io.loaddata(filename) or "")
+ datasets[tag] = {
+ Data = data,
+ Line = function(n) mp.path(data[n or 1]) end,
+ Size = function() mp.size(data) end,
+ }
+end
+
+--
+
local replacer = lpeg.replacer("@","%%")
function mp.format(fmt,...)
@@ -126,7 +187,53 @@ function mp.quoted(fmt,s,...)
end
end
-local f_code = formatters["%s return mp._f_()"]
+function mp.n(t)
+ return type(t) == "table" and #t or 0
+end
+
+local whitespace = lpeg.patterns.whitespace
+local newline = lpeg.patterns.newline
+local setsep = newline^2
+local comment = (S("#%") + P("--")) * (1-newline)^0 * (whitespace - setsep)^0
+local value = (1-whitespace)^1 / tonumber
+local entry = Ct( value * whitespace * value)
+local set = Ct((entry * (whitespace-setsep)^0 * comment^0)^1)
+local series = Ct((set * whitespace^0)^1)
+
+local pattern = whitespace^0 * series
+
+function mp.dataset(str)
+ return lpegmatch(pattern,str)
+end
+
+-- \startluacode
+-- local str = [[
+-- 10 20 20 20
+-- 30 40 40 60
+-- 50 10
+--
+-- 10 10 20 30
+-- 30 50 40 50
+-- 50 20 -- the last one
+--
+-- 10 20 % comment
+-- 20 10
+-- 30 40 # comment
+-- 40 20
+-- 50 10
+-- ]]
+--
+-- MP.myset = mp.dataset(str)
+--
+-- inspect(MP.myset)
+-- \stopluacode
+--
+-- \startMPpage
+-- color c[] ; c[1] := red ; c[2] := green ; c[3] := blue ;
+-- for i=1 upto lua("mp.print(mp.n(MP.myset))") :
+-- draw lua("mp.path(MP.myset[" & decimal i & "])") withcolor c[i] ;
+-- endfor ;
+-- \stopMPpage
-- function metapost.runscript(code)
-- local f = loadstring(f_code(code))
@@ -148,40 +255,6 @@ local f_code = formatters["%s return mp._f_()"]
local cache, n = { }, 0 -- todo: when > n then reset cache or make weak
--- function metapost.runscript(code)
--- if trace_enabled and trace_luarun then
--- report_luarun("code: %s",code)
--- end
--- local f
--- if n > 100 then
--- cache = nil -- forget about caching
--- f = loadstring(f_code(code))
--- else
--- f = cache[code]
--- if not f then
--- f = loadstring(f_code(code))
--- if f then
--- n = n + 1
--- cache[code] = f
--- end
--- end
--- end
--- if f then
--- local result = f()
--- if result then
--- local t = type(result)
--- if t == "number" then
--- return f_numeric(result)
--- elseif t == "string" then
--- return result
--- else
--- return tostring(result)
--- end
--- end
--- end
--- return ""
--- end
-
function metapost.runscript(code)
local trace = trace_enabled and trace_luarun
if trace then
@@ -255,10 +328,13 @@ local get_number = get_numeric
local currentmpx = nil
-mp.numeric = function(s) return get_numeric(currentmpx,s) end
-mp.string = function(s) return get_string (currentmpx,s) end
-mp.boolean = function(s) return get_boolean(currentmpx,s) end
-mp.number = mp.numeric
+local get = { }
+mp.get = get
+
+get.numeric = function(s) return get_numeric(currentmpx,s) end
+get.string = function(s) return get_string (currentmpx,s) end
+get.boolean = function(s) return get_boolean(currentmpx,s) end
+get.number = mp.numeric
function metapost.initializescriptrunner(mpx,trialrun)
currentmpx = mpx
diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua
index 3d712320a..b5d061954 100644
--- a/tex/context/base/mult-fun.lua
+++ b/tex/context/base/mult-fun.lua
@@ -120,5 +120,6 @@ return {
"startpassingvariable", "stoppassingvariable",
--
"eofill", "eoclip",
+ "area"
},
}
diff --git a/tex/context/base/s-youless.mkiv b/tex/context/base/s-youless.mkiv
index 247eb5f64..e15973b9c 100644
--- a/tex/context/base/s-youless.mkiv
+++ b/tex/context/base/s-youless.mkiv
@@ -59,9 +59,10 @@
for y=year,year do
- local year = years[y]
- local scale = 20
- local mark = 3
+ local year = years[y]
+ local scale = 20
+ local mark = 3
+ local maxwatt = specification.maxwatt or year.maxwatt
for m=1,12 do
local month = year.months[m]
@@ -69,7 +70,7 @@
context.startMPpage { offset = "10pt" }
context("linecap := butt; pickup pencircle scaled .5")
- for i=0,(math.div(year.maxwatt,1000)+1)*1000,100 do
+ for i=0,(math.div(maxwatt,1000)+1)*1000,100 do
context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",0,i/scale,31 * 24,i/scale)
end
@@ -123,7 +124,7 @@
context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset,0,xoffset,-10)
end
- local max = (math.div(year.maxwatt,1000)+1)
+ local max = (math.div(maxwatt,1000)+1)
for i=0,max*1000,1000 do
context([[draw textext.lft("%s") shifted (%s,%s) ; ]],i,-10,i/scale)
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index af02b31e0..e40fc5b00 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index e46c23463..5ffa09b28 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi
index 2edcedfff..dccf1c85c 100644
--- a/tex/context/base/strc-itm.mkvi
+++ b/tex/context/base/strc-itm.mkvi
@@ -809,7 +809,7 @@
\ifinsidecolumns\else\ifcase\c_strc_itemgroups_column_depth
\global\c_strc_itemgroups_column_depth\c_strc_itemgroups_nesting % global ?
\strc_itemgroups_before_command
- \strc_itemgroups_tag_start_group
+ %\strc_itemgroups_tag_start_group
\strc_itemgroups_start_columns
\fi\fi
\fi
@@ -962,7 +962,7 @@
{\setfalse\c_strc_itemgroups_first
% \begingroup % (3)
\ifcase\c_strc_itemgroups_nesting
- % 0
+ % 0
\or
\strc_itemgroups_start_item_first_one % 1
\else
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f95494d6f..3d6b849b6 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 : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 01/05/15 22:24:31
+-- merge date : 01/07/15 01:32:37
do -- begin closure to overcome local limits and interference