summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base')
-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-pe.mkii3
-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-ctx.lua8
-rw-r--r--tex/context/base/mkiv/font-imp-properties.lua1
-rw-r--r--tex/context/base/mkiv/font-ini.lua4
-rw-r--r--tex/context/base/mkiv/hand-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/hand-ini.mkxl2
-rw-r--r--tex/context/base/mkiv/l-gzip.lua191
-rw-r--r--tex/context/base/mkiv/lpdf-img.lua4
-rw-r--r--tex/context/base/mkiv/lpdf-lmt.lua2
-rw-r--r--tex/context/base/mkiv/math-act.lua7
-rw-r--r--tex/context/base/mkiv/math-noa.lua17
-rw-r--r--tex/context/base/mkiv/math-tag.lua2
-rw-r--r--tex/context/base/mkiv/mlib-svg.lua6
-rw-r--r--tex/context/base/mkiv/node-aux.lua234
-rw-r--r--tex/context/base/mkiv/node-cmp.lua232
-rw-r--r--tex/context/base/mkiv/node-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/node-met.lua230
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26597 -> 26578 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin268220 -> 269165 bytes
-rw-r--r--tex/context/base/mkiv/strc-def.mkiv146
-rw-r--r--tex/context/base/mkiv/strc-sec.mkiv3
-rw-r--r--tex/context/base/mkiv/typo-chr.lua1
-rw-r--r--tex/context/base/mkiv/util-zip.lua126
28 files changed, 1010 insertions, 225 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index c6965809e..3821ec4a7 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2019.12.02 18:28}
+\newcontextversion{2019.12.05 18: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 171e1555a..21d3808ea 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.02 18:28}
+\edef\contextversion{2019.12.05 18:44}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index eb5c6d3b8..b9d71fe33 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -232,6 +232,7 @@
\setinterfacevariable{handwritten}{دست‌نوشته}
\setinterfacevariable{hang}{بیاویز}
\setinterfacevariable{hanging}{آویزان}
+\setinterfacevariable{hangingboth}{hangingboth}
\setinterfacevariable{head}{سر}
\setinterfacevariable{header}{سربرگ}
\setinterfacevariable{headintext}{headintext}
@@ -1044,6 +1045,7 @@
\setinterfaceconstant{overprint}{overprint}
\setinterfaceconstant{ownerpassword}{ownerpassword}
\setinterfaceconstant{ownnumber}{شماره‌خود}
+\setinterfaceconstant{packcriterium}{packcriterium}
\setinterfaceconstant{page}{صفحه}
\setinterfaceconstant{pageboundaries}{مرزهای‌صفحه}
\setinterfaceconstant{pagecolor}{رنگ‌صفحه}
@@ -1053,6 +1055,7 @@
\setinterfaceconstant{pageconversion}{pageconversion}
\setinterfaceconstant{pageconversionset}{pageconversionset}
\setinterfaceconstant{pageleft}{pageleft}
+\setinterfaceconstant{pagemethod}{pagemethod}
\setinterfaceconstant{pagenumber}{شماره‌صفحه}
\setinterfaceconstant{pageprefix}{pageprefix}
\setinterfaceconstant{pageprefixconnector}{pageprefixconnector}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index f0590d199..cfec9c098 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2019.12.02 18:28}
+\newcontextversion{2019.12.05 18: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 3169d21f8..54f6ecc35 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.02 18:28}
+\edef\contextversion{2019.12.05 18: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 5cf9188d4..e91fbc285 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.02 18:28}
+\edef\contextversion{2019.12.05 18:44}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index a0e695005..f6c81e76d 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -3106,9 +3106,9 @@ end
do
- local family_font = node.family_font
- local new_glyph = nodes.pool.glyph
- local fontproperties = fonts.hashes.properties
+ local getfontoffamily = font.getfontoffamily
+ local new_glyph = nodes.pool.glyph
+ local fontproperties = fonts.hashes.properties
local function getprivateslot(id,name)
if not name then
@@ -3177,7 +3177,7 @@ do
name = "getprivatemathchar",
arguments = "string",
actions = function(name)
- local p = getprivateslot(family_font(0),name)
+ local p = getprivateslot(getfontoffamily(0),name)
if p then
context(utfchar(p))
end
diff --git a/tex/context/base/mkiv/font-imp-properties.lua b/tex/context/base/mkiv/font-imp-properties.lua
index 5805235b7..21b55aeb2 100644
--- a/tex/context/base/mkiv/font-imp-properties.lua
+++ b/tex/context/base/mkiv/font-imp-properties.lua
@@ -35,7 +35,6 @@ local constructors = fonts.constructors
local getprivate = constructors.getprivate
local allocate = utilities.storage.allocate
-local family_font = node.family_font
local setmetatableindex = table.setmetatableindex
diff --git a/tex/context/base/mkiv/font-ini.lua b/tex/context/base/mkiv/font-ini.lua
index 462e30bf9..8fdac011d 100644
--- a/tex/context/base/mkiv/font-ini.lua
+++ b/tex/context/base/mkiv/font-ini.lua
@@ -52,3 +52,7 @@ fonts.privateoffsets = {
mathbase = 0xFF000, -- used for hidden (virtual math)
keepnames = false, -- when set to true names are always kept (not for context)
}
+
+if not tex.getfontoffamily then
+ tex.getfontoffamily = node.family_font -- we moved this
+end
diff --git a/tex/context/base/mkiv/hand-ini.mkiv b/tex/context/base/mkiv/hand-ini.mkiv
index a18f86707..dc6d1b198 100644
--- a/tex/context/base/mkiv/hand-ini.mkiv
+++ b/tex/context/base/mkiv/hand-ini.mkiv
@@ -60,7 +60,7 @@
\def\font_expansion_enable {\normaladjustspacing\plusthree}
\def\font_expansion_enable_k{\normaladjustspacing\plustwo}
-\def\font_expansion_enable_n{\normaladjustspacing\plusone}
+%def\font_expansion_enable_n{\normaladjustspacing\plusone}
\def\font_expansion_disable {\normaladjustspacing\zerocount}
\def\font_protruding_enable_b{\normalprotrudechars\plusthree} % also deal with r2l (experimental lmtx)
diff --git a/tex/context/base/mkiv/hand-ini.mkxl b/tex/context/base/mkiv/hand-ini.mkxl
index 66da0585e..ca6922ddd 100644
--- a/tex/context/base/mkiv/hand-ini.mkxl
+++ b/tex/context/base/mkiv/hand-ini.mkxl
@@ -60,7 +60,7 @@
\def\font_expansion_enable {\normaladjustspacing\plusthree}
\def\font_expansion_enable_k{\normaladjustspacing\plustwo}
-\def\font_expansion_enable_n{\normaladjustspacing\plusone}
+%def\font_expansion_enable_n{\normaladjustspacing\plusone}
\def\font_expansion_disable {\normaladjustspacing\zerocount}
\def\font_protruding_enable_b{\normalprotrudechars\plusthree} % also deal with r2l (experimental lmtx)
diff --git a/tex/context/base/mkiv/l-gzip.lua b/tex/context/base/mkiv/l-gzip.lua
index 31466bde8..f141b5ebb 100644
--- a/tex/context/base/mkiv/l-gzip.lua
+++ b/tex/context/base/mkiv/l-gzip.lua
@@ -5,39 +5,77 @@ if not modules then modules = { } end modules ['l-gzip'] = {
license = "see context related readme files"
}
-if gzip then
+-- We only have a few official methods here:
+--
+-- local decompressed = gzip.load (filename)
+-- local resultsize = gzip.save (filename,compresslevel)
+-- local compressed = gzip.compress (str,compresslevel)
+-- local decompressed = gzip.decompress (str)
+-- local iscompressed = gzip.compressed (str)
+-- local suffix, okay = gzip.suffix (filename)
+--
+-- In LuaMetaTeX we have only xzip which implements a very few methods:
+--
+-- compress (str,level,method,window,memory,strategy)
+-- decompress (str,window)
+-- adler32 (str,checksum)
+-- crc32 (str,checksum)
+--
+-- Special window values are:
+--
+-- flate : - 15
+-- zlib : 15
+-- gzip : 15 | 16
+-- auto : 15 | 32
+
+gzip = gzip or { } -- so in luatex we keep the old ones too
+
+if not zlib then
+ zlib = xzip -- in luametatex we shadow the old one
+elseif not xzip then
+ xzip = zlib
+end
+
+if zlib then
- local suffix, suffixes = file.suffix, file.suffixes
+ local suffix = file.suffix
+ local suffixes = file.suffixes
+ local find = string.find
+ local openfile = io.open
+
+ local gzipwindow = 15 + 16 -- +16: gzip, +32: gzip|zlib
+ local gziplevel = 3
+ local identifier = "^\x1F\x8B\x08"
+
+ local compress = zlib.compress
+ local decompress = zlib.decompress
function gzip.load(filename)
- local f = io.open(filename,"rb")
+ local f = openfile(filename,"rb")
if not f then
-- invalid file
- elseif suffix(filename) == "gz" then
- f:close()
- local g = gzip.open(filename,"rb")
- if g then
- local str = g:read("*all")
- g:close()
- return str
- end
else
- local str = f:read("*all")
+ local data = f:read("*all")
f:close()
- return str
+ if data and data ~= "" then
+ if suffix(filename) == "gz" then
+ data = decompress(data,gzipwindow)
+ end
+ return data
+ end
end
end
- function gzip.save(filename,data)
+ function gzip.save(filename,data,level)
if suffix(filename) ~= "gz" then
filename = filename .. ".gz"
end
- local f = io.open(filename,"wb")
+ local f = openfile(filename,"wb")
if f then
- local s = zlib.compress(data or "",9,nil,15+16)
- f:write(s)
+ data = compress(data or "",level or gziplevel,nil,gzipwindow)
+ f:write(data)
f:close()
- return #s
+ return #data
end
end
@@ -47,24 +85,6 @@ if gzip then
return suffix, gzipped
end
-else
-
- -- todo: fallback on flate
-
-end
-
-if flate then
-
- local type = type
- local find = string.find
-
- local compress = flate.gz_compress
- local decompress = flate.gz_decompress
-
- local absmax = 128*1024*1024
- local initial = 64*1024
- local identifier = "^\x1F\x8B\x08"
-
function gzip.compressed(s)
return s and find(s,identifier)
end
@@ -72,46 +92,89 @@ if flate then
function gzip.compress(s,level)
if s and not find(s,identifier) then -- the find check might go away
if not level then
- level = 3
+ level = gziplevel
elseif level <= 0 then
return s
elseif level > 9 then
level = 9
end
- return compress(s,level) or s
+ return compress(s,level or gziplevel,nil,gzipwindow) or s
end
end
- function gzip.decompress(s,size,iterate)
+ function gzip.decompress(s)
if s and find(s,identifier) then
- if type(size) ~= "number" then
- size = initial
- end
- if size > absmax then
- size = absmax
- end
- if type(iterate) == "number" then
- max = size * iterate
- elseif iterate == nil or iterate == true then
- iterate = true
- max = absmax
- end
- if max > absmax then
- max = absmax
- end
- while true do
- local d = decompress(s,size)
- if d then
- return d
- end
- size = 2 * size
- if not iterate or size > max then
- return false
- end
- end
+ return decompress(s,gzipwindow)
else
return s
end
end
end
+
+-- In luametatex we can use this one but it doesn't look like there wil be stream
+-- support so for now we still use zlib (the performance difference is not that
+-- spectacular in our usage.
+
+-- if flate then
+--
+-- local type = type
+-- local find = string.find
+--
+-- local compress = flate.gz_compress
+-- local decompress = flate.gz_decompress
+--
+-- local absmax = 128*1024*1024
+-- local initial = 64*1024
+-- local identifier = "^\x1F\x8B\x08"
+--
+-- function gzip.compressed(s)
+-- return s and find(s,identifier)
+-- end
+--
+-- function gzip.compress(s,level)
+-- if s and not find(s,identifier) then -- the find check might go away
+-- if not level then
+-- level = 3
+-- elseif level <= 0 then
+-- return s
+-- elseif level > 9 then
+-- level = 9
+-- end
+-- return compress(s,level) or s
+-- end
+-- end
+--
+-- function gzip.decompress(s,size,iterate)
+-- if s and find(s,identifier) then
+-- if type(size) ~= "number" then
+-- size = initial
+-- end
+-- if size > absmax then
+-- size = absmax
+-- end
+-- if type(iterate) == "number" then
+-- max = size * iterate
+-- elseif iterate == nil or iterate == true then
+-- iterate = true
+-- max = absmax
+-- end
+-- if max > absmax then
+-- max = absmax
+-- end
+-- while true do
+-- local d = decompress(s,size)
+-- if d then
+-- return d
+-- end
+-- size = 2 * size
+-- if not iterate or size > max then
+-- return false
+-- end
+-- end
+-- else
+-- return s
+-- end
+-- end
+--
+-- end
diff --git a/tex/context/base/mkiv/lpdf-img.lua b/tex/context/base/mkiv/lpdf-img.lua
index 97b596937..17305a1cf 100644
--- a/tex/context/base/mkiv/lpdf-img.lua
+++ b/tex/context/base/mkiv/lpdf-img.lua
@@ -51,8 +51,8 @@ local pdfminorversion = lpdf.minorversion
local createimage = images.create
-local zlibcompress = flate and flate.zip_compress or zlib.compress
-local zlibdecompress = zlib.decompress -- todo
+local zlibcompress = (xzip or zlib).compress
+local zlibdecompress = (xzip or zlib).decompress
local trace = false
diff --git a/tex/context/base/mkiv/lpdf-lmt.lua b/tex/context/base/mkiv/lpdf-lmt.lua
index b09f0a4f8..32d743614 100644
--- a/tex/context/base/mkiv/lpdf-lmt.lua
+++ b/tex/context/base/mkiv/lpdf-lmt.lua
@@ -43,7 +43,7 @@ local bpfactor <const> = number.dimenfactors.bp
local md5HEX = md5.HEX
local osuuid = os.uuid
-local zlibcompress = flate.zip_compress or zlib.compress
+local zlibcompress = (xzip or zlib).compress
local nuts = nodes.nuts
local tonut = nodes.tonut
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index 07ef32746..1f0140960 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -441,7 +441,8 @@ mathematics.tweaks = tweaks
-- helpers
local setmetatableindex = table.setmetatableindex
-local family_font = node.family_font
+
+local getfontoffamily = tex.getfontoffamily
local fontcharacters = fonts.hashes.characters
local extensibles = utilities.storage.allocate()
@@ -512,7 +513,7 @@ setmetatableindex(extensibles,function(extensibles,font)
end)
local function extensiblecode(family,unicode)
- return extensibles[family_font(family or 0)][unicode][1]
+ return extensibles[getfontoffamily(family or 0)][unicode][1]
end
-- left : [head] ...
@@ -522,7 +523,7 @@ end
-- abs(right["start"] - right["end"]) | right.advance | characters[right.glyph].width
local function horizontalcode(family,unicode)
- local font = family_font(family or 0)
+ local font = getfontoffamily(family or 0)
local data = extensibles[font][unicode]
local kind = data[1]
local loffset = 0
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 5c078b784..f53410b18 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -136,8 +136,6 @@ local set_visual = nuts.setvisual
local mlist_to_hlist = nuts.mlist_to_hlist
-local font_of_family = node.family_font
-
local new_kern = nodepool.kern
local new_submlist = nodepool.submlist
local new_noad = nodepool.noad
@@ -152,6 +150,7 @@ local fontitalics = fonthashes.italics
local variables = interfaces.variables
local texsetattribute = tex.setattribute
local texgetattribute = tex.getattribute
+local getfontoffamily = tex.getfontoffamily
local unsetvalue = attributes.unsetvalue
local implement = interfaces.implement
@@ -512,7 +511,7 @@ do
report_families("no bold replacement for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa])
end
setfam(pointer,newa)
- elseif not fontcharacters[font_of_family(newa)][bold] then
+ elseif not fontcharacters[getfontoffamily(newa)][bold] then
if trace_families then
report_families("no bold character for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa])
end
@@ -529,7 +528,7 @@ do
end
else
local char = getchar(pointer)
- if not fontcharacters[font_of_family(a)][char] then
+ if not fontcharacters[getfontoffamily(a)][char] then
if trace_families then
report_families("no bold replacement for %C",char)
end
@@ -553,14 +552,14 @@ do
a = a - 3
end
local char = getfield(pointer,"small_char")
- local okay = fontcharacters[font_of_family(a)][char]
+ local okay = fontcharacters[getfontoffamily(a)][char]
if okay then
setfield(pointer,"small_fam",a)
elseif a > 2 then
setfield(pointer,"small_fam",a-3)
end
local char = getfield(pointer,"large_char")
- local okay = fontcharacters[font_of_family(a)][char]
+ local okay = fontcharacters[getfontoffamily(a)][char]
if okay then
setfield(pointer,"large_fam",a)
elseif a > 2 then
@@ -585,7 +584,7 @@ do
-- a = a - 3
-- end
-- local char = getchar(pointer)
- -- local okay = fontcharacters[font_of_family(a)][char]
+ -- local okay = fontcharacters[getfontoffamily(a)][char]
-- if okay then
-- setfam(pointer,a)
-- elseif a > 2 then
@@ -792,7 +791,7 @@ do
local chr = getchar(delimiter)
if chr > 0 then
local fam = getfam(delimiter)
- local id = font_of_family(fam)
+ local id = getfontoffamily(fam)
if id > 0 then
local data = fontdata[id]
local char = mathematics.big(data,chr,size,method)
@@ -1362,7 +1361,7 @@ do
local fontresources = fonts.hashes.resources
local function getalternate(fam,tag,current)
- local resources = fontresources[font_of_family(fam)]
+ local resources = fontresources[getfontoffamily(fam)]
local attribute = unsetvalue
if resources then
local mathalternates = resources.mathalternates
diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua
index d7aa37a5b..daa757f6a 100644
--- a/tex/context/base/mkiv/math-tag.lua
+++ b/tex/context/base/mkiv/math-tag.lua
@@ -163,7 +163,7 @@ local fencesstack = { }
-- local function getunicode(n) -- instead of getchar
-- local char = getchar(n)
--- -- local font = font_of_family(getfield(n,"fam")) -- font_of_family
+-- -- local font = getfontoffamily(getfield(n,"fam"))
-- local font = getfont(n)
-- local data = fontcharacters[font][char]
-- return data.unicode or char
diff --git a/tex/context/base/mkiv/mlib-svg.lua b/tex/context/base/mkiv/mlib-svg.lua
index afbf36ecf..fee23acdf 100644
--- a/tex/context/base/mkiv/mlib-svg.lua
+++ b/tex/context/base/mkiv/mlib-svg.lua
@@ -2924,7 +2924,7 @@ do
local entry = svgshapes[i]
local data = entry.data
if decompress then
- data = decompress(data,128*1024) or data
+ data = decompress(data) or data
end
local specification = {
data = xmlconvert(data),
@@ -2971,7 +2971,7 @@ do
local entry = svgshapes[i]
local data = entry.data
if decompress then
- data = decompress(data,128*1024) or data
+ data = decompress(data) or data
end
local specification = {
data = xmlconvert(data),
@@ -3024,7 +3024,7 @@ do
if index >= entry.first and index <= entry.last then
local data = entry.data
if data then
- local root = xml.convert(gzip.decompress(data,128*1024) or data)
+ local root = xml.convert(gzip.decompress(data) or data)
return metapost.svgtomp (
{
data = root,
diff --git a/tex/context/base/mkiv/node-aux.lua b/tex/context/base/mkiv/node-aux.lua
index e68a672cd..1567868d7 100644
--- a/tex/context/base/mkiv/node-aux.lua
+++ b/tex/context/base/mkiv/node-aux.lua
@@ -553,8 +553,8 @@ do
nuts.find_node = find_node
- nuts.getnormalizeline = direct.getnormalizeline or function() return 0 end
- nuts.setnormalizeline = direct.setnormalizeline or function() end
+ nodes.getnormalizeline = nodes.getnormalizeline or function() return 0 end
+ nodes.setnormalizeline = nodes.setnormalizeline or function() end
nuts.getnormalizedline = direct.getnormalizedline or function(h)
if getid(h) == hlist_code and getsubtype(h) == line_code then
@@ -577,3 +577,233 @@ do
end
end
+
+if not nodes.count then
+
+ local type = type
+
+ local direct = node.direct
+ local todirect = direct.tovaliddirect
+ local tonode = direct.tonode
+
+ local count = direct.count
+ local length = direct.length
+ local slide = direct.slide
+
+ function node.count(id,first,last)
+ return count(id,first and todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.length(first,last)
+ return length(first and todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.slide(n)
+ if n then
+ n = slide(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+ end
+
+ local hyphenating = direct.hyphenating
+ local ligaturing = direct.ligaturing
+ local kerning = direct.kerning
+
+ -- kind of inconsistent
+
+ function node.hyphenating(first,last)
+ if first then
+ local h, t = hyphenating(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ function node.ligaturing(first,last)
+ if first then
+ local h, t = ligaturing(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ function node.kerning(first,last)
+ if first then
+ local h, t = kerning(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ local protect_glyph = direct.protect_glyph
+ local unprotect_glyph = direct.unprotect_glyph
+ local protect_glyphs = direct.protect_glyphs
+ local unprotect_glyphs = direct.unprotect_glyphs
+
+ function node.protect_glyphs(first,last)
+ protect_glyphs(todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.unprotect_glyphs(first,last)
+ unprotect_glyphs(todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.protect_glyph(first)
+ protect_glyph(todirect(first))
+ end
+
+ function node.unprotect_glyph(first)
+ unprotect_glyph(todirect(first))
+ end
+
+ local flatten_discretionaries = direct.flatten_discretionaries
+ local check_discretionaries = direct.check_discretionaries
+ local check_discretionary = direct.check_discretionary
+
+ function node.flatten_discretionaries(first)
+ local h, count = flatten_discretionaries(todirect(first))
+ return tonode(h), count
+ end
+
+ function node.check_discretionaries(n)
+ check_discretionaries(todirect(n))
+ end
+
+ function node.check_discretionary(n)
+ check_discretionary(todirect(n))
+ end
+
+ local hpack = direct.hpack
+ local vpack = direct.vpack
+ local list_to_hlist = direct.mlist_to_hlist
+
+ function node.hpack(head,...)
+ local h, badness = hpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+ end
+
+ function node.vpack(head,...)
+ local h, badness = vpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+ end
+
+ function node.mlist_to_hlist(head,...)
+ return tonode(mlist_to_hlist(head and todirect(head) or nil,...))
+ end
+
+ local end_of_math = direct.end_of_math
+ local find_attribute = direct.find_attribute
+ local first_glyph = direct.first_glyph
+
+ function node.end_of_math(n)
+ if n then
+ n = end_of_math(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+ end
+
+ function node.find_attribute(n,a)
+ if n then
+ local v, n = find_attribute(todirect(n),a)
+ if n then
+ return v, tonode(n)
+ end
+ end
+ return nil
+ end
+
+ function node.first_glyph(first,last)
+ local n = first_glyph(todirect(first), last and todirect(last) or nil)
+ return n and tonode(n) or nil
+ end
+
+ local dimensions = direct.dimensions
+ local rangedimensions = direct.rangedimensions
+ local effective_glue = direct.effective_glue
+
+ function node.dimensions(a,b,c,d,e)
+ if type(a) == "userdata" then
+ a = todirect(a)
+ if type(b) == "userdata" then
+ b = todirect(b)
+ end
+ return dimensions(a,b)
+ else
+ d = todirect(d)
+ if type(e) == "userdata" then
+ e = todirect(e)
+ end
+ return dimensions(a,b,c,d,e)
+ end
+ return 0, 0, 0
+ end
+
+ function node.rangedimensions(parent,first,last)
+ return rangedimenensions(todirect(parent),todirect(first),last and todirect(last))
+ end
+
+ function node.effective_glue(list,parent)
+ return effective_glue(list and todirect(list) or nil,parent and todirect(parent) or nil)
+ end
+
+ local uses_font = direct.uses_font
+ local has_glyph = direct.has_glyph
+ local protrusion_skippable = direct.protrusion_skippable
+ local prepend_prevdepth = direct.prepend_prevdepth
+ local make_extensible = direct.make_extensible
+
+ function node.uses_font(n,f)
+ return uses_font(todirect(n),f)
+ end
+
+ function node.has_glyph(n)
+ return has_glyph(todirect(n))
+ end
+
+ function node.protrusion_skippable(n)
+ return protrusion_skippable(todirect(n))
+ end
+
+ function node.prepend_prevdepth(n)
+ local n, d = prepend_prevdepth(todirect(n))
+ return tonode(n), d
+ end
+
+ function node.make_extensible(...)
+ local n = make_extensible(...)
+ return n and tonode(n) or nil
+ end
+
+ local last_node = direct.last_node
+
+ function node.last_node()
+ local n = last_node()
+ return n and tonode(n) or nil
+ end
+
+ local is_zero_glue = direct.is_zero_glue
+ local getglue = direct.getglue
+ local setglue = direct.setglue
+
+ function node.is_zero_glue(n)
+ return is_zero_glue(todirect(n))
+ end
+
+ function node.get_glue(n)
+ return get_glue(todirect(n))
+ end
+
+ function node.set_glue(n)
+ return set_glue(todirect(n))
+ end
+
+end
diff --git a/tex/context/base/mkiv/node-cmp.lua b/tex/context/base/mkiv/node-cmp.lua
new file mode 100644
index 000000000..e13e93d1f
--- /dev/null
+++ b/tex/context/base/mkiv/node-cmp.lua
@@ -0,0 +1,232 @@
+if node.count then
+ return
+end
+
+local type = type
+
+local node = node
+local direct = node.direct
+local todirect = direct.tovaliddirect
+local tonode = direct.tonode
+
+local count = direct.count
+local length = direct.length
+local slide = direct.slide
+
+function node.count(id,first,last)
+ return count(id,first and todirect(first), last and todirect(last) or nil)
+end
+
+function node.length(first,last)
+ return length(first and todirect(first), last and todirect(last) or nil)
+end
+
+function node.slide(n)
+ if n then
+ n = slide(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+end
+
+local hyphenating = direct.hyphenating
+local ligaturing = direct.ligaturing
+local kerning = direct.kerning
+
+-- kind of inconsistent
+
+function node.hyphenating(first,last)
+ if first then
+ local h, t = hyphenating(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+end
+
+function node.ligaturing(first,last)
+ if first then
+ local h, t = ligaturing(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+end
+
+function node.kerning(first,last)
+ if first then
+ local h, t = kerning(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+local protect_glyph = direct.protect_glyph
+local unprotect_glyph = direct.unprotect_glyph
+local protect_glyphs = direct.protect_glyphs
+local unprotect_glyphs = direct.unprotect_glyphs
+
+function node.protect_glyphs(first,last)
+ protect_glyphs(todirect(first), last and todirect(last) or nil)
+end
+
+function node.unprotect_glyphs(first,last)
+ unprotect_glyphs(todirect(first), last and todirect(last) or nil)
+end
+
+function node.protect_glyph(first)
+ protect_glyph(todirect(first))
+end
+
+function node.unprotect_glyph(first)
+ unprotect_glyph(todirect(first))
+end
+
+local flatten_discretionaries = direct.flatten_discretionaries
+local check_discretionaries = direct.check_discretionaries
+local check_discretionary = direct.check_discretionary
+
+function node.flatten_discretionaries(first)
+ local h, count = flatten_discretionaries(todirect(first))
+ return tonode(h), count
+end
+
+function node.check_discretionaries(n)
+ check_discretionaries(todirect(n))
+end
+
+function node.check_discretionary(n)
+ check_discretionary(todirect(n))
+end
+
+local hpack = direct.hpack
+local vpack = direct.vpack
+local list_to_hlist = direct.mlist_to_hlist
+
+function node.hpack(head,...)
+ local h, badness = hpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+end
+
+function node.vpack(head,...)
+ local h, badness = vpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+end
+
+function node.mlist_to_hlist(head,...)
+ return tonode(mlist_to_hlist(head and todirect(head) or nil,...))
+end
+
+local end_of_math = direct.end_of_math
+local find_attribute = direct.find_attribute
+local first_glyph = direct.first_glyph
+
+function node.end_of_math(n)
+ if n then
+ n = end_of_math(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+end
+
+function node.find_attribute(n,a)
+ if n then
+ local v, n = find_attribute(todirect(n),a)
+ if n then
+ return v, tonode(n)
+ end
+ end
+ return nil
+end
+
+function node.first_glyph(first,last)
+ local n = first_glyph(todirect(first), last and todirect(last) or nil)
+ return n and tonode(n) or nil
+end
+
+local dimensions = direct.dimensions
+local rangedimensions = direct.rangedimensions
+local effective_glue = direct.effective_glue
+
+function node.dimensions(a,b,c,d,e)
+ if type(a) == "userdata" then
+ a = todirect(a)
+ if type(b) == "userdata" then
+ b = todirect(b)
+ end
+ return dimensions(a,b)
+ else
+ d = todirect(d)
+ if type(e) == "userdata" then
+ e = todirect(e)
+ end
+ return dimensions(a,b,c,d,e)
+ end
+ return 0, 0, 0
+end
+
+function node.rangedimensions(parent,first,last)
+ return rangedimenensions(todirect(parent),todirect(first),last and todirect(last))
+end
+
+function node.effective_glue(list,parent)
+ return effective_glue(list and todirect(list) or nil,parent and todirect(parent) or nil)
+end
+
+local uses_font = direct.uses_font
+local has_glyph = direct.has_glyph
+local protrusion_skippable = direct.protrusion_skippable
+local prepend_prevdepth = direct.prepend_prevdepth
+local make_extensible = direct.make_extensible
+
+function node.uses_font(n,f)
+ return uses_font(todirect(n),f)
+end
+
+function node.has_glyph(n)
+ return has_glyph(todirect(n))
+end
+
+function node.protrusion_skippable(n)
+ return protrusion_skippable(todirect(n))
+end
+
+function node.prepend_prevdepth(n)
+ local n, d = prepend_prevdepth(todirect(n))
+ return tonode(n), d
+end
+
+function node.make_extensible(...)
+ local n = make_extensible(...)
+ return n and tonode(n) or nil
+end
+
+local last_node = direct.last_node
+
+function node.last_node()
+ local n = last_node()
+ return n and tonode(n) or nil
+end
+
+local is_zero_glue = direct.is_zero_glue
+local getglue = direct.getglue
+local setglue = direct.setglue
+
+function node.is_zero_glue(n)
+ return is_zero_glue(todirect(n))
+end
+
+function node.get_glue(n)
+ return get_glue(todirect(n))
+end
+
+function node.set_glue(n)
+ return set_glue(todirect(n))
+end
+
+node.family_font = tex.getfontoffamily
diff --git a/tex/context/base/mkiv/node-ini.mkiv b/tex/context/base/mkiv/node-ini.mkiv
index 7a00a8930..5bf53cd2d 100644
--- a/tex/context/base/mkiv/node-ini.mkiv
+++ b/tex/context/base/mkiv/node-ini.mkiv
@@ -17,6 +17,10 @@
\newcount\filterstate \filterstate\plusone % hm, public
+\ifcase\contextlmtxmode \else
+ \registerctxluafile{node-cmp}{}
+\fi
+
\registerctxluafile{node-ini}{}
\registerctxluafile{node-met}{}
\registerctxluafile{node-nut}{}
diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua
index f472d31a9..db079c116 100644
--- a/tex/context/base/mkiv/node-met.lua
+++ b/tex/context/base/mkiv/node-met.lua
@@ -629,3 +629,233 @@ end
nodes.keys = keys -- [id][subtype]
nodes.fields = nodefields -- (n)
+
+if not nodes.count then
+
+ local type = type
+
+ local direct = node.direct
+ local todirect = direct.tovaliddirect
+ local tonode = direct.tonode
+
+ local count = direct.count
+ local length = direct.length
+ local slide = direct.slide
+
+ function node.count(id,first,last)
+ return count(id,first and todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.length(first,last)
+ return length(first and todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.slide(n)
+ if n then
+ n = slide(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+ end
+
+ local hyphenating = direct.hyphenating
+ local ligaturing = direct.ligaturing
+ local kerning = direct.kerning
+
+ -- kind of inconsistent
+
+ function node.hyphenating(first,last)
+ if first then
+ local h, t = hyphenating(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ function node.ligaturing(first,last)
+ if first then
+ local h, t = ligaturing(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ function node.kerning(first,last)
+ if first then
+ local h, t = kerning(todirect(first), last and todirect(last) or nil)
+ return h and tonode(h) or nil, t and tonode(t) or nil, true
+ else
+ return nil, false
+ end
+ end
+
+ local protect_glyph = direct.protect_glyph
+ local unprotect_glyph = direct.unprotect_glyph
+ local protect_glyphs = direct.protect_glyphs
+ local unprotect_glyphs = direct.unprotect_glyphs
+
+ function node.protect_glyphs(first,last)
+ protect_glyphs(todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.unprotect_glyphs(first,last)
+ unprotect_glyphs(todirect(first), last and todirect(last) or nil)
+ end
+
+ function node.protect_glyph(first)
+ protect_glyph(todirect(first))
+ end
+
+ function node.unprotect_glyph(first)
+ unprotect_glyph(todirect(first))
+ end
+
+ local flatten_discretionaries = direct.flatten_discretionaries
+ local check_discretionaries = direct.check_discretionaries
+ local check_discretionary = direct.check_discretionary
+
+ function node.flatten_discretionaries(first)
+ local h, count = flatten_discretionaries(todirect(first))
+ return tonode(h), count
+ end
+
+ function node.check_discretionaries(n)
+ check_discretionaries(todirect(n))
+ end
+
+ function node.check_discretionary(n)
+ check_discretionary(todirect(n))
+ end
+
+ local hpack = direct.hpack
+ local vpack = direct.vpack
+ local list_to_hlist = direct.mlist_to_hlist
+
+ function node.hpack(head,...)
+ local h, badness = hpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+ end
+
+ function node.vpack(head,...)
+ local h, badness = vpack(head and todirect(head) or nil,...)
+ return tonode(h), badness
+ end
+
+ function node.mlist_to_hlist(head,...)
+ return tonode(mlist_to_hlist(head and todirect(head) or nil,...))
+ end
+
+ local end_of_math = direct.end_of_math
+ local find_attribute = direct.find_attribute
+ local first_glyph = direct.first_glyph
+
+ function node.end_of_math(n)
+ if n then
+ n = end_of_math(todirect(n))
+ if n then
+ return tonode(n)
+ end
+ end
+ return nil
+ end
+
+ function node.find_attribute(n,a)
+ if n then
+ local v, n = find_attribute(todirect(n),a)
+ if n then
+ return v, tonode(n)
+ end
+ end
+ return nil
+ end
+
+ function node.first_glyph(first,last)
+ local n = first_glyph(todirect(first), last and todirect(last) or nil)
+ return n and tonode(n) or nil
+ end
+
+ local dimensions = direct.dimensions
+ local rangedimensions = direct.rangedimensions
+ local effective_glue = direct.effective_glue
+
+ function node.dimensions(a,b,c,d,e)
+ if type(a) == "userdata" then
+ a = todirect(a)
+ if type(b) == "userdata" then
+ b = todirect(b)
+ end
+ return dimensions(a,b)
+ else
+ d = todirect(d)
+ if type(e) == "userdata" then
+ e = todirect(e)
+ end
+ return dimensions(a,b,c,d,e)
+ end
+ return 0, 0, 0
+ end
+
+ function node.rangedimensions(parent,first,last)
+ return rangedimenensions(todirect(parent),todirect(first),last and todirect(last))
+ end
+
+ function node.effective_glue(list,parent)
+ return effective_glue(list and todirect(list) or nil,parent and todirect(parent) or nil)
+ end
+
+ local uses_font = direct.uses_font
+ local has_glyph = direct.has_glyph
+ local protrusion_skippable = direct.protrusion_skippable
+ local prepend_prevdepth = direct.prepend_prevdepth
+ local make_extensible = direct.make_extensible
+
+ function node.uses_font(n,f)
+ return uses_font(todirect(n),f)
+ end
+
+ function node.has_glyph(n)
+ return has_glyph(todirect(n))
+ end
+
+ function node.protrusion_skippable(n)
+ return protrusion_skippable(todirect(n))
+ end
+
+ function node.prepend_prevdepth(n)
+ local n, d = prepend_prevdepth(todirect(n))
+ return tonode(n), d
+ end
+
+ function node.make_extensible(...)
+ local n = make_extensible(...)
+ return n and tonode(n) or nil
+ end
+
+ local last_node = direct.last_node
+
+ function node.last_node()
+ local n = last_node()
+ return n and tonode(n) or nil
+ end
+
+ local is_zero_glue = direct.is_zero_glue
+ local getglue = direct.getglue
+ local setglue = direct.setglue
+
+ function node.is_zero_glue(n)
+ return is_zero_glue(todirect(n))
+ end
+
+ function node.get_glue(n)
+ return get_glue(todirect(n))
+ end
+
+ function node.set_glue(n)
+ return set_glue(todirect(n))
+ end
+
+end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index ebe7a3717..14160c825 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 a9f5e7dbb..1fb3effab 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-def.mkiv b/tex/context/base/mkiv/strc-def.mkiv
index 941f561c8..52b3b3ad9 100644
--- a/tex/context/base/mkiv/strc-def.mkiv
+++ b/tex/context/base/mkiv/strc-def.mkiv
@@ -90,13 +90,18 @@
% \definesection (could become \definehead with one parameter)
-\definesection[\s!section-1] % part
-\definesection[\s!section-2] % chapter
-\definesection[\s!section-3] % section
-\definesection[\s!section-4] % subsection
-\definesection[\s!section-5] % subsubsection
-\definesection[\s!section-6] % subsubsubsection
-\definesection[\s!section-7] % subsubsubsubsection
+\definesection[\s!section-1] % part
+\definesection[\s!section-2] % chapter
+\definesection[\s!section-3] % section
+\definesection[\s!section-4] % subsection
+\definesection[\s!section-5] % subsubsection
+\definesection[\s!section-6] % subsubsubsection
+\definesection[\s!section-7] % subsubsubsubsection
+\definesection[\s!section-8] % subsubsubsubsubsection
+\definesection[\s!section-9] % subsubsubsubsubsubsection
+\definesection[\s!section-10] % subsubsubsubsubsubsubsection
+\definesection[\s!section-11] % subsubsubsubsubsubsubsubsection
+\definesection[\s!section-12] % subsubsubsubsubsubsubsubsubsection
% \definehead
@@ -133,6 +138,31 @@
\c!default=\v!subsubsubsection]
\definehead
+ [\v!subsubsubsubsubsection]
+ [\c!section=\s!section-8,
+ \c!default=\v!subsubsubsubsection]
+
+\definehead
+ [\v!subsubsubsubsubsubsection]
+ [\c!section=\s!section-9,
+ \c!default=\v!subsubsubsubsubsection]
+
+\definehead
+ [\v!subsubsubsubsubsubsubsection]
+ [\c!section=\s!section-10,
+ \c!default=\v!subsubsubsubsubsubsection]
+
+\definehead
+ [\v!subsubsubsubsubsubsubsubsection]
+ [\c!section=\s!section-11,
+ \c!default=\v!subsubsubsubsubsubsubsection]
+
+\definehead
+ [\v!subsubsubsubsubsubsubsubsubsection]
+ [\c!section=\s!section-12,
+ \c!default=\v!subsubsubsubsubsubsubsubsection]
+
+\definehead
[\v!title]
[\c!coupling=\v!chapter,
\c!default=\v!chapter,
@@ -168,63 +198,6 @@
\c!default=\v!subsubsubsubsection,
\c!incrementnumber=\v!no]
-\setuphead
- [\v!part]
- [\c!placehead=\v!no]
-
-\setuphead
- [\v!chapter]
- [\v!appendix\c!label=\v!appendix,
- \v!bodypart\c!label=\v!chapter] % bijlageconversie=\Character
-
-\setuphead
- [\v!section]
- [\v!appendix\c!label=\v!section,
- \v!bodypart\c!label=\v!section] % bijlageconversie=\Character
-
-\setuphead
- [\v!subsection]
- [\v!appendix\c!label=\v!subsection,
- \v!bodypart\c!label=\v!subsection] % bijlageconversie=\Character
-
-\setuphead
- [\v!subsubsection]
- [\v!appendix\c!label=\v!subsubsection,
- \v!bodypart\c!label=\v!subsubsection] % bijlageconversie=\Character
-
-% extras
-
-\definesection[\s!section-8] % subsubsubsubsubsection
-\definesection[\s!section-9] % subsubsubsubsubsubsection
-\definesection[\s!section-10] % subsubsubsubsubsubsubsection
-\definesection[\s!section-11] % subsubsubsubsubsubsubsubsection
-\definesection[\s!section-12] % subsubsubsubsubsubsubsubsubsection
-
-\definehead
- [\v!subsubsubsubsubsection]
- [\c!section=\s!section-8,
- \c!default=\v!subsubsubsubsection]
-
-\definehead
- [\v!subsubsubsubsubsubsection]
- [\c!section=\s!section-9,
- \c!default=\v!subsubsubsubsubsection]
-
-\definehead
- [\v!subsubsubsubsubsubsubsection]
- [\c!section=\s!section-10,
- \c!default=\v!subsubsubsubsubsubsection]
-
-\definehead
- [\v!subsubsubsubsubsubsubsubsection]
- [\c!section=\s!section-11,
- \c!default=\v!subsubsubsubsubsubsubsection]
-
-\definehead
- [\v!subsubsubsubsubsubsubsubsubsection]
- [\c!section=\s!section-12,
- \c!default=\v!subsubsubsubsubsubsubsubsection]
-
\definehead
[\v!subsubsubsubsubsubject]
[\c!coupling=\v!subsubsubsubsubsection,
@@ -255,6 +228,34 @@
\c!default=\v!subsubsubsubsubsubsubsubsubsection,
\c!incrementnumber=\v!no]
+% setups
+
+\setuphead
+ [\v!part]
+ [\c!placehead=\v!no]
+
+\setuphead
+ [\v!chapter]
+ [\v!appendix\c!label=\v!appendix,
+ \v!bodypart\c!label=\v!chapter] % bijlageconversie=\Character
+
+\setuphead
+ [\v!section]
+ [\v!appendix\c!label=\v!section,
+ \v!bodypart\c!label=\v!section] % bijlageconversie=\Character
+
+\setuphead
+ [\v!subsection]
+ [\v!appendix\c!label=\v!subsection,
+ \v!bodypart\c!label=\v!subsection] % bijlageconversie=\Character
+
+\setuphead
+ [\v!subsubsection]
+ [\v!appendix\c!label=\v!subsubsection,
+ \v!bodypart\c!label=\v!subsubsection] % bijlageconversie=\Character
+
+% prefixes
+
\defineprefixset
[\v!all]
[section-1,section-2,section-3,section-4,section-5,section-6,section-7,%
@@ -321,12 +322,17 @@
[\c!before={\blank[\v!preference,\v!big]}, % sort of mkii compatible, watch columns
\c!after=]
-\setuplist [\v!part] [\c!width=0\emwidth]
-\setuplist [\v!chapter] [\c!width=2\emwidth]
-\setuplist [\v!section] [\c!width=3\emwidth]
-\setuplist [\v!subsection] [\c!width=4\emwidth]
-\setuplist [\v!subsubsection] [\c!width=5\emwidth]
-\setuplist [\v!subsubsubsection] [\c!width=6\emwidth]
+\setuplist [\v!part] [\c!width=0\emwidth]
+\setuplist [\v!chapter] [\c!width=2\emwidth]
+\setuplist [\v!section] [\c!width=3\emwidth]
+\setuplist [\v!subsection] [\c!width=4\emwidth]
+\setuplist [\v!subsubsection] [\c!width=5\emwidth]
+\setuplist [\v!subsubsubsection] [\c!width=6\emwidth]
\setuplist [\v!subsubsubsubsection] [\c!width=7\emwidth]
+\setuplist [\v!subsubsubsubsubsection] [\c!width=8\emwidth]
+\setuplist [\v!subsubsubsubsubsubsection] [\c!width=9\emwidth]
+\setuplist [\v!subsubsubsubsubsubsubsection] [\c!width=10\emwidth]
+\setuplist [\v!subsubsubsubsubsubsubsubsection] [\c!width=11\emwidth]
+\setuplist [\v!subsubsubsubsubsubsubsubsubsection] [\c!width=12\emwidth]
\protect \endinput
diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv
index 21e6adfe3..0e30d92fa 100644
--- a/tex/context/base/mkiv/strc-sec.mkiv
+++ b/tex/context/base/mkiv/strc-sec.mkiv
@@ -430,6 +430,9 @@
}%
\doifelselist\currenthead\donothing
{\definelist[\currenthead][\c!prefix=\v!no]}%
+ % we can't do this now for backward compatibility reasons
+ % \doifelselist\currenthead\donothing
+ % {\normalexpanded{\definelist[\currenthead][\currentheadparent][\c!prefix=\v!no]}}%
\else
\normalexpanded {%
\setheadparameter{\c!label}{\currenthead}%
diff --git a/tex/context/base/mkiv/typo-chr.lua b/tex/context/base/mkiv/typo-chr.lua
index cabfc4ab1..966df6098 100644
--- a/tex/context/base/mkiv/typo-chr.lua
+++ b/tex/context/base/mkiv/typo-chr.lua
@@ -101,7 +101,6 @@ local texsetcount = tex.setcount
local flush_node = nodes.flush_node
local flush_list = nodes.flush_list
------ start_of_par = nodes.start_of_par
local settexattribute = tex.setattribute
local punctuation = characters.is_punctuation
diff --git a/tex/context/base/mkiv/util-zip.lua b/tex/context/base/mkiv/util-zip.lua
index 7d252a74f..33f8d8a7e 100644
--- a/tex/context/base/mkiv/util-zip.lua
+++ b/tex/context/base/mkiv/util-zip.lua
@@ -16,7 +16,7 @@ local type, tostring, tonumber = type, tostring, tonumber
local sort = table.sort
local find, format, sub, gsub = string.find, string.format, string.sub, string.gsub
-local osdate, ostime = os.date, os.time
+local osdate, ostime, osclock = os.date, os.time, os.clock
local ioopen = io.open
local loaddata, savedata = io.loaddata, io.savedata
local filejoin, isdir, dirname, mkdirs = file.join, lfs.isdir, file.dirname, dir.mkdirs
@@ -36,12 +36,12 @@ local lshift = bit32.lshift
local decompress, calculatecrc
-if flate then
-
- decompress = flate.flate_decompress
- calculatecrc = flate.update_crc32
-
-else
+-- if flate then
+--
+-- decompress = flate.flate_decompress
+-- calculatecrc = flate.update_crc32
+--
+-- else
local zlibdecompress = zlib.decompress
local zlibchecksum = zlib.crc32
@@ -59,7 +59,7 @@ else
return zlibchecksum(initial or 0,buffer)
end
-end
+-- end
local zipfiles = { }
utilities.zipfiles = zipfiles
@@ -183,6 +183,8 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist
end
end
+ local expandsize = xzip.expandsize
+
function unzipfile(z,filename,check)
local hash = z.hash
if not hash then
@@ -201,7 +203,11 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist
setposition(handle,position)
local result = readstring(handle,compressed)
if data.method == 8 then
- result = decompress(result,data.uncompressed)
+ if expandsize then
+ result = expandsize(result,data.uncompressed)
+ else
+ result = decompress(result)
+ end
end
if check and data.crc32 ~= calculatecrc(result) then
print("checksum mismatch")
@@ -223,7 +229,7 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist
end
-if flate then do
+if xzip then -- flate then do
local writecardinal1 = files.writebyte
local writecardinal2 = files.writecardinal2le
@@ -232,8 +238,10 @@ if flate then do
local logwriter = logs.writer
local globpattern = dir.globpattern
- local compress = flate.flate_compress
- local checksum = flate.update_crc32
+-- local compress = flate.flate_compress
+-- local checksum = flate.update_crc32
+ local compress = xzip.compress
+ local checksum = xzip.crc32
-- local function fromdostime(dostime,dosdate)
-- return ostime {
@@ -469,18 +477,20 @@ if flate then do
local count = #list
local step = number.idiv(count,10)
local done = 0
+ local steps = verbose == "steps"
+ local time = steps and osclock()
for i=1,count do
local l = list[i]
local n = l.filename
local d = unzipfile(z,n) -- true for check
local p = filejoin(path,n)
if mkdirs(dirname(p)) then
- if verbose == "steps" then
+ if steps then
total = total + #d
done = done + 1
if done >= step then
done = 0
- logwriter(format("%4i files of %4i done, %10i bytes",i,count,total))
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
end
elseif verbose then
logwriter(n)
@@ -488,8 +498,8 @@ if flate then do
savedata(p,d)
end
end
- if verbose == "steps" then
- logwriter(format("%4i files of %4i done, %10i bytes",count,count,total))
+ if steps then
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
return true
@@ -502,48 +512,50 @@ if flate then do
zipfiles.zipdir = zipdir
zipfiles.unzipdir = unzipdir
-end end
-
-if flate then
-
- local streams = utilities.streams
- local openfile = streams.open
- local closestream = streams.close
- local setposition = streams.setposition
- local getsize = streams.size
- local readcardinal4 = streams.readcardinal4le
- local getstring = streams.getstring
- local decompress = flate.gz_decompress
-
- -- id1=1 id2=1 method=1 flags=1 mtime=4(le) extra=1 os=1
- -- flags:8 comment=...<nul> flags:4 name=...<nul> flags:2 extra=...<nul> flags:1 crc=2
- -- data:?
- -- crc=4 size=4
-
- function zipfiles.gunzipfile(filename)
- local strm = openfile(filename)
- if strm then
- setposition(strm,getsize(strm) - 4 + 1)
- local size = readcardinal4(strm)
- local data = decompress(getstring(strm),size)
- closestream(strm)
- return data
- end
- end
-
-elseif gzip then
-
- local openfile = gzip.open
+end
- function zipfiles.gunzipfile(filename)
- local g = openfile(filename,"rb")
- if g then
- local d = g:read("*a")
- d:close()
- return d
- end
- end
+zipfiles.gunzipfile = gzip.load
-end
+-- if flate then
+--
+-- local streams = utilities.streams
+-- local openfile = streams.open
+-- local closestream = streams.close
+-- local setposition = streams.setposition
+-- local getsize = streams.size
+-- local readcardinal4 = streams.readcardinal4le
+-- local getstring = streams.getstring
+-- local decompress = flate.gz_decompress
+--
+-- -- id1=1 id2=1 method=1 flags=1 mtime=4(le) extra=1 os=1
+-- -- flags:8 comment=...<nul> flags:4 name=...<nul> flags:2 extra=...<nul> flags:1 crc=2
+-- -- data:?
+-- -- crc=4 size=4
+--
+-- function zipfiles.gunzipfile(filename)
+-- local strm = openfile(filename)
+-- if strm then
+-- setposition(strm,getsize(strm) - 4 + 1)
+-- local size = readcardinal4(strm)
+-- local data = decompress(getstring(strm),size)
+-- closestream(strm)
+-- return data
+-- end
+-- end
+--
+-- elseif gzip then
+--
+-- local openfile = gzip.open
+--
+-- function zipfiles.gunzipfile(filename)
+-- local g = openfile(filename,"rb")
+-- if g then
+-- local d = g:read("*a")
+-- d:close()
+-- return d
+-- end
+-- end
+--
+-- end
return zipfiles