summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2016-12-21 20:09:16 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-12-21 20:09:16 +0100
commit72e032447232f3f89056f352d3f6b8e2abc499cb (patch)
treedcce6719b22076c68a286ac202ea4245999c0843
parentae375264381ae74f70415b2351bdbf209248e1af (diff)
downloadcontext-72e032447232f3f89056f352d3f6b8e2abc499cb.tar.gz
2016-12-21 18:57:00
-rw-r--r--doc/context/documents/general/qrcs/setup-cs.pdfbin798848 -> 798801 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-de.pdfbin800258 -> 800146 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-en.pdfbin803714 -> 803602 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-fr.pdfbin797145 -> 797039 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-it.pdfbin800067 -> 799958 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-nl.pdfbin795212 -> 795134 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-ro.pdfbin795091 -> 794991 bytes
-rw-r--r--metapost/context/base/mpiv/mp-chem.mpiv2
-rw-r--r--metapost/context/base/mpiv/mp-grap.mpiv6
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv16
-rw-r--r--metapost/context/base/mpiv/mp-mlib.mpiv2
-rw-r--r--metapost/context/base/mpiv/mp-node.mpiv16
-rw-r--r--metapost/context/base/mpiv/mp-tool.mpiv39
-rw-r--r--scripts/context/lua/mtxrun.lua61
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua61
-rw-r--r--scripts/context/stubs/unix/mtxrun61
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua61
-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/mkii/mult-cs.mkii1
-rw-r--r--tex/context/base/mkii/mult-de.mkii1
-rw-r--r--tex/context/base/mkii/mult-en.mkii1
-rw-r--r--tex/context/base/mkii/mult-fr.mkii1
-rw-r--r--tex/context/base/mkii/mult-it.mkii1
-rw-r--r--tex/context/base/mkii/mult-nl.mkii1
-rw-r--r--tex/context/base/mkii/mult-pe.mkii1
-rw-r--r--tex/context/base/mkii/mult-ro.mkii1
-rw-r--r--tex/context/base/mkii/pack-box.mkii2
-rw-r--r--tex/context/base/mkiv/back-pdf.mkiv3
-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/font-nod.lua18
-rw-r--r--tex/context/base/mkiv/grph-inc.lua14
-rw-r--r--tex/context/base/mkiv/l-number.lua23
-rw-r--r--tex/context/base/mkiv/l-table.lua35
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua76
-rw-r--r--tex/context/base/mkiv/mtx-context-domotica.tex48
-rw-r--r--tex/context/base/mkiv/mult-def.lua4
-rw-r--r--tex/context/base/mkiv/pack-box.mkiv152
-rw-r--r--tex/context/base/mkiv/pack-lyr.mkiv2
-rw-r--r--tex/context/base/mkiv/page-sid.mkiv23
-rw-r--r--tex/context/base/mkiv/publ-dat.lua8
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25603 -> 25587 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368575 -> 369201 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi1
-rw-r--r--tex/context/base/mkiv/strc-ref.lua4
-rw-r--r--tex/context/base/mkiv/supp-box.lua11
-rw-r--r--tex/context/base/mkiv/supp-box.mkiv21
-rw-r--r--tex/context/interface/mkii/keys-cs.xml1
-rw-r--r--tex/context/interface/mkii/keys-de.xml1
-rw-r--r--tex/context/interface/mkii/keys-en.xml1
-rw-r--r--tex/context/interface/mkii/keys-fr.xml1
-rw-r--r--tex/context/interface/mkii/keys-it.xml1
-rw-r--r--tex/context/interface/mkii/keys-nl.xml1
-rw-r--r--tex/context/interface/mkii/keys-pe.xml1
-rw-r--r--tex/context/interface/mkii/keys-ro.xml1
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin803714 -> 803602 bytes
-rw-r--r--tex/context/interface/mkiv/i-floats.xml3
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60767 -> 60766 bytes
-rw-r--r--tex/context/modules/mkiv/s-domotica-settings.lua67
-rw-r--r--tex/context/modules/mkiv/s-domotica-settings.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua34
62 files changed, 770 insertions, 130 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf
index b3fdde322..70173bef3 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 74db2a056..c32ef8046 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 e3dd2d9ed..0f76a4ac2 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 cd89a82b6..380ede7cc 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 f8167100a..7b5a254ae 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-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf
index 47f745afe..0951d8e92 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 ae2fdcc67..0439429da 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-chem.mpiv b/metapost/context/base/mpiv/mp-chem.mpiv
index 72ab8037d..4ed9eaa8f 100644
--- a/metapost/context/base/mpiv/mp-chem.mpiv
+++ b/metapost/context/base/mpiv/mp-chem.mpiv
@@ -1381,7 +1381,7 @@ vardef chem_bw@# (suffix $) (expr f, t, r, c) = % BW
enddef ;
vardef chem_bd@# (suffix $) (expr f, t, r, c) = % BD
- if chem_star[$] : chem_rbd#@($,f,t,r,c) ; fi
+ if chem_star[$] : chem_rbd@#($,f,t,r,c) ; fi
enddef ;
vardef chem_rbd@# (suffix $) (expr f, t, r, c) = % RBD
diff --git a/metapost/context/base/mpiv/mp-grap.mpiv b/metapost/context/base/mpiv/mp-grap.mpiv
index 51b2e5a3d..5f102fe1c 100644
--- a/metapost/context/base/mpiv/mp-grap.mpiv
+++ b/metapost/context/base/mpiv/mp-grap.mpiv
@@ -473,9 +473,9 @@ enddef ;
% String manipulation routines for MetaPost
% It is harmless to input this file more than once.
-vardef isdigit primary d =
- ("0"<=d)and(d<="9")
-enddef ;
+% vardef isdigit primary d =
+% ("0"<=d)and(d<="9")
+% enddef ;
% Number of initial characters of string s where `c <character>' is true
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index 8c30da279..253438dee 100644
--- a/metapost/context/base/mpiv/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -105,3 +105,19 @@ enddef ;
def message expr t =
if t <> "" : lua.mp.report(t) fi ;
enddef ;
+
+% a few helpers
+
+% A few helpers:
+
+vardef isarray suffix a =
+ lua.mp.isarray(str a)
+enddef ;
+
+vardef prefix suffix a =
+ lua.mp.prefix(str a)
+enddef ;
+
+vardef dimensions suffix a =
+ lua.mp.dimensions(str a)
+enddef ;
diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv
index 0c7dddf4c..3ad7d0efb 100644
--- a/metapost/context/base/mpiv/mp-mlib.mpiv
+++ b/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -1608,7 +1608,7 @@ def nofill text t = fill t withpostscript "collect" enddef ;
% so we can do: withcolor "red"
-def resolvedcolor expr s =
+vardef resolvedcolor primary s =
% lua.mp.namedcolor(s) % conflicts with macro namedcolor
% lua.mp.NamedColor(s) % okay but, can also be
% lua.mp("NamedColor",s) % which gives expansion mess
diff --git a/metapost/context/base/mpiv/mp-node.mpiv b/metapost/context/base/mpiv/mp-node.mpiv
index c7b0bcabe..fdd308ad1 100644
--- a/metapost/context/base/mpiv/mp-node.mpiv
+++ b/metapost/context/base/mpiv/mp-node.mpiv
@@ -21,17 +21,25 @@ boolean context_node ; context_node := true ;
% returns a pair suffix if the path is unknown
vardef makenode@#(suffix p)(text t) =
- save i ; numeric i ;
+ save i, b ; numeric i ; string b ;
for a = t :
if unknown i : % first argument is the index
i = a ;
- if not picture p.pic[i] : picture p.pic[] ; fi
- if not pair p.pos[i] : pair p.pos[] ; fi
+ if isarray p :
%
% note that one needs to declare "path p[] ; picture p[]pic[] ;"
% before calling node() if one is to use a pseudo-array for p
% because "picture p1.pic[] ;" is not a valid syntax!
%
+ % The following works, but is a bit awkward...
+ %
+ b := prefix p ;
+ if not picture p.pic[i] : scantokens("picture " & b & "[]pic[] ;") ; fi
+ if not pair p.pos[i] : scantokens("pair " & b & "[]pos[] ;") ; fi
+ else :
+ if not picture p.pic[i] : picture p.pic[] ; fi
+ if not pair p.pos[i] : pair p.pos[] ; fi
+ fi
else :
if known p.pic[i] :
addto p.pic[i] also
@@ -140,7 +148,7 @@ vardef nodeboundingpoint@#(suffix p)(expr i) =
fi
enddef ;
-% returns pair: scaled laboff direction
+% returns pair: scaled laboff direction
vardef relative@#(expr s) =
(mfun_laboff@# scaled s)
diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv
index 809384ef7..c3775ad92 100644
--- a/metapost/context/base/mpiv/mp-tool.mpiv
+++ b/metapost/context/base/mpiv/mp-tool.mpiv
@@ -871,7 +871,7 @@ secondarydef p intersection_point q =
begingroup
save x_, y_ ;
(x_,y_) = p intersectiontimes q ;
- if x_ < 0 :
+ if x_< 0 :
intersection_found := false ;
center p % origin
else :
@@ -3243,8 +3243,9 @@ enddef ;
%D These new helpers are by Alan and are used in for instance the mp-node
%D module.
-newinternal crossingoption ; crossingoption := 0 ;
-newinternal crossingscale ; crossingscale := 20 ;
+newinternal crossingdebug ; crossingdebug := 0 ;
+newinternal crossingscale ; crossingscale := 10 ;
+newinternal crossingnumbermax ; crossingnumbermax := 1000 ;
% primary, secondary or tertiary? always hard to decide but primary makes sense
@@ -3262,20 +3263,20 @@ primarydef p crossingunder q =
fi
endfor
elseif path p :
- save n, m, t, a, b, c, r, bcuttings, hold ;
- numeric n, m, t[] ;
+ save n, t, a, b, c, r, bcuttings, hold ;
+ numeric n, t[], hold ;
path a, b, c, r, bcuttings, hold[] ;
c := makepath(currentpen scaled crossingscale) ;
r := if picture q : boundingbox fi q ;
- t[0] := n := m := 0 ;
+ t[0] := n := hold := 0 ;
a := p ;
% The cutbefore/cutafter using c below prevents endless loops!
%forever : % find all intersections
- for i=1 upto 100 : % limit the number, until we can make this robust
+ for i=1 upto crossingnumbermax : % safeguard
clearxy ; z = a intersectiontimes r ;
if x < 0 :
- exitif m < 1 ;
- a := hold[m] ; m := m - 1 ;
+ exitif hold < 1 ;
+ a := hold[hold] ; hold := hold - 1 ;
clearxy ; z = a intersectiontimes r ;
fi
(t[incr n], whatever) = p intersectiontimes point x of a ;
@@ -3295,14 +3296,18 @@ primarydef p crossingunder q =
if length bcuttings > 0 :
clearxy ; z = b intersectiontimes r ;
if x >= 0 :
- hold[incr m] := b ;
+ hold[incr hold] := b ;
fi
fi
fi
fi
- if length cuttings = 0 :
- exitif m < 1 ;
- a := hold[m] ; m := m - 1 ;
+ if length cuttings = 0 : % a single point: nothing cut
+ exitif hold < 1 ;
+ a := hold[hold] ; hold := hold - 1 ;
+ fi
+ if i = crossingnumbermax :
+ message("crossingunder reached maximum " & decimal i &
+ " intersections.");
fi
endfor
@@ -3316,15 +3321,15 @@ primarydef p crossingunder q =
% Now, n>1 !
% t[0] is the first point of the path and t[n] is the last point
% (or the first intersection beyond the length if cyclic)
- m := 0 ;
+ save m ; m := 0 ;
for i=if cycle p: 2 else: 1 fi upto n :
% skip the first segment if cyclic
% as it gets repeated (fully) at the end.
- if crossingoption > 0 :
- if crossingoption = 1 :
+ if crossingdebug > 0 :
+ if crossingdebug = 1 :
addto pic doublepath c shifted point t[i] of p
withpen currentpen withtransparency(1,.5) ;
- elseif crossingoption = 2 :
+ elseif crossingdebug = 2 :
addto pic also
infotext (incr m,crossingscale/5)
shifted point t[i] of p ;
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 1a276ab30..4df664cee 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -1389,7 +1389,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 38086, stripped down to: 22844
+-- original size: 38808, stripped down to: 23386
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -2103,6 +2103,38 @@ local function flattened(t,f,depth)
return f
end
table.flattened=flattened
+local function collapsed(t,f,h)
+ if f==nil then
+ f={}
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1]=v
+ h[v]=true
+ end
+ end
+ return f
+end
+local function collapsedhash(t,h)
+ if h==nil then
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsedhash(v,h)
+ else
+ h[v]=true
+ end
+ end
+ return h
+end
+table.collapsed=collapsed
+table.collapsedhash=collapsedhash
local function unnest(t,f)
if not f then
f={}
@@ -2743,7 +2775,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-number"] = package.loaded["l-number"] or true
--- original size: 5146, stripped down to: 2933
+-- original size: 5588, stripped down to: 3299
if not modules then modules={} end modules ['l-number']={
version=1.001,
@@ -2756,6 +2788,7 @@ local tostring,tonumber=tostring,tonumber
local format,floor,match,rep=string.format,math.floor,string.match,string.rep
local concat,insert=table.concat,table.insert
local lpegmatch=lpeg.match
+local floor=math.floor
number=number or {}
local number=number
if bit32 then
@@ -2880,6 +2913,26 @@ end
function number.bits(n)
return { bits(n,1) }
end
+function number.bytetodecimal(b)
+ local d=floor(b*100/255+0.5)
+ if d>100 then
+ return 100
+ elseif d<-100 then
+ return -100
+ else
+ return d
+ end
+end
+function number.decimaltobyte(d)
+ local b=floor(d*255/100+0.5)
+ if b>255 then
+ return 255
+ elseif b<-255 then
+ return -255
+ else
+ return b
+ end
+end
end -- of closure
@@ -19005,8 +19058,8 @@ end -- of closure
-- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 807382
--- stripped bytes : 293400
+-- original bytes : 808546
+-- stripped bytes : 293656
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 1a276ab30..4df664cee 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -1389,7 +1389,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 38086, stripped down to: 22844
+-- original size: 38808, stripped down to: 23386
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -2103,6 +2103,38 @@ local function flattened(t,f,depth)
return f
end
table.flattened=flattened
+local function collapsed(t,f,h)
+ if f==nil then
+ f={}
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1]=v
+ h[v]=true
+ end
+ end
+ return f
+end
+local function collapsedhash(t,h)
+ if h==nil then
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsedhash(v,h)
+ else
+ h[v]=true
+ end
+ end
+ return h
+end
+table.collapsed=collapsed
+table.collapsedhash=collapsedhash
local function unnest(t,f)
if not f then
f={}
@@ -2743,7 +2775,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-number"] = package.loaded["l-number"] or true
--- original size: 5146, stripped down to: 2933
+-- original size: 5588, stripped down to: 3299
if not modules then modules={} end modules ['l-number']={
version=1.001,
@@ -2756,6 +2788,7 @@ local tostring,tonumber=tostring,tonumber
local format,floor,match,rep=string.format,math.floor,string.match,string.rep
local concat,insert=table.concat,table.insert
local lpegmatch=lpeg.match
+local floor=math.floor
number=number or {}
local number=number
if bit32 then
@@ -2880,6 +2913,26 @@ end
function number.bits(n)
return { bits(n,1) }
end
+function number.bytetodecimal(b)
+ local d=floor(b*100/255+0.5)
+ if d>100 then
+ return 100
+ elseif d<-100 then
+ return -100
+ else
+ return d
+ end
+end
+function number.decimaltobyte(d)
+ local b=floor(d*255/100+0.5)
+ if b>255 then
+ return 255
+ elseif b<-255 then
+ return -255
+ else
+ return b
+ end
+end
end -- of closure
@@ -19005,8 +19058,8 @@ end -- of closure
-- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 807382
--- stripped bytes : 293400
+-- original bytes : 808546
+-- stripped bytes : 293656
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 1a276ab30..4df664cee 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -1389,7 +1389,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 38086, stripped down to: 22844
+-- original size: 38808, stripped down to: 23386
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -2103,6 +2103,38 @@ local function flattened(t,f,depth)
return f
end
table.flattened=flattened
+local function collapsed(t,f,h)
+ if f==nil then
+ f={}
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1]=v
+ h[v]=true
+ end
+ end
+ return f
+end
+local function collapsedhash(t,h)
+ if h==nil then
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsedhash(v,h)
+ else
+ h[v]=true
+ end
+ end
+ return h
+end
+table.collapsed=collapsed
+table.collapsedhash=collapsedhash
local function unnest(t,f)
if not f then
f={}
@@ -2743,7 +2775,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-number"] = package.loaded["l-number"] or true
--- original size: 5146, stripped down to: 2933
+-- original size: 5588, stripped down to: 3299
if not modules then modules={} end modules ['l-number']={
version=1.001,
@@ -2756,6 +2788,7 @@ local tostring,tonumber=tostring,tonumber
local format,floor,match,rep=string.format,math.floor,string.match,string.rep
local concat,insert=table.concat,table.insert
local lpegmatch=lpeg.match
+local floor=math.floor
number=number or {}
local number=number
if bit32 then
@@ -2880,6 +2913,26 @@ end
function number.bits(n)
return { bits(n,1) }
end
+function number.bytetodecimal(b)
+ local d=floor(b*100/255+0.5)
+ if d>100 then
+ return 100
+ elseif d<-100 then
+ return -100
+ else
+ return d
+ end
+end
+function number.decimaltobyte(d)
+ local b=floor(d*255/100+0.5)
+ if b>255 then
+ return 255
+ elseif b<-255 then
+ return -255
+ else
+ return b
+ end
+end
end -- of closure
@@ -19005,8 +19058,8 @@ end -- of closure
-- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 807382
--- stripped bytes : 293400
+-- original bytes : 808546
+-- stripped bytes : 293656
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 1a276ab30..4df664cee 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -1389,7 +1389,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-table"] = package.loaded["l-table"] or true
--- original size: 38086, stripped down to: 22844
+-- original size: 38808, stripped down to: 23386
if not modules then modules={} end modules ['l-table']={
version=1.001,
@@ -2103,6 +2103,38 @@ local function flattened(t,f,depth)
return f
end
table.flattened=flattened
+local function collapsed(t,f,h)
+ if f==nil then
+ f={}
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1]=v
+ h[v]=true
+ end
+ end
+ return f
+end
+local function collapsedhash(t,h)
+ if h==nil then
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsedhash(v,h)
+ else
+ h[v]=true
+ end
+ end
+ return h
+end
+table.collapsed=collapsed
+table.collapsedhash=collapsedhash
local function unnest(t,f)
if not f then
f={}
@@ -2743,7 +2775,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-number"] = package.loaded["l-number"] or true
--- original size: 5146, stripped down to: 2933
+-- original size: 5588, stripped down to: 3299
if not modules then modules={} end modules ['l-number']={
version=1.001,
@@ -2756,6 +2788,7 @@ local tostring,tonumber=tostring,tonumber
local format,floor,match,rep=string.format,math.floor,string.match,string.rep
local concat,insert=table.concat,table.insert
local lpegmatch=lpeg.match
+local floor=math.floor
number=number or {}
local number=number
if bit32 then
@@ -2880,6 +2913,26 @@ end
function number.bits(n)
return { bits(n,1) }
end
+function number.bytetodecimal(b)
+ local d=floor(b*100/255+0.5)
+ if d>100 then
+ return 100
+ elseif d<-100 then
+ return -100
+ else
+ return d
+ end
+end
+function number.decimaltobyte(d)
+ local b=floor(d*255/100+0.5)
+ if b>255 then
+ return 255
+ elseif b<-255 then
+ return -255
+ else
+ return b
+ end
+end
end -- of closure
@@ -19005,8 +19058,8 @@ end -- of closure
-- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 807382
--- stripped bytes : 293400
+-- original bytes : 808546
+-- stripped bytes : 293656
-- end library merge
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index a439529d3..53fe67bc2 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{2016.12.05 14:44}
+\newcontextversion{2016.12.21 18:51}
%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 14b60ec69..d022b1626 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{2016.12.05 14:44}
+\edef\contextversion{2016.12.21 18:51}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii
index a32302fe2..6294d6b29 100644
--- a/tex/context/base/mkii/mult-cs.mkii
+++ b/tex/context/base/mkii/mult-cs.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{vse}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{vzdy}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{dodatky}
diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii
index d3e4f6865..6993afa4d 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{alles}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{immer}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{und}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{anhaenge}
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index 07359c8c8..8865cd201 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{all}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{always}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{appendices}
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 87e6b3a2c..45f382ec5 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{tout}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{toujours}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{annexes}
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index 39bd65cf9..05c72b1f1 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{tutti}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{sempre}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{appendici}
diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii
index 9e2b2cc2a..6e87a52fc 100644
--- a/tex/context/base/mkii/mult-nl.mkii
+++ b/tex/context/base/mkii/mult-nl.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{alles}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{altijd}
+\setinterfacevariable{anchor}{anker}
\setinterfacevariable{and}{en}
\setinterfacevariable{answerarea}{antwoordgebied}
\setinterfacevariable{appendices}{bijlagen}
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index 399155996..61b14382a 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{همه}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{همواره}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{پیوستها}
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index 886bc6c2b..7edb17d65 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -76,6 +76,7 @@
\setinterfacevariable{all}{tot}
\setinterfacevariable{alphabetic}{alphabetic}
\setinterfacevariable{always}{totdeauna}
+\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
\setinterfacevariable{appendices}{apendixuri}
diff --git a/tex/context/base/mkii/pack-box.mkii b/tex/context/base/mkii/pack-box.mkii
index 1752e2b91..928450385 100644
--- a/tex/context/base/mkii/pack-box.mkii
+++ b/tex/context/base/mkii/pack-box.mkii
@@ -27,7 +27,7 @@
% \definelayer[\v!tekst+2][\c!positie=\v!ja]
% we need to set the size, else we get dimensions depending
-% on the content, which in itsel fis ok, but can lead to loops
+% on the content, which in itself is ok, but can lead to loops
% due to rounding errors (happened in demo-obv)
\definelayer[\v!text-2][\c!position=\v!yes,\c!width=\overlaywidth,\c!height=\overlayheight]
diff --git a/tex/context/base/mkiv/back-pdf.mkiv b/tex/context/base/mkiv/back-pdf.mkiv
index 8c4061f2e..84e58d84c 100644
--- a/tex/context/base/mkiv/back-pdf.mkiv
+++ b/tex/context/base/mkiv/back-pdf.mkiv
@@ -296,7 +296,8 @@
% clipping
\unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
- {\PointsToBigPoints{#2}\width
+ {\forcecolorhack
+ \PointsToBigPoints{#2}\width
\PointsToBigPoints{#3}\height
\meta_grab_clip_path{#1}\width\height{%
0 0 m %
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 5751a60da..d31d880f7 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.12.05 14:44}
+\newcontextversion{2016.12.21 18:51}
%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 b338d3c43..86722cf34 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.12.05 14:44}
+\edef\contextversion{2016.12.21 18:51}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua
index 519a5c478..41fc215b1 100644
--- a/tex/context/base/mkiv/font-nod.lua
+++ b/tex/context/base/mkiv/font-nod.lua
@@ -469,16 +469,16 @@ end
--
-local threshold = 65536
+local threshold = 65536 -- 1pt
-local function toutf(list,result,nofresult,stopcriterium)
+local function toutf(list,result,nofresult,stopcriterium,nostrip)
if list then
for n in traverse_nodes(tonut(list)) do
local c, id = isglyph(n)
if c then
local components = getfield(n,"components")
if components then
- result, nofresult = toutf(components,result,nofresult)
+ result, nofresult = toutf(components,result,nofresult,false,true)
elseif c > 0 then
local fc = fontcharacters[getfont(n)]
if fc then
@@ -510,20 +510,20 @@ local function toutf(list,result,nofresult,stopcriterium)
result[nofresult] = f_badcode(c)
end
elseif id == disc_code then
- result, nofresult = toutf(getfield(n,"replace"),result,nofresult) -- needed?
+ result, nofresult = toutf(getfield(n,"replace"),result,nofresult,false,true) -- needed?
elseif id == hlist_code or id == vlist_code then
-- if nofresult > 0 and result[nofresult] ~= " " then
-- nofresult = nofresult + 1
-- result[nofresult] = " "
-- end
- result, nofresult = toutf(getlist(n),result,nofresult)
+ result, nofresult = toutf(getlist(n),result,nofresult,false,true)
elseif id == glue_code then
- if nofresult > 0 and result[nofresult] ~= " " then
+ if nofresult > 0 and result[nofresult] ~= " " and getfield(n,"width") > threshold then
nofresult = nofresult + 1
result[nofresult] = " "
end
- elseif id == kern_code and getfield(n,"kern") > threshold then
- if nofresult > 0 and result[nofresult] ~= " " then
+ elseif id == kern_code then
+ if nofresult > 0 and result[nofresult] ~= " " and getfield(n,"kern") > threshold then
nofresult = nofresult + 1
result[nofresult] = " "
end
@@ -533,7 +533,7 @@ local function toutf(list,result,nofresult,stopcriterium)
end
end
end
- if nofresult > 0 and result[nofresult] == " " then
+ if not nostrip and nofresult > 0 and result[nofresult] == " " then
result[nofresult] = nil
nofresult = nofresult - 1
end
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index d948d9ad8..901d31827 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -1252,9 +1252,17 @@ function figures.done(data)
-- somehow this fails on some of tacos files
-- ds.xscale = ds.width /(du.width or 1)
-- ds.yscale = ds.height/(du.height or 1)
- -- so we add some extra safeguards
- ds.xscale = ds.width /(du.width and du.width>0 and du.width or du.xsize) or 1
- ds.yscale = ds.height/(du.height and du.height>0 and du.height or du.ysize) or 1
+ -- du.width and du.height can be false
+ if du.width and du.height and du.width > 0 and du.height > 0 then
+ ds.xscale = ds.width /du.width
+ ds.yscale = ds.height/du.height
+ elseif du.xsize and du.ysize and du.xsize > 0 and du.ysize > 0 then
+ ds.xscale = ds.width /du.xsize
+ ds.yscale = ds.height/du.ysize
+ else
+ ds.xscale = 1
+ ds.yscale = 1
+ end
-- sort of redundant but can be limited
ds.page = ds.page or du.page or dr.page
return data
diff --git a/tex/context/base/mkiv/l-number.lua b/tex/context/base/mkiv/l-number.lua
index 001ca31f7..c6f1e3359 100644
--- a/tex/context/base/mkiv/l-number.lua
+++ b/tex/context/base/mkiv/l-number.lua
@@ -13,6 +13,7 @@ local tostring, tonumber = tostring, tonumber
local format, floor, match, rep = string.format, math.floor, string.match, string.rep
local concat, insert = table.concat, table.insert
local lpegmatch = lpeg.match
+local floor = math.floor
number = number or { }
local number = number
@@ -205,3 +206,25 @@ end
function number.bits(n)
return { bits(n,1) }
end
+
+function number.bytetodecimal(b)
+ local d = floor(b * 100 / 255 + 0.5)
+ if d > 100 then
+ return 100
+ elseif d < -100 then
+ return -100
+ else
+ return d
+ end
+end
+
+function number.decimaltobyte(d)
+ local b = floor(d * 255 / 100 + 0.5)
+ if b > 255 then
+ return 255
+ elseif b < -255 then
+ return -255
+ else
+ return b
+ end
+end
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index 1cf63db0c..39357bd25 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -971,6 +971,41 @@ end
table.flattened = flattened
+local function collapsed(t,f,h)
+ if f == nil then
+ f = { }
+ h = { }
+ end
+ for k=1,#t do
+ local v = t[k]
+ if type(v) == "table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1] = v
+ h[v] = true
+ end
+ end
+ return f
+end
+
+local function collapsedhash(t,h)
+ if h == nil then
+ h = { }
+ end
+ for k=1,#t do
+ local v = t[k]
+ if type(v) == "table" then
+ collapsedhash(v,h)
+ else
+ h[v] = true
+ end
+ end
+ return h
+end
+
+table.collapsed = collapsed -- 20% faster than unique(collapsed(t))
+table.collapsedhash = collapsedhash
+
local function unnest(t,f) -- only used in mk, for old times sake
if not f then -- and only relevant for token lists
f = { } -- this one can become obsolete
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index c5893ee90..2b5648e16 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -11,7 +11,7 @@ if not modules then modules = { } end modules ['mlib-lua'] = {
-- maybe we need mplib.model, but how with instances
local type, tostring, select, loadstring = type, tostring, select, loadstring
-local find, gsub = string.find, string.gsub
+local find, match, gsub, gmatch = string.find, string.match, string.gsub, string.gmatch
local formatters = string.formatters
local concat = table.concat
@@ -62,6 +62,7 @@ end
local f_code = formatters["%s return mp._f_()"]
local f_numeric = formatters["%.16f"]
+local f_integer = formatters["%i"]
local f_pair = formatters["(%.16f,%.16f)"]
local f_triplet = formatters["(%.16f,%.16f,%.16f)"]
local f_quadruple = formatters["(%.16f,%.16f,%.16f,%.16f)"]
@@ -99,17 +100,22 @@ mp.print = mpprint
--
-- lua.mp("somedefdname","foo")
-
table.setmetatablecall(mp,function(t,k,...) return t[k](...) end)
-function mp.boolean(n)
+function mp.boolean(b)
+ n = n + 1
+ buffer[n] = b and "true" or "false"
+end
+
+function mp.numeric(f)
n = n + 1
- buffer[n] = n and "true" or "false"
+ buffer[n] = f and f_numeric(f) or "0"
end
-function mp.numeric(n)
+function mp.integer(i)
n = n + 1
- buffer[n] = n and f_numeric(n) or "0"
+ -- buffer[n] = i and f_integer(i) or "0"
+ buffer[n] = i or "0"
end
function mp.pair(x,y)
@@ -204,7 +210,7 @@ function mp.format(fmt,...)
buffer[n] = formatters[fmt](...)
end
-function mp.quoted(fmt,s,...)
+local function mpquoted(fmt,s,...)
n = n + 1
if s then
if not find(fmt,"%%") then
@@ -218,6 +224,8 @@ function mp.quoted(fmt,s,...)
end
end
+mp.quoted = mpquoted
+
function mp.n(t)
return type(t) == "table" and #t or 0
end
@@ -440,7 +448,7 @@ end
function mp.inhash(n,key)
local h = hashes[n]
- mpprint(h and h[key] or false)
+ mpprint(h and h[key] and true or false)
end
function mp.tohash(n,key)
@@ -449,3 +457,55 @@ function mp.tohash(n,key)
h[key] = true
end
end
+
+local modes = tex.modes
+local systemmodes = tex.systemmodes
+
+function mp.mode(s)
+ mpprint(modes[s] and true or false)
+end
+
+function mp.systemmode(s)
+ mpprint(systemmodes[s] and true or false)
+end
+
+-- for alan's nodes:
+
+function mp.isarray(str)
+ mpprint(find(str,"%d") and true or false)
+end
+
+function mp.prefix(str)
+ mpquoted(match(str,"^(.-)[%d%[]") or str)
+end
+
+function mp.dimensions(str)
+ local n = 0
+ for s in gmatch(str,"%[?%-?%d+%]?") do --todo: lpeg
+ n = n + 1
+ end
+ mpprint(n)
+end
+
+-- faster and okay as we don't have many variables but probably only
+-- basename makes sense and even then it's not called that often
+
+-- local hash = table.setmetatableindex(function(t,k)
+-- local v = find(k,"%d") and true or false
+-- t[k] = v
+-- return v
+-- end)
+--
+-- function mp.isarray(str)
+-- mpprint(hash[str])
+-- end
+--
+-- local hash = table.setmetatableindex(function(t,k)
+-- local v = '"' .. (match(k,"^(.-)%d") or k) .. '"'
+-- t[k] = v
+-- return v
+-- end)
+--
+-- function mp.prefix(str)
+-- mpprint(hash[str])
+-- end
diff --git a/tex/context/base/mkiv/mtx-context-domotica.tex b/tex/context/base/mkiv/mtx-context-domotica.tex
index a904d865b..62e6e8786 100644
--- a/tex/context/base/mkiv/mtx-context-domotica.tex
+++ b/tex/context/base/mkiv/mtx-context-domotica.tex
@@ -23,11 +23,13 @@
% --verycompact : small margins, 7pt font
%
% --openzwave : process openzwave xml files
+% --hue : process hue task file
%
% --pattern=spec : files to process
%
% example: context --extra=domotica --openzwave ./config/fibaro/fgms.xml ./open-zwave-master/config/aeotec/zw100.xml
% example: context --extra=domotica --openzwave --pattern="./open-zwave-master/config/**.xml"
+% example: context --extra=domotica --hue hue-pragma-tasks.lua
%
% end help
@@ -64,7 +66,12 @@
[\getdocumentargument{paperformat_paper}]
[\getdocumentargument{paperformat_print}]
+\setuphead
+ [section]
+ [style=bold]
+
\doifdocumentargument {openzwave} {\enablemode[openzwave]}
+\doifdocumentargument {hue} {\enablemode[hue]}
\startmode[openzwave]
@@ -79,18 +86,11 @@
[section]
[width=4em]
- \setuphead
- [section]
- [style=bold]
-
\setupheadertexts
\setupheadertexts
[chapter][pagenumber]
- \setupheader
- [style=bold]
-
\starttitle[title=Zwave devices]
\placelist[chapter,section]
@@ -131,3 +131,37 @@
\stopmode
+\startmode[hue]
+
+ \starttext
+
+ \setupheadertexts
+
+ \startluacode
+
+ local arguments = document.arguments
+ local files = document.files
+ local pattern = arguments.pattern
+ local filename = files[1]
+
+ if filename then
+ context.starttitle { title = "Hue: " .. file.nameonly(filename) }
+ filename = file.addsuffix(filename,"lua")
+ if lfs.isfile(filename) then
+ moduledata.hue.show_state(filename)
+ else
+ context("unknown file %a",filename)
+ end
+ context.stoptitle()
+ else
+ context("no files given")
+ context.stoptitle()
+ end
+
+ \stopluacode
+
+ \stoptext
+
+\stopmode
+
+
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index 8bd8bb802..e41f7f342 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -12414,6 +12414,10 @@ return {
["pe"]="قطعی",
["ro"]="absolut",
},
+ ["anchor"]={
+ ["en"]="anchor",
+ ["nl"]="anker",
+ },
["action"]={
["cs"]="akce",
["de"]="aktion",
diff --git a/tex/context/base/mkiv/pack-box.mkiv b/tex/context/base/mkiv/pack-box.mkiv
index fad7d6e18..ab9fc465e 100644
--- a/tex/context/base/mkiv/pack-box.mkiv
+++ b/tex/context/base/mkiv/pack-box.mkiv
@@ -24,10 +24,15 @@
%D which in itself is ok, but can lead to loops due to rounding errors (happened
%D in demo-obv).
-\definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
-\definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
-\definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
-\definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
+% \definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
+% \definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
+% \definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
+% \definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height]
+
+\definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\textwidth,\c!height=\textheight]
+\definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\textwidth,\c!height=\textheight]
+\definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\textwidth,\c!height=\textheight]
+\definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\textwidth,\c!height=\textheight]
\unexpanded\def\internaltextoverlay#1% will become more generic and installable
{\startoverlay % i.e. probably an overlay by itself
@@ -42,6 +47,10 @@
\installcorenamespace {anchor}
+% produces a box too
+%
+% \anchor[text-1][preset=lefttop][framed settings]{HELLO WORLD}
+
\unexpanded\def\defineanchor
{\doquadrupleempty\pack_anchors_define}
@@ -64,13 +73,14 @@
{\begingroup
\edef\currentanchor{#1}%
\ifcsname\??anchor\currentanchor\endcsname
- \expandafter\pack_anchor_predefined
+% \expandafter\pack_anchor_predefined
+ \expandafter\lastnamedcs
\else
\expandafter\pack_anchor_notdefined
\fi}
-\def\pack_anchor_predefined
- {\csname\??anchor\currentanchor\endcsname}
+% \def\pack_anchor_predefined
+% {\csname\??anchor\currentanchor\endcsname}
\def\pack_anchor_notdefined
{\dodoubleempty\pack_anchor_notdefined_indeed}
@@ -93,33 +103,121 @@
\newdimen\d_pack_anchors_height
\newdimen\d_pack_anchors_depth
-\definelayer[anchor] % \defineoverlay[anchor][\ruledhbox{\flushlayer[anchor]}]
+% \definelayer[anchor]
+
+% % old and no longer valid
+%
+% \def\pack_anchors_process_finish#1#2#3% brrr: we need to apply offset only once .. a bit messy
+% {\checkpositionoverlays
+% % for the moment we ignore the depth
+% \setbox\b_pack_anchors\box\nextbox
+% \d_pack_anchors_width \wd\b_pack_anchors
+% \d_pack_anchors_height\ht\b_pack_anchors
+% \d_pack_anchors_depth \dp\b_pack_anchors
+% \setbox\scratchbox\emptyhbox
+% \wd\scratchbox\d_pack_anchors_width
+% \ht\scratchbox\d_pack_anchors_height
+% \dp\scratchbox\d_pack_anchors_depth
+% \setlayer
+% [anchor]%
+% [\c!width=\d_pack_anchors_width,%
+% \c!height=\d_pack_anchors_height,%
+% \c!offset=\zeropoint,%
+% #2,#3]%
+% {\setlayer[#1]{\box\b_pack_anchors}}% % #1 uses overlaywidth/height
+% \framed % could be a predefined framed
+% [#2,%
+% \c!background=anchor,%
+% \c!offset=\v!overlay,%
+% \c!frame=\v!off,%
+% #3]%
+% {\box\scratchbox}%
+% \endgroup}
+
+% % new and ok but not synced
+%
+% \def\pack_anchors_process_finish#1#2#3% brrr: we need to apply offset only once .. a bit messy
+% {\checkpositionoverlays
+% \setbox\b_pack_anchors\box\nextbox
+% \framed % could be a predefined framed
+% %[#2,\c!offset=\v!overlay,\c!frame=\v!off,#3]
+% [\c!offset=\v!overlay,\c!frame=\v!off,#3]
+% {\novrule % hm, not needed as we frame the size (but kind of default)
+% \s!width \wd\b_pack_anchors
+% \s!height\ht\b_pack_anchors
+% \s!depth \dp\b_pack_anchors}%
+% \setlayer[#1][#2,\c!position=\v!no]{\box\b_pack_anchors}% no position
+% \endgroup}
+
+\newcount\c_pack_anchors_n
+\newtoks \t_pack_anchors_flush
+
+\unexpanded\def\pack_anchors_register#1#2%
+ {\global\advance\c_pack_anchors_n\plusone
+ \pagereference[\v!layer:\v!anchor:\number\c_pack_anchors_n]%
+ \putboxincache{\v!anchor}{\number\c_pack_anchors_n}\b_pack_anchors
+ \doglobal\appendetoks
+ \pack_anchors_flush{\number\c_pack_anchors_n}{#1}{#2}%
+ \to \t_pack_anchors_flush
+ \glet\pack_anchors_flush_all\pack_anchors_flush_all_indeed}
+
+\unexpanded\def\pack_anchors_flush#1#2#3%
+ {\doifelseboxincache{\v!anchor}{#1}
+ {\doifelsereferencefound{\v!layer:\v!anchor:#1}
+ {\ifnum\currentreferencerealpage=\realpageno\relax
+ \setlayer[#2][#3,\c!position=\v!no]{\directboxfromcache{\v!anchor}{#1}}%
+ \else
+ \donetrue
+ \fi
+ }\donetrue}%
+ \donetrue}%
+
+\unexpanded\def\pack_anchors_flush_all_indeed
+ {\donefalse
+ \the\t_pack_anchors_flush
+ \ifdone\else
+ \global\t_pack_anchors_flush\emptytoks
+ \glet\pack_anchors_flush_all\relax
+ \fi}
+
+\let\pack_anchors_flush_all\relax
+
+\appendtoks
+ \pack_anchors_flush_all
+\to \everybeforepagebody
\def\pack_anchors_process_finish#1#2#3% brrr: we need to apply offset only once .. a bit messy
{\checkpositionoverlays
- % for the moment we ignore the depth
\setbox\b_pack_anchors\box\nextbox
- \d_pack_anchors_width \wd\b_pack_anchors
- \d_pack_anchors_height\ht\b_pack_anchors
- \d_pack_anchors_depth \dp\b_pack_anchors
- \setbox\scratchbox\emptyhbox
- \wd\scratchbox\d_pack_anchors_width
- \ht\scratchbox\d_pack_anchors_height
- \dp\scratchbox\d_pack_anchors_depth
- \setlayer
- [anchor]
- [\c!width=\d_pack_anchors_width,
- \c!height=\d_pack_anchors_height,
- \c!offset=\zeropoint,
- #2,#3]
- {\setlayer[#1]{\box\b_pack_anchors}}% % #1 uses ovelaywidth/height
\framed % could be a predefined framed
- [\c!background=anchor,
+ [%#2,
+ %\c!background=\v!color,
+ %\c!backgroundcolor=darkblue,
\c!offset=\v!overlay,
\c!frame=\v!off,
#3]
- {\box\scratchbox}%
- \endgroup}
+ {\pack_anchors_register{#1}{#2}%
+ \novrule % hm, not needed as we frame the size (but kind of default)
+ \s!width \wd\b_pack_anchors
+ \s!height\ht\b_pack_anchors
+ \s!depth \dp\b_pack_anchors}%
+ \endgroup}
+
+% \setlayeranchored[text-1][preset=lefttop]{HELLO WORLD} produces a simple (empty) hbox
+% synchronizes per page
+
+\unexpanded\def\setlayeranchored
+ {\begingroup
+ \dodoubleempty\pack_anchors_set_finish}
+
+\def\pack_anchors_set_finish[#1][#2]%
+ {\dowithnextbox
+ {\iffirstargument
+ \checkpositionoverlays
+ \setbox\b_pack_anchors\box\nextbox
+ \dontleavehmode\hpack{\pack_anchors_register{#1}{#2}}%
+ \fi
+ \endgroup}\hbox}
% collectors
@@ -573,7 +671,7 @@
\ifconditional\c_pack_boxes_t
\paperheight -\MPy\currentbgposition+\MPy\currentpageposition % not checked
\else\ifconditional\c_pack_boxes_b
- \scratchheight+\MPy\currentbgposition-\MPy\currentpageposition % not checked
+ \scratchheight+\MPy\currentbgposition-\MPy\currentpageposition + \MPh\currentbgposition % not checked (\MPh added)
\else
\scratchheight
\fi\fi
diff --git a/tex/context/base/mkiv/pack-lyr.mkiv b/tex/context/base/mkiv/pack-lyr.mkiv
index 1235c47ce..8661fe57a 100644
--- a/tex/context/base/mkiv/pack-lyr.mkiv
+++ b/tex/context/base/mkiv/pack-lyr.mkiv
@@ -433,6 +433,8 @@
\smashbox\nextbox
\vskip\dimexpr\d_pack_layers_y_position+\d_pack_layers_y_offset\relax
\hskip\dimexpr\d_pack_layers_x_position+\d_pack_layers_x_offset\relax
+ % or maybe instead of the \vskip
+ % \raise-\dimexpr\d_pack_layers_y_position+\d_pack_layers_y_offset\relax
\box\nextbox
\ifvoid\layerpagebox
% already flushed
diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv
index 2c1c624df..501f24e88 100644
--- a/tex/context/base/mkiv/page-sid.mkiv
+++ b/tex/context/base/mkiv/page-sid.mkiv
@@ -38,7 +38,6 @@
\newdimen \d_page_sides_progress
\newdimen \d_page_sides_page_total
\newdimen \d_page_sides_saved_depth
-\newdimen \d_page_sides_grid_shift
\newbox \b_page_sides_bottom
@@ -552,31 +551,21 @@
\prevdepth\d_page_sides_saved_depth}
\def\page_sides_place_float_normal
- {\d_page_sides_grid_shift\zeropoint % be nice
- \page_sides_push_float_inline\firstofoneargument}
+ {\page_sides_push_float_inline\firstofoneargument}
% The following needs some more work .. consider this a quick hack. We
% probably need an mkiv hanging grid option.
\def\page_sides_place_snap_to_grid#1%
- {\snaptogrid[\v!line,\v!offset:\the\d_page_sides_grid_shift]\hbox{#1}}
-
-% this will be a grid option in float placement:
-
-\newconstant\c_page_sides_place_grid_shift \c_page_sides_place_grid_shift\plustwo
+ {\edef\p_grid{\floatparameter\c!grid}%
+ \ifx\p_grid\empty\else
+ \snaptogrid[\p_grid]%
+ \fi
+ \hbox{#1}}
\def\page_sides_place_float_grid
{\getrawnoflines\d_page_sides_height % raw ?
\d_page_sides_height\noflines\lineheight
- \d_page_sides_grid_shift\the\dimexpr \plustwo\lineheight
- \ifcase\c_page_sides_place_grid_shift
- -3\lineheight % high
- \or
- -2.5\lineheight % half (does not work currently)
- \else
- -2\lineheight % low
- \fi
- \relax
\page_sides_push_float_inline\page_sides_place_snap_to_grid}
\def\page_sides_push_float_inline#1%
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index 5fc1031cd..f6650dd4d 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -609,7 +609,13 @@ do
local d_value = (double/"") * (unbalanced + d_quoted) * (double/"")
local r_value = reference * Carg(1) / resolve
- local somevalue = d_value + b_value + s_value + r_value
+-- local e_value = (1-S(",}"))^0 / function(s)
+ local e_value = Cs((left * balanced * right + (1 - S(",}")))^0) / function(s)
+ report("error in database, invalid value %a",s)
+ return "[invalid: " .. s .. "]"
+ end
+
+ local somevalue = d_value + b_value + s_value + r_value + e_value
local value = Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0))
local stripper = lpegpatterns.stripper
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 8f0dca563..0a9d95fef 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 79290af72..b7090d2a8 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/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index e28039716..b63d678ab 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -126,6 +126,7 @@
\c!strut=\v!no,
\c!radius=.5\bodyfontsize,
\c!corner=\v!rectangular,
+ \c!grid=,
%\c!background=,
%\c!backgroundcolor=,
\c!backgroundoffset=\!!zeropoint,
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index b678bd0d7..23aa79ed4 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -2507,8 +2507,8 @@ implement {
arguments = { "string", "boolean", "boolean" }
}
-local function referencerealpage(actions)
- actions = actions or references.currentset
+local function referencerealpage()
+ local actions = references.currentset
return not actions and 0 or actions.realpage or setreferencerealpage(actions)
end
diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua
index c12cca2c2..f5974daf7 100644
--- a/tex/context/base/mkiv/supp-box.lua
+++ b/tex/context/base/mkiv/supp-box.lua
@@ -472,6 +472,11 @@ name = tonumber(name) or name
cache[category][name] = b or false
end
+ function boxes.found(category,name)
+name = tonumber(name) or name
+ return cache[category][name] and true or false
+ end
+
function boxes.direct(category,name,copy)
name = tonumber(name) or name
local c = cache[category]
@@ -578,6 +583,12 @@ name = tonumber(name) or name
}
interfaces.implement {
+ name = "doifelseboxincache",
+ arguments = { "string", "string" },
+ actions = { boxes.found, doifelse },
+ }
+
+ interfaces.implement {
name = "resetboxesincache",
arguments = { "string" },
actions = boxes.reset,
diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv
index ba00a9e1d..6e31d2139 100644
--- a/tex/context/base/mkiv/supp-box.mkiv
+++ b/tex/context/base/mkiv/supp-box.mkiv
@@ -2550,9 +2550,15 @@
\fi
\setstackbox{#1}{#2}}
+\unexpanded\def\flushbox#1#2% unwrapped
+ {\ifcsname\??stackbox#1:#2\endcsname
+ \box\lastnamedcs
+ \else
+ \emptybox
+ \fi}
+
\unexpanded\def\restorebox#1#2% unwrapped
{\ifcsname\??stackbox#1:#2\endcsname
- %\copy\csname\??stackbox#1:#2\endcsname
\copy\lastnamedcs
\else
\emptybox
@@ -2561,16 +2567,18 @@
\unexpanded\def\foundbox#1#2% wrapped
{\vpack
{\ifcsname\??stackbox#1:#2\endcsname
- %\copy\csname\??stackbox#1:#2\endcsname
\copy\lastnamedcs
\fi}}
-\unexpanded\def\doifelsebox#1#2#3#4%
+\unexpanded\def\doifelsebox#1#2%
{\ifcsname\??stackbox#1:#2\endcsname
- %\ifvoid\csname\??stackbox#1:#2\endcsname#4\else#3\fi
- \ifvoid\lastnamedcs#4\else#3\fi
+ \ifvoid\lastnamedcs
+ \doubleexpandafter\secondoftwoarguments
+ \else
+ \doubleexpandafter\firstoftwoarguments
+ \fi
\else
- #4%
+ \expandafter\secondoftwoarguments
\fi}
\let\doifboxelse\doifelsebox
@@ -2622,6 +2630,7 @@
\unexpanded\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax}
\unexpanded\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax}
+\unexpanded\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}}
\unexpanded\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax}
\unexpanded\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}}
\unexpanded\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}}
diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml
index 5a59e9fae..ad166f2f9 100644
--- a/tex/context/interface/mkii/keys-cs.xml
+++ b/tex/context/interface/mkii/keys-cs.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='vse'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='vzdy'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='dodatky'/>
diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml
index 939b6ee1e..19ffc98e7 100644
--- a/tex/context/interface/mkii/keys-de.xml
+++ b/tex/context/interface/mkii/keys-de.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='alles'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='immer'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='und'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='anhaenge'/>
diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml
index 5eb518a75..80f348b9e 100644
--- a/tex/context/interface/mkii/keys-en.xml
+++ b/tex/context/interface/mkii/keys-en.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='all'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='always'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='appendices'/>
diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml
index 9f7ea64b1..ae600f5f9 100644
--- a/tex/context/interface/mkii/keys-fr.xml
+++ b/tex/context/interface/mkii/keys-fr.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='tout'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='toujours'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='annexes'/>
diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml
index 9e9b4cdf0..49902eee5 100644
--- a/tex/context/interface/mkii/keys-it.xml
+++ b/tex/context/interface/mkii/keys-it.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='tutti'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='sempre'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='appendici'/>
diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml
index 6466aa7f8..a8f65b552 100644
--- a/tex/context/interface/mkii/keys-nl.xml
+++ b/tex/context/interface/mkii/keys-nl.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='alles'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='altijd'/>
+ <cd:variable name='anchor' value='anker'/>
<cd:variable name='and' value='en'/>
<cd:variable name='answerarea' value='antwoordgebied'/>
<cd:variable name='appendices' value='bijlagen'/>
diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml
index 224ec2b6a..b31c3ee97 100644
--- a/tex/context/interface/mkii/keys-pe.xml
+++ b/tex/context/interface/mkii/keys-pe.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='همه'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='همواره'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='پیوستها'/>
diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml
index 477ef7115..707082d64 100644
--- a/tex/context/interface/mkii/keys-ro.xml
+++ b/tex/context/interface/mkii/keys-ro.xml
@@ -79,6 +79,7 @@
<cd:variable name='all' value='tot'/>
<cd:variable name='alphabetic' value='alphabetic'/>
<cd:variable name='always' value='totdeauna'/>
+ <cd:variable name='anchor' value='anchor'/>
<cd:variable name='and' value='and'/>
<cd:variable name='answerarea' value='answerarea'/>
<cd:variable name='appendices' value='apendixuri'/>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index e3dd2d9ed..0f76a4ac2 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-floats.xml b/tex/context/interface/mkiv/i-floats.xml
index 153078fb4..edc7f7f03 100644
--- a/tex/context/interface/mkiv/i-floats.xml
+++ b/tex/context/interface/mkiv/i-floats.xml
@@ -64,6 +64,9 @@
<cd:constant type="grid"/>
<cd:constant type="normal" default="yes"/>
</cd:parameter>
+ <cd:parameter name="grid">
+ <cd:constant type="cd:string"/>
+ </cd:parameter>
<!--
<cd:parameter name="topoffset">
<cd:constant type="cd:dimension"/>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 4d81dd35b..5a55f45de 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/mkiv/s-domotica-settings.lua b/tex/context/modules/mkiv/s-domotica-settings.lua
index e7e8c309b..a564ddf0e 100644
--- a/tex/context/modules/mkiv/s-domotica-settings.lua
+++ b/tex/context/modules/mkiv/s-domotica-settings.lua
@@ -12,6 +12,7 @@ moduledata.domotica.settings = moduledata.domotica.settings or { }
-- bah, no proper wrapper around value|help
moduledata.zwave = moduledata.zwave or { }
+moduledata.hue = moduledata.hue or { }
local NC = context.NC
local BC = context.BC
@@ -96,3 +97,69 @@ function moduledata.zwave.show_settings(pattern)
end
end
+
+function moduledata.hue.show_state(filename)
+
+ require("control-common")
+ require("control-hue")
+
+ local specification = domotica.hue.check(filename)
+ local instances = specification.instances
+
+ local ctx_NC, ctx_BC, ctx_NR = context.NC, context.BC, context.NR
+
+ for i=1,#instances do
+ local known = instances[i].knowndevices
+
+ if #instances > 1 then
+ context.subject("instance %i",i)
+ end
+
+ context.starttabulate { "|l|c|c|c|c|c|l|" }
+ ctx_BC() context("light name")
+ ctx_BC() context("id")
+ ctx_BC() context("state")
+ ctx_BC() context("level")
+ ctx_BC() context("color")
+ ctx_BC() context("seen")
+ ctx_BC() context("internal")
+ ctx_BC() ctx_NR()
+ for id, entry in table.sortedhash(known.lights) do
+ if entry.used then
+ local state = entry.state
+ local name = entry.name
+ local internal = entry.internalname
+ ctx_NC() context(entry.name)
+ ctx_NC() context(entry.identifier)
+ ctx_NC() context(state.on and "on " or "off")
+ ctx_NC() context(state.brightness or 0)
+ ctx_NC() context(state.temperature or 0)
+ ctx_NC() context((state.reachable or entry.reachable) and "yes" or "no ")
+ ctx_NC() if name == internal then context(name) else context.emphasized(internal) end
+ ctx_NC() ctx_NR()
+ end
+ end
+ context.stoptabulate()
+ context.starttabulate { "|l|c|c|c|l|" }
+ ctx_BC() context("sensor name")
+ ctx_BC() context("id")
+ ctx_BC() context("seen")
+ ctx_BC() context("battery")
+ ctx_BC() context("internal")
+ ctx_BC() ctx_NR()
+ for id, entry in table.sortedhash(known.sensors) do
+ if entry.used then
+ local state = entry.state
+ local name = entry.name
+ local internal = entry.internalname
+ ctx_NC() context(name)
+ ctx_NC() context(entry.identifier)
+ ctx_NC() context((state.reachable or entry.reachable) and "yes" or "no ")
+ ctx_NC() context(entry.battery or "")
+ ctx_NC() if name == internal then context(name) else context.emphasized(internal) end
+ ctx_NC() ctx_NR()
+ end
+ end
+ context.stoptabulate()
+ end
+end
diff --git a/tex/context/modules/mkiv/s-domotica-settings.mkiv b/tex/context/modules/mkiv/s-domotica-settings.mkiv
index e8c483e32..d32e53830 100644
--- a/tex/context/modules/mkiv/s-domotica-settings.mkiv
+++ b/tex/context/modules/mkiv/s-domotica-settings.mkiv
@@ -17,7 +17,7 @@
% see mtx-context-domotica.tex for usage example(s)
-\startmodule[domotica-]
+\startmodule[domotica-settings]
\registerctxluafile{s-domotica-settings}{}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 9ce686896..c503add27 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 12/05/16 14:44:50
+-- merge date : 12/21/16 18:51:59
do -- begin closure to overcome local limits and interference
@@ -1739,6 +1739,38 @@ local function flattened(t,f,depth)
return f
end
table.flattened=flattened
+local function collapsed(t,f,h)
+ if f==nil then
+ f={}
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsed(v,f,h)
+ elseif not h[v] then
+ f[#f+1]=v
+ h[v]=true
+ end
+ end
+ return f
+end
+local function collapsedhash(t,h)
+ if h==nil then
+ h={}
+ end
+ for k=1,#t do
+ local v=t[k]
+ if type(v)=="table" then
+ collapsedhash(v,h)
+ else
+ h[v]=true
+ end
+ end
+ return h
+end
+table.collapsed=collapsed
+table.collapsedhash=collapsedhash
local function unnest(t,f)
if not f then
f={}