diff options
37 files changed, 910 insertions, 922 deletions
diff --git a/metapost/context/base/mp-mlib.mp b/metapost/context/base/mp-mlib.mp index 03d30ba99..520e49b06 100644 --- a/metapost/context/base/mp-mlib.mp +++ b/metapost/context/base/mp-mlib.mp @@ -20,6 +20,10 @@ numeric _tt_w_[], _tt_h_[], _tt_d_[] ; numeric _tt_n_ ; _tt_n_ := 0 ; boolean _trial_run_ ; _trial_run_ := false ; +def resettextexts = + _tt_n_ := 0 ; +enddef ; + vardef textext(expr str) = if _trial_run_ : image ( @@ -137,6 +141,7 @@ enddef ; extra_beginfig := extra_beginfig & "currentgraphictext := 0 ; " ; extra_endfig := extra_endfig & "finishsavingdata ; " ; +extra_endfig := extra_endfig & "resettextexts ; " ; boolean cmykcolors ; cmykcolors := true ; boolean spotcolors ; spotcolors := true ; diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua index a810b16d6..213922fb3 100644 --- a/scripts/context/lua/luatools.lua +++ b/scripts/context/lua/luatools.lua @@ -1595,6 +1595,8 @@ function file.extname(name) return name:match("^.+%.([^/\\]-)$") or "" end +file.suffix = file.extname + function file.stripsuffix(name) return (name:gsub("%.[%a%d]+$","")) end @@ -1895,29 +1897,29 @@ if lfs then do dir.glob_pattern = glob_pattern - local function glob(pattern, action) - local t = { } - local path, rest, patt, recurse - local action = action or function(name) t[#t+1] = name end - local pattern = pattern:gsub("^%*%*","./**") - local pattern = pattern:gsub("/%*/","/**/") - path, rest = pattern:match("^(/)(.-)$") - if path then - path = path - else - path, rest = pattern:match("^([^/]*)/(.-)$") - end - if rest then - patt = rest:gsub("([%.%-%+])", "%%%1") - end - patt = patt:gsub("%*", "[^/]*") - patt = patt:gsub("%?", "[^/]") - patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") - if path == "" then path = "." end - recurse = patt:find("%.%*/") ~= nil - glob_pattern(path,patt,recurse,action) - return t - end + --~ local function glob(pattern, action) + --~ local t = { } + --~ local path, rest, patt, recurse + --~ local action = action or function(name) t[#t+1] = name end + --~ local pattern = pattern:gsub("^%*%*","./**") + --~ local pattern = pattern:gsub("/%*/","/**/") + --~ path, rest = pattern:match("^(/)(.-)$") + --~ if path then + --~ path = path + --~ else + --~ path, rest = pattern:match("^([^/]*)/(.-)$") + --~ end + --~ if rest then + --~ patt = rest:gsub("([%.%-%+])", "%%%1") + --~ end + --~ patt = patt:gsub("%*", "[^/]*") + --~ patt = patt:gsub("%?", "[^/]") + --~ patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") + --~ if path == "" then path = "." end + --~ recurse = patt:find("%.%*/") ~= nil + --~ glob_pattern(path,patt,recurse,action) + --~ return t + --~ end local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V @@ -1931,13 +1933,13 @@ if lfs then do P("**") / ".*" + P("*") / "[^/]*" + P("?") / "[^/]" + - P(".") / "%." + - P("+") / "%+" + - P("-") / "%-" + + P(".") / "%%." + + P("+") / "%%+" + + P("-") / "%%-" + P(1) )^0 ) - function glob(str) + local function glob(str) local split = pattern:match(str) if split then local t = { } @@ -1946,7 +1948,8 @@ if lfs then do local recurse = base:find("**") local start = root .. path local result = filter:match(start .. base) - -- print(str, start, result) +--~ print(str, start, result) +--~ print(start, result) glob_pattern(start,result,recurse,action) return t else @@ -5734,65 +5737,79 @@ if texconfig and not texlua then do -- this will become: ctx.install_statistics(fnc() return ..,.. end) etc - function ctx.show_statistics() - local function ws(...) - ctx.writestatus("mkiv lua stats",string.format(...)) - end + local statusinfo, n = { }, 0 + + function ctx.register_statistics(tag,pattern,fnc) + statusinfo[#statusinfo+1] = { tag, pattern, fnc } + if #tag > n then n = #tag end + end + + function ctx.show_statistics() -- todo: move calls if caches then - ws("used config path - %s", caches.configpath(texmf.instance)) - ws("used cache path - %s", caches.path) + ctx.register_statistics("used config path", "%s", function() return caches.configpath(texmf.instance) end) + ctx.register_statistics("used cache path", "%s", function() return caches.path end) end if status.luabytecodes > 0 and input.storage and input.storage.done then - ws("modules/dumps/instances - %s/%s/%s", status.luabytecodes-500, input.storage.done, status.luastates) + ctx.register_statistics("modules/dumps/instances", "%s/%s/%s", function() return status.luabytecodes-500, input.storage.done, status.luastates end) end if texmf.instance then - ws("input load time - %s seconds", input.loadtime(texmf.instance)) + ctx.register_statistics("input load time", "%s seconds", function() return input.loadtime(texmf.instance) end) end if fonts then - ws("fonts load time - %s seconds", input.loadtime(fonts)) + ctx.register_statistics("fonts load time","%s seconds", function() return input.loadtime(fonts) end) end if xml then - ws("xml load time - %s seconds (backreferences: %i, outer filtering time: %s)", input.loadtime(xml), #lxml.self, input.loadtime(lxml)) + ctx.register_statistics("xml load time", "%s seconds, backreferences: %i, outer filtering time: %s", function() return input.loadtime(xml), #lxml.self, input.loadtime(lxml) end) end if mptopdf then - ws("mps conversion time - %s seconds", input.loadtime(mptopdf)) + ctx.register_statistics("mps conversion time", "%s seconds", function() return input.loadtime(mptopdf) end) end if nodes then - ws("node processing time - %s seconds (including kernel)", input.loadtime(nodes)) + ctx.register_statistics("node processing time", "%s seconds (including kernel)", function() return input.loadtime(nodes) end) end if kernel then - ws("kernel processing time - %s seconds", input.loadtime(kernel)) + ctx.register_statistics("kernel processing time", "%s seconds", function() return input.loadtime(kernel) end) end if attributes then - ws("attribute processing time - %s seconds", input.loadtime(attributes)) + ctx.register_statistics("attribute processing time", "%s seconds", function() return input.loadtime(attributes) end) end if languages then - ws("language load time - %s seconds (n=%s)", input.loadtime(languages), languages.hyphenation.n()) + ctx.register_statistics("language load time", "%s seconds, n=%s", function() return input.loadtime(languages), languages.hyphenation.n() end) end if figures then - ws("graphics processing time - %s seconds (n=%s) (including tex)", input.loadtime(figures), figures.n or "?") + ctx.register_statistics("graphics processing time", "%s seconds, n=%s (including tex)", function() return input.loadtime(figures), figures.n or "?" end) end if metapost then - ws("metapost processing time - %s seconds (loading: %s seconds, execution: %s seconds, n: %s)", input.loadtime(metapost), input.loadtime(mplib), input.loadtime(metapost.exectime), metapost.n) + ctx.register_statistics("metapost processing time", "%s seconds, loading: %s seconds, execution: %s seconds, n: %s", function() return input.loadtime(metapost), input.loadtime(mplib), input.loadtime(metapost.exectime), metapost.n end) end if status.luastate_bytes then - ws("current memory usage - %s bytes", status.luastate_bytes) + ctx.register_statistics("current memory usage", "%s bytes", function() return status.luastate_bytes end) end if nodes then - ws("cleaned up reserved nodes - %s nodes, %s lists (of %s)", nodes.cleanup_reserved(tex.count[24])) -- \topofboxstack - end - if languages then - ws("loaded patterns - %s", languages.logger.report()) + ctx.register_statistics("cleaned up reserved nodes", "%s nodes, %s lists of %s", function() return nodes.cleanup_reserved(tex.count[24]) end) -- \topofboxstack end if status.node_mem_usage then - ws("node memory usage - %s", status.node_mem_usage) + ctx.register_statistics("node memory usage", "%s", function() return status.node_mem_usage end) + end + if languages then + ctx.register_statistics("loaded patterns", "%s", function() return languages.logger.report() end) end if fonts then - ws("loaded fonts - %s", fonts.logger.report()) -- last because it is often a long list + ctx.register_statistics("loaded fonts", "%s", function() return fonts.logger.report() end) end if xml then -- so we are in mkiv, we need a different check - -- todo: \nofshipouts - ws("shipped out pages - %i (of %i processed pages)", tex.count['nofshipouts'], tex.count['realpageno']-1) -- last because we want to see this + ctx.register_statistics("runtime", "%s seconds, %i processed pages, %i shipped pages, %.3f pages/second", function() + input.stoptiming(texmf) + local runtime = input.loadtime(texmf) + local shipped = tex.count['nofshipouts'] + local pages = tex.count['realpageno'] - 1 + local persecond = shipped / runtime + return runtime, pages, shipped, persecond + end) + end + for _, t in ipairs(statusinfo) do + local tag, pattern, fnc = t[1], t[2], t[3] + ctx.writestatus("mkiv lua stats", string.format("%s - %s", tag:rpadd(n," "), pattern:format(fnc()))) end end @@ -5808,10 +5825,13 @@ if texconfig and not texlua then if not texmf then texmf = { } end + input.starttiming(texmf) + if not texmf.instance then if not texmf.instance then -- prevent a second loading + texmf.instance = input.reset() texmf.instance.progname = environment.progname or 'context' texmf.instance.engine = environment.engine or 'luatex' diff --git a/scripts/context/lua/luatools.rme b/scripts/context/lua/luatools.rme new file mode 100644 index 000000000..b320e1184 --- /dev/null +++ b/scripts/context/lua/luatools.rme @@ -0,0 +1,3 @@ +On MSWindows the luatools.lua script is called +with luatools.cmd. On Unix you can either rename +luatools.lua to luatools, or use a symlink. diff --git a/scripts/context/lua/mtx-cache.lua b/scripts/context/lua/mtx-cache.lua index 0fdaca6a4..8091eaa65 100644 --- a/scripts/context/lua/mtx-cache.lua +++ b/scripts/context/lua/mtx-cache.lua @@ -13,8 +13,8 @@ scripts.cache = scripts.cache or { } function scripts.cache.collect_one(...) local path = caches.setpath(instance,...) - local tmas = dir.glob(path .. "/*tma") - local tmcs = dir.glob(path .. "/*tmc") + local tmas = dir.glob(path .. "/*.tma") + local tmcs = dir.glob(path .. "/*.tmc") return path, tmas, tmcs end @@ -25,12 +25,9 @@ function scripts.cache.collect_two(...) end function scripts.cache.process_one(action) - action("fonts", "afm") - action("fonts", "tfm") - action("fonts", "def") - action("fonts", "enc") - action("fonts", "otf") - action("fonts", "data") + for k, v in ipairs({ "afm", "tfm", "def", "enc", "otf", "mp", "data" }) do + action("fonts", v) + end end function scripts.cache.process_two(action) @@ -57,23 +54,27 @@ function scripts.cache.remove(list,keep) end function scripts.cache.delete(all,keep) - local function action(...) + scripts.cache.process_one(function(...) + local path, rest = scripts.cache.collect_one(...) + local n = scripts.cache.remove(rest,keep) + logs.report("cache path",string.format("%4i files out of %4i deleted on %s",n,#rest,path)) + end) + scripts.cache.process_two(function(...) local path, rest = scripts.cache.collect_two(...) local n = scripts.cache.remove(rest,keep) logs.report("cache path",string.format("%4i files out of %4i deleted on %s",n,#rest,path)) - end - scripts.cache.process_one(action) - scripts.cache.process_two(action) + end) end function scripts.cache.list(all) scripts.cache.process_one(function(...) local path, tmas, tmcs = scripts.cache.collect_one(...) - logs.report("cache path",string.format("tma:%4i tmc:%4i %s",#tmas,#tmcs,path)) + logs.report("cache path",string.format("%4i (tma:%4i, tmc:%4i) %s",#tmas+#tmcs,#tmas,#tmcs,path)) + logs.report("cache path",string.format("%4i (tma:%4i, tmc:%4i) %s",#tmas+#tmcs,#tmas,#tmcs,path)) end) scripts.cache.process_two(function(...) local path, rest = scripts.cache.collect_two("curl") - logs.report("cache path",string.format("all:%4i %s",#rest,path)) + logs.report("cache path",string.format("%4i %s",#rest,path)) end) end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index ed263f916..de5f53975 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -41,7 +41,6 @@ banner = "version 1.0.2 - 2007+ - PRAGMA ADE / CONTEXT" texlua = true -- begin library merge - -- filename : l-string.lua -- comment : split off from luat-lib -- author : Hans Hagen, PRAGMA-ADE, Hasselt NL @@ -1610,6 +1609,8 @@ function file.extname(name) return name:match("^.+%.([^/\\]-)$") or "" end +file.suffix = file.extname + function file.stripsuffix(name) return (name:gsub("%.[%a%d]+$","")) end @@ -1805,29 +1806,29 @@ if lfs then do dir.glob_pattern = glob_pattern - local function glob(pattern, action) - local t = { } - local path, rest, patt, recurse - local action = action or function(name) t[#t+1] = name end - local pattern = pattern:gsub("^%*%*","./**") - local pattern = pattern:gsub("/%*/","/**/") - path, rest = pattern:match("^(/)(.-)$") - if path then - path = path - else - path, rest = pattern:match("^([^/]*)/(.-)$") - end - if rest then - patt = rest:gsub("([%.%-%+])", "%%%1") - end - patt = patt:gsub("%*", "[^/]*") - patt = patt:gsub("%?", "[^/]") - patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") - if path == "" then path = "." end - recurse = patt:find("%.%*/") ~= nil - glob_pattern(path,patt,recurse,action) - return t - end + --~ local function glob(pattern, action) + --~ local t = { } + --~ local path, rest, patt, recurse + --~ local action = action or function(name) t[#t+1] = name end + --~ local pattern = pattern:gsub("^%*%*","./**") + --~ local pattern = pattern:gsub("/%*/","/**/") + --~ path, rest = pattern:match("^(/)(.-)$") + --~ if path then + --~ path = path + --~ else + --~ path, rest = pattern:match("^([^/]*)/(.-)$") + --~ end + --~ if rest then + --~ patt = rest:gsub("([%.%-%+])", "%%%1") + --~ end + --~ patt = patt:gsub("%*", "[^/]*") + --~ patt = patt:gsub("%?", "[^/]") + --~ patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") + --~ if path == "" then path = "." end + --~ recurse = patt:find("%.%*/") ~= nil + --~ glob_pattern(path,patt,recurse,action) + --~ return t + --~ end local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V @@ -1841,13 +1842,13 @@ if lfs then do P("**") / ".*" + P("*") / "[^/]*" + P("?") / "[^/]" + - P(".") / "%." + - P("+") / "%+" + - P("-") / "%-" + + P(".") / "%%." + + P("+") / "%%+" + + P("-") / "%%-" + P(1) )^0 ) - function glob(str) + local function glob(str) local split = pattern:match(str) if split then local t = { } @@ -1856,7 +1857,8 @@ if lfs then do local recurse = base:find("**") local start = root .. path local result = filter:match(start .. base) - -- print(str, start, result) +--~ print(str, start, result) +--~ print(start, result) glob_pattern(start,result,recurse,action) return t else @@ -2178,6 +2180,8 @@ xml.trace_remap = false local format, concat = string.format, table.concat +--~ local pairs, next, type = pairs, next, type + -- todo: some things per xml file, liek namespace remapping --[[ldx-- @@ -2281,9 +2285,13 @@ local x = xml.convert(somestring) element.</p> --ldx]]-- +xml.strip_cm_and_dt = false -- an extra global flag, in case we have many includes + do - local remove, nsremap = table.remove, xml.xmlns + -- not just one big nested table capture (lpeg overflow) + + local remove, nsremap, resolvens = table.remove, xml.xmlns, xml.resolvens local stack, top, dt, at, xmlns, errorstr = {}, {}, {}, {}, {}, nil @@ -2293,6 +2301,7 @@ do return "" end + local strip = false local cleanup = false function xml.set_text_cleanup(fnc) @@ -2301,7 +2310,7 @@ do local function add_attribute(namespace,tag,value) if tag == "xmlns" then - xmlns[#xmlns+1] = xml.resolvens(value) + xmlns[#xmlns+1] = resolvens(value) at[tag] = value elseif namespace == "xmlns" then xml.checkns(tag,value) @@ -2359,93 +2368,106 @@ do dt[#dt+1] = text end end + --~ local function add_special(what, spacing, text) + --~ if #spacing > 0 then + --~ dt[#dt+1] = spacing + --~ end + --~ top = stack[#stack] -- hm, left over 1 + --~ setmetatable(top, mt) -- hm, left over 2 + --~ dt[#dt+1] = { special=true, ns="", tg=what, dt={text} } + --~ end local function add_special(what, spacing, text) if #spacing > 0 then dt[#dt+1] = spacing end - top = stack[#stack] - setmetatable(top, mt) - dt[#dt+1] = { special=true, ns="", tg=what, dt={text} } + if strip and (what == "@cm@" or what == "@dt@") then + -- forget it + else + dt[#dt+1] = { special=true, ns="", tg=what, dt={text} } + end end local function set_message(txt) errorstr = "garbage at the end of the file: " .. txt:gsub("([ \n\r\t]*)","") end - local space = lpeg.S(' \r\n\t') - local open = lpeg.P('<') - local close = lpeg.P('>') - local squote = lpeg.S("'") - local dquote = lpeg.S('"') - local equal = lpeg.P('=') - local slash = lpeg.P('/') - local colon = lpeg.P(':') - local valid = lpeg.R('az', 'AZ', '09') + lpeg.S('_-.') - local name_yes = lpeg.C(valid^1) * colon * lpeg.C(valid^1) - local name_nop = lpeg.C(lpeg.P(true)) * lpeg.C(valid^1) + local P, S, R, C, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V + + local space = S(' \r\n\t') + local open = P('<') + local close = P('>') + local squote = S("'") + local dquote = S('"') + local equal = P('=') + local slash = P('/') + local colon = P(':') + local valid = R('az', 'AZ', '09') + S('_-.') + local name_yes = C(valid^1) * colon * C(valid^1) + local name_nop = C(P(true)) * C(valid^1) local name = name_yes + name_nop - local utfbom = lpeg.P('\000\000\254\255') + lpeg.P('\255\254\000\000') + - lpeg.P('\255\254') + lpeg.P('\254\255') + lpeg.P('\239\187\191') -- no capture + local utfbom = P('\000\000\254\255') + P('\255\254\000\000') + + P('\255\254') + P('\254\255') + P('\239\187\191') -- no capture - local spacing = lpeg.C(space^0) - local justtext = lpeg.C((1-open)^1) + local spacing = C(space^0) + local justtext = C((1-open)^1) local somespace = space^1 local optionalspace = space^0 - local value = (squote * lpeg.C((1 - squote)^0) * squote) + (dquote * lpeg.C((1 - dquote)^0) * dquote) + local value = (squote * C((1 - squote)^0) * squote) + (dquote * C((1 - dquote)^0) * dquote) local attribute = (somespace * name * optionalspace * equal * optionalspace * value) / add_attribute local attributes = attribute^0 local text = justtext / add_text - local balanced = lpeg.P { "[" * ((1 - lpeg.S"[]") + lpeg.V(1))^0 * "]" } -- taken from lpeg manual, () example + local balanced = P { "[" * ((1 - S"[]") + V(1))^0 * "]" } -- taken from lpeg manual, () example local emptyelement = (spacing * open * name * attributes * optionalspace * slash * close) / add_empty local beginelement = (spacing * open * name * attributes * optionalspace * close) / add_begin local endelement = (spacing * open * slash * name * optionalspace * close) / add_end - local begincomment = open * lpeg.P("!--") - local endcomment = lpeg.P("--") * close - local begininstruction = open * lpeg.P("?") - local endinstruction = lpeg.P("?") * close - local begincdata = open * lpeg.P("![CDATA[") - local endcdata = lpeg.P("]]") * close + local begincomment = open * P("!--") + local endcomment = P("--") * close + local begininstruction = open * P("?") + local endinstruction = P("?") * close + local begincdata = open * P("![CDATA[") + local endcdata = P("]]") * close - local someinstruction = lpeg.C((1 - endinstruction)^0) - local somecomment = lpeg.C((1 - endcomment )^0) - local somecdata = lpeg.C((1 - endcdata )^0) + local someinstruction = C((1 - endinstruction)^0) + local somecomment = C((1 - endcomment )^0) + local somecdata = C((1 - endcdata )^0) - local begindoctype = open * lpeg.P("!DOCTYPE") + local begindoctype = open * P("!DOCTYPE") local enddoctype = close - local publicdoctype = lpeg.P("PUBLIC") * somespace * value * somespace * value * somespace * balanced^0 - local systemdoctype = lpeg.P("SYSTEM") * somespace * value * somespace * balanced^0 + local publicdoctype = P("PUBLIC") * somespace * value * somespace * value * somespace * balanced^0 + local systemdoctype = P("SYSTEM") * somespace * value * somespace * balanced^0 local simpledoctype = (1-close)^1 * balanced^0 - local somedoctype = lpeg.C((somespace * lpeg.P(publicdoctype + systemdoctype + simpledoctype) * optionalspace)^0) + local somedoctype = C((somespace * P(publicdoctype + systemdoctype + simpledoctype) * optionalspace)^0) local instruction = (spacing * begininstruction * someinstruction * endinstruction) / function(...) add_special("@pi@",...) end local comment = (spacing * begincomment * somecomment * endcomment ) / function(...) add_special("@cm@",...) end local cdata = (spacing * begincdata * somecdata * endcdata ) / function(...) add_special("@cd@",...) end - local doctype = (spacing * begindoctype * somedoctype * enddoctype ) / function(...) add_special("@dd@",...) end + local doctype = (spacing * begindoctype * somedoctype * enddoctype ) / function(...) add_special("@dt@",...) end -- nicer but slower: -- -- local instruction = (lpeg.Cc("@pi@") * spacing * begininstruction * someinstruction * endinstruction) / add_special -- local comment = (lpeg.Cc("@cm@") * spacing * begincomment * somecomment * endcomment ) / add_special -- local cdata = (lpeg.Cc("@cd@") * spacing * begincdata * somecdata * endcdata ) / add_special - -- local doctype = (lpeg.Cc("@dd@") * spacing * begindoctype * somedoctype * enddoctype ) / add_special + -- local doctype = (lpeg.Cc("@dt@") * spacing * begindoctype * somedoctype * enddoctype ) / add_special local trailer = space^0 * (justtext/set_message)^0 - -- comment + emptyelement + text + cdata + instruction + lpeg.V("parent"), -- 6.5 seconds on 40 MB database file - -- text + comment + emptyelement + cdata + instruction + lpeg.V("parent"), -- 5.8 - -- text + lpeg.V("parent") + emptyelement + comment + cdata + instruction, -- 5.5 + -- comment + emptyelement + text + cdata + instruction + V("parent"), -- 6.5 seconds on 40 MB database file + -- text + comment + emptyelement + cdata + instruction + V("parent"), -- 5.8 + -- text + V("parent") + emptyelement + comment + cdata + instruction, -- 5.5 - local grammar = lpeg.P { "preamble", - preamble = utfbom^0 * instruction^0 * (doctype + comment + instruction)^0 * lpeg.V("parent") * trailer, - parent = beginelement * lpeg.V("children")^0 * endelement, - children = text + lpeg.V("parent") + emptyelement + comment + cdata + instruction, + local grammar = P { "preamble", + preamble = utfbom^0 * instruction^0 * (doctype + comment + instruction)^0 * V("parent") * trailer, + parent = beginelement * V("children")^0 * endelement, + children = text + V("parent") + emptyelement + comment + cdata + instruction, } - function xml.convert(data, no_root) + function xml.convert(data, no_root, strip_cm_and_dt) + strip = strip_cm_and_dt or xml.strip_cm_and_dt stack, top, at, xmlns, errorstr, result = {}, {}, {}, {}, nil, nil stack[#stack+1] = top top.dt = { } @@ -2546,24 +2568,30 @@ generic table copier. Since we know what we're dealing with we can speed up things a bit. The second argument is not to be used!</p> --ldx]]-- -function xml.copy(old,tables) - if old then - tables = tables or { } - local new = { } - if not tables[old] then - tables[old] = new - end - for k,v in pairs(old) do - new[k] = (type(v) == "table" and (tables[v] or xml.copy(v, tables))) or v - end - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) +do + + function copy(old,tables) + if old then + tables = tables or { } + local new = { } + if not tables[old] then + tables[old] = new + end + for k,v in pairs(old) do + new[k] = (type(v) == "table" and (tables[v] or copy(v, tables))) or v + end + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end + return new + else + return { } end - return new - else - return { } end + + xml.copy = copy + end --[[ldx-- @@ -2585,7 +2613,7 @@ do return elseif not nocommands then local ec = e.command - if ec then + if ec ~= nil then -- we can have all kind of types local xc = xml.command if xc then xc(e,ec) @@ -2608,14 +2636,14 @@ do end elseif etg == "@pi@" then -- handle(format("<?%s?>",edt[1])) - handle("<?" .. edt[1] .. "?>") -- maybe table.join(edt) + handle("<?" .. edt[1] .. "?>") elseif etg == "@cm@" then -- handle(format("<!--%s-->",edt[1])) handle("<!--" .. edt[1] .. "-->") elseif etg == "@cd@" then -- handle(format("<![CDATA[%s]]>",edt[1])) handle("<![CDATA[" .. edt[1] .. "]]>") - elseif etg == "@dd@" then + elseif etg == "@dt@" then -- handle(format("<!DOCTYPE %s>",edt[1])) handle("<!DOCTYPE " .. edt[1] .. ">") elseif etg == "@rt@" then @@ -2623,7 +2651,7 @@ do end else local ens, eat, edt, ern = e.ns, e.at, e.dt, e.rn - local ats = eat and next(eat) and { } + local ats = eat and next(eat) and { } -- type test maybe faster if ats then if attributeconverter then for k,v in pairs(eat) do @@ -2739,7 +2767,7 @@ do if root then if type(root) == 'string' then return root - elseif next(root) then + elseif next(root) then -- next is faster than type (and >0 test) local result = { } serialize(root,function(s) result[#result+1] = s end) return concat(result,"") @@ -2887,36 +2915,38 @@ do local map = { } - local space = lpeg.S(' \r\n\t') - local squote = lpeg.S("'") - local dquote = lpeg.S('"') - local lparent = lpeg.P('(') - local rparent = lpeg.P(')') - local atsign = lpeg.P('@') - local lbracket = lpeg.P('[') - local rbracket = lpeg.P(']') - local exclam = lpeg.P('!') - local period = lpeg.P('.') - local eq = lpeg.P('==') + lpeg.P('=') - local ne = lpeg.P('<>') + lpeg.P('!=') - local star = lpeg.P('*') - local slash = lpeg.P('/') - local colon = lpeg.P(':') - local bar = lpeg.P('|') - local hat = lpeg.P('^') - local valid = lpeg.R('az', 'AZ', '09') + lpeg.S('_-') - local name_yes = lpeg.C(valid^1) * colon * lpeg.C(valid^1 + star) -- permits ns:* - local name_nop = lpeg.C(lpeg.P(true)) * lpeg.C(valid^1) + local P, S, R, C, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V + + local space = S(' \r\n\t') + local squote = S("'") + local dquote = S('"') + local lparent = P('(') + local rparent = P(')') + local atsign = P('@') + local lbracket = P('[') + local rbracket = P(']') + local exclam = P('!') + local period = P('.') + local eq = P('==') + P('=') + local ne = P('<>') + P('!=') + local star = P('*') + local slash = P('/') + local colon = P(':') + local bar = P('|') + local hat = P('^') + local valid = R('az', 'AZ', '09') + S('_-') + local name_yes = C(valid^1) * colon * C(valid^1 + star) -- permits ns:* + local name_nop = C(P(true)) * C(valid^1) local name = name_yes + name_nop - local number = lpeg.C((lpeg.S('+-')^0 * lpeg.R('09')^1)) / tonumber + local number = C((S('+-')^0 * R('09')^1)) / tonumber local names = (bar^0 * name)^1 local morenames = name * (bar^0 * name)^1 - local instructiontag = lpeg.P('pi::') - local spacing = lpeg.C(space^0) + local instructiontag = P('pi::') + local spacing = C(space^0) local somespace = space^1 local optionalspace = space^0 - local text = lpeg.C(valid^0) - local value = (squote * lpeg.C((1 - squote)^0) * squote) + (dquote * lpeg.C((1 - dquote)^0) * dquote) + local text = C(valid^0) + local value = (squote * C((1 - squote)^0) * squote) + (dquote * C((1 - dquote)^0) * dquote) local empty = 1-slash local is_eq = lbracket * atsign * name * eq * value * rbracket @@ -2926,9 +2956,9 @@ do local is_number = lbracket * number * rbracket local nobracket = 1-(lbracket+rbracket) -- must be improved - local is_expression = lbracket * lpeg.C(((lpeg.C(nobracket^1))/make_expression)) * rbracket + local is_expression = lbracket * C(((C(nobracket^1))/make_expression)) * rbracket - local is_expression = lbracket * (lpeg.C(nobracket^1))/make_expression * rbracket + local is_expression = lbracket * (C(nobracket^1))/make_expression * rbracket local is_one = name local is_none = exclam * name @@ -2977,12 +3007,12 @@ do -- a few ugly goodies: - local docroottag = lpeg.P('^^') / function( ) map[#map+1] = { 12 } end - local subroottag = lpeg.P('^') / function( ) map[#map+1] = { 13 } end - local roottag = lpeg.P('root::') / function( ) map[#map+1] = { 12 } end - local parenttag = lpeg.P('parent::') / function( ) map[#map+1] = { 11 } end - local childtag = lpeg.P('child::') - local selftag = lpeg.P('self::') + local docroottag = P('^^') / function( ) map[#map+1] = { 12 } end + local subroottag = P('^') / function( ) map[#map+1] = { 13 } end + local roottag = P('root::') / function( ) map[#map+1] = { 12 } end + local parenttag = P('parent::') / function( ) map[#map+1] = { 11 } end + local childtag = P('child::') + local selftag = P('self::') -- there will be more and order will be optimized @@ -2996,15 +3026,15 @@ do dont_match_and_eq + dont_match_and_ne + match_and_eq + match_and_ne + dont_expression + expression + -dont_self_expression + self_expression + + dont_self_expression + self_expression + has_attribute + has_value + dont_match_one_of + match_one_of + dont_match + match + crap + empty ) - local grammar = lpeg.P { "startup", - startup = (initial + documentroot + subtreeroot + roottag + docroottag + subroottag)^0 * lpeg.V("followup"), + local grammar = P { "startup", + startup = (initial + documentroot + subtreeroot + roottag + docroottag + subroottag)^0 * V("followup"), followup = ((slash + parenttag + childtag + selftag)^0 * selector)^1, } @@ -3086,7 +3116,7 @@ dont_self_expression + self_expression + t[#t+1] = (vv and "==") or "<>" end end - report(format("%2i: %s %s -> %s\n", k,v[1],actions[v[1]],table.join(t," "))) + report(format("%2i: %s %s -> %s\n", k,v[1],actions[v[1]],concat(t," "))) else report(format("%2i: %s %s\n", k,v[1],actions[v[1]])) end @@ -3376,53 +3406,25 @@ do xml.filters = { } - --[[ldx-- - <p>For splitting the filter function from the path specification, we can - use string matching or lpeg matching. Here the difference in speed is - neglectable but the lpeg variant is more robust.</p> - --ldx]]-- - - -- function xml.filter(root,pattern) - -- local pat, fun, arg = pattern:match("^(.+)/(.-)%((.*)%)$") - -- if fun then - -- return (xml.filters[fun] or xml.filters.default)(root,pat,arg) - -- else - -- pat, arg = pattern:match("^(.+)/@(.-)$") - -- if arg then - -- return xml.filters.attributes(root,pat,arg) - -- else - -- return xml.filters.default(root,pattern) - -- end - -- end - -- end - - -- not faster but hipper ... although ... i can't get rid of the trailing / in the path - - local name = (lpeg.R("az","AZ")+lpeg.R("_-"))^1 - local path = lpeg.C(((1-lpeg.P('/'))^0 * lpeg.P('/'))^1) - local argument = lpeg.P { "(" * lpeg.C(((1 - lpeg.S("()")) + lpeg.V(1))^0) * ")" } - local action = lpeg.Cc(1) * path * lpeg.C(name) * argument - local attribute = lpeg.Cc(2) * path * lpeg.P('@') * lpeg.C(name) - - local parser = action + attribute - - function xml.filter(root,pattern) - local kind, a, b, c = parser:match(pattern) - if kind == 1 then - return (xml.filters[b] or xml.filters.default)(root,a,c) - elseif kind == 2 then - return xml.filters.attributes(root,a,b) - else - return xml.filters.default(root,pattern) - end - end - function xml.filters.default(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end) return dt and dt[dk], rt, dt, dk end - + function xml.filters.attributes(root,pattern,arguments) + local rt, dt, dk + traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) + local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) + if ekat then + if arguments then + return ekat[arguments] or "", rt, dt, dk + else + return ekat, rt, dt, dk + end + else + return { }, rt, dt, dk + end + end function xml.filters.reverse(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end, 'reverse') @@ -3480,27 +3482,13 @@ do end return nil, nil, nil, nil end - function xml.filters.attributes(root,pattern,arguments) - local rt, dt, dk - traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) - local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) - if ekat then - if arguments then - return ekat[arguments] or "", rt, dt, dk - else - return ekat, rt, dt, dk - end - else - return { }, rt, dt, dk - end - end function xml.filters.attribute(root,pattern,arguments) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) return (ekat and (ekat[arguments] or ekat[arguments:gsub("^([\"\'])(.*)%1$","%2")])) or "" end - function xml.filters.text(root,pattern,arguments) -- ?? why index + function xml.filters.text(root,pattern,arguments) -- ?? why index, tostring slow local dtk, rt, dt, dk = xml.filters.index(root,pattern,arguments) if dtk then local dtkdt = dtk.dt @@ -3517,6 +3505,66 @@ do end --[[ldx-- + <p>For splitting the filter function from the path specification, we can + use string matching or lpeg matching. Here the difference in speed is + neglectable but the lpeg variant is more robust.</p> + --ldx]]-- + + -- not faster but hipper ... although ... i can't get rid of the trailing / in the path + + local P, S, R, C, V, Cc = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc + + local name = (R("az","AZ")+R("_-"))^1 + local path = C(((1-P('/'))^0 * P('/'))^1) + local argument = P { "(" * C(((1 - S("()")) + V(1))^0) * ")" } + local action = Cc(1) * path * C(name) * argument + local attribute = Cc(2) * path * P('@') * C(name) + + local parser = action + attribute + + local filters = xml.filters + local attribute_filter = xml.filters.attributes + local default_filter = xml.filters.default + + function xml.filter(root,pattern) + local kind, a, b, c = parser:match(pattern) + if kind == 1 then + return (filters[b] or default_filter)(root,a,c) + elseif kind == 2 then + return attribute_filter(root,a,b) + else + return default_filter(root,pattern) + end + end + + --~ slightly faster, but first we need a proper test file + --~ + --~ local hash = { } + --~ + --~ function xml.filter(root,pattern) + --~ local h = hash[pattern] + --~ if not h then + --~ local kind, a, b, c = parser:match(pattern) + --~ if kind == 1 then + --~ h = { kind, filters[b] or default_filter, a, b, c } + --~ elseif kind == 2 then + --~ h = { kind, attribute_filter, a, b, c } + --~ else + --~ h = { kind, default_filter, a, b, c } + --~ end + --~ hash[pattern] = h + --~ end + --~ local kind = h[1] + --~ if kind == 1 then + --~ return h[2](root,h[2],h[4]) + --~ elseif kind == 2 then + --~ return h[2](root,h[2],h[3]) + --~ else + --~ return h[2](root,pattern) + --~ end + --~ end + + --[[ldx-- <p>The following functions collect elements and texts.</p> --ldx]]-- @@ -3586,12 +3634,14 @@ do <p>We use the function variants in the filters.</p> --ldx]]-- + local wrap, yield = coroutine.wrap, coroutine.yield + function xml.elements(root,pattern,reverse) - return coroutine.wrap(function() traverse(root, lpath(pattern), coroutine.yield, reverse) end) + return wrap(function() traverse(root, lpath(pattern), yield, reverse) end) end function xml.elements_only(root,pattern,reverse) - return coroutine.wrap(function() traverse(root, lpath(pattern), function(r,d,k) coroutine.yield(d[k]) end, reverse) end) + return wrap(function() traverse(root, lpath(pattern), function(r,d,k) yield(d[k]) end, reverse) end) end function xml.each_element(root, pattern, handle, reverse) @@ -3617,7 +3667,7 @@ do local ek = d[k] local a = ek.at or { } handle(a) - if next(a) then + if next(a) then -- next is faster than type (and >0 test) ek.at = a else ek.at = nil @@ -3937,6 +3987,8 @@ end do + local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- -- 1021:0335:0287:0247 @@ -3945,23 +3997,23 @@ do -- -- 1559:0257:0288:0190 (last one suggested by roberto) - -- escaped = lpeg.Cs((lpeg.S("<&>") / xml.escapes + 1)^0) - -- escaped = lpeg.Cs((lpeg.S("<")/"<" + lpeg.S(">")/">" + lpeg.S("&")/"&" + 1)^0) - local normal = (1 - lpeg.S("<&>"))^0 - local special = lpeg.P("<")/"<" + lpeg.P(">")/">" + lpeg.P("&")/"&" - local escaped = lpeg.Cs(normal * (special * normal)^0) + -- escaped = Cs((S("<&>") / xml.escapes + 1)^0) + -- escaped = Cs((S("<")/"<" + S(">")/">" + S("&")/"&" + 1)^0) + local normal = (1 - S("<&>"))^0 + local special = P("<")/"<" + P(">")/">" + P("&")/"&" + local escaped = Cs(normal * (special * normal)^0) -- 100 * 1000 * "oeps< oeps> oeps&" : gsub:lpeg == 0153:0280:0151:0080 (last one by roberto) - -- unescaped = lpeg.Cs((lpeg.S("<")/"<" + lpeg.S(">")/">" + lpeg.S("&")/"&" + 1)^0) - -- unescaped = lpeg.Cs((((lpeg.P("&")/"") * (lpeg.P("lt")/"<" + lpeg.P("gt")/">" + lpeg.P("amp")/"&") * (lpeg.P(";")/"")) + 1)^0) - local normal = (1 - lpeg.S"&")^0 - local special = lpeg.P("<")/"<" + lpeg.P(">")/">" + lpeg.P("&")/"&" - local unescaped = lpeg.Cs(normal * (special * normal)^0) + -- unescaped = Cs((S("<")/"<" + S(">")/">" + S("&")/"&" + 1)^0) + -- unescaped = Cs((((P("&")/"") * (P("lt")/"<" + P("gt")/">" + P("amp")/"&") * (P(";")/"")) + 1)^0) + local normal = (1 - S"&")^0 + local special = P("<")/"<" + P(">")/">" + P("&")/"&" + local unescaped = Cs(normal * (special * normal)^0) -- 100 * 5000 * "oeps <oeps bla='oeps' foo='bar'> oeps </oeps> oeps " : gsub:lpeg == 623:501 msec (short tags, less difference) - local cleansed = lpeg.Cs(((lpeg.P("<") * (1-lpeg.P(">"))^0 * lpeg.P(">"))/"" + 1)^0) + local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) function xml.escaped (str) return escaped :match(str) end function xml.unescaped(str) return unescaped:match(str) end @@ -3976,9 +4028,9 @@ function xml.join(t,separator,lastseparator) result[k] = xml.tostring(v) end if lastseparator then - return table.join(result,separator or "",1,#result-1) .. (lastseparator or "") .. result[#result] + return concat(result,separator or "",1,#result-1) .. (lastseparator or "") .. result[#result] else - return table.join(result,separator) + return concat(result,separator) end else return "" @@ -3997,13 +4049,17 @@ do if unicode and unicode.utf8 then xml.entities = xml.entities or { } -- xml.entities.handler == function + function xml.entities.handler(e) + return format("[s]",e) + end + local char = unicode.utf8.char local function toutf(s) return char(tonumber(s,16)) end - function xml.utfize(root) + function utfize(root) local d = root.dt for k=1,#d do local dk = d[k] @@ -4013,22 +4069,26 @@ do if unicode and unicode.utf8 then d[k] = dk:gsub("&#x(.-);",toutf) end else - xml.utfize(dk) + utfize(dk) end end end + xml.utfize = utfize + local entities = xml.entities - local function resolve(e) - local ee = entities[e] - if ee then - return ee - elseif e:find("#x") then + local function resolve(e) -- hex encoded always first, just to avoid mkii fallbacks + if e:find("#x") then return char(tonumber(e:sub(3),16)) else - local h = entities.handler - return (h and h(e)) or "&" .. e .. ";" + local ee = entities[e] + if ee then + return ee + else + local h = xml.entities.handler + return (h and h(e)) or "&" .. e .. ";" + end end end @@ -4041,7 +4101,7 @@ do if unicode and unicode.utf8 then d[k] = dk:gsub("&(.-);",resolve) end else - xml.utfize(dk) + utfize(dk) end end end @@ -4054,7 +4114,7 @@ do if unicode and unicode.utf8 then end end - function xml.resolve_text_entities(str) + function xml.resolve_text_entities(str) -- maybe an lpeg. maybe resolve inline if str:find("&") then return (str:gsub("&(.-);",resolve)) else @@ -4070,11 +4130,11 @@ do if unicode and unicode.utf8 then end end +end end + -- xml.set_text_cleanup(xml.show_text_entities) -- xml.set_text_cleanup(xml.resolve_text_entities) -end end - --~ xml.lshow("/../../../a/(b|c)[@d='e']/f") --~ xml.lshow("/../../../a/!(b|c)[@d='e']/f") --~ xml.lshow("/../../../a/!b[@d!='e']/f") @@ -4169,7 +4229,7 @@ function utils.merger._self_swap_(data,code) end function utils.merger._self_libs_(libs,list) - local result, f = "", nil + local result, f = { }, nil if type(libs) == 'string' then libs = { libs } end if type(list) == 'string' then list = { list } end for _, lib in ipairs(libs) do @@ -4178,7 +4238,7 @@ function utils.merger._self_libs_(libs,list) f = io.open(name) if f then -- utils.report("merging library",name) - result = result .. "\n" .. f:read("*all") .. "\n" + result[#result+1] = f:read("*all") f:close() list = { pth } -- speed up the search break @@ -4187,7 +4247,7 @@ function utils.merger._self_libs_(libs,list) end end end - return result or "" + return table.concat(result, "\n\n") end function utils.merger.selfcreate(libs,list,target) @@ -5633,6 +5693,8 @@ end -- work that well; the parsing is ok, but dealing with the resulting -- table is a pain because we need to work inside-out recursively +-- get rid of piecewise here, just a gmatch is ok + function input.aux.splitpathexpr(str, t, validate) -- no need for optimization, only called a few times, we can use lpeg for the sub t = t or { } @@ -5640,7 +5702,7 @@ function input.aux.splitpathexpr(str, t, validate) while true do local done = false while true do - ok = false + local ok = false str = str:gsub("([^{},]+){([^{}]-)}", function(a,b) local t = { } b:piecewise(",", function(s) t[#t+1] = a .. s end) @@ -5650,7 +5712,7 @@ function input.aux.splitpathexpr(str, t, validate) if not ok then break end end while true do - ok = false + local ok = false str = str:gsub("{([^{}]-)}([^{},]+)", function(a,b) local t = { } a:piecewise(",", function(s) t[#t+1] = s .. b end) @@ -5660,7 +5722,7 @@ function input.aux.splitpathexpr(str, t, validate) if not ok then break end end while true do - ok = false + local ok = false str = str:gsub("([,{]){([^{}]+)}([,}])", function(a,b,c) ok, done = true, true return a .. b .. c @@ -5670,7 +5732,7 @@ function input.aux.splitpathexpr(str, t, validate) if not done then break end end while true do - ok = false + local ok = false str = str:gsub("{([^{}]-)}{([^{}]-)}", function(a,b) local t = { } a:piecewise(",", function(sa) @@ -5684,7 +5746,7 @@ function input.aux.splitpathexpr(str, t, validate) if not ok then break end end while true do - ok = false + local ok = false str = str:gsub("{([^{}]-)}", function(a) ok = true return a @@ -6553,7 +6615,7 @@ do resolvers.file = resolvers.filename resolvers.path = resolvers.pathname - function resolve(instance,str) + local function resolve(instance,str) if type(str) == "table" then for k, v in pairs(str) do str[k] = resolve(instance,v) or v @@ -7365,7 +7427,6 @@ end --~ states.load("teststate", "update") --~ print(states.get_by_tag("update","rsync.server","unknown")) - -- end library merge own = { } @@ -7608,29 +7669,36 @@ function file.savechecksum(name, checksum) return nil end -function os.currentplatform() - local currentplatform = "linux" - if os.platform == "windows" then - currentplatform = "mswin" - else - local architecture = os.resultof("uname -m") - local unixvariant = os.resultof("uname -s") - if architecture and architecture:find("x86_64") then - currentplatform = "linux-64" - elseif unixvariant and unixvariant:find("Darwin") then - if architecture and architecture:find("i386") then - currentplatform = "osx-intel" +os.arch = os.arch or function() + return os.resultof("uname -m") or "linux" +end + +function os.currentplatform(name, default) + local name = os.name or os.platform or name -- os.name is built in, os.platform is mine + if name then + if name == "windows" or name == "mswin" or name == "win32" or name == "msdos" then + return "mswin" + elseif name == "linux" then + local architecture = os.arch() + if architecture:find("x86_64") then + return "linux-64" + else + return "linux" + end + elseif name == "macosx" then + local architecture = os.arch() + if architecture:find("i386") then + return "osx-intel" else - currentplatform = "osx-ppc" + return "osx-ppc" end - elseif unixvariant and unixvariant:find("FreeBSD") then - currentplatform = "freebsd" + elseif name == "freebsd" then + return "freebsd" end end - return currentplatform + return default or name end - -- it starts here input.runners = { } @@ -7896,6 +7964,10 @@ function input.runners.locate_file(instance,filename) end end +function input.runners.locate_platform(instance) + input.runners.report_location(instance,os.currentplatform()) +end + function input.runners.report_location(instance,result) if input.verbose then input.report("") @@ -8115,9 +8187,11 @@ elseif environment.argument("resolve") then elseif environment.argument("locate") then -- locate file input.runners.locate_file(instance,filename) +elseif environment.argument("platform")then + -- locate platform + input.runners.locate_platform(instance) elseif environment.argument("help") or filename=='help' or filename == "" then input.help(banner,messages.help) -else -- execute script if filename:find("^bin:") then ok = input.runners.execute_program(instance,filename) diff --git a/scripts/context/lua/mtxrun.rme b/scripts/context/lua/mtxrun.rme new file mode 100644 index 000000000..9cb56486a --- /dev/null +++ b/scripts/context/lua/mtxrun.rme @@ -0,0 +1,3 @@ +On MSWindows the mtxrun.lua script is called +with mtxrun.cmd. On Unix you can either rename +mtxrun.lua to mtxrun, or use a symlink. diff --git a/scripts/context/lua/context.cmd b/scripts/context/stubs/mswin/context.cmd index 64ac1ea91..64ac1ea91 100644 --- a/scripts/context/lua/context.cmd +++ b/scripts/context/stubs/mswin/context.cmd diff --git a/scripts/context/lua/luatools.cmd b/scripts/context/stubs/mswin/luatools.cmd index 4bc998d65..4bc998d65 100644 --- a/scripts/context/lua/luatools.cmd +++ b/scripts/context/stubs/mswin/luatools.cmd diff --git a/scripts/context/lua/mtxrun.cmd b/scripts/context/stubs/mswin/mtxrun.cmd index f30148ddb..f30148ddb 100644 --- a/scripts/context/lua/mtxrun.cmd +++ b/scripts/context/stubs/mswin/mtxrun.cmd diff --git a/scripts/context/lua/context b/scripts/context/stubs/unix/context index a9d71ce9c..a9d71ce9c 100644..100755 --- a/scripts/context/lua/context +++ b/scripts/context/stubs/unix/context diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 2a4f9ac50..37c9facfa 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2008.04.16 17:34} +\newcontextversion{2008.04.18 14:17} %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.tex b/tex/context/base/context.tex index cf6aec247..f1c5dd750 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -42,7 +42,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2008.04.16 17:34} +\edef\contextversion{2008.04.18 14:17} %D For those who want to use this: diff --git a/tex/context/base/core-buf.lua b/tex/context/base/core-buf.lua index b1e956603..4203486f6 100644 --- a/tex/context/base/core-buf.lua +++ b/tex/context/base/core-buf.lua @@ -57,8 +57,6 @@ function buffers.grab(name,begintag,endtag,data) end buffers.data[name] = buffers.data[name]:gsub("[\010\013]$","") if buffers.flags.store_as_table then - -- todo: specific splitter, do we really want to erase the spaces? - --~ buffers.data[name] = string.split(buffers.data[name]," *[\010\013]") buffers.data[name] = buffers.data[name]:splitlines() end end @@ -84,7 +82,7 @@ buffers.commands.empty_line_command = "\\doverbatimemptyline" function buffers.verbatimbreak(n,m) if buffers.flags.optimize_verbatim then - if (n==2) or (n==m) then + if n == 2 or n == m then texsprint(buffers.commands.no_break) else texsprint(buffers.commands.do_break) @@ -92,34 +90,76 @@ function buffers.verbatimbreak(n,m) end end +function buffers.strip(lines) + local first, last = 1, #lines + for i=first,last do + if #lines[i] == 0 then + first = first + 1 + else + break + end + end + for i=last,first,-1 do + if #lines[i] == 0 then + last = last - 1 + else + break + end + end + return first, last, last - first + 1 +end + function buffers.type(name) local lines = buffers.data[name] local action = buffers.typeline if lines then if type(lines) == "string" then - lines = lines:splitlines() -- lines:split(" *[\010\013]") + lines = lines:splitlines() end - local line, n, m = 0, 0, #lines - for i=1,m do + local line, n = 0, 0 + local first, last, m = buffers.strip(lines) + for i=first,last do n, line = action(lines[i], n, m, line) end end end +--~ function buffers.typefile(name) +--~ local t = input.openfile(name) +--~ local action = buffers.typeline +--~ if t then +--~ local line, n, m = 0, 0, t.noflines +--~ while true do +--~ str = t.reader(t) +--~ if str then +--~ n, line = action(str, n, m, line) +--~ else +--~ break +--~ end +--~ end +--~ t.close() +--~ end +--~ end + function buffers.typefile(name) local t = input.openfile(name) local action = buffers.typeline if t then - local line, n, m = 0, 0, t.noflines + local lines = { } while true do - str = t.reader(t) + local str = t.reader() if str then - n, line = action(str, n, m, line) + lines[#lines+1] = str else break end end t.close() + local line, n = 0, 0 + local first, last, m = buffers.strip(lines) + for i=first,last do + n, line = action(lines[i], n, m, line) + end end end diff --git a/tex/context/base/core-buf.mkiv b/tex/context/base/core-buf.mkiv index 09f4f552e..c313fc450 100644 --- a/tex/context/base/core-buf.mkiv +++ b/tex/context/base/core-buf.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% this will become a proper new verbatim module + \unprotect \registerctxluafile{core-buf}{1.001} diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex index 38763ea4b..003a9a390 100644 --- a/tex/context/base/core-int.tex +++ b/tex/context/base/core-int.tex @@ -157,10 +157,6 @@ \unprotect -\definesystemconstant {link} - -\definesystemvariable {lk} - % \expand vs \expanded % linked registers implementeren als een koppeling == mooier @@ -177,13 +173,13 @@ {\expanded{\definetwopasslist{\s!link:#1}}% \expanded{\doloadtwopassdata{\s!link:#1}}% \getfirsttwopassdata{\s!link:#1}% - \setxvalue{\s!link:#1:f}{\twopassdata}% + \letgvalue{\s!link:#1:f}\twopassdata \getlasttwopassdata{\s!link:#1}% - \setxvalue{\s!link:#1:l}{\twopassdata}% - \setxvalue{\s!link:#1:s}{\noftwopassitems}% + \letgvalue{\s!link:#1:l}\twopassdata + \letgvalue{\s!link:#1:s}\noftwopassitems \gettwopassdata{\s!link:#1}% - \setxvalue{\s!link:#1:c}{\twopassdata}% - \setxvalue{\s!link:#1:n}{\twopassdata}}} + \letgvalue{\s!link:#1:c}\twopassdata + \letgvalue{\s!link:#1:n}\twopassdata}} \def\koppeling[#1]#2% {\bgroup @@ -191,38 +187,37 @@ \doglobal\increment\numberoflinks \gettwopassdata{\s!link:#1}% \edef\numberoflinks{0\getvalue{\s!link:#1:s}}% - \edef\firstlink{0\getvalue{\s!link:#1:f}}% - \edef\lastlink{0\getvalue{\s!link:#1:l}}% - \edef\currentlink{0\getvalue{\s!link:#1:n}}% - \edef\prevlink{0\getvalue{\s!link:#1:c}}% + \edef\firstlink {0\getvalue{\s!link:#1:f}}% + \edef\lastlink {0\getvalue{\s!link:#1:l}}% + \edef\currentlink {0\getvalue{\s!link:#1:n}}% + \edef\prevlink {0\getvalue{\s!link:#1:c}}% \iftwopassdatafound \edef\nextlink{0\twopassdata}% - \setxvalue{\s!link:#1:n}{\nextlink}% - \setxvalue{\s!link:#1:c}{\currentlink}% + \letgvalue{\s!link:#1:n}\nextlink + \letgvalue{\s!link:#1:c}\currentlink \else - \edef\nextlink {0\getvalue{\s!link:#1:l}}% + \edef\nextlink{0\getvalue{\s!link:#1:l}}% \fi \lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}% - \ifnum\noflinks<2 + \ifnum\noflinks<\plustwo \locationfalse \fi \iflocation \hbox - {%\setupinteraction[\c!width=\!!zeropoint]% - \setinteractionparameter\c!width\!!zeropoint - \doganaareenpagina\??lk\gotobegincharacter\firstlink\hss - \ifnum\noflinks>2 - \hskip\@@lkafstand - \doganaareenpagina\??lk\gobackwardcharacter\prevlink\hss + {\setinteractionparameter\c!width\!!zeropoint + \dogotosomepage\??lk\gotobegincharacter\firstlink\hss + \ifnum\noflinks>\plustwo + \hskip\@@lkdistance + \dogotosomepage\??lk\gobackwardcharacter\prevlink\hss \fi - \hskip\@@lkafstand + \hskip\@@lkdistance #2\relax - \hskip\@@lkafstand - \ifnum\noflinks>2 - \doganaareenpagina\??lk\goforwardcharacter\nextlink\hss - \hskip\@@lkafstand + \hskip\@@lkdistance + \ifnum\noflinks>\plustwo + \dogotosomepage\??lk\goforwardcharacter\nextlink\hss + \hskip\@@lkdistance \fi - \doganaareenpagina\??lk\gotoendcharacter\lastlink}% + \dogotosomepage\??lk\gotoendcharacter\lastlink}% \else \hbox{#2}% \fi @@ -239,8 +234,7 @@ \gettwopassdata{\s!link:#1}% \let\currentlink\twopassdata \let\nextlink\twopassdata - \setxvalue{\s!link:#1:}% - {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}}} + \setxvalue{\s!link:#1:}{\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}}} \def\koppeling[#1]#2% {\bgroup @@ -254,29 +248,26 @@ \edef\prevlink {0##4}% \edef\currentlink{0##5}}% \expanded{\next[\getvalue{\s!link:#1:}]}% - \edef\nextlink - {0\iftwopassdatafound\twopassdata\else\lastlink\fi}% - \setxvalue{\s!link:#1:}% - {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}% + \edef\nextlink{0\iftwopassdatafound\twopassdata\else\lastlink\fi}% + \setxvalue{\s!link:#1:}{\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}% \lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}% - \ifnum\noflinks<2 + \ifnum\noflinks<\plustwo \locationfalse \fi \iflocation \hbox - {%\setupinteraction[\c!width=\!!zeropoint]% - \setinteractionparameter\c!width\!!zeropoint + {\setinteractionparameter\c!width\!!zeropoint #2\relax - \hskip\@@lkafstand - \doganaareenpagina\??lk\gotobegincharacter\firstlink\hss - \ifnum\noflinks>2 - \doganaareenpagina\??lk\gobackwardcharacter\prevlink\hss + \hskip\@@lkdistance + \dogotosomepage\??lk\gotobegincharacter\firstlink\hss + \ifnum\noflinks>\plustwo + \dogotosomepage\??lk\gobackwardcharacter\prevlink\hss \fi - \ifnum\noflinks>2 - \doganaareenpagina\??lk\goforwardcharacter\nextlink\hss - \hskip\@@lkafstand + \ifnum\noflinks>\plustwo + \dogotosomepage\??lk\goforwardcharacter\nextlink\hss + \hskip\@@lkdistance \fi - \doganaareenpagina\??lk\gotoendcharacter\lastlink}% + \dogotosomepage\??lk\gotoendcharacter\lastlink}% \else \hbox{#2}% \fi @@ -286,36 +277,22 @@ \def\docalculateinteractionscreen {\doifelse\@@scwidth\v!fit - {\!!widtha\leftedgewidth - \advance\!!widtha \leftedgedistance - \advance\!!widtha \leftmarginwidth - \advance\!!widtha \leftmargindistance + {\!!widtha\leftcombitotal \ifdim\backspace>\!!widtha\ifdim\backspace>\zeropoint\relax \advance\backspace -\!!widtha \fi\fi - \advance\!!widtha \makeupwidth - \advance\!!widtha \rightmargindistance - \advance\!!widtha \rightmarginwidth - \advance\!!widtha \rightedgedistance - \advance\!!widtha \rightedgewidth - \scratchdimen\@@scbackspace - \advance\scratchdimen \@@schoroffset - \advance\!!widtha 2\scratchdimen} + \advance\!!widtha\rightcombitotal + \advance\!!widtha 2\dimexpr\@@scbackspace+\@@schoroffset\relax} {\doifelse\@@scwidth\v!max {\!!widtha\printpaperwidth} {\!!widtha\@@scwidth}}% \doifelse\@@scheight\v!fit - {\!!heighta\topheight - \advance\!!heighta \topdistance + {\!!heighta\dimexpr\topheight+\topdistance\relax \ifdim\topspace>\!!heighta\ifdim\topspace>\zeropoint\relax \advance\topspace -\!!heighta \fi\fi - \advance\!!heighta \makeupheight - \advance\!!heighta \bottomdistance - \advance\!!heighta \bottomheight - \scratchdimen\@@sctopspace - \advance\scratchdimen \@@scveroffset - \advance\!!heighta 2\scratchdimen} + \advance\!!heighta \dimexpr\makeupheight+\bottomdistance+\bottomheight\relax + \advance\!!heighta 2\dimexpr\@@sctopspace+\@@scveroffset\relax} {\doifelse\@@scheight\v!max {\!!heighta\printpaperheight} {\!!heighta\@@scheight}}% @@ -698,54 +675,6 @@ \def\dosetlocationboxnone#1[#2]#3[#4]% {\global\skippedmenuitemtrue} -% the following version looks ok but is not, since it is unaware of -% some reference properties -% -% \def\setlocationboxyes#1% -% {\locationclicktrue -% \ifx\currentouterreference\empty -% \ifrealreferencepage\!!doneatrue\else\!!doneafalse\fi -% \else -% \!!doneafalse -% \fi -% \if!!donea -% \ifcase\csname\??am\??am\csname#1\c!samepage\endcsname\endcsname\relax -% \copycsname#1\c!color\endcsname\csname#1\c!contrastcolor\endcsname -% \@EAEAEA\dosetlocationboxyes -% \or -% \@EAEAEA\dosetlocationboxempty -% \or -% \@EAEAEA\dosetlocationboxno -% \or -% \@EAEAEA\dosetlocationboxnone -% \fi -% \else -% \@EA\dosetlocationboxcontent -% \fi{#1}} -% -% \def\setlocationboxnop#1% -% {\locationclickfalse -% \ifcase\csname\??am\??am\csname#1\c!unknownreference\endcsname\endcsname\relax -% \@EA\dosetlocationboxyes -% \or -% \@EA\dosetlocationboxempty -% \or -% \@EA\dosetlocationboxno -% \or -% \@EA\dosetlocationboxnone -% \fi{#1}} -% -% \def\setlocationbox#1[#2]#3[#4]% -% {\bgroup % really needed ! -% \edef\permittedreferences{\csname#1\c!obstruction\endcsname}% -% \doifreferencepermittedelse{#4} -% {\setlocationboxyes{#1}[#2]{#3}[#4]} -% {\setlocationboxnop{#1}[#2]{#3}[#4]}% -% \egroup} -% -% \def\setlocationboxraw#1[#2]#3[#4]% -% {\localframed[#1][#2]{\dolocationattributes{#1}\c!style\c!color{#3}}} - \def\setlocationboxyes#1[#2]#3[#4]% {\locationclicktrue \setbox\locationbox\hbox @@ -796,20 +725,6 @@ {\setlocationboxnop{#1}[#2]{#3}[#4]}% \egroup} -\def\dodosetlocationcommanditem#1#2#3[#4]#5\\% - {\bgroup - \leavevmode - \doifelse{#5}{[]} - {\doifassignmentelse{#4}{#3}{\setlocationbox{\??am#1}[]{#3}[#4]}} - {#3}% - \ifskippedmenuitem \else - \getvalue{\??am#1#2}% - \fi - \egroup} - -\def\dosetlocationcommanditem#1#2#3% - {\dodosetlocationcommanditem{#1}{#2}#3[]\\} - \def\setlocationnop#1[#2]#3% {\localframed[#1][#2]{#3}} @@ -820,18 +735,8 @@ % \v!empty=>\chardef\handleunknownmenuitem=1\relax, % \v!no=>\chardef\handleunknownmenuitem=2\relax]% \getvalue{\??am#1#3}\relax - \ifextendedmenu - \setamboxcommands{#1}{#4}% - \def\next - {\ignorespaces#2}% - \else - \def\dolocationcommand##1% - {\dosetlocationcommanditem{#1}{#4}{##1}}% - \def\next - {\processcommalist[#2]\dolocationcommand}% - \fi - \next - \unskip + \setamboxcommands{#1}{#4}% + \ignorespaces#2\unskip \getvalue{\??am#1#5}} \newcounter\currentamposition @@ -845,8 +750,9 @@ \the\everysetmenucommands} \def\menu@@amboxcommand#1\\% - {\bgroup - \leavevmode\ignorespaces#1\unskip\relax + {\dontleavehmode + \bgroup + \ignorespaces#1\unskip\relax \ifskippedmenuitem \else \getvalue{\??am\currentmenu\currentsubmenu}% \fi @@ -867,7 +773,6 @@ {\@@amboxcommand\setlocationbox{\??am\currentmenu}[\c!frame=\v!off,\c!background=]{\ignorespaces#2\unskip}[#1]\\}% \def\menu@nop#1\\% - %{\@@amboxcommand\phantom{\localframed[\??am\currentmenu][]{#1}}\\}% {\@@amboxcommand\setlocationboxraw{\??am\currentmenu}[\c!frame=\v!off,\c!background=,\c!empty=\v!yes]{\ignorespaces#1\unskip}[]\\}% \def\menu@txt#1\\% @@ -897,27 +802,27 @@ % beware : never change the concept of pbgoffset +\def\menuparameter#1{\csname\??am\currentmenu#1\endcsname} + \def\@@amhbox#1#2#3#4% {\def\currentmenu{#3}% \testinteractionmenu{#3}% \iflocationmenupermitted \bgroup \showcomposition - \def\dolocationcommand##1{\dosetlocationcommanditem{#3}{##1}}% - \dimen0=\makeupwidth - \advance\dimen0 \pagebackgroundhoffset - \advance\dimen0 \pagebackgroundhoffset - \advance\dimen0 -\getvalue{\??am#3\c!leftoffset}% - \advance\dimen0 -\getvalue{\??am#3\c!rightoffset}% - \setbox0\hbox to \dimen0 - {\forgetall - \executeamboxcommands{#3}{#4}\c!left\c!middle\c!right}% - \setbox0\hbox{\do@@ammenuposition{#3}{\box0}}% - \wd0=\makeupwidth - % geen \ht=#2 setting (yet) - \hskip-\pagebackgroundhoffset - \hskip \getvalue{\??am#3\c!leftoffset}% - \box0\relax + \scratchdimen\dimexpr + \makeupwidth + +\pagebackgroundhoffset + +\pagebackgroundhoffset + -\menuparameter\c!leftoffset + -\menuparameter\c!rightoffset + \relax + \setbox\scratchbox\hbox to \scratchdimen + {\forgetall\executeamboxcommands{#3}{#4}\c!left\c!middle\c!right}% + \setbox\scratchbox\hbox{\do@@ammenuposition{#3}{\box\scratchbox}}% + \wd\scratchbox\makeupwidth % geen \ht=#2 setting (yet) + \hskip\dimexpr-\pagebackgroundhoffset+\menuparameter\c!leftoffset\relax + \box\scratchbox \egroup \else #1\relax @@ -929,28 +834,29 @@ \iflocationmenupermitted \bgroup \showcomposition - \dimen0=\textheight - \advance\dimen0 \pagebackgroundvoffset - \advance\dimen0 \pagebackgroundvoffset - \advance\dimen0 \pagebackgrounddepth - \advance\dimen0 -\getvalue{\??am#3\c!topoffset}% - \advance\dimen0 -\getvalue{\??am#3\c!bottomoffset}% - \setbox0\vbox to \dimen0 - {\forgetall % Voor't geval de afstand + \scratchdimen\dimexpr + \textheight + +\pagebackgroundvoffset + +\pagebackgroundvoffset + +\pagebackgrounddepth + -\menuparameter\c!topoffset + -\menuparameter\c!bottomoffset + \relax + \setbox\scratchbox\vbox to \scratchdimen + {\forgetall % Voor't geval de afstand %\setupblank[\v!standard]% % (tijdelijk) is aangepast. \restorestandardblank \hsize#2\relax \executeamboxcommands{#3}{#4}\c!before\c!inbetween\c!after}% - \setbox0\vbox{\hbox{\do@@ammenuposition{#3}{\box0}}}% - \setbox0\vbox - {\vskip-\pagebackgroundvoffset - \vskip\getvalue{\??am#3\c!topoffset}% - \ht0=\zeropoint - \box0 + \setbox\scratchbox\vbox{\hbox{\do@@ammenuposition{#3}{\box\scratchbox}}}% + \setbox\scratchbox\vbox + {\ht\scratchbox\zeropoint + \vskip\dimexpr-\pagebackgroundvoffset+\endcsname\c!topoffset\relax + \box\scratchbox \vskip\pagebackgroundvoffset}% overbodig - \ht0=\textheight - \wd0=#2\relax - \box0 + \ht\scratchbox\textheight + \wd\scratchbox#2\relax + \box\scratchbox \egroup \else #1\relax @@ -973,47 +879,47 @@ \def\horizontalinteractionmenu#1#2#3#4% {\ifdim#2>\zeropoint % new - \dimen2\zeropoint - \setbox0\hbox + \scratchdimen\zeropoint + \setbox\scratchbox\hbox {\def\docommand##1% {\doifnotvalue{\??am##1\c!state}\v!none - {\hskip\dimen2 + {\hskip\scratchdimen \setbox2\hbox to #2 {\getvalue{\??am##1#3}\interactionmenu[##1]\getvalue{\??am##1#4}}% \doifelsevalue{\??am##1\c!distance}\v!overlay - {\dimen2\zeropoint + {\scratchdimen\zeropoint \wd2\zeropoint}% - {\dimen2=\getvalue{\??am##1\c!distance}}% + {\scratchdimen\getvalue{\??am##1\c!distance}}% \box2}}% \startinteraction \processcommacommand[\getvalue{\??am#1}]\docommand \stopinteraction}% - \wd0=#2\relax - \box0\relax + \wd\scratchbox#2\relax + \box\scratchbox \fi} \def\verticalinteractionmenu#1#2#3#4% {\ifdim#2>\zeropoint % new - \dimen2\zeropoint - \setbox0\vbox + \scratchdimen\zeropoint + \setbox\scratchbox\vbox {\def\docommand##1% {\doifnotvalue{\??am##1\c!state}\v!none - {\vskip\dimen2 + {\vskip\scratchdimen \setbox2\vbox to #2 {\getvalue{\??am##1#3}\interactionmenu[##1]\getvalue{\??am##1#4}}% \doifelsevalue{\??am##1\c!distance}\v!overlay - {\dimen2\zeropoint + {\scratchdimen\zeropoint \offinterlineskip \dp2\zeropoint \ht2\zeropoint}% - {\dimen2=\getvalue{\??am##1\c!distance}}% + {\scratchdimen\getvalue{\??am##1\c!distance}}% \box2}}% \startinteraction \processcommacommand[\getvalue{\??am#1}]\docommand \stopinteraction}% - \ht0=#2\relax - \dp0\zeropoint - \box0\relax + \ht\scratchbox#2\relax + \dp\scratchbox\zeropoint + \box\scratchbox \fi} \letvalue{\??am\v!left }\empty @@ -1030,14 +936,10 @@ \dodummypageskip{#1}% \fi} -\setvalue{\??am\??am\c!menu\v!left}% - {\horizontalinteractionmenu\v!left\leftedgewidth\c!left\c!right} -\setvalue{\??am\??am\c!menu\v!right}% - {\horizontalinteractionmenu\v!right\rightedgewidth\c!left\c!right} -\setvalue{\??am\??am\c!menu\v!top}% - {\verticalinteractionmenu\v!top\topheight\c!before\c!after} -\setvalue{\??am\??am\c!menu\v!bottom}% - {\verticalinteractionmenu\v!bottom\bottomheight\c!before\c!after} +\setvalue{\??am\??am\c!menu\v!left }{\horizontalinteractionmenu\v!left \leftedgewidth \c!left \c!right} +\setvalue{\??am\??am\c!menu\v!right }{\horizontalinteractionmenu\v!right \rightedgewidth\c!left \c!right} +\setvalue{\??am\??am\c!menu\v!top }{\verticalinteractionmenu \v!top \topheight \c!before\c!after} +\setvalue{\??am\??am\c!menu\v!bottom}{\verticalinteractionmenu \v!bottom\bottomheight \c!before\c!after} % this can be implemented with the following command (which % is new, undocumented, experimental, untested, etc etc) @@ -1047,12 +949,8 @@ \def\dodefineinteractionmenuclass[#1][#2]% tag hori|veri {\doifelse{#2}\v!vertical - {\setvalue{\??am\??am\c!menu#1}% - {\verticalinteractionmenu - {#1}{\getvalue{\??am#1\c!width}}\c!before\c!after}} - {\setvalue{\??am\??am\c!menu#1}% - {\horizontalinteractionmenu - {#1}{\getvalue{\??am#1\c!height}}\c!left\c!right}}} + {\setvalue{\??am\??am\c!menu#1}{\verticalinteractionmenu {#1}{\getvalue{\??am#1\c!width }}\c!before\c!after}} + {\setvalue{\??am\??am\c!menu#1}{\horizontalinteractionmenu{#1}{\getvalue{\??am#1\c!height}}\c!left\c!right }}} % \setupinteraction[menu=on,state=start] % @@ -1107,33 +1005,18 @@ %D We also need an explicit position control some day. I'll %D do that when I need it. [The stacking order.] -% for the moment we will support the old method -% -% \stelinteractionmenuin[right][{abc[xyz]},...] -% \stelinteractionmenuin[right][key=val,...] - \newif\ifextendedmenu -\def\defineinteractionmenu - {\dotripleempty\dodefineinteractionmenu} - -\def\dodefineinteractionmenu[#1][#2]% compatibility hack - {\defconvertedargument\ascii{#2}% will disappear soon - \doifinstringelse[\ascii - \dodosetupinteractionlistmenux - \dododefineinteractionmenu - [#1][#2]} - % [name] [location] % [name] [location] [pars] -\def\dododefineinteractionmenu[#1][#2][#3]% +\def\defineinteractionmenu + {\dotripleempty\dodefineinteractionmenu} + +\def\dodefineinteractionmenu[#1][#2][#3]% {% main settings \letvalue{\??am\c!menu#1}\empty - % \setvalue{\??am\c!menu#1}% - % {\extendedmenufalse\dointeractionmenu{#1}{}}% - \setvalue{\@@dodolistelement#1}% - {\def\dosomelistelement{\dodomenulistelement{#1}}}% + \setvalue{\@@dodolistelement#1}{\def\dosomelistelement{\dodomenulistelement{#1}}}% \presetlocalframed[\??am#1]% % register location \expanded{\addtocommalist{#1}\@EA\noexpand\csname\??am#2\endcsname}% @@ -1152,27 +1035,15 @@ \def\setupinteractionmenu {\dodoubleargument\dosetupinteractionmenu} -\def\dosetupinteractionmenu[#1][% compatibillity hack - {\doifnextcharelse\bgroup % will disappear soon - {\dodosetupinteractionlistmenuy[#1][} - {\dodosetupinteractionmenu [#1][}} - -\def\dodosetupinteractionlistmenux[#1][#2][#3]% compatibillity hack - {\setvalue{\??am\c!menu#1}{\extendedmenufalse\dointeractionmenu{#1}{#2}}} - -\def\dodosetupinteractionlistmenuy[#1][#2]% compatibillity hack - {\setvalue{\??am\c!menu#1}% - {\extendedmenufalse\dointeractionmenu{#1}{#2}}} - -\def\dodosetupinteractionmenu[#1][#2]% +\def\dosetupinteractionmenu[#1][#2]% {\def\docommand##1{\getparameters[\??am##1][#2]}% \processcommalist[#1]\docommand} -\setvalue{\??am\??am\v!yes }{0} -\setvalue{\??am\??am\v!empty}{1} -\setvalue{\??am\??am\v!no }{2} -\setvalue{\??am\??am\v!none}{3} -\setvalue{\??am\??am }{1} % default +\expandafter\chardef\csname\??am\??am\v!yes \endcsname\zerocount +\expandafter\chardef\csname\??am\??am\v!empty\endcsname\plusone +\expandafter\chardef\csname\??am\??am\v!no \endcsname\plustwo +\expandafter\chardef\csname\??am\??am\v!none \endcsname\plusthree +\expandafter\chardef\csname\??am\??am \endcsname\plusone % default \processbetween{\v!interactionmenu}\dostartinteractionmenu @@ -1188,7 +1059,7 @@ \def\dodomenulistelement#1#2#3#4#5#6#7% {\setbox0=\hbox {\let\gotolocation\gobbleoneargument % hack to catch last [] -%\locationclickfalse % ipv ^ + %\locationclickfalse % ipv ^ \docheckrealreferencepage{#7}% \setlocationboxyes {\??am#1}% % needed ! @@ -1246,13 +1117,6 @@ \setlocationbox{\??am#1}[]{#3}[#4]% \egroup} -\def\domenubox[#1][#2]#3% - {\bgroup - \def\setlocationbox##1[##2]##3[##4]% - {\localframed[##1][##2]{\dolocationattributes{##1}\c!style\c!color{##3}}}% - \domenubutton[#1][#2]#3[]% - \egroup} - \def\menubox {\dodoubleempty\domenubox} @@ -1381,66 +1245,71 @@ \egroup \fi\fi} -% Dit is leuke toepassing van glue! +% A nice application of glue. All this code will be rewritten and +% generalized. -\newbox\meterbox +\newbox\interactionbarbox \newif\ifbarsymbol -\def\doganaareenpagina#1#2#3% nog checken ! +\def\dogotosomepage#1#2#3% nog checken ! {\checkreferences % nodig ?? - \iflocation - \ifnum#3=\realpageno - {#2}% + \hbox + {\iflocation + \ifnum#3=\realpageno + #2% + \else + \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!color}{#2}}% + \fi \else - \doifelsenothing{#1} - {\hbox{\gotorealpage{}{}{#3} - {#2}}} - {\hbox{\gotorealpage{}{}{#3} - {\dolocationattributes{#1}\c!style\c!color{#2}}}}% - \fi - \else - {#2}% - \fi} + #2% + \fi}} + +\def\dogotosomecontrastpage#1#2#3% nog checken, may replace previous + {\checkreferences % nodig ?? + \hbox + {\iflocation + \ifnum#3=\realpageno + \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!contrastcolor}{#2}}% + \else + \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!color}{#2}}% + \fi + \else + #2% + \fi}} \presetlocalframed[\??ib] -\def\interactionbara - {\iflocation +\def\interactionbara % we need better control over contrastcolor + {\iflocation % maybe just use gotopage and set colors \bgroup - %\setupinteraction[\c!width=\!!zeropoint]% - \setinteractionparameter\c!width\!!zeropoint - \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% maten ?? - \!!widthb\@@ibwidth - \advance\!!widthb -2.75em\relax - \!!widtha\!!widthb - \divide\!!widtha \lastpage\relax + \setinteractionparameter\c!width\zeropoint + \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% + \!!widthb\dimexpr\@@ibwidth-2.75\emwidth\relax + \!!widtha\dimexpr\!!widthb/\lastpage\relax \bgroup - \advance\realpageno \minusone - \ifvoid\meterbox + \advance\realpageno\minusone + \ifvoid\interactionbarbox \bgroup \processaction [\@@ibstep] - [ \v!small=>\dimen0=.25em\relax, - \v!medium=>\dimen0=.5em\relax, - \v!big=>\dimen0=1em\relax, - \s!unknown=>\dimen0=\!!widtha]% - \ifdim\!!widtha<\dimen0\relax - \!!counta\dimen0\relax - \!!countb\!!widtha - \divide\!!counta \!!countb + [ \v!small=>\scratchdimen.25\emwidth, + \v!medium=>\scratchdimen.5\emwidth, + \v!big=>\scratchdimen\emwidth, + \s!unknown=>\scratchdimen\!!widtha]% + \ifdim\!!widtha<\scratchdimen\relax + \!!counta\numexpr\scratchdimen/\!!widtha\relax \else \!!counta\@@ibstep\relax \fi - \!!widtha=\!!counta\!!widtha - \setbox0\hbox{\blackrule[\c!width=\!!widtha]}% - \global\setbox\meterbox\hbox to \!!widthb + \!!widtha\!!counta\!!widtha + \setbox\scratchbox\hbox{\blackrule[\c!width=\!!widtha,\c!color=middlegray]}% color here, else no mkiv + \global\setbox\interactionbarbox\hbox to \!!widthb {\hss - % brrr - \for \teller=1 \to \lastpage \step \!!counta \do - {\gotorealpage{}{}{\teller}{\copy0}}% + \dostepwiserecurse\plusone\lastpage\!!counta + {\gotorealpage\empty\empty\recurselevel{\copy\scratchbox}}% \hss}% - \global\wd\meterbox\zeropoint + \global\wd\interactionbarbox\zeropoint \egroup \fi \egroup @@ -1448,40 +1317,34 @@ \strut \hbox to \@@ibwidth {\dontcomplain - \setupblackrules[\c!width=1em]% - \doganaareenpagina\??ib\blackrule\firstpage + \setupblackrules[\c!width=\emwidth]% + \dogotosomecontrastpage\??ib\blackrule\firstpage \hss - \color[middlegray]{\copy\meterbox}% + \copy\interactionbarbox \hbox to \!!widthb - {\ifdim\!!widtha<1em\relax - \!!widtha=1em\relax + {\ifdim\!!widtha<\emwidth + \!!widtha\emwidth \fi \setupblackrules[\c!width=\!!widtha]% \ifnum\realpageno>\plusone - \!!counta\realpageno - \advance\!!counta -2\relax + \!!counta\numexpr\realpageno-\plustwo\relax \hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow - % or just: \hskip\zeropoint\!!plus\!!counta \relax % cm gives overflow - \doganaareenpagina\??ib\blackrule\prevpage + \dogotosomepage\??ib\blackrule\prevpage \fi - \color[\@@ibcontrastcolor]{\blackrule[\c!width=.5em]}% + \dogotosomecontrastpage\??ib{\blackrule[\c!width=.5em]}\realpageno \ifnum\realpageno<\lastpage\relax - \doganaareenpagina\??ib\blackrule\nextpage - \!!counta\lastpage - \advance\!!counta -\realpageno - \advance\!!counta \minusone + \dogotosomepage\??ib\blackrule\nextpage + \!!counta\numexpr\lastpage-\realpageno-\plusone\relax \hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow - % or just \hskip\zeropoint\!!plus\!!counta\relax % cm gives overflow \fi}% \hss - \doganaareenpagina\??ib\blackrule\lastpage}% + \dogotosomecontrastpage\??ib\blackrule\lastpage}% \egroup \fi} \def\interactionbarb {\ifnum\lastpage>\firstpage\relax - \interactionbuttons - [\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]% + \interactionbuttons[\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]% \fi} \def\interactionbarc @@ -1489,27 +1352,17 @@ \ifnum\lastpage>\plusone \hbox to \@@ibwidth {\setupblackrules[\c!height=\@@ibheight,\c!depth=\@@ibdepth]% - \def\gotox##1% - {\doganaareenpagina{}{\blackrule[\c!width=##1]}}% - \dimen0=\@@ibwidth\relax - \advance\dimen0 -4em - \!!counta\lastpage - \advance\!!counta \minusone - \divide\dimen0 \!!counta - \!!counta\realpageno - \advance\!!counta \minusone - \!!widtha\!!counta\dimen0 - \!!countb\lastpage - \advance\!!countb -\realpageno - \!!widthb\!!countb\dimen0 + \scratchdimen\dimexpr(\@@ibwidth-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax + \!!widtha\numexpr\realpageno+\minusone\relax\scratchdimen + \!!widthb\numexpr\lastpage-\realpageno\relax\scratchdimen \startcolor[\locationcolor\@@ibcolor]% - \gotox{1em}\firstpage + \dogotosomepage\empty{\blackrule[\c!width=\emwidth]}\firstpage \hss - \gotox\!!widtha\prevpage - \color[\@@ibcontrastcolor]{\blackrule[\c!width=1em]}% - \gotox\!!widthb\nextpage + \dogotosomepage\empty{\blackrule[\c!width=\!!widtha]}\prevpage + \color[\@@ibcontrastcolor]{\blackrule[\c!width=\emwidth]}% + \dogotosomepage\empty{\blackrule[\c!width=\!!widthb]}\nextpage \hss - \gotox{1em}\lastpage + \dogotosomepage\empty{\blackrule[\c!width=\emwidth]}\lastpage \stopcolor}% \fi \fi} @@ -1517,42 +1370,29 @@ \def\interactionbard {\iflocation\ifshowingsubpage \ifnum\nofsubpages>\plusone - \hbox - \bgroup - %\setupinteraction[\c!width=\!!zeropoint]% - \setinteractionparameter\c!width\!!zeropoint - \ifbarsymbol % beter: 3 chars assign en 3*box - \setupsymbolset[\@@iasymbolset]% - \setbox0\hbox{\symbol[\v!previous]}% - \setbox2\hbox{\symbol[\v!somewhere]}% - \setbox4\hbox{\symbol[\v!next]}% - \else - \setbox0\hbox - {\vrule - \!!height\@@ibheight - \!!depth\@@ibdepth - \!!width\@@ibwidth}% - \setbox2\copy0 - \setbox4\copy0 - \fi - \startcolor[\locationcolor\@@ibcolor]% - \for\teller=1\to\nofsubpages\step1\do % brr, \dostepwiserecurse - {\bgroup - \increment(\teller,\firstsubpage)\relax - \decrement\teller\relax - \ifnum\teller<\realpageno\relax - \gotorealpage{}{}{\teller}{\copy0}\relax - \else\ifnum\teller=\realpageno\relax - \color - [\@@ibcontrastcolor] - {\gotorealpage{}{}{\teller}{\copy2}}% - \else - \gotorealpage{}{}{\teller}{\copy4}\relax - \fi\fi - \egroup - \hskip\@@ibdistance}% - \unskip - \stopcolor + \hbox \bgroup + \setinteractionparameter\c!width\!!zeropoint + \ifbarsymbol + \setupsymbolset[\@@iasymbolset]% + \def\dogotox##1% + {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!next\fi]}}% + \else + \def\dogotox##1% + {\hbox{\vrule\!!height\@@ibheight\!!depth \@@ibdepth\!!width \@@ibwidth}}% + \fi + \dostepwiserecurse\plusone\nofsubpages\plusone + {\bgroup + \scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax + \ifnum\scratchcounter<\realpageno\relax + \dogotosomecontrastpage\??ib{\dogotox0}\scratchcounter + \else\ifnum\scratchcounter=\realpageno\relax + \dogotosomecontrastpage\??ib{\dogotox1}\scratchcounter + \else + \dogotosomecontrastpage\??ib{\dogotox2}\scratchcounter + \fi\fi + \egroup + \hskip\@@ibdistance}% + \unskip % not needed \egroup \fi \fi\fi} @@ -1561,72 +1401,54 @@ {\iflocation\ifshowingsubpage \ifnum\nofsubpages>\plusone \bgroup - \!!widthb\@@ibdistance - \multiply\!!widthb \nofsubpages - \advance\!!widthb -\@@ibdistance % (n-1) - \!!widtha\@@ibwidth - \advance\!!widtha -\!!widthb - \divide\!!widtha \nofsubpages\relax + \!!widthb\dimexpr\nofsubpages\dimexpr\@@ibdistance\relax-\@@ibdistance\relax % (n-1) + \!!widtha\dimexpr(\@@ibwidth-\!!widthb)/\nofsubpages\relax \ifdim\!!widtha<\@@ibdistance\relax \interactionbarf \else - %\setupinteraction[\c!width=\!!zeropoint]% \setinteractionparameter\c!width\!!zeropoint \noindent \hbox to \@@ibwidth \bgroup \ifbarsymbol \setupsymbolset[\@@iasymbolset]% - \setbox0\hbox{\symbol[\v!previous]}% - \setbox2\hbox{\symbol[\v!somewhere]}% - \setbox4\hbox{\symbol[\v!next]}% + \def\dogotox##1% + {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!next\fi}}% \else - \setbox0\hbox - {\vrule - \!!height\@@ibheight - \!!depth\@@ibdepth - \!!width\!!widtha}% - \setbox2\copy0 - \setbox4\copy0 + \def\dogotox##1% + {\hbox{\vrule\!!height\@@ibheight\!!depth\@@ibdepth\!!width\!!widtha}}% \fi - \startcolor[\locationcolor\@@ibcolor]% - \for\teller=1\to\nofsubpages\step1\do + \dostepwiserecurse\plusone\nofsubpages\plusone {\bgroup - \increment(\teller,\firstsubpage)\relax - \decrement\teller\relax - \ifnum\teller<\realpageno\relax - \gotorealpage{}{}{\teller}{\copy0}\relax - \else\ifnum\teller=\realpageno\relax - \color - [\@@ibcontrastcolor] - {\gotorealpage{}{}{\teller}{\copy2}}% + \scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax + \ifnum\scratchcounter<\realpageno\relax + \dogotosomecontrastpage\??ib{\dogotox0}\scratchcounter + \else\ifnum\scratchcounter=\realpageno\relax + \dogotosomecontrastpage\??ib{\dogotox1}\scratchcounter \else - \gotorealpage{}{}{\teller}{\copy4}\relax + \dogotosomecontrastpage\??ib{\dogotox2}\scratchcounter \fi\fi \egroup \hss}% \unskip - \stopcolor \egroup \fi \egroup \fi \fi\fi} -\def\interactionbarf% !! KAN WORDEN GECOMBINEERD MET D !! +\def\interactionbarf % !! KAN WORDEN GECOMBINEERD MET D !! {\iflocation\ifshowingsubpage \ifnum\nofsubpages>\plusone - %\setupinteraction[\c!width=\!!zeropoint]% \setinteractionparameter\c!width\!!zeropoint \noindent \hbox to \@@ibwidth \bgroup \!!countb\zerocount - \loop + \loop % todo: \doloop \advance\!!countb \plusone - \!!countc\nofsubpages - \divide\!!countc \!!countb - \advance\!!countc \plusone + %\!!countc\nofsubpages \divide\!!countc \!!countb \advance\!!countc \plusone + \!!countc\numexpr(\nofsubpages/\!!countb)+\plusone\relax % rounding \!!widthb\@@ibdistance \multiply\!!widthb \!!countc \advance\!!widthb -\@@ibdistance @@ -1635,83 +1457,74 @@ \divide\!!widtha \!!countc \ifdim\!!widtha<\@@ibdistance\relax \repeat -\advance\!!countc -2 -\!!widtha-\@@ibdistance -\!!widtha=\!!countc\!!widtha -\advance\!!widtha \@@ibwidth -\advance\!!countc \plusone -\divide\!!widtha \!!countc + \ifnum\!!countc>\plusone + % this is not that well tested + \advance\!!countc \minustwo + \!!widtha-\@@ibdistance + \!!widtha\!!countc\!!widtha + \advance\!!widtha \@@ibwidth + \advance\!!countc \plusone + \divide\!!widtha \!!countc + \fi \ifbarsymbol \setupsymbolset[\@@iasymbolset]% - \setbox0\hbox{\symbol[\v!previous]}% - \setbox4\hbox{\symbol[\v!somewhere]}% - \setbox8\hbox{\symbol[\v!next]}% - \setbox2\copy4 - \setbox6\copy4 + \def\dogotox##1% + {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!somewhere\or\v!somewhere\or\v!next\fi}}% \else - \setbox0\hbox - {\vrule - \!!height\@@ibheight - \!!depth\@@ibdepth - \!!width\!!widtha}% - \setbox4\copy0 - \setbox8\copy0 - \setbox2\hbox - {\vrule - \!!height.5\ht0 - \!!depth.5\dp0 - \!!width\!!widtha}% - \ht2\ht0 - \dp2\dp0 - \setbox6\copy2 + \def\dogotox##1% + {\hbox + {\!!heighta\@@ibheight + \!!deptha\@@ibdepth + \ifcase##1\relax + \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha + \or + \vrule\!!height.5\!!heighta\!!depth.5\!!deptha\!!width\!!widtha + \or + \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha + \or + \vrule\!!height.5\!!heighta\!!depth.5\!!deptha\!!width\!!widtha + \or + \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha + \fi}}% \fi - \def\gotox##1% - {\ifnum\teller=\realpageno - \color - [\@@ibcontrastcolor] - {\gotorealpage{}{}{\teller}{\copy##1}}% - \else - \gotorealpage{}{}{\teller}{\copy##1}% - \fi - \!!countf\zerocount - \hss}% - \startcolor[\locationcolor\@@ibcolor]% - \!!countc\realpageno \advance\!!countc -2 - \!!countd\realpageno \advance\!!countd 2 + \!!countc\numexpr\realpageno-\plustwo\relax + \!!countd\numexpr\realpageno+\plustwo\relax + \ifnum\!!countc<\plusone \!!countc\plusone \fi \!!countf\zerocount - \for\teller=\firstsubpage\to\lastsubpage\step1\do + \dostepwiserecurse\firstsubpage\lastsubpage\plusone {\!!doneafalse \advance\!!countf \plusone - \ifnum\teller=\firstsubpage\relax \!!doneatrue \fi - \ifnum\teller=\lastsubpage\relax \!!doneatrue \fi - \ifnum\teller>\!!countc \ifnum\teller<\!!countd \!!doneatrue \fi\fi + \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi + \ifnum\recurselevel=\lastsubpage\relax \!!doneatrue \fi \if!!donea - \ifnum\teller<\realpageno - \gotox0% - \else\ifnum\teller>\realpageno - \gotox4% + \ifnum\recurselevel<\realpageno + \dogotosomecontrastpage\??ib{\dogotox0}\recurselevel + \else\ifnum\recurselevel>\realpageno + \dogotosomecontrastpage\??ib{\dogotox2}\recurselevel \else - \gotox8% + \dogotosomecontrastpage\??ib{\dogotox4}\recurselevel \fi\fi + \hss + \!!countf\zerocount \else\ifnum\!!countf=\!!countb - \ifnum\teller<\realpageno - \gotox2% - \else\ifnum\teller>\realpageno - \gotox6% + \ifnum\recurselevel<\realpageno + \dogotosomecontrastpage\??ib{\dogotox1}\recurselevel + \else\ifnum\recurselevel>\realpageno + \dogotosomecontrastpage\??ib{\dogotox3}\recurselevel \else - \gotox4% + \dogotosomecontrastpage\??ib{\dogotox2}\recurselevel \fi\fi + \hss + \!!countf\zerocount \fi\fi}% \unskip - \stopcolor \egroup \fi \fi\fi} \def\interactionbarg {\ifnum\lastsubpage>\firstsubpage\relax - \interactionbuttons - [\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]% + \interactionbuttons[\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]% \fi} \def\checkinteractionbar#1#2#3% @@ -1721,7 +1534,7 @@ \def\complexinteractionbar[#1]% {\doifelse{#1}\v!reset - {\global\setbox\meterbox\box\voidb@x}% + {\global\setbox\interactionbarbox\box\voidb@x}% {\bgroup \iflocation \checksubpages % goes wrong / loads \numberofpages too @@ -1730,10 +1543,10 @@ {\startinteraction \processaction % breedte defaults ! [\@@ibalternative] - [ c=>\checkinteractionbar{.5em}\v!max \v!max, + [ c=>\checkinteractionbar{10em}\v!max \v!max, d=>\checkinteractionbar{.5em}{.5em} \!!zeropoint, - e=>\checkinteractionbar{.5em}{.5em} \!!zeropoint, - f=>\checkinteractionbar{.5em}{.5em} \!!zeropoint, + e=>\checkinteractionbar{10em}{.5em} \!!zeropoint, + f=>\checkinteractionbar{10em}{.5em} \!!zeropoint, \s!default=>\checkinteractionbar{10em}\v!broad\!!zeropoint, \s!unknown=>\checkinteractionbar{10em}\v!broad\!!zeropoint]% \doifelse\@@ibsymbol\v!yes @@ -2427,35 +2240,27 @@ \c!rightoffset=\!!zeropoint] \def\placeleftedgetextblock % Is \hss/\hsize really needed here? - {\hbox to \leftedgewidth % (check outer level and settings) - {\hsize\leftedgewidth - \hss - \interactionmenus[\v!left]}} + {\hbox to \leftedgewidth % (check outer level and settings) + {\hsize\leftedgewidth\hss\interactionmenus[\v!left]}} \def\placerightedgetextblock % Is \hss/\hsize really needed here? - {\hbox to \rightedgewidth % (check outer level and settings) - {\hsize\rightedgewidth - \interactionmenus[\v!right]% - \hss}} + {\hbox to \rightedgewidth % (check outer level and settings) + {\hsize\rightedgewidth\interactionmenus[\v!right]\hss}} \def\placetoptextblock {\vbox to \topheight {\vsize\topheight -% \getvalue{\??tk\v!boven\v!tekst\c!voor} - \getvalue{\??tk\v!top\c!before} - \interactionmenus[\v!top] -% \getvalue{\??tk\v!boven\v!tekst\c!na} - \getvalue{\??tk\v!top\c!after} + \csname\??tk\v!top\c!before\endcsname + \interactionmenus[\v!top]% + \csname\??tk\v!top\c!after\endcsname \kern\zeropoint}} \def\placebottomtextblock {\vbox to \bottomheight {\vsize\bottomheight -% \getvalue{\??tk\v!onder\v!tekst\c!voor} - \getvalue{\??tk\v!bottom\c!before} - \interactionmenus[\v!bottom] -% \getvalue{\??tk\v!onder\v!tekst\c!na} - \getvalue{\??tk\v!bottom\c!after} + \csname\??tk\v!bottom\c!before\endcsname + \interactionmenus[\v!bottom]% + \csname\??tk\v!bottom\c!after\endcsname \kern\zeropoint}} \ifx\leftedgetextcontent\undefined \else diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex index 2457d735c..045a05123 100644 --- a/tex/context/base/core-nav.tex +++ b/tex/context/base/core-nav.tex @@ -250,7 +250,7 @@ %D situations where the typeface is handled by the calling %D macro. -\def\interactioncolor +\def\interactioncolor % todo \??ia as argument {\iflocation \ifrealreferencepage \@@iacontrastcolor diff --git a/tex/context/base/core-pos.lua b/tex/context/base/core-pos.lua index d5c365031..8fff3e350 100644 --- a/tex/context/base/core-pos.lua +++ b/tex/context/base/core-pos.lua @@ -16,80 +16,79 @@ if not jobs then jobs = { } end if not job then jobs['main'] = { } end job = jobs['main'] if not job.positions then job.positions = { } end -function job.MPp(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[1]) else tex.sprint('0' ) end end -function job.MPx(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[2]) else tex.sprint('0pt') end end -function job.MPy(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[3]) else tex.sprint('0pt') end end -function job.MPw(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[4]) else tex.sprint('0pt') end end -function job.MPh(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[5]) else tex.sprint('0pt') end end -function job.MPd(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[6]) else tex.sprint('0pt') end end +local texprint = tex.print +local positions = job.positions +local concat = table.concat +local format = string.format + +function job.MPp(id) local jpi = positions[id] texprint((jpi and jpi[1]) or '0' ) end +function job.MPx(id) local jpi = positions[id] texprint((jpi and jpi[2]) or '0pt') end +function job.MPy(id) local jpi = positions[id] texprint((jpi and jpi[3]) or '0pt') end +function job.MPw(id) local jpi = positions[id] texprint((jpi and jpi[4]) or '0pt') end +function job.MPh(id) local jpi = positions[id] texprint((jpi and jpi[5]) or '0pt') end +function job.MPd(id) local jpi = positions[id] texprint((jpi and jpi[6]) or '0pt') end + +-- the following are only for MP so there we can leave out the pt function job.MPxy(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint('('..jpi[2]..','..jpi[3]..')') + texprint(format('(%s,%s)',jpi[2],jpi[3])) else - tex.sprint('(0pt,0pt)') + texprint('(0,0)') end end function job.MPll(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint('('..jpi[2]..'-'..-jpi[3]..','..jpi[6]..')') + texprint(format('(%s,%s-%s)',jpi[2],jpi[3],jpi[6])) else - tex.sprint('(0pt,0pt)') + texprint('(0,0)') end end function job.MPlr(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint('('..jpi[2]..'+'..jpi[4]..','..jpi[3]..'-'..jpi[6]..')') + texprint(format('(%s+%s,%s-%s)',jpi[2],jpi[4],jpi[3],jpi[6])) else - tex.sprint('(0pt,0pt)') + texprint('(0,0)') end end function job.MPur(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint('('..jpi[2]..'+'..jpi[4]..','..jpi[3]..'+'..jpi[5]..')') + texprint(format('(%s+%s,%s+%s)',jpi[2],jpi[4],jpi[3],jpi[5])) else - tex.sprint('(0pt,0pt)') + texprint('(0,0)') end end function job.MPul(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint('('..jpi[2]..','..jpi[3]..'+'..jpi[5]..')') + texprint(format('(%s,%s+%s)',jpi[2],jpi[3],jpi[5])) else - tex.sprint('(0pt,0pt)') + texprint('(0,0)') end end -- todo function job.MPpos(id) - local jpi = job.positions[id] + local jpi = positions[id] if jpi then - tex.sprint(table.concat(jpi,',',1,6)) + texprint(concat(jpi,',',1,6)) else - tex.sprint('0,0pt,0pt,0pt,0pt,0pt') + texprint('0,0,0,0,0,0') end end -function job.MPplus(id,n) - local jpi = job.positions[id] - if jpi then - tex.sprint(jpi[n] or '0pt') - else - tex.sprint('0pt') - end +function job.MPplus(id,n,default) + local jpi = positions[id] + texprint((jpi and jpi[n]) or default) end function job.MPrest(id,default) -- 7 or 8 ? - local jpi = job.positions[id] - if jpi then - tex.sprint(jpi[7] or default) - else - tex.sprint(default) - end + local jpi = positions[id] + texprint((jpi and jpi[7]) or default) end diff --git a/tex/context/base/core-pos.mkiv b/tex/context/base/core-pos.mkiv index 7c80984dc..ad57a8ed1 100644 --- a/tex/context/base/core-pos.mkiv +++ b/tex/context/base/core-pos.mkiv @@ -55,8 +55,8 @@ \def\MPul #1{\ctxlua{job.MPul("#1")}} \def\MPpos#1{\ctxlua{job.MPpos("#1")}} -\def\MPplus#1#2{\ctxlua{job.MPplus("#1",#2)}} -\def\MPrest#1#2{\ctxlua{job.MPrest("#1","#2")}} +\def\MPplus#1#2#3{\ctxlua{job.MPplus("#1",#2,"#3")}} +\def\MPrest #1#2{\ctxlua{job.MPrest("#1","#2")}} \def\doifpositionelse#1{\ctxlua{cs.testcase(job.positions['#1'])}} diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 4308426e9..3b56cc86a 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -1600,11 +1600,11 @@ \def\gotodestination#1#2#3#4#5% url file destination page data {\iflocation \ifusepagedestinations - \gotorealpage{#1}{#2}{#4}{#5}% + \gotorealpage{#1}{#2}{\number#4}{#5}% \else \dohandlegoto {#5}% - {\the\everyreference\dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{#4}}% + {\the\everyreference\dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{\number#4}}% {\dostopgotolocation}% \fi \else @@ -1615,7 +1615,7 @@ {\iflocation \dohandlegoto {#4}% - {\dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{#3}}% + {\dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{\number#3}}% {\dostopgotorealpage}% \else {#4}% diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 8efc01b52..4acdc2c8b 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -191,9 +191,10 @@ function fonts.tfm.do_scale(tfmtable, scaledpoints) for k,v in pairs(tfmtable) do t[k] = (type(v) == "table" and { }) or v end - if tfmtable.fonts then - t.fonts = table.fastcopy(tfmtable.fonts) - end +-- new +if tfmtable.fonts then + t.fonts = table.fastcopy(tfmtable.fonts) +end -- local zerobox = { 0, 0, 0, 0 } local tp = t.parameters for k,v in pairs(tfmtable.parameters) do diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 0600d72fa..b6c70d264 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -85,29 +85,29 @@ if lfs then do dir.glob_pattern = glob_pattern - local function glob(pattern, action) - local t = { } - local path, rest, patt, recurse - local action = action or function(name) t[#t+1] = name end - local pattern = pattern:gsub("^%*%*","./**") - local pattern = pattern:gsub("/%*/","/**/") - path, rest = pattern:match("^(/)(.-)$") - if path then - path = path - else - path, rest = pattern:match("^([^/]*)/(.-)$") - end - if rest then - patt = rest:gsub("([%.%-%+])", "%%%1") - end - patt = patt:gsub("%*", "[^/]*") - patt = patt:gsub("%?", "[^/]") - patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") - if path == "" then path = "." end - recurse = patt:find("%.%*/") ~= nil - glob_pattern(path,patt,recurse,action) - return t - end + --~ local function glob(pattern, action) + --~ local t = { } + --~ local path, rest, patt, recurse + --~ local action = action or function(name) t[#t+1] = name end + --~ local pattern = pattern:gsub("^%*%*","./**") + --~ local pattern = pattern:gsub("/%*/","/**/") + --~ path, rest = pattern:match("^(/)(.-)$") + --~ if path then + --~ path = path + --~ else + --~ path, rest = pattern:match("^([^/]*)/(.-)$") + --~ end + --~ if rest then + --~ patt = rest:gsub("([%.%-%+])", "%%%1") + --~ end + --~ patt = patt:gsub("%*", "[^/]*") + --~ patt = patt:gsub("%?", "[^/]") + --~ patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*") + --~ if path == "" then path = "." end + --~ recurse = patt:find("%.%*/") ~= nil + --~ glob_pattern(path,patt,recurse,action) + --~ return t + --~ end local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V @@ -121,13 +121,13 @@ if lfs then do P("**") / ".*" + P("*") / "[^/]*" + P("?") / "[^/]" + - P(".") / "%." + - P("+") / "%+" + - P("-") / "%-" + + P(".") / "%%." + + P("+") / "%%+" + + P("-") / "%%-" + P(1) )^0 ) - function glob(str) + local function glob(str) local split = pattern:match(str) if split then local t = { } @@ -136,7 +136,8 @@ if lfs then do local recurse = base:find("**") local start = root .. path local result = filter:match(start .. base) - -- print(str, start, result) +--~ print(str, start, result) +--~ print(start, result) glob_pattern(start,result,recurse,action) return t else diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 1645912dc..bee903549 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -40,14 +40,16 @@ function lpeg.splitter(pattern, action) return (((1-lpeg.P(pattern))^1)/action+1)^0 end - -local crlf = lpeg.P("\r\n") -local cr = lpeg.P("\r") -local lf = lpeg.P("\n") -local space = lpeg.S(" \t\f\v") -local newline = crlf + cr + lf -local spacing = space^0 * newline -local content = lpeg.Cs((1-spacing)^1) * spacing^-1 * (spacing * lpeg.Cc(""))^0 +local crlf = lpeg.P("\r\n") +local cr = lpeg.P("\r") +local lf = lpeg.P("\n") +local space = lpeg.S(" \t\f\v") +local newline = crlf + cr + lf +local spacing = space^0 * newline + +local empty = spacing * lpeg.Cc("") +local nonempty = lpeg.Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 local capture = lpeg.Ct(content^0) diff --git a/tex/context/base/luat-tex.lua b/tex/context/base/luat-tex.lua index 78e4501a1..c241bcf80 100644 --- a/tex/context/base/luat-tex.lua +++ b/tex/context/base/luat-tex.lua @@ -67,14 +67,24 @@ if texconfig and not texlua then input.logger('= ' .. tag .. ' closer (' .. unicode.utfname[u] .. ')',filename) input.show_close(filename) end, +--~ getline = function(n) +--~ local line = t.lines[n] +--~ if not line or line == "" then +--~ return "" +--~ else +--~ local translator = input.filters.utf_translator +--~ return (translator and translator(line)) or line +--~ end +--~ end, reader = function(self) self = self or t local current, lines = self.current, self.lines if current >= #lines then return nil else - self.current = current + 1 - local line = lines[self.current] + current = current + 1 + self.current = current + local line = lines[current] if line == "" then return "" else diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua index 7963e73f6..800328ba4 100644 --- a/tex/context/base/lxml-ini.lua +++ b/tex/context/base/lxml-ini.lua @@ -358,6 +358,11 @@ function lxml.setsetup(id,pattern,setup) if trace then texio.write_nl(format("lpath matched -> %s -> skipped", command)) end + elseif setup == "+" then + dtdk.command = true + if trace then + texio.write_nl(format("lpath matched -> %s -> text", command)) + end else dtdk.command = command if trace then @@ -380,6 +385,15 @@ function lxml.setsetup(id,pattern,setup) texio.write_nl(format("lpath matched -> %s:%s -> skipped", ns, tg)) end end + elseif b == "+" then + dtdk.command = true + if trace then + if ns == "" then + texio.write_nl(format("lpath matched -> %s -> text", tg)) + else + texio.write_nl(format("lpath matched -> %s:%s -> text", ns, tg)) + end + end else dtdk.command = a .. tg if trace then diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index a2d64e225..f4b784455 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -757,6 +757,7 @@ function metapost.graphic_extra_pass() metapost.process(current_format, { "beginfig(0); ", "_trial_run_ := false ;", + "_tt_n_ := 0 ;", -- resettextexts join(metapost.text_texts_data()," ;\n"), current_graphic, "endfig ;" diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 62d6931d6..2b17c9590 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -119,32 +119,23 @@ \definesystemconstant {next} \definesystemconstant {pickup} - \definesystemconstant {ascii} \definesystemconstant {default} \definesystemconstant {unknown} - \definesystemconstant {action} \definesystemconstant {compare} - \definesystemconstant {do} \definesystemconstant {dodo} - \definesystemconstant {complex} \definesystemconstant {simple} - \definesystemconstant {start} \definesystemconstant {stop} - \definesystemconstant {dummy} - \definesystemconstant {local} \definesystemconstant {global} - \definesystemconstant {done} - \definesystemconstant {font} - +\definesystemconstant {link} \definesystemconstant {section} \let\v!sectionlevel\s!section % for old times sake %D A more experienced \TEX\ user will recognize the next four @@ -476,6 +467,7 @@ \definesystemvariable {lf} % LocalFigures \definesystemvariable {lg} % taal (LanGuage) \definesystemvariable {li} % LIjst +\definesystemvariable {lk} % LinK \definesystemvariable {ll} % Layers \definesystemvariable {lx} % LayerteXt \definesystemvariable {ln} % LijNen diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex index 5cd66a420..e8375d2e0 100644 --- a/tex/context/base/page-mul.tex +++ b/tex/context/base/page-mul.tex @@ -914,7 +914,7 @@ \bgroup \ifcase\clevernotes\or \getmulticolumnlines - \advance\nofcolumnlines -2 % ? + \advance\nofcolumnlines \minustwo \scratchdimen\nofcolumnlines\lineheight \advance\scratchdimen \topskip \setbox0\hbox @@ -931,7 +931,7 @@ \scratchdimen\ht\firstcolumnbox \advance\scratchdimen -\openstrutdepth % \strutdp \getnoflines\scratchdimen - \advance\noflines -2 + \advance\noflines \minustwo \scratchdimen\noflines\lineheight \advance\scratchdimen \topskip \setbox0\hbox diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 02d238a31..626c1445b 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -365,6 +365,8 @@ \newcount \zerocount \newcount \minusone \minusone = -1 +\newcount \minustwo + \minustwo = -2 \chardef \plusone = 1 \chardef \plustwo = 2 diff --git a/tex/context/base/unic-ini.mkii b/tex/context/base/unic-ini.mkii index 000d7f948..ac1851fb6 100644 --- a/tex/context/base/unic-ini.mkii +++ b/tex/context/base/unic-ini.mkii @@ -163,6 +163,9 @@ %D `#4-\utf@g)} %D \stoptyping +% beware, unless surrounded by \numexpr .. \relax, a division +% results in a float until the final result is calculated + \def\utfdiv#1{\the\numexpr (#1-\utf@g)/\utf@h \relax} \def\utfmod#1{\the\numexpr#1-\utf@h*((#1-\utf@g)/\utf@h)\relax} diff --git a/tex/context/base/x-mmp.mkiv b/tex/context/base/x-mmp.mkiv index 32bf4671c..17cef5b55 100644 --- a/tex/context/base/x-mmp.mkiv +++ b/tex/context/base/x-mmp.mkiv @@ -13,10 +13,7 @@ % -- ignored: malignmark % -- luacode will be moved to x-mmp.lua - -% \defineXMLentity[textspace] {\enspace} -% \defineXMLentity[textcomma] {{,}} -% \defineXMLentity[textperiod] {{.}} +% -- { } # % _ ^ & etc escapen, {} in mathtype entities; mo/mtext \startluacode do @@ -25,18 +22,30 @@ local texsprint = tex.sprint - local replacements = { --- [" "] = utf.char(0x2002), -- "&textspace;" -> tricky, no &; in mkiv --- ["."] = "{.}", --- [","] = "{,}", - } + -- an alternative is to remap to private codes, where we can have + -- different properties .. to be done - local reppattern = "([ %.%,])" + local n_replacements = { + -- [" "] = utf.char(0x2002), -- "&textspace;" -> tricky, no &; in mkiv + ["."] = "{.}", + [","] = "{,}", + } + local o_replacements = { + ["{"] = "\\{", + ["}"] = "\\}", + } function lxml.mml.prepare_number(id,pattern) local str = xml.content(lxml.id(id),pattern) or "" str = str:gsub("^%s*(.-)%s*$","%1") - str = str:gsub(reppattern,replacements) + str = str:gsub(".",n_replacements) + texsprint(str) + end + + function lxml.mml.prepare_operator(id,pattern) + local str = xml.content(lxml.id(id),pattern) or "" + str = str:gsub("^%s*(.-)%s*$","%1") + str = str:gsub(".",o_replacements) texsprint(str) end @@ -199,17 +208,19 @@ \startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground \begingroup - \rm \ctxlua{lxml.mml.prepare_number("#1","*")} + \mr \ctxlua{lxml.mml.prepare_number("#1","*")} \endgroup \stopxmlsetups -\startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground - \mathop{\hbox{\mr \ctxlua{lxml.mml.prepare_number("#1","*")}}}% we need . and , properly spaced -\stopxmlsetups - +% hbox will make . and , behave ok, see rep patterns above as alternative +% +% \startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground +% % problem, we need an hbox because of . , +% \mathop{\hbox{\mr \ctxlua{lxml.mml.prepare_number("#1","*")}}}% we need . and , properly spaced +% \stopxmlsetups \startxmlsetups mml:mo - \edef\MMPoperator{\xmlstripped{#1}{*}} + \edef\MMPoperator{\ctxlua{lxml.mml.prepare_operator("#1","*")}} \doifXMLentityelse{\detokenize\expandafter{\MMPoperator}} { \getXMLentity\MMPoperator } { @@ -365,7 +376,6 @@ % \limits % \stopsetups - \startsetups mml:mover \mathop { \edef\mmlovertoken{\xmlraw{#1}{/mml:mo[position()==2]}} diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index a2108f1e5..86fc4d151 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 0a85bb17e..cdd1c702e 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index d85a3b7b2..ce537a676 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 367608830..fb056b816 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 5188c2818..097b3f054 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 011e6aa05..63e719905 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index ece576eba..7ac866069 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.16 17:34"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.18 14:17"> <cd:variables> <cd:variable name="lesshyphenation" value="lesshyphenation"/> |