summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/buff-ini.lua24
-rw-r--r--tex/context/base/buff-ini.mkiv14
-rw-r--r--tex/context/base/cldf-bas.lua140
-rw-r--r--tex/context/base/cldf-bas.mkiv18
-rw-r--r--tex/context/base/cldf-com.lua121
-rw-r--r--tex/context/base/colo-imp-rgb.mkiv53
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4074 -> 7476 bytes
-rw-r--r--tex/context/base/context-version.pngbin105820 -> 105334 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv8
-rw-r--r--tex/context/base/core-uti.lua18
-rw-r--r--tex/context/base/data-res.lua34
-rw-r--r--tex/context/base/lxml-css.mkiv2
-rw-r--r--tex/context/base/mult-aux.mkiv20
-rw-r--r--tex/context/base/mult-sys.mkiv1
-rw-r--r--tex/context/base/node-aux.lua18
-rw-r--r--tex/context/base/pack-rul.mkiv36
-rw-r--r--tex/context/base/spac-ali.mkiv65
-rw-r--r--tex/context/base/status-files.pdfbin23826 -> 115913 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin165294 -> 837917 bytes
-rw-r--r--tex/context/base/strc-flt.mkiv156
-rw-r--r--tex/context/base/syst-aux.mkiv28
-rw-r--r--tex/context/base/tabl-ntb.mkiv6
-rw-r--r--tex/context/base/tabl-tsp.mkiv106
-rw-r--r--tex/context/base/tabl-xtb.lua606
-rw-r--r--tex/context/base/tabl-xtb.mkvi368
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
29 files changed, 1487 insertions, 363 deletions
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 0a52151d6..90b4b4a76 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -106,13 +106,21 @@ end
local counters = { }
local nesting = 0
local autoundent = true
+local continue = false
+
+-- Beware: the first character of bufferdata has to be discarded as it's there to
+-- prevent gobbling of newlines in the case of nested buffers. The last one is
+-- a newlinechar and is removed too.
+--
+-- An \n is unlikely to show up as \r is the endlinechar but \n is more generic
+-- for us.
function commands.grabbuffer(name,begintag,endtag,bufferdata) -- maybe move \\ to call
local dn = getcontent(name)
if dn == "" then
nesting = 0
+ continue = false
end
- -- nesting = nesting + count(bufferdata,"\\"..begintag) - count(bufferdata,"\\"..endtag)
local counter = counters[begintag]
if not counter then
counter = countnesting(begintag,endtag)
@@ -121,14 +129,18 @@ function commands.grabbuffer(name,begintag,endtag,bufferdata) -- maybe move \\ t
nesting = nesting + lpegmatch(counter,bufferdata)
local more = nesting > 0
if more then
- dn = dn .. bufferdata .. endtag
+ dn = dn .. sub(bufferdata,2,-1) .. endtag
nesting = nesting - 1
+ continue = true
else
- -- bufferdata ends with a \
- if dn == "" then
- dn = sub(bufferdata,1,-2)
+ if continue then
+ dn = dn .. sub(bufferdata,2,-2) -- no \r, \n is more generic
else
- dn = dn .. "\n" .. sub(bufferdata,1,-2) -- no \r, \n is more generic
+ if dn == "" then
+ dn = sub(bufferdata,2,-2)
+ else
+ dn = dn .. "\n" .. sub(bufferdata,2,-2) -- no \r, \n is more generic
+ end
end
local last = sub(dn,-1)
if last == "\n" or last == "\r" then -- \n is unlikely as \r is the endlinechar
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index cbd53c040..5653fbeee 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -71,7 +71,8 @@
{\egroup
#5}%
\long\def\dododowithbuffer##1#3% is detokenize needed? TEST
- {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} % space ?
+ %{\ctxcommand{grabbuffer("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} % space ?
+ {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs>##1\!!es)}% space ?
\dododowithbuffer
\nododowithbuffer}%
\dododowithbuffer}
@@ -153,14 +154,17 @@
% \let\processTEXbuffer\getbuffer % handy synonym
+\unexpanded\def\doprocesstexbuffer#1%
+ {\pushcatcodetable
+ \catcodetable\ctxcatcodes
+ \dododogetbuffer{#1}%
+ \popcatcodetable}
+
\unexpanded\def\processTEXbuffer
{\dosingleempty\doprocessTEXbuffer}
\def\doprocessTEXbuffer[#1]%
- {\pushcatcodetable
- \catcodetable\ctxcatcodes
- \getbuffer[#1]%
- \popcatcodetable}
+ {\doprocesstexbuffer{#1}}
\setupbuffer
[\c!before=,
diff --git a/tex/context/base/cldf-bas.lua b/tex/context/base/cldf-bas.lua
new file mode 100644
index 000000000..30a9265bc
--- /dev/null
+++ b/tex/context/base/cldf-bas.lua
@@ -0,0 +1,140 @@
+if not modules then modules = { } end modules ['cldf-ini'] = {
+ version = 1.001,
+ comment = "companion to cldf-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- -- speedtest needed:
+--
+-- local flush, writer = context.getlogger()
+--
+-- trackers.register("context.trace",function(v)
+-- flush, writer = context.getlogger()
+-- end)
+--
+-- function context.bgroup()
+-- flush(ctxcatcodes,"{")
+-- end
+--
+-- function context.egroup()
+-- flush(ctxcatcodes,"}")
+-- end
+
+local type = type
+local format = string.format
+local utfchar = utf.char
+local concat = table.concat
+
+local context = context
+local generics = context.generics
+local variables = interfaces.variables
+
+local new_rule = nodes.pool.rule
+
+function context.char(k) -- used as escape too, so don't change to utf
+ if type(k) == "table" then
+ -- for i=1,#k do
+ -- context(format([[\char%s\relax]],k[i]))
+ -- end
+ context([[\char%s\relax]],concat(k,[[\relax\char]]))
+ elseif k then
+ context([[\char%s\relax]],k)
+ end
+end
+
+function context.utfchar(k)
+ context(utfchar(k))
+end
+
+-- plain variants
+
+function context.chardef(cs,u)
+ context([[\chardef\%s=%s\relax]],k)
+end
+
+function context.par()
+ context([[\par]]) -- no need to add {} there
+end
+
+function context.bgroup()
+ context("{")
+end
+
+function context.egroup()
+ context("}")
+end
+
+function context.hrule(w,h,d,dir)
+ if type(w) == "table" then
+ context(new_rule(w.width,w.height,w.depth,w.dir))
+ else
+ context(new_rule(w,h,d,dir))
+ end
+end
+
+context.vrule = context.hrule
+
+--~ local hbox, bgroup, egroup = context.hbox, context.bgroup, context.egroup
+
+--~ function context.hbox(a,...)
+--~ if type(a) == "table" then
+--~ local s = { }
+--~ if a.width then
+--~ s[#s+1] = "to " .. a.width -- todo: check for number
+--~ elseif a.spread then
+--~ s[#s+1] = "spread " .. a.spread -- todo: check for number
+--~ end
+--~ -- todo: dir, attr etc
+--~ hbox(false,table.concat(s," "))
+--~ bgroup()
+--~ context(string.format(...))
+--~ egroup()
+--~ else
+--~ hbox(a,...)
+--~ end
+--~ end
+
+-- not yet used ... but will get variant at the tex end as well
+
+function context.sethboxregister (n) context("\\setbox %s\\hbox",n) end
+function context.setvboxregister (n) context("\\setbox %s\\vbox",n) end
+
+function context.starthboxregister(n)
+ if type(n) == "number" then
+ context("\\setbox%s\\hbox\\bgroup",n)
+ else
+ context("\\setbox\\%s\\hbox\\bgroup",n)
+ end
+end
+
+function context.startvboxregister(n)
+ if type(n) == "number" then
+ context("\\setbox%s\\vbox\\bgroup",n)
+ else
+ context("\\setbox\\%s\\vbox\\bgroup",n)
+ end
+end
+
+context.stophboxregister = context.egroup
+context.stopvboxregister = context.egroup
+
+function context.flushboxregister(n)
+ if type(n) == "number" then
+ context("\\box%s ",n)
+ else
+ context("\\box\\%s",n)
+ end
+end
+
+function context.beginvbox()
+ context("\\vbox\\bgroup") -- we can do \bvbox ... \evbox (less tokens)
+end
+
+function context.beginhbox()
+ context("\\hbox\\bgroup") -- todo: use fast one
+end
+
+context.endvbox = context.egroup
+context.endhbox = context.egroup
diff --git a/tex/context/base/cldf-bas.mkiv b/tex/context/base/cldf-bas.mkiv
new file mode 100644
index 000000000..f2bd05177
--- /dev/null
+++ b/tex/context/base/cldf-bas.mkiv
@@ -0,0 +1,18 @@
+%D \module
+%D [ file=cldf-bas,
+%D version=2010.10.19,,
+%D title=\CONTEXT\ \LUA\ Document Functions,
+%D subtitle=Basics,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Lua Documents / Basics}
+
+\registerctxluafile{cldf-bas}{1.001}
+
+\endinput
diff --git a/tex/context/base/cldf-com.lua b/tex/context/base/cldf-com.lua
index 47c8080d1..bacbbeafd 100644
--- a/tex/context/base/cldf-com.lua
+++ b/tex/context/base/cldf-com.lua
@@ -6,12 +6,9 @@ if not modules then modules = { } end modules ['cldf-com'] = {
license = "see context related readme files"
}
-local tostring, type = tostring, type
-local format = string.format
-local utfchar = utf.char
-
+local tostring = tostring
local context = context
-local generics = context.generics
+local generics = context.generics -- needs documentation
local variables = interfaces.variables
generics.starttabulate = "start" .. variables.tabulate -- todo: e!start
@@ -38,117 +35,3 @@ function context.tabulaterow (...) tabulaterow(false, ...) end
function context.tabulaterowbold(...) tabulaterow("bold",...) end
function context.tabulaterowtype(...) tabulaterow("type",...) end
function context.tabulaterowtyp (...) tabulaterow("typ", ...) end
-
--- these will move up, just after cld definitions
-
-function context.char(k) -- used as escape too, so don't change to utf
- if type(k) == "table" then
- for i=1,#k do
- context(format([[\char%s\relax]],k[i]))
- end
- elseif k then
- context(format([[\char%s\relax]],k))
- end
-end
-
-function context.utfchar(k)
- context(utfchar(k))
-end
-
--- plain variants
-
-function context.chardef(cs,u)
- context(format([[\chardef\%s=%s\relax]],k)) -- context does already do format
-end
-
-function context.par()
- context([[\par]]) -- no need to add {} there
-end
-
-function context.bgroup()
- context("{")
-end
-
-function context.egroup()
- context("}")
-end
-
--- -- speedtest needed:
---
--- local flush, writer = context.getlogger()
---
--- trackers.register("context.trace",function(v)
--- flush, writer = context.getlogger()
--- end)
---
--- function context.bgroup()
--- flush(ctxcatcodes,"{")
--- end
---
--- function context.egroup()
--- flush(ctxcatcodes,"}")
--- end
-
-local rule = nodes.pool.rule
-
-function context.hrule(w,h,d,dir)
- if type(w) == "table" then
- context(rule(w.width,w.height,w.depth,w.dir))
- else
- context(rule(w,h,d,dir))
- end
-end
-
-context.vrule = context.hrule
-
---~ local hbox, bgroup, egroup = context.hbox, context.bgroup, context.egroup
-
---~ function context.hbox(a,...)
---~ if type(a) == "table" then
---~ local s = { }
---~ if a.width then
---~ s[#s+1] = "to " .. a.width -- todo: check for number
---~ elseif a.spread then
---~ s[#s+1] = "spread " .. a.spread -- todo: check for number
---~ end
---~ -- todo: dir, attr etc
---~ hbox(false,table.concat(s," "))
---~ bgroup()
---~ context(string.format(...))
---~ egroup()
---~ else
---~ hbox(a,...)
---~ end
---~ end
-
--- not yet used ... but will get variant at the tex end as well
-
-function context.sethboxregister (n) context("\\setbox %s\\hbox",n) end
-function context.setvboxregister (n) context("\\setbox %s\\vbox",n) end
-
-function context.starthboxregister(n)
- if type(n) == "number" then
- context("\\setbox%s\\hbox\\bgroup",n)
- else
- context("\\setbox\\%s\\hbox\\bgroup",n)
- end
-end
-
-function context.startvboxregister(n)
- if type(n) == "number" then
- context("\\setbox%s\\vbox\\bgroup",n)
- else
- context("\\setbox\\%s\\vbox\\bgroup",n)
- end
-end
-
-context.stophboxregister = context.egroup
-context.stopvboxregister = context.egroup
-
-function context.flushboxregister(n)
- if type(n) == "number" then
- context("\\box%s ",n)
- else
- context("\\box\\%s",n)
- end
-end
diff --git a/tex/context/base/colo-imp-rgb.mkiv b/tex/context/base/colo-imp-rgb.mkiv
index f734c7a01..68fb4e839 100644
--- a/tex/context/base/colo-imp-rgb.mkiv
+++ b/tex/context/base/colo-imp-rgb.mkiv
@@ -8,8 +8,8 @@
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
%D Just to give users a start we define some colors. While
%D switching fonts is as international as can be, thanks to the
@@ -18,7 +18,7 @@
%D interface dependant colors. We use the color inheritance
%D mechanisms to implement the interface dependant ones.
-%D First we define some simple primary \cap{RGB} and \cap{CMYK}
+%D First we define some simple primary \cap{RGB} and \cap{CMYK}
%D colors. All colors are defined in \cap{RGB} color space.
\definecolor [red] [r=1, g=0, b=0]
@@ -30,33 +30,32 @@
\definecolor [yellow] [r=1, g=1, b=0]
\definecolor [white] [s=1] % [r=1, g=1, b=1]
-\definecolor [black] [s=0]
+\definecolor [black] [s=0]
\definecolor [gray] [s=.9]
-\definecolor [darkred] [r=.8, g=0, b=0]
-\definecolor [middlered] [r=.9, g=0, b=0]
-\definecolor [lightred] [r=1, g=0, b=0]
+% adapted per 2011.10.28
-\definecolor [darkgreen] [r=0, g=.6, b=0]
-\definecolor [middlegreen] [r=0, g=.8, b=0]
+\definecolor [lightred] [r=1, g=0, b=0]
\definecolor [lightgreen] [r=0, g=1, b=0]
-
-\definecolor [darkblue] [r=0, g=0, b=.8]
-\definecolor [middleblue] [r=0, g=0, b=.9]
\definecolor [lightblue] [r=0, g=0, b=1]
-\definecolor [darkcyan] [r=.6, g=.8, b=.8]
-\definecolor [middlecyan] [r=0, g=.8, b=.8]
-
-\definecolor [darkmagenta] [r=.8, g=.6, b=.8]
-\definecolor [middlemagenta] [r=1, g=0, b=.6]
+\definecolor [middlered] [r=.8, g=0, b=0]
+\definecolor [middlegreen] [r=0, g=.8, b=0]
+\definecolor [middleblue] [r=0, g=0, b=.8]
+\definecolor [middlecyan] [r=0, g=.6, b=.6]
+\definecolor [middlemagenta] [r=.6, g=0, b=.6]
+\definecolor [middleyellow] [r=.6, g=.6, b=.0]
-\definecolor [darkyellow] [r=.8, g=.8, b=.6]
-\definecolor [middleyellow] [r=1, g=1, b=.2]
+\definecolor [darkred] [r=.6, g=0, b=0]
+\definecolor [darkgreen] [r=0, g=.6, b=0]
+\definecolor [darkblue] [r=0, g=0, b=.6]
+\definecolor [darkcyan] [r=0, g=.4, b=.4]
+\definecolor [darkmagenta] [r=.4, g=0, b=.4]
+\definecolor [darkyellow] [r=.4, g=.4, b=0]
-\definecolor [darkgray] [s=.5]
-\definecolor [middlegray] [s=.7]
-\definecolor [lightgray] [s=.9]
+\definecolor [darkgray] [s=.60]
+\definecolor [middlegray] [s=.725]
+\definecolor [lightgray] [s=.85]
%D These colors are mapped to interface dependant colornames.
@@ -211,10 +210,10 @@
\definecolor [bluchiaro] [lightblue]
\definecolor [azzurroscuro] [darkcyan]
- \definecolor [azzurrochiaro] [middlecyan]
+ \definecolor [azzurrochiaro] [middlecyan]
- \definecolor [cremisiscuro] [darkmagenta]
- \definecolor [cremisichiaro] [middlemagenta]
+ \definecolor [cremisiscuro] [darkmagenta]
+ \definecolor [cremisichiaro] [middlemagenta]
\definecolor [gialloscuro] [darkyellow]
@@ -270,7 +269,7 @@
%D Like colors, we first define the english colorgroups. These
%D colorgroups are tuned for distinctive gray scale printing.
-% todo : more efficient and real gray
+% todo : more efficient and real gray
\definecolorgroup
[gray]
@@ -523,7 +522,7 @@
\definecolor [texcolorthree] [middleblue]
\definecolor [texcolorfour] [darkyellow]
-%D Bonus (needed for FO test):
+%D Bonus (needed for FO test):
\definecolor [orange] [r=1,g=.5]
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index f3d979a4b..d9a812d45 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.10.26 15:10}
+\newcontextversion{2011.10.28 16:04}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 94e082a36..76cbd4681 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.10.26 15:10}
+\newcontextversion{2011.10.28 16:04}
%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/context-version.pdf b/tex/context/base/context-version.pdf
index 2f6eed468..78735e220 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 7ef6208ce..acb09bd39 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index d489e30b6..08dc32014 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.10.26 15:10}
+\edef\contextversion{2011.10.28 16:04}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 76056b772..7bfad2220 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.10.26 15:10}
+\edef\contextversion{2011.10.28 16:04}
%D For those who want to use this:
@@ -82,6 +82,8 @@
\loadmarkfile{cldf-ini}
+\nopdfcompression
+
% From here on we have \unexpanded being \normalprotected, as we
% already had \unexpanded long before etex came around.
@@ -123,6 +125,9 @@
\loadmarkfile{layo-ini}
\loadmarkfile{node-ini}
+
+\loadmarkfile{cldf-bas} % basics / depends on nodes
+
\loadmarkfile{node-fin}
\loadmarkfile{node-mig}
\loadmarkfile{node-par}
@@ -298,6 +303,7 @@
\loadmarkfile{tabl-nte}
\loadmarkfile{tabl-ltb}
\loadmarkfile{tabl-tsp}
+\loadmkvifile{tabl-xtb}
\loadmarkfile{java-ini}
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua
index 02dc1557b..febb5cebd 100644
--- a/tex/context/base/core-uti.lua
+++ b/tex/context/base/core-uti.lua
@@ -251,13 +251,15 @@ statistics.register("randomizer", function()
end)
function statistics.formatruntime(runtime)
- local shipped = tex.count['nofshipouts']
- local pages = tex.count['realpageno'] - 1
- if shipped > 0 or pages > 0 then
- local persecond = shipped / runtime
- if pages == 0 then pages = shipped end
- return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond)
- else
- return format("%s seconds",runtime)
+ if not environment.initex then -- else error when testing as not counters yet
+ local shipped = tex.count['nofshipouts']
+ local pages = tex.count['realpageno'] - 1
+ if shipped > 0 or pages > 0 then
+ local persecond = shipped / runtime
+ if pages == 0 then pages = shipped end
+ return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond)
+ else
+ return format("%s seconds",runtime)
+ end
end
end
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index 38611830d..73f3cc337 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -216,6 +216,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
remember = true,
diskcache = true,
renewcache = false,
+ renewtree = false,
loaderror = false,
savelists = true,
pattern = nil, -- lists
@@ -526,6 +527,39 @@ local function save_file_databases() -- will become cachers
end
end
+function resolvers.renew(hashname)
+ if hashname and hashname ~= "" then
+ local expanded = resolvers.expansion(hashname) or ""
+ if expanded ~= "" then
+ if trace_locating then
+ report_resolving("identifying tree '%s' from '%s'",expanded,hashname)
+ end
+ hashname = expanded
+ else
+ if trace_locating then
+ report_resolving("identifying tree '%s'",hashname)
+ end
+ end
+ local realpath = resolvers.resolve(hashname)
+ if lfs.isdir(realpath) then
+ if trace_locating then
+ report_resolving("using path '%s'",realpath)
+ end
+ methodhandler('generators',hashname)
+ -- could be shared
+ local content = instance.files[hashname]
+ caches.collapsecontent(content)
+ if trace_locating then
+ report_resolving("saving tree '%s'",hashname)
+ end
+ caches.savecontent(hashname,"files",content)
+ -- till here
+ else
+ report_resolving("invalid path '%s'",realpath)
+ end
+ end
+end
+
local function load_databases()
locate_file_databases()
if instance.diskcache and not instance.renewcache then
diff --git a/tex/context/base/lxml-css.mkiv b/tex/context/base/lxml-css.mkiv
index 012db826c..2174874d9 100644
--- a/tex/context/base/lxml-css.mkiv
+++ b/tex/context/base/lxml-css.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\registerctxluafile{lxml-css}{}
+\registerctxluafile{lxml-css}{1.001}
\def\ctxmodulecss#1{\directlua\zerocount{moduledata.css.#1}}
diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv
index ea4337809..3b93bf172 100644
--- a/tex/context/base/mult-aux.mkiv
+++ b/tex/context/base/mult-aux.mkiv
@@ -96,13 +96,14 @@
\expandafter\noexpand\csname detokenizedroot#2parameter\endcsname
\expandafter\noexpand\csname root#2parameter\endcsname}}
-\unexpanded\def\doinstallparameterhashhandler#1#2#3#4#5#6#7%
+\unexpanded\def\doinstallparameterhashhandler#1#2#3#4#5#6#7#8%
{\ifx#2\relax\let#2\empty\fi
\def#3##1{#4{#1#2}{##1}:}%
\def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}%
\def#5##1##2{\ifx##1\relax\else#4{##1}{##2}\fi}% is {} needed around ##1 ?
\def#6{#1#2:}%
- \def#7##1{#1##1:}}%
+ \def#7##1{#1##1:}%
+ \def#8{\ifx#2\empty\else\ifcsname#1#2:\s!parent\endcsname\else\expandafter\let\csname#1#2:\s!parent\endcsname#1\fi\fi}}
\unexpanded\def\installparameterhashhandler#1#2%
{\normalexpanded
@@ -113,14 +114,25 @@
\expandafter\noexpand\csname do#2parameterhash\endcsname
\expandafter\noexpand\csname do#2parentparameterhash\endcsname
\expandafter\noexpand\csname current#2hash\endcsname
- \expandafter\noexpand\csname named#2hash\endcsname}}
+ \expandafter\noexpand\csname named#2hash\endcsname
+ \expandafter\noexpand\csname check#2parent\endcsname}}
-\unexpanded\def\doinstallparametersethandler#1#2#3#4#5%
+\unexpanded\def\doinstallparametersethandler#1#2#3#4#5% we can speed thsi up for english
{\ifx#2\relax\let#2\empty\fi
\unexpanded\def#3{\dosetvalue{#1#2:}}% ##1 {##2} (braces are mandate)
\unexpanded\def#4{\doletvalue{#1#2:}}% ##1 ##2
\unexpanded\def#5{\doletvalue{#1#2:}\empty}}% ##1
+\startinterface english
+
+ \unexpanded\def\doinstallparametersethandler#1#2#3#4#5%
+ {\ifx#2\relax\let#2\empty\fi
+ \unexpanded\def#3##1{\expandafter\def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate)
+ \unexpanded\def#4##1{\expandafter\let\csname#1#2:##1\endcsname}% ##1 ##2
+ \unexpanded\def#5##1{\expandafter\let\csname#1#2:##1\endcsname\empty}}% ##1
+
+\stopinterface
+
\unexpanded\def\installparametersethandler#1#2%
{\normalexpanded
{\doinstallparametersethandler
diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv
index b96e267b0..051b32ded 100644
--- a/tex/context/base/mult-sys.mkiv
+++ b/tex/context/base/mult-sys.mkiv
@@ -603,6 +603,7 @@
\definesystemvariable {lt} % LiTeratuur
\definesystemvariable {lr} % LayeR
\definesystemvariable {ls} % languageScript
+\definesystemvariable {lt} % LuaTables
\definesystemvariable {ly} % LaYout
\definesystemvariable {ma} % MargeAchtergrond
\definesystemvariable {mb} % MargeBlokken
diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua
index fc5b8ff9c..a7246e9ca 100644
--- a/tex/context/base/node-aux.lua
+++ b/tex/context/base/node-aux.lua
@@ -339,3 +339,21 @@ local function locate(start,wantedid,wantedsubtype)
end
nodes.locate = locate
+
+function nodes.concat(list) -- no slide !
+ local head, tail
+ for i=1,#list do
+ local li = list[i]
+ if not li then
+ -- skip
+ elseif head then
+ tail.next = li
+ li.prev = tail
+ tail = li
+ else
+ head = li
+ tail = li
+ end
+ end
+ return head, tail
+end
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index af0e417f2..48ec81471 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -985,7 +985,7 @@
\boxhasformatfalse
\else
\boxhasformattrue
- \dosetraggedcommand\localformat
+ \dosetraggedcommand\localformat % not that fast
\edef\dobeforeframedbox{\raggedtopcommand\framedparameter\c!top}%
\edef\doafterframedbox {\framedparameter\c!bottom\raggedbottomcommand}%
\fi
@@ -1301,10 +1301,16 @@
\let\postprocessframebox\relax % prevent nesting
\next\framebox
\fi
- \ifboxhasframe % real or invisible frame
- \dooutlinebox
+ \iftrialtypesetting
+ % new
+ \else
+ \ifboxhasframe % real or invisible frame
+ \dooutlinebox
+ \fi
+ \ifx\framedbackground\empty \else
+ \dobackedbox
+ \fi
\fi
- \ifx\framedbackground\empty\else\dobackedbox\fi
\handleframedlocator\c!after\@@locallocation
\box\framebox
\egroup
@@ -1506,14 +1512,6 @@
%D ourselves a frame and/or background, but no content, so
%D actually we have a sort of phantom framed box.
-%D Because color marks and specials can interfere with
-%D spacing, we provide a way to specify a foregroundcolor.
-
-\def\docolorframebox
- {\doifcolor\framedforegroundcolor
- {\setbox\framebox\hbox{\faststartcolor[\framedforegroundcolor]\box\framebox\faststopcolor}}}
- %{\setbox\framebox\hbox{\doactivatecolor\framedforegroundcolor\box\framebox}}}
-
%D \macros
%D {mframed, minframed}
%D
@@ -1735,7 +1733,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\oninterlineskip
\hsize\!!framedwidth
\vsize\!!framedheight
@@ -1754,7 +1754,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\oninterlineskip
\hsize\!!framedwidth
\vsize\!!framedheight
@@ -1773,7 +1775,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\oninterlineskip
\doframedsetups
\raggedcommand
@@ -1790,7 +1794,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\oninterlineskip
\hsize\!!framedwidth
\doframedsetups
@@ -1808,7 +1814,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\vsize\!!framedheight
\doframedsetups
\vss
@@ -1826,7 +1834,9 @@
\bgroup
\let\postprocessframebox\relax
\framedforgetall
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\doframedsetups
\hss
\localstrut
@@ -1838,7 +1848,9 @@
\def\doformatboxNoSize
{\hbox
\bgroup
+\iftrialtypesetting \else
\setframedforegroundcolor
+\fi
\let\postprocessframebox\relax
\doframedsetups
\localstrut
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index b7418bd0b..e5e815d19 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -180,9 +180,6 @@
\setvalue{\@@ragged@@hbox\v!flushright}{\def\raggedbox{\doalignedline\v!left }}
\setvalue{\@@ragged@@hbox\v!center }{\def\raggedbox{\doalignedline\v!middle}}
-\def\dosetraggedcommand#1%
- {\normalexpanded{\noexpand\dodosetraggedcommand{#1}}}
-
\newtoks\everyraggedcommand
\def\raggedcommand{\the\everyraggedcommand}
@@ -191,35 +188,69 @@
\let\raggedbox\relax
-\unexpanded\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that!
+% pretty slow (will be sped up)
+
+\unexpanded\def\dosetraggedcommand#1% beware: #1=empty is ignored, keep that! assumes \forgetall
+ {\edef\askedraggedalign{#1}%
+ \ifx\askedraggedalign\empty
+ \nonosetraggedcommand
+ \else
+ \dodosetraggedcommand
+ \fi}
+
+\def\nonosetraggedcommand
+ {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
+ \let\raggedtopcommand\empty
+ \let\raggedbottomcommand\empty
+ \let\raggedbox\relax
+ \setfalse\raggedonelinerstate}
+
+\def\dodosetraggedcommand % beware: #1=empty is ignored, keep that!
{\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
\let\raggedtopcommand\empty
\let\raggedbottomcommand\empty
\let\raggedbox\relax
\setfalse\raggedonelinerstate
- \doifsomething{#1}%
- {\doifinsetelse\v!broad{#1}\!!doneatrue\!!doneafalse
- \doifinsetelse\v!wide {#1}\!!donebtrue\!!donebfalse
- \!!donectrue
- \rawprocesscommalist[#1]\dododosetraggedcommand}}
+ \ifcsname\@@ragged@@command\askedraggedalign\endcsname % fast for one keyword and special table case
+ \!!doneafalse
+ \!!donebfalse
+ \!!donectrue
+ \csname\@@ragged@@command\askedraggedalign\endcsname
+ \else
+ \doifinsetelse\v!broad\askedraggedalign\!!doneatrue\!!doneafalse
+ \doifinsetelse\v!wide \askedraggedalign\!!donebtrue\!!donebfalse
+ \!!donectrue
+ \rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand
+ \fi}
+
+\setvalue{\@@ragged@@command\v!table}% {flushleft,broad,high}
+ {\let\raggedbottomcommand\vfilll
+ \appendtoks\veryraggedright\to\everyraggedcommand}
\def\dododosetraggedcommand#1%
- {\executeifdefined{\@@ragged@@command\string#1}\relax}
+% {\executeifdefined{\@@ragged@@command\string#1}\relax}
+ {\csname\@@ragged@@command#1\endcsname}
+
+\def\ragged_command_tolerant {\tolerance3000\relax}
+\def\ragged_command_very_tolerant{\tolerance4500\relax}
+\def\ragged_command_stretch {\emergencystretch\bodyfontsize}
+
+% \everyraggedcommand\expandafter{\the\everyraggedcommand#1}
\setvalue{\@@ragged@@command\v!hanging }{\appendtoks\enableprotruding \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!nothanging }{\appendtoks\disableprotruding \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!hz }{\appendtoks\enableadjusting \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!nohz }{\appendtoks\disableadjusting \to\everyraggedcommand}
-% \setvalue{\@@ragged@@command\v!spacing }{\appendtoks\enablespacehandling
-% \enablekernhandling \to\everyraggedcommand}
-% \setvalue{\@@ragged@@command\v!nospacing }{\appendtoks\disablespacehandling
-% \disablekernhandling \to\everyraggedcommand}
+%setvalue{\@@ragged@@command\v!spacing }{\appendtoks\enablespacehandling
+% \enablekernhandling \to\everyraggedcommand}
+%setvalue{\@@ragged@@command\v!nospacing }{\appendtoks\disablespacehandling
+% \disablekernhandling \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!hyphenated }{\appendtoks\dohyphens \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!nothyphenated}{\appendtoks\nohyphens \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!tolerant }{\appendtoks\tolerance3000\relax \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!verytolerant}{\appendtoks\tolerance4500\relax \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!stretch }{\appendtoks\emergencystretch\bodyfontsize\to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!tolerant }{\appendtoks\ragged_command_tolerant \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!verytolerant }{\appendtoks\ragged_command_very_tolerant\to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!stretch }{\appendtoks\ragged_command_stretch \to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!left}%
{\if!!donea \appendtoks\veryraggedleft\to\everyraggedcommand
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index f2006bb38..81a7c47e7 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 5fb64b64f..9a59f9df0 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv
index 219ff812a..4d94018ca 100644
--- a/tex/context/base/strc-flt.mkiv
+++ b/tex/context/base/strc-flt.mkiv
@@ -238,70 +238,30 @@
%
% potential sync bug with sectionblocks, see uguide.tex
-% NOT YET REDONE ! ! ! ! !
+% begin of todo
- \unexpanded\def\placefloatcaption
- {\dodoubleempty\doplacefloatcaption}
+\unexpanded\def\placefloatcaption{\dodoubleempty\doplacefloatcaption}
+\unexpanded\def\setfloatcaption {\dodoubleempty\dodosetfloatcaption}
- \long\def\doplacefloatcaption[#1][#2]#3%
- {\setfloatcaption[#1][#2]{#3}%
- \placefloatcaptiontext[#1]%
- \placefloatcaptionreference[#1]}
+\def\doplacefloatcaption[#1][#2]#3{[not supported]}
+\def\dodosetfloatcaption[#1][#2]#3{[not supported]} % \dosetfloatcaption already in use
- \unexpanded\def\setfloatcaption % \dosetfloatcaption already in use
- {\dodoubleempty\dodosetfloatcaption} % beware, name clash
+\unexpanded\def\placefloatcaptiontext [#1]{[not suported yet]}
+\unexpanded\def\placefloatcaptionnumber [#1]{[not suported yet]}
+\unexpanded\def\placefloatcaptionreference[#1]{[not suported yet]}
- \long\def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
- {\ifnofloatnumber % also handle trialtypesetting
- \letgvalue{@fl@r@#1}\relax
- \letgvalue{@fl@t@#1}\relax
- \else
- \preparefloatnumber{#1}%
- \letgvalue{@fl@n@#1}\composedsectionnumber
- % indirect macro can be more efficient
- \setgvalue{@fl@r@#1}%
- {\tracefloatnumber{#1}%
- \ifconditional\retainfloatnumber\else
- % todo
- \fi
- \letgvalue{@fl@r@#1}\relax}% nils
- \setgvalue{@fl@t@#1}%
- {\preparefullnumber{\??kj#1}{\getvalue{@fl@n@#1}}\preparednumber % !!!!!!!!!!!!!!!!!!!!!!!!!!! wrong
- \begingroup
- \dosetfloatcaptionattributes\c!style\c!color
- \begingroup
- \dosetfloatcaptionattributes\c!headstyle\c!headcolor
- \labeltexts{#1}{\preparednumber}%
- \endgroup
- \begingroup
- \dosetfloatcaptionattributes\c!textstyle\c!textcolor
- \dotfskip{\floatcaptionparameter\c!distance}#3%
- \endgroup
- \endgroup}%
- \fi}
-
- \long\def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
- {\letgvalue{@fl@r@#1}\relax
- \letgvalue{@fl@t@#1}\relax}
-
- \unexpanded\def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}}
- \unexpanded\def\placefloatcaptionnumber [#1]{\getvalue{@fl@n@#1}}
- \unexpanded\def\placefloatcaptionreference[#1]{\getvalue{@fl@r@#1}}
-
- % still needed for uguide
-
- \let\placefloatlabel \placefloatcaption
- \let\placefloatlabeltext \placefloatcaptiontext
- \let\placefloatlabelreference \placefloatcaptionreference
-
-% TILL HERE
+\let\placefloatlabel \placefloatcaption
+\let\placefloatlabeltext \placefloatcaptiontext
+\let\placefloatlabelreference\placefloatcaptionreference
+
+% end of todo
\newbox\captionbox
\long\def\putcompletecaption#1#2%
{\doifsomething{\floatcaptionparameter\c!spacebefore}{\blank[\floatcaptionparameter\c!spacebefore]}%
%\floatcaptionparameter\c!before % test for side effects first
-\synchronizedisplaydirection % temp hack, till we have a proper model
+ \synchronizedisplaydirection % temp hack, till we have a proper model
\noindent
\gdef\lastcaptiontag{\strut#1}% was xdef
\begingroup
@@ -412,48 +372,6 @@
\def\tracefloatnumber#1%
{\doifnot{\rootfloatparameter\c!numbering}\v!nocheck{\tagnodelocation{\v!float\@@thenumber{#1}}}}
-\newconditional\retainfloatnumber
-
-\def\preparefloatnumber#1% use in special case see below
- {\xdef\floatcaptionnumber{#1}%
- \doifelsenodelocation{\v!float\@@thenumber{#1}}
- \donothing {\nodelocationmode\zerocount}%
- \doifelse{\rootfloatparameter\c!numbering}\v!nocheck
- {\incrementnumber[#1]%
- \makesectionnumber[#1]%
- \ifconditional\retainfloatnumber\decrementnumber[#1]\fi}
- {\ifinsidecolumns
- \nodelocationmode\zerocount
- % to be perfected:
- % \nodelocationmode\plustwo
- \fi
-% FOR THE MOMENT NOT AVAILABLE
-\nodelocationmode\zerocount
-% BUT NOT THAT HARD TO DO
- \ifcase\nodelocationmode
- \incrementnumber[#1]%
- \makesectionnumber[#1]%
- \ifconditional\retainfloatnumber\decrementnumber[#1]\fi
- \else
- % force check, so that we get a proper way-sync and
- % can use the accumulated number
- % \checknumber[#1]% \incrementnumber does this
- \incrementnumber[#1]%
- \savenumber[#1]%
- % the real work is done here
- \nextnodelocation{\v!float\@@thenumber{#1}}% better \nextfloatnumber
- \analyzenodelocation{\v!float\@@thenumber{#1}}%
- \scratchcounter\getnodelocationo{\v!float\@@thenumber{#1}}%
- \advance\scratchcounter\minusone
- % here we correct for 'per whatever handling'
- \advance\scratchcounter-\accumulatednumber[#1]%
- \setnumber[#1]\scratchcounter
- \incrementnumber[#1]%
- \makesectionnumber[#1]%
- \restorenumber[#1]%
- % now we're back to normal numbering
- \fi}}
-
%D test case:
%D
%D \starttyping
@@ -504,6 +422,7 @@
\egroup
\endgroup}
+
\def\flushfloatslist
{\v!left,\v!right,\v!inner,\v!outer,%
\v!backspace,\v!cutspace,%
@@ -534,7 +453,7 @@
\the\everyinsidefloat
\let\@@extrafloat\empty
\presetmorefloatvariables{#2}%
-\dostarttagged\t!floatcontent\empty
+ \dostarttagged\t!floatcontent\empty
\dowithnextboxcontent % better a \the\everyfloattoks
{\setlocalfloathsize
\floatparameter\c!inner
@@ -557,7 +476,7 @@
\doinhibitblank
\fi}% better move this to side floats
\vbox}
-
+
\def\xxdocompletefloat#1#2%
{\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}}
@@ -567,7 +486,7 @@
\let\floatrotation\!!zerocount
-\long\def\presetfloatvariables#1#2#3#4%
+\unexpanded\def\presetfloatvariables#1#2#3#4%
{\doifcommonelse
{#2}
{\v!left,\v!right,\v!inner,\v!outer,%
@@ -623,14 +542,8 @@
{\global\nofloatnumbertrue}}%
% this has to change
\ConvertToConstant\doifelse{#4}{}
-% \ConvertToConstant\doifelse{\detokenize{#4}}{}
{\global\emptyfloatcaptiontrue}
{\global\emptyfloatcaptionfalse}%
-% \doifinsetelse\v!none{#2}
-% {\global\nofloatcaptiontrue}
-% {\ConvertToConstant\doifelse{#4}\v!none
-% {\global\nofloatcaptiontrue}
-% {\global\nofloatcaptionfalse}}%
\doifinsetelse\v!none{#2}
{\global\nofloatcaptiontrue}
{\global\nofloatcaptionfalse}%
@@ -666,7 +579,7 @@
\xdef\naturalfloatwidth {\the\wd#1}%
\xdef\naturalfloatdepth {\the\dp#1}}
-\long\def\doifelsemainfloatbody#1#2%
+\def\doifelsemainfloatbody#1#2%
{\ifinsidesplitfloat\ifconditional\splitfloatfirstdone#2\else#1\fi\else#1\fi}
% todo: optional user pars
@@ -920,7 +833,7 @@
\inheritedfloatframed{#1}%
\endgroup}
-\long\def\docomplexreserveblock[#1][#2][#3][#4]#5%
+\def\docomplexreserveblock[#1][#2][#3][#4]#5%
{\getvalue{\e!place#1}[#3][#4]{#5}{\dodocomplexreserveblock{#1}{#2}}}
\def\docomplexstartreservetextblock[#1][#2][#3][#4]%
@@ -964,16 +877,18 @@
\global#1\ht\scratchbox}}}
\def\calculatefloatskips
- {{\docalculatefloatskip\floattopskip{\rootfloatparameter\c!spacebefore}%
- \docalculatefloatskip\floatbottomskip{\rootfloatparameter\c!spaceafter}%
- \docalculatefloatskip\sidefloattopskip{\rootfloatparameter\c!sidespacebefore}%
- \docalculatefloatskip\sidefloatbottomskip{\rootfloatparameter\c!sidespaceafter}%
- \gdef\sidefloattopoffset{\openstrutdepth}% was \def
- \global\floatsideskip\rootfloatparameter\c!margin
- \global\sidefloatleftshift\floatparameter\c!leftmargindistance
- \global\sidefloatrightshift\floatparameter\c!rightmargindistance
- \global\noftopfloats\rootfloatparameter\c!ntop\relax
- \global\nofbotfloats\rootfloatparameter\c!nbottom\relax}}
+ {\begingroup
+ \docalculatefloatskip\floattopskip{\rootfloatparameter\c!spacebefore}%
+ \docalculatefloatskip\floatbottomskip{\rootfloatparameter\c!spaceafter}%
+ \docalculatefloatskip\sidefloattopskip{\rootfloatparameter\c!sidespacebefore}%
+ \docalculatefloatskip\sidefloatbottomskip{\rootfloatparameter\c!sidespaceafter}%
+ \gdef\sidefloattopoffset{\openstrutdepth}% was \def
+ \global\floatsideskip\rootfloatparameter\c!margin
+ \global\sidefloatleftshift\floatparameter\c!leftmargindistance
+ \global\sidefloatrightshift\floatparameter\c!rightmargindistance
+ \global\noftopfloats\rootfloatparameter\c!ntop\relax
+ \global\nofbotfloats\rootfloatparameter\c!nbottom\relax
+ \endgroup}
% beter de laatste skip buiten de \insert uitvoeren,
% bovendien bij volle flush onder baseline.
@@ -1820,13 +1735,6 @@
\let\floatrow \empty
\let\forcedfloatmethod\empty
-% \def\setfloatmethodvariables#1%
-% {\getfromcommalist[#1][1]%
-% \@EA\beforesplitstring\commalistelement\at:\to\floatmethod
-% \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
-% \@EA\aftersplitstring \floatcolumn\at*\to\floatrow
-% \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn}
-
\def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn
{\ctxcommand{analysefloatmethod("#1")}}
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 011e25e48..1a90c89b0 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -258,6 +258,16 @@
%D test in a run. Of course it also is more convenient to read a
%D trace then.
+% We could make variants without the \if_next_blank_space_token but
+% the overhead is only .1 sec on 3.5 for 10^6 tests and often that
+% branch is not entered anyway. The fast variants with less checking
+% do make a difference however:
+
+% \testfeature{1000000}{\doifnextoptionalelse \gobbleoneargument\gobbleoneargument[} % 2.902s
+% \testfeature{1000000}{\doifnextoptionalcselse \gobbleoneargument\gobbleoneargument[} % 2.590s
+% \testfeature{1000000}{\doiffastoptionalcheckelse \gobbleoneargument\gobbleoneargument[} % 2.387s
+% \testfeature{1000000}{\doiffastoptionalcheckcselse\gobbleoneargument\gobbleoneargument[} % 2.168s
+
\newif\if_next_blank_space_token
\let\next_optional_character_token=[
@@ -268,6 +278,12 @@
\let\if_next_blank_space_token\iffalse
\futurelet\nexttoken\inspect_next_optional_character}
+\unexpanded\def\doifnextoptionalcselse#1#2% \cs \cs (upto 10% faster)
+ {\let\next_optional_command_yes#1%
+ \let\next_optional_command_nop#2%
+ \let\if_next_blank_space_token\iffalse
+ \futurelet\nexttoken\inspect_next_optional_character}
+
\def\inspect_next_optional_character
{\ifx\nexttoken\blankspace
\expandafter\reinspect_next_optional_character
@@ -331,7 +347,11 @@
\unexpanded\def\doiffastoptionalcheckelse#1#2%
{\def\next_optional_command_yes{#1}%
\def\next_optional_command_nop{#2}%
- \let\if_next_blank_space_token\iffalse % not needed
+ \futurelet\nexttoken\do_if_fast_optional_check_else}
+
+\unexpanded\def\doiffastoptionalcheckcselse#1#2% \cs \cs
+ {\let\next_optional_command_yes#1%
+ \let\next_optional_command_nop#2%
\futurelet\nexttoken\do_if_fast_optional_check_else}
\def\do_if_fast_optional_check_else
@@ -952,10 +972,14 @@
%D The hack we used for checking the next character
%D \type {\doifnextcharelse} is also used here.
-\def\:{\re_do_process_comma_item}
+\let\next\:
+
+\def\:{\re_do_process_comma_item} % \:not saved ?
\expandafter\def\: {\futurelet\nexttoken\do_do_process_comma_item}
+\let\:\next
+
%D The previous examples lead to:
%D
%D \getbuffer
diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv
index 573b18858..960833731 100644
--- a/tex/context/base/tabl-ntb.mkiv
+++ b/tex/context/base/tabl-ntb.mkiv
@@ -71,12 +71,6 @@
%D To Do:
%D
%D \starttyping
-%D splitsen = ja | herhaal => als nofTH>1 then ja als herhaal
-%D \stoptyping
-
-%D To Do:
-%D
-%D \starttyping
%D break over pagina
%D kop herhalen
%D reset settings
diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv
index f43ff8138..2e89aa2d8 100644
--- a/tex/context/base/tabl-tsp.mkiv
+++ b/tex/context/base/tabl-tsp.mkiv
@@ -59,7 +59,7 @@
\the\everysplitfloatsetup
\def\splitfloatcommand{#2}%
\global\settrue \onlyonesplitofffloat
- \global\setfalse\somenextplitofffloat
+ \global\setfalse\somenextsplitofffloat
\dopushsavedfloats
\@@sibefore
\let\next} % \bgroup
@@ -71,7 +71,7 @@
\fi}
\settrue \onlyonesplitofffloat
-\setfalse\somenextplitofffloat
+\setfalse\somenextsplitofffloat
%D When \type {inbetween} is made empty instead of the
%D default \type {\page}, we will get delayed flushing
@@ -109,24 +109,18 @@
\global\settrue\splitfloatdone
\nodelocationmode\zerocount % bypass auto-renumbering
\global\advance\noffloatssplits\plusone
- \ifcase\noffloatssplits\relax
- \or
+ \ifcase\noffloatssplits\relax \or
\ifconditional\onlyonesplitofffloat
\let\floatcaptionsuffix\empty
\fi
- \else
- \global\settrue\usesamefloatnumber % one shot
\fi
\bgroup
- \ifconditional\somenextplitofffloat
- \settrue\retainfloatnumber
- \notesenabledfalse % best here, experimental, brrr; test with note in caption
- \else
- \setfalse\retainfloatnumber
- \fi
- \splitfloatcommand{\box\nextbox}%
+ \ifconditional\somenextsplitofffloat
+ \notesenabledfalse % best here, experimental, brrr; test with note in caption
+ \fi
+ \splitfloatcommand{\box\nextbox}%
\egroup
- \ifconditional\somenextplitofffloat
+ \ifconditional\somenextsplitofffloat
\doifelsenothing\@@siinbetween
{\ifconditional\splitfloatfirstdone\else\page\fi}
\@@siinbetween
@@ -150,29 +144,29 @@
{\ifinsidesplitfloat
% \ifdim\ht#1=\zeropoint % funny: \ifcase does not check for overflow
\ifcase\ht#1\relax
- \global\setfalse\somenextplitofffloat
+ \global\setfalse\somenextsplitofffloat
\else
- \global\settrue \somenextplitofffloat
+ \global\settrue \somenextsplitofffloat
\global\setfalse\onlyonesplitofffloat
\fi
\fi}
-\def\analyzesplitfloatcaption#1% depends on page-flt
- {\doif\extrasplitfloatlines\v!auto
- {\bgroup
- \settrue\retainfloatnumber
- \nodelocationmode\zerocount
+\def\analyzesplitfloatcaption#1% depends on page-flt .. pretty messy
+ {\edef\extrasplitfloatlines{\extrasplitfloatlines}%
+ \ifx\extrasplitfloatlines\v!auto
+ \bgroup
\forcelocalfloats
\setuplocalfloats[\c!before=,\c!after=,\c!inbetween=]%
- \splitfloatcommand{\hbox to \wd#1{\strut}}% dummy line
+ \splitfloatcommand{\hbox to #1{\strut}}% dummy line
\setbox\scratchbox\vbox{\flushlocalfloats}%
\getnoflines{\ht\scratchbox}%
\resetlocalfloats
\advance\noflines\minusone % compensate dummy line
- \expanded{\egroup\noexpand\edef\noexpand\extrasplitfloatlines{\the\noflines}}}}
-
-% \def\analyzesplitfloatcaption#1%
-% {\edef\extrasplitfloatlines{11}}
+ \normalexpanded{\egroup\noexpand\edef\noexpand\extrasplitfloatlines{\the\noflines}}%
+ \global\settrue\usesamefloatnumber
+ \else
+ \doifnumberelse\extrasplitfloatlines\donothing{\def\extrasplitfloatlines{1}}%
+ \fi}
\def\dowithsplitofffloat % nextbox
{\ifinsidesplitfloat
@@ -228,7 +222,7 @@
\newconditional\splitfloatfirstdone
\def\handletsplit
- {\analyzesplitfloatcaption\tsplitcontent
+ {\analyzesplitfloatcaption{\wd\tsplitcontent}%
\global\setfalse\splitfloatfirstdone
\testpagesync % new, sync, but still tricky
[\tsplitminimumfreelines]
@@ -311,6 +305,7 @@
\tsplitinbetween
\unvcopy\tsplittail}%
\dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}%
+ \global\settrue\usesamefloatnumber % new, prevent next increment
\doifnotinsidesplitfloat\tsplitafter
\endgraf
\exitloop
@@ -335,6 +330,63 @@
\doifnotinsidesplitfloat\page
\fi
\fi}%
+ \global\setfalse\usesamefloatnumber % new, prevent next increment
+ \global\setfalse\splitfloatfirstdone} % we can use this one for tests
+
+%D The next one assumes that the split takes place elsewhere. This is
+%D used in xtables.
+
+\let\resetdirecttsplit\resettsplit
+
+\def\tsplitdirectwidth{\hsize}
+
+\def\handledirecttsplit
+ {\analyzesplitfloatcaption{\tsplitdirectwidth}%
+ \global\setfalse\splitfloatfirstdone
+ \testpagesync % new, sync, but still tricky
+ [\tsplitminimumfreelines]
+ [\dimexpr\tsplitminimumfreespace+\extrasplitfloatlines\lineheight\relax]%
+ \doloop
+ {\ifinsidecolumns
+ \global\setfalse\splitfloatfirstdone
+ \scratchdimen\textheight
+ \else\ifconditional\splitfloatfirstdone
+ \scratchdimen\textheight
+ \else\ifdim\pagegoal<\maxdimen
+ \scratchdimen\dimexpr\pagegoal-\pagetotal\relax
+ \else
+ \scratchdimen\textheight
+ \fi\fi\fi
+ \scratchdimen\dimexpr\scratchdimen-\tsplitminimumfreespace-\extrasplitfloatlines\lineheight\relax
+ \tsplitdirectsplitter\scratchdimen % also sets state
+ \ifdim\ht\tsplitresult>\zeropoint
+ \ifconditional\somenextsplitofffloat
+ \global\setfalse\onlyonesplitofffloat
+ \fi
+ \ifdim\pagegoal<\maxdimen
+ \global\pagegoal\dimexpr\pagegoal+\lineheight\relax % etex
+ \fi
+ \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}%
+ \global\settrue\usesamefloatnumber % new, prevent next increment
+ \endgraf
+ \ifconditional\somenextsplitofffloat
+ \ifinsidecolumns
+ \goodbreak
+ \else
+ \page
+ \fi
+ \fi
+ \global\settrue\splitfloatfirstdone
+ \else\ifconditional\somenextsplitofffloat
+ \ifinsidecolumns
+ \goodbreak
+ \else
+ \page % no room
+ \fi
+ \else
+ \exitloop
+ \fi\fi}%
+ \global\setfalse\usesamefloatnumber % new, prevent next increment
\global\setfalse\splitfloatfirstdone} % we can use this one for tests
\protect \endinput
diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua
new file mode 100644
index 000000000..c27371254
--- /dev/null
+++ b/tex/context/base/tabl-xtb.lua
@@ -0,0 +1,606 @@
+if not modules then modules = { } end modules ['tabl-xtb'] = {
+ version = 1.001,
+ comment = "companion to tabl-xtb.mkvi",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local texdimen = tex.dimen
+local texcount = tex.count
+local texbox = tex.box
+local texsetcount = tex.setcount
+local texsetdimen = tex.setdimen
+
+local format = string.format
+
+local context = context
+local context_beginvbox = context.beginvbox
+local context_endvbox = context.endvbox
+local context_blank = context.blank
+local context_nointerlineskip = context.nointerlineskip
+
+local variables = interfaces.variables
+
+local setmetatableindex = table.setmetatableindex
+local copy_node_list = node.copy_list
+local hpack_node_list = node.hpack
+local vpack_node_list = node.vpack
+local slide_node_list = node.slide
+local flush_node_list = node.flush_list
+
+local new_glue = nodes.pool.glue
+local new_kern = nodes.pool.kern
+
+local v_stretch = variables.stretch
+local v_normal = variables.normal
+local v_width = variables.width
+local v_repeat = variables["repeat"]
+
+xtables = { }
+
+local head_mode = 1
+local foot_mode = 2
+local more_mode = 3
+local body_mode = 4
+
+local stack, data = { }, nil
+
+function xtables.create(settings)
+ table.insert(stack,data)
+ local rows = { }
+ local widths = { }
+ local heights = { }
+ local depths = { }
+ local spans = { }
+ local distances = { }
+ local modes = { }
+ data = {
+ rows = rows,
+ widths = widths,
+ heights = heights,
+ depths = depths,
+ spans = spans,
+ distances = distances,
+ modes = modes,
+ nofrows = 0,
+ nofcolumns = 0,
+ currentrow = 0,
+ currentcolumn = 0,
+ settings = settings or { },
+ }
+ local function add_zero(t,k)
+ t[k] = 0
+ return 0
+ end
+ local function add_cell(row,c)
+ local cell = {
+ nx = 0,
+ ny = 0,
+ list = false,
+ }
+ row[c] = cell
+ if c > data.nofcolumns then
+ data.nofcolumns = c
+ end
+ return cell
+ end
+ local function add_row(rows,r)
+ local row = { }
+ setmetatableindex(row,add_cell)
+ rows[r] = row
+ if r > data.nofrows then
+ data.nofrows = r
+ end
+ return row
+ end
+ setmetatableindex(rows,add_row)
+ setmetatableindex(widths,add_zero)
+ setmetatableindex(heights,add_zero)
+ setmetatableindex(depths,add_zero)
+ setmetatableindex(distances,add_zero)
+ setmetatableindex(modes,add_zero)
+ --
+ settings.columndistance = tonumber(settings.columndistance) or 0
+ settings.rowdistance = tonumber(settings.rowdistance) or 0
+ settings.leftmargindistance = tonumber(settings.leftmargindistance) or 0
+ settings.rightmargindistance = tonumber(settings.rightmargindistance) or 0
+ settings.options = utilities.parsers.settings_to_hash(settings.option)
+ settings.textwidth = tonumber(settings.textwidth) or tex.hsize
+ -- if #stack > 0 then
+ -- settings.textwidth = tex.hsize
+ -- end
+end
+
+function xtables.initialize_one()
+ local r = data.currentrow
+ local c = data.currentcolumn + 1
+ local drc = data.rows[r][c]
+ drc.nx = texcount.x_table_nx
+ drc.ny = texcount.x_table_ny
+ local distances, distance = data.distances, texdimen.x_table_distance
+ if distance > distances[c] then
+ distances[c] = distance
+ end
+ data.currentcolumn = c
+end
+
+function xtables.set_one()
+ local r = data.currentrow
+ local c = data.currentcolumn
+ local rows = data.rows
+ local row = rows[r]
+ while row[c].span do -- can also be previous row ones
+ c = c + 1
+ end
+ local tb = texbox.x_table_box
+ local drc = row[c]
+ --
+ drc.list = true -- we don't need to keep the content around as we're in trial mode (no: copy_node_list(tb))
+ --
+ local widths, width = data.widths, tb.width
+ if width > widths[c] then
+ widths[c] = width
+ end
+ local heights, height = data.heights, tb.height
+ if height > heights[r] then
+ heights[r] = height
+ end
+ local depths, depth = data.depths, tb.depth
+ if depth > depths[r] then
+ depths[r] = depth
+ end
+ --
+ local nx, ny = drc.nx, drc.ny
+ if nx > 1 or ny > 1 then
+ local spans = data.spans
+ local self = true
+ for y=1,ny do
+ for x=1,nx do
+ if self then
+ self = false
+ else
+ local ry = r + y - 1
+ local cx = c + x - 1
+ if y > 1 then
+ spans[ry] = true
+ end
+ rows[ry][cx].span = true
+ end
+ end
+ end
+ c = c + nx - 1
+ end
+ if c > data.nofcolumns then
+ data.nofcolumns = c
+ end
+ data.currentcolumn = c
+end
+
+function xtables.initialize_two()
+ local r = data.currentrow
+ local c = data.currentcolumn + 1
+ local rows = data.rows
+ local row = rows[r]
+ while row[c].span do -- can also be previous row ones
+ c = c + 1
+ end
+ data.currentcolumn = c
+ local widths = data.widths
+ local heights = data.heights
+ local depths = data.depths
+ local w = widths[c]
+ local h = heights[r]
+ local d = depths[r]
+ local drc = row[c]
+ for x=1,drc.nx-1 do
+ w = w + widths[c+x]
+ end
+ for y=1,drc.ny-1 do
+ h = h + heights[c+y]
+ d = d + depths[c+y]
+ end
+ texdimen.x_table_width = w
+ texdimen.x_table_height = h + d
+ texdimen.x_table_depth = 0
+end
+
+function xtables.set_two()
+ local r = data.currentrow
+ local c = data.currentcolumn
+ local rows = data.rows
+ local row = rows[r]
+ while row[c].span do -- can also be previous row ones
+ c = c + 1
+ end
+ local drc = row[c]
+ -- this will change as soon as in luatex we can reset a box list without freeing
+ drc.list = copy_node_list(texbox.x_table_box)
+ c = c + drc.nx - 1
+ data.currentcolumn = c
+end
+
+function xtables.reflow()
+ local nofrows = data.nofrows
+ local nofcolumns = data.nofcolumns
+ local rows = data.rows
+ for r=1,nofrows do
+ local row = rows[r]
+ for c=1,nofcolumns do
+ local drc = row[c]
+ if drc.list then
+ --- flush_node_list(drc.list)
+ drc.list = false
+ end
+ end
+ end
+ -- spread
+ local settings = data.settings
+ local options = settings.options
+ if options[v_stretch] then
+ local widths = data.widths
+ local distances = data.distances
+ local width = 0
+ local distance = 0
+ for c=1,nofcolumns do
+ width = width + widths[c]
+ if c < nofcolumns then
+ distance = distance + distances[c]
+ end
+ end
+ local delta = settings.textwidth - width - distance - (nofcolumns-1) * settings.columndistance
+ - settings.leftmargindistance - settings.rightmargindistance
+ if delta > 0 then
+ if options[v_width] then
+ for c=1,nofcolumns do
+ widths[c] = widths[c] + delta * widths[c] / width
+ end
+ else
+ local plus = delta / nofcolumns
+ for c=1,nofcolumns do
+ widths[c] = widths[c] + plus
+ end
+ end
+ end
+ end
+ --
+ data.currentrow = 0
+ data.currentcolumn = 0
+end
+
+function xtables.construct()
+ local rows = data.rows
+ local heights = data.heights
+ local depths = data.depths
+ local widths = data.widths
+ local spans = data.spans
+ local distances = data.distances
+ local modes = data.modes
+ local settings = data.settings
+ local nofcolumns = data.nofcolumns
+ local nofrows = data.nofrows
+ local columndistance = settings.columndistance
+ local rowdistance = settings.rowdistance
+ local leftmargindistance = settings.leftmargindistance
+ local rightmargindistance = settings.rightmargindistance
+ -- ranges can be mixes so we collect
+ local ranges = {
+ [head_mode] = { },
+ [foot_mode] = { },
+ [more_mode] = { },
+ [body_mode] = { },
+ }
+ for r=1,nofrows do
+ local m = modes[r]
+ if m == 0 then
+ m = body_mode
+ end
+ local range = ranges[m]
+ range[#range+1] = r
+ end
+ -- todo: hook in the splitter ... the splitter can ask for a chunk of
+ -- a certain size ... no longer a split memory issue then and header
+ -- footer then has to happen here too .. target height
+ local function packaged_column(r)
+ local row = rows[r]
+ local start = nil
+ local stop = nil
+ if leftmargindistance > 0 then
+ start = new_kern(leftmargindistance)
+ stop = start
+ end
+ for c=1,nofcolumns do
+ local drc = row[c]
+ local list = drc.list
+ if list then
+ list.shift = list.height + list.depth
+ list = hpack_node_list(list) -- is somehow needed
+ list.width = 0
+ list.height = 0
+ list.depth = 0
+ if start then
+ stop.next = list
+ list.prev = stop
+ else
+ start = list
+ end
+ stop = list -- one node anyway, so not needed: slide_node_list(list)
+ end
+ local step = widths[c]
+ if c < nofcolumns then
+ step = step + columndistance + distances[c]
+ end
+ local kern = new_kern(step)
+ stop.prev = kern
+ stop.next = kern
+ stop = kern
+ end
+ if start then
+ if rightmargindistance > 0 then
+ local kern = new_kern(rightmargindistance)
+ stop.next = kern
+ kern.prev = stop
+ -- stop = kern
+ end
+ return start, heights[r] + depths[r]
+ end
+ end
+ local function collect_range(range)
+ local result = { }
+ local nofrange = #range
+ for i=1,#range do
+ local r = range[i]
+ local row = rows[r]
+ local list, size = packaged_column(r)
+ if list then
+ result[#result+1] = {
+ hpack_node_list(list),
+ size,
+ i < nofrange and rowdistance > 0 and rowdistance or false, -- might move
+ }
+ end
+ end
+ return result
+ end
+ local body = collect_range(ranges[body_mode])
+ data.results = {
+ [head_mode] = collect_range(ranges[head_mode]),
+ [foot_mode] = collect_range(ranges[foot_mode]),
+ [more_mode] = collect_range(ranges[more_mode]),
+ [body_mode] = body,
+ }
+ if #body == 0 then
+ texsetcount("global","x_table_state",0)
+ texsetdimen("global","x_table_final_width",0)
+ else
+ texsetcount("global","x_table_state",1)
+ texsetdimen("global","x_table_final_width",body[1][1].width)
+ end
+end
+
+local function inject(row,copy,package)
+ local list = row[1]
+ if copy then
+ row[1] = copy_node_list(list)
+ end
+ if package then
+ context_beginvbox()
+ context(list)
+ context(new_kern(row[2]))
+ context_endvbox()
+ context_nointerlineskip() -- figure out a better way
+ if row[3] then
+ context_blank(row[3] .. "sp")
+ else
+ context(new_glue(0))
+ end
+ else
+ context(list)
+ context(new_kern(row[2]))
+ if row[3] then
+ context(new_glue(row[3]))
+ end
+ end
+end
+
+local function total(row,distance)
+ local n = #row > 0 and rowdistance or 0
+ for i=1,#row do
+ local ri = row[i]
+ n = n + ri[2] + (ri[3] or 0)
+ end
+ return n
+end
+
+-- local function append(list,what)
+-- for i=1,#what do
+-- local l = what[i]
+-- list[#list+1] = l[1]
+-- local k = l[2] + (l[3] or 0)
+-- if k ~= 0 then
+-- list[#list+1] = new_kern(k)
+-- end
+-- end
+-- end
+
+function xtables.flush(directives) -- todo split by size / no inbetween then .. glue list kern blank
+ local vsize = directives.vsize
+ local method = directives.method or v_normal
+ local settings = data.settings
+ local results = data.results
+ local rowdistance = settings.rowdistance
+ local head = results[head_mode]
+ local foot = results[foot_mode]
+ local more = results[more_mode]
+ local body = results[body_mode]
+ local repeatheader = settings.header == v_repeat
+ local repeatfooter = settings.footer == v_repeat
+ if vsize and vsize > 0 then
+ context_beginvbox()
+ local bodystart = data.bodystart or 1
+ local bodystop = data.bodystop or #body
+ if bodystart <= bodystop then
+ local bodysize = vsize
+ local footsize = total(foot,rowdistance)
+ local headsize = total(head,rowdistance)
+ local moresize = total(more,rowdistance)
+ local firstsize = body[bodystart][2]
+ if bodystart == 1 then -- first chunk gets head
+ bodysize = bodysize - headsize - footsize
+ if headsize > 0 and bodysize >= firstsize then
+ for i=1,#head do
+ inject(head[i],repeatheader)
+ end
+ if rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ if not repeatheader then
+ results[head_mode] = { }
+ end
+ end
+ elseif moresize > 0 then -- following chunk gets next
+ bodysize = bodysize - footsize - moresize
+ if bodysize >= firstsize then
+ for i=1,#more do
+ inject(more[i],true)
+ end
+ if rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ end
+ elseif headsize > 0 and repeatheader then -- following chunk gets head
+ bodysize = bodysize - footsize - headsize
+ if bodysize >= firstsize then
+ for i=1,#head do
+ inject(head[i],true)
+ end
+ if rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ end
+ else -- following chunk gets nothing
+ bodysize = bodysize - footsize
+ end
+ if bodysize >= firstsize then
+ for i=bodystart,bodystop do -- room for improvement
+ local bi = body[i]
+ local bs = bodysize - bi[2] - (bi[3] or 0)
+ if bs > 0 then
+ inject(bi)
+ bodysize = bs
+ bodystart = i + 1
+ body[i] = nil
+ else
+ break
+ end
+ end
+ if bodystart > bodystop then
+ -- all is flushed and footer fits
+ if footsize > 0 then
+ if rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ for i=1,#foot do
+ inject(foot[i])
+ end
+ results[foot_mode] = { }
+ end
+ results[body_mode] = { }
+ texsetcount("global","x_table_state",0)
+ else
+ -- some is left so footer is delayed
+ -- todo: try to flush a few more lines
+ if repeatfooter and footsize > 0 then
+ if rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ for i=1,#foot do
+ inject(foot[i],true)
+ end
+ else
+ -- todo: try to fit more of body
+ end
+ texsetcount("global","x_table_state",2)
+ end
+ else
+ texsetcount("global","x_table_state",2) -- 1
+ end
+ else
+ texsetcount("global","x_table_state",0)
+ end
+ data.bodystart = bodystart
+ data.bodystop = bodystop
+ context_endvbox()
+ else
+ if method == variables.split then
+ -- maybe also a non float mode with header/footer repeat although
+ -- we can also use a float without caption
+ for i=1,#head do
+ inject(head[i],false,true)
+ end
+ if #head > 0 and rowdistance > 0 then
+ context_blank(rowdistance .. "sp")
+ end
+ for i=1,#body do
+ inject(body[i],false,true)
+ end
+ if #foot > 0 and rowdistance > 0 then
+ context_blank(rowdistance .. "sp")
+ end
+ for i=1,#foot do
+ inject(foot[i],false,true)
+ end
+ else -- normal
+ context_beginvbox()
+ for i=1,#head do
+ inject(head[i])
+ end
+ if #head > 0 and rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ for i=1,#body do
+ inject(body[i])
+ end
+ if #foot > 0 and rowdistance > 0 then
+ context(new_glue(rowdistance))
+ end
+ for i=1,#foot do
+ inject(foot[i])
+ end
+ context_endvbox()
+ end
+ results[head_mode] = { }
+ results[body_mode] = { }
+ results[foot_mode] = { }
+ texsetcount("global","x_table_state",0)
+ end
+end
+
+function xtables.cleanup()
+ for mode, result in next, data.results do
+ for _, r in next, result do
+ flush_node_list(r[1])
+ end
+ end
+ data = table.remove(stack)
+end
+
+function xtables.next_row()
+ local r = data.currentrow + 1
+ data.modes[r] = texcount.x_table_mode
+ data.currentrow = r
+ data.currentcolumn = 0
+end
+
+-- eventually we might only have commands
+
+commands.x_table_create = xtables.create
+commands.x_table_reflow = xtables.reflow
+commands.x_table_construct = xtables.construct
+commands.x_table_flush = xtables.flush
+commands.x_table_cleanup = xtables.cleanup
+commands.x_table_next_row = xtables.next_row
+commands.x_table_init_one = xtables.initialize_one
+commands.x_table_init_two = xtables.initialize_two
+commands.x_table_set_one = xtables.set_one
+commands.x_table_set_two = xtables.set_two
diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi
new file mode 100644
index 000000000..2d47c2c73
--- /dev/null
+++ b/tex/context/base/tabl-xtb.mkvi
@@ -0,0 +1,368 @@
+% macros=mkvi
+
+%D \module
+%D [ file=tabl-xtb,
+%D version=2011.10.26,
+%D title=\CONTEXT\ Table Macros,
+%D subtitle=Xtreme,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Table Macros / Xtreme}
+
+\registerctxluafile{tabl-xtb}{1.001}
+
+%D This module started as an afternoon experiment and surprisingly could be
+%D mostly finished the same evening. Of course it builds upon existing
+%D functionality. The main reason for writing it is that we occasionally
+%D run into pretty large tables that take tens of pages and need to be split
+%D into floats. Speed is one issue there, avoiding to use vsplit is another.
+%D
+%D \starttyping
+%D \definextable [tag] | [tag][parent]
+%D \setupxtable [settings] | [tag][settings]
+%D
+%D \startxtable[tag|settings]
+%D \startxtablehead|\startxtablenext|\startxtablebody|\startxtablefoot
+%D \startxrowgroup[tag|settings]
+%D \startxrow[settings]
+%D \startxcellgroup[tag|settings]
+%D \startxcell[settings] ... \stopxcell
+%D \stopxcellgroup
+%D \stopxrow
+%D \startxrowgroup
+%D \stopxtablehead|\stopxtablenext|\stopxtablebody|\stopxtablefoot
+%D \stopxtable
+%D \stoptyping
+%D
+%D See xtables-001.tex etc for some examples.
+
+% We can avoid some checking by using the fastoptionalcheckcs helpers
+% instead of dosingleempty but the speed gain is neglectable.
+
+\unprotect
+
+\def\v!xtable{xtable}
+
+% todo:
+%
+% - template alignment
+% - maybe split horizontal (a la linetables)
+% - before/after and wrapping (linecorrection)
+% - maybe also some before/after commands
+% - maybe correction when non float usage
+% - tagging needs to be checked
+% - maybe only tag the box
+
+% option=stretch : equal distribution
+% option={stretch,width} : proportional distribution
+
+% \setbox\scratchbox\hbox attr \taggedattribute \attribute\taggedattribute {...}
+%
+% \let\tsplitbeforeresult\donothing
+% \let\tsplitafterresult \donothing
+% \let\tsplitinbetween \donothing
+% \let\tsplitbefore \donothing
+% \let\tsplitafter \donothing
+% \let\postprocesstsplit \donothing
+
+\let\dotagxtablecell \relax
+\let\dotagxtablesignal\relax
+
+\appendtoks
+ \def\dotagxtablecell {\taggedctxcommand{settagtablecell(\number\tablecellrows,\number\tablecellcolumns,\number\raggedstatus)}}%
+ \def\dotagxtablesignal{\char\zerocount}% not used
+\to \everyenableelements
+
+\newdimen\x_table_width
+\newdimen\x_table_height
+\newdimen\x_table_depth % not used
+\newdimen\x_table_distance
+\newcount\x_table_nx
+\newcount\x_table_ny
+\newcount\x_table_mode
+\newbox \x_table_box
+\newcount\x_table_state % 0=empty 1=content 3=splitleft
+\newdimen\x_table_final_width
+\newcount\x_table_nesting
+
+\installframedcommandhandler \??lt {xtable} \??lt
+
+\appendtoks
+ \checkxtableparent % so we can deal with undefined settings, not that it's efficient
+\to \everysetupxtable
+
+\setupxtable[%
+ \c!nx=1,
+ \c!ny=1,
+ \c!align=\v!table, % {\v!flushleft,\v!broad,\v!high}, % just as \bTABLE .. \eTABLE
+ \c!frameoffset=.5\linewidth,
+ \c!backgroundoffset=\v!frame,
+ % \c!framecolor=\s!black,
+ \c!width=\v!fit,
+ \c!height=\v!fit,
+ \c!autowidth=\v!yes, % controls framed
+ \c!rulethickness=\linewidth,
+ \c!strut=\v!yes,
+ \c!autostrut=\v!no,
+ \c!split=\v!auto, % a number will take that many lines
+ \c!splitoffset=\zeropoint, % extra space taken
+ % \c!aligncharacter=\v!no,
+ % \c!alignmentcharacter={,},
+ % \c!option=, % \v!stretch {\v!stretch,\v!width}
+ % \c!footer=,
+ % \c!header=,
+ \c!spaceinbetween=,
+ \c!textwidth=\hsize,
+ \c!distance=\zeropoint, % individual column
+ \c!columndistance=\zeropoint, % each column (whole table)
+ \c!leftmargindistance=\zeropoint, % whole table
+ \c!rightmargindistance=\zeropoint,% whole table
+]
+
+\unexpanded\def\startxtable
+ {\dosingleempty\start_x_table}
+
+\let\stopxtable\relax
+
+\unexpanded\def\start_x_table[#settings]% maybe two arguments: [tag][settings] | [tag] | [settings]
+ {\bgroup
+ \advance\x_table_nesting\plusone
+ \dostarttagged\t!table\empty
+ \forgetall
+ \iffirstargument
+ \set_checked_x_table{#settings}%
+ \fi
+ \normalexpanded
+ {\dodowithbuffer
+ {x_table:\number\x_table_nesting}%
+ {\e!start\v!xtable}%
+ {\e!stop\v!xtable}
+ \relax
+ \x_table_process}} % name start stop before after
+
+\unexpanded\def\x_table_process
+ {\setbox\scratchbox\vbox{\xtableparameter\c!spaceinbetween}%
+ \ctxcommand{x_table_create {
+ option = "\xtableparameter\c!option",
+ textwidth = \number\dimexpr\xtableparameter\c!textwidth,
+ columndistance = \number\dimexpr\xtableparameter\c!columndistance,
+ leftmargindistance = \number\dimexpr\xtableparameter\c!leftmargindistance,
+ rightmargindistance = \number\dimexpr\xtableparameter\c!rightmargindistance,
+ rowdistance = \number\ht\scratchbox,
+ header = "\xtableparameter\c!header",
+ footer = "\xtableparameter\c!footer",
+ } }%
+ \begingroup
+ \let\start_x_row \start_x_row_one
+ \let\stop_x_row \stop_x_row_one
+ \let\start_x_cell\start_x_cell_one
+ \let\stop_x_cell \stop_x_cell_one
+ \settrialtypesetting
+ \doprocesstexbuffer{x_table:\number\x_table_nesting}\relax
+ \ctxcommand{x_table_reflow()}%
+ \relax
+ \endgroup
+ \begingroup
+ \let\start_x_row \start_x_row_two
+ \let\stop_x_row \stop_x_row_two
+ \let\start_x_cell\start_x_cell_two
+ \let\stop_x_cell \stop_x_cell_two
+ \doprocesstexbuffer{x_table:\number\x_table_nesting}\relax
+ \ctxcommand{x_table_construct()}%
+ \relax
+ \endgroup
+ \ifinsidesplitfloat
+ \x_table_flush_float_split
+ \else\ifinsidefloat
+ \x_table_flush_float_normal
+ \else
+ \doifelse{\xtableparameter\c!split}\v!yes
+ {\x_table_flush_flow_split}
+ {\x_table_flush_flow_normal}%
+ \fi\fi
+ \ctxcommand{x_table_cleanup()}%
+ \dostoptagged
+ \resetbuffer[x_table:\number\x_table_nesting]%
+ \egroup}
+
+\let\extratxtablesplitheight\zeropoint % might disappear so don't depend on it
+
+\def\x_table_flush_float_normal
+ {\ctxcommand{x_table_flush{ method = "\v!normal" }}}
+
+\def\x_table_flush_float_split
+ {\resetdirecttsplit
+ \edef\extrasplitfloatlines {\xtableparameter\c!split}%
+ \edef\tsplitminimumfreespace{\the\dimexpr\extratxtablesplitheight+\xtableparameter\c!splitoffset\relax}%
+ % \edef\tsplitminimumfreelines{2}% not needed here as we're precise enough
+ \let\tsplitdirectsplitter\x_table_split_splitter
+ \let\tsplitdirectwidth \x_table_final_width
+ \handledirecttsplit}
+
+\def\x_table_flush_flow_normal
+ {\ctxcommand{x_table_flush{ method = "\v!normal" }}}
+
+\def\x_table_flush_flow_split
+ {\ctxcommand{x_table_flush{ method = "\v!split" }}}
+
+\def\x_table_split_splitter#vsize%
+ {\setbox\tsplitresult\vbox
+ {\ctxcommand{x_table_flush{ method = "\v!split", vsize = \number\dimexpr#vsize }}}%
+ \ifcase\x_table_state
+ \global\setfalse\somenextsplitofffloat
+ \else
+ \global\settrue \somenextsplitofffloat
+ \fi}
+
+\unexpanded\def\startxrow
+ {\begingroup
+ \dosingleempty\start_x_row}
+
+\def\start_x_row_one[#settings]%
+ {\iffirstargument
+ \setupcurrentxtable[#settings]%
+ \fi
+ \ctxcommand{x_table_next_row()}}
+
+\def\start_x_row_two[#settings]%
+ {\iffirstargument
+ \setupcurrentxtable[#settings]%
+ \fi
+ \dostarttagged\t!tablerow\empty
+ \ctxcommand{x_table_next_row()}}
+
+\def\stop_x_row_one
+ {}
+
+\def\stop_x_row_two
+ {\dostoptagged}
+
+\unexpanded\def\stopxrow
+ {\stop_x_row
+ \endgroup}
+
+\unexpanded\def\startxcell
+ {\dosingleempty\start_x_cell}
+
+\def\start_x_cell_one[#settings]%
+ {\setbox\x_table_box\hbox\bgroup
+ \ifnum\x_table_nesting>\plusone
+ \letxtableparameter\c!width \v!fit % overloads given width
+ \letxtableparameter\c!height\v!fit % overloads given height
+ \fi
+ \iffirstargument
+ \setupcurrentxtable[#settings]%
+ \fi
+ \x_table_nx \xtableparameter\c!nx
+ \x_table_ny \xtableparameter\c!ny
+ \x_table_distance\xtableparameter\c!distance
+ \relax
+ \ctxcommand{x_table_init_one()}%
+ \inheritedxtableframed\bgroup
+ \inhibitblank
+ \everypar{\delayedbegstrut}} % could be a copy
+
+\def\start_x_cell_two[#settings]%
+ {\dostarttagged\t!tablecell\empty % can't we just tag the box
+ \setbox\x_table_box\hbox\bgroup
+ \iffirstargument
+ \setupcurrentxtable[#settings]%
+ \fi
+ \letxtableparameter\c!width \x_table_width % overloads given width
+ \letxtableparameter\c!height\x_table_height % overloads given height
+ % \letxtableparameter\c!depth \x_table_depth % overloads given depth
+ \ctxcommand{x_table_init_two()}%
+ \inheritedxtableframed\bgroup
+ \inhibitblank
+ \dotagxtablecell % needs checking
+ \everypar{\delayedbegstrut}} % could be a copy
+
+\unexpanded\def\stopxcell
+ {\ifhmode
+ \delayedendstrut
+ \par
+ \else
+ \par
+ \ifdim\prevdepth<\zeropoint % =-1000pt ?
+ \vskip-\strutdp
+ \else
+ \removebottomthings
+ \fi
+ \fi
+ \egroup
+ \egroup
+ \stop_x_cell}
+
+\unexpanded\def\stop_x_cell_one
+ {\ctxcommand{x_table_set_one()}}
+
+\unexpanded\def\stop_x_cell_two
+ {\ctxcommand{x_table_set_two()}%
+ \dostoptagged}
+
+\unexpanded\def\startxcellgroup
+ {\begingroup
+ \dosingleempty\start_x_cell_group}
+
+\unexpanded\def\stopxcellgroup
+ {\endgroup}
+
+\def\start_x_cell_group[#settings]%
+ {\iffirstargument
+ \set_checked_x_table{#settings}%
+ \fi}
+
+\unexpanded\def\startxrowgroup
+ {\begingroup
+ \dosingleempty\start_x_row_group}
+
+\unexpanded\def\stopxrowgroup
+ {\dostoptagged
+ \endgroup}
+
+\def\start_x_row_group[#settings]%
+ {\iffirstargument
+ \set_checked_x_table{#settings}%
+ \fi}
+
+% \def\set_checked_x_table#settings
+% {\doifassignmentelse{#settings}
+% {\setupcurrentxtable[#settings]}
+% {\ifcsname\namedxtablehash{#settings}\s!parent\endcsname
+% \edef\currentxtable{#settings}%
+% \fi}}
+
+\def\set_checked_x_table#settings%
+ {\ifcsname\namedxtablehash{#settings}\s!parent\endcsname
+ \edef\currentxtable{#settings}%
+ \else
+ \setupcurrentxtable[#settings]%
+ \fi}
+
+\unexpanded\def\startxtablehead{\begingroup\x_table_mode\plusone \dosingleempty\start_x_table_partition}
+\unexpanded\def\startxtablefoot{\begingroup\x_table_mode\plustwo \dosingleempty\start_x_table_partition}
+\unexpanded\def\startxtablenext{\begingroup\x_table_mode\plusthree\dosingleempty\start_x_table_partition}
+\unexpanded\def\startxtablebody{\begingroup\x_table_mode\plusfour \dosingleempty\start_x_table_partition}
+
+\unexpanded\def\start_x_table_partition[#settings]%
+ {\iffirstargument
+ \set_checked_x_table{#settings}%
+ \fi}
+
+\unexpanded\def\stop_x_table_partition
+ {\endgroup}
+
+\let\stopxtablehead\stop_x_table_partition
+\let\stopxtablefoot\stop_x_table_partition
+\let\stopxtablenext\stop_x_table_partition
+\let\stopxtablebody\stop_x_table_partition
+
+\protect
+
+% \continueifinputfile{tabl-xtb.mkvi}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 917c3939d..e07ee2fa9 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/26/11 15:10:36
+-- merge date : 10/28/11 16:04:20
do -- begin closure to overcome local limits and interference