summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2007-12-06 16:24:00 +0100
committerHans Hagen <pragma@wxs.nl>2007-12-06 16:24:00 +0100
commit139e350aef0016037e1db086dbdb093627dd5a30 (patch)
treebbc1859099729dc992f331fe99650fb9995c6a5a
parent6312e2b2913bc7de6f3c0ba30b993e2b4714edf1 (diff)
downloadcontext-139e350aef0016037e1db086dbdb093627dd5a30.tar.gz
stable 2007.12.06 16:24
-rw-r--r--scripts/context/lua/luatools.lua482
-rw-r--r--scripts/context/lua/mtxrun.lua326
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-syn.lua2
-rw-r--r--tex/context/base/font-def.lua17
-rw-r--r--tex/context/base/font-ini.tex6
-rw-r--r--tex/context/base/font-otf.lua140
-rw-r--r--tex/context/base/l-os.lua2
-rw-r--r--tex/context/base/luat-inp.lua2
-rw-r--r--tex/context/base/luat-tmp.lua4
-rw-r--r--tex/context/base/regi-ini.mkii2
-rw-r--r--tex/context/base/x-mmp.mkiv3
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
20 files changed, 760 insertions, 244 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index 1dc67519e..7740bf524 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -446,12 +446,17 @@ function table.sortedkeys(tab)
srt[#srt+1] = key
if kind == 3 then
-- no further check
- elseif type(key) == "string" then
- if kind == 2 then kind = 3 else kind = 1 end
- elseif type(key) == "number" then
- if kind == 1 then kind = 3 else kind = 2 end
else
- kind = 3
+ local tkey = type(key)
+ if tkey == "string" then
+ -- if kind == 2 then kind = 3 else kind = 1 end
+ kind = (kind == 2 and 3) or 1
+ elseif tkey == "number" then
+ -- if kind == 1 then kind = 3 else kind = 2 end
+ kind = (kind == 1 and 3) or 2
+ else
+ kind = 3
+ end
end
end
if kind == 0 or kind == 3 then
@@ -474,52 +479,96 @@ function table.prepend(t, list)
end
end
+--~ function table.merge(t, ...)
+--~ for _, list in ipairs({...}) do
+--~ for k,v in pairs(list) do
+--~ t[k] = v
+--~ end
+--~ end
+--~ return t
+--~ end
+
function table.merge(t, ...)
- for _, list in ipairs({...}) do
- for k,v in pairs(list) do
+ local lst = {...}
+ for i=1,#lst do
+ for k, v in pairs(lst[i]) do
t[k] = v
end
end
return t
end
+--~ function table.merged(...)
+--~ local tmp = { }
+--~ for _, list in ipairs({...}) do
+--~ for k,v in pairs(list) do
+--~ tmp[k] = v
+--~ end
+--~ end
+--~ return tmp
+--~ end
+
function table.merged(...)
- local tmp = { }
- for _, list in ipairs({...}) do
- for k,v in pairs(list) do
+ local tmp, lst = { }, {...}
+ for i=1,#lst do
+ for k, v in pairs(lst[i]) do
tmp[k] = v
end
end
return tmp
end
+--~ function table.imerge(t, ...)
+--~ for _, list in ipairs({...}) do
+--~ for _, v in ipairs(list) do
+--~ t[#t+1] = v
+--~ end
+--~ end
+--~ return t
+--~ end
+
function table.imerge(t, ...)
- for _, list in ipairs({...}) do
- for k,v in ipairs(list) do
- t[#t+1] = v
+ local lst = {...}
+ for i=1,#lst do
+ local nst = lst[i]
+ for j=1,#nst do
+ t[#t+1] = nst[j]
end
end
return t
end
+--~ function table.imerged(...)
+--~ local tmp = { }
+--~ for _, list in ipairs({...}) do
+--~ for _,v in pairs(list) do
+--~ tmp[#tmp+1] = v
+--~ end
+--~ end
+--~ return tmp
+--~ end
+
function table.imerged(...)
- local tmp = { }
- for _, list in ipairs({...}) do
- for _,v in pairs(list) do
- tmp[#tmp+1] = v
+ local tmp, lst = { }, {...}
+ for i=1,#lst do
+ local nst = lst[i]
+ for j=1,#nst do
+ tmp[#tmp+1] = nst[j]
end
end
return tmp
end
-if not table.fastcopy then
+if not table.fastcopy then do
+
+ local type, pairs, getmetatable, setmetatable = type, pairs, getmetatable, setmetatable
- function table.fastcopy(old) -- fast one
+ local function fastcopy(old) -- fast one
if old then
local new = { }
for k,v in pairs(old) do
if type(v) == "table" then
- new[k] = table.fastcopy(v) -- was just table.copy
+ new[k] = fastcopy(v) -- was just table.copy
else
new[k] = v
end
@@ -534,11 +583,15 @@ if not table.fastcopy then
end
end
-end
+ table.fastcopy = fastcopy
+
+end end
+
+if not table.copy then do
-if not table.copy then
+ local type, pairs, getmetatable, setmetatable = type, pairs, getmetatable, setmetatable
- function table.copy(t, tables) -- taken from lua wiki, slightly adapted
+ local function copy(t, tables) -- taken from lua wiki, slightly adapted
tables = tables or { }
local tcopy = {}
if not tables[t] then
@@ -549,7 +602,7 @@ if not table.copy then
if tables[i] then
i = tables[i]
else
- i = table.copy(i, tables)
+ i = copy(i, tables)
end
end
if type(v) ~= "table" then
@@ -557,7 +610,7 @@ if not table.copy then
elseif tables[v] then
tcopy[i] = tables[v]
else
- tcopy[i] = table.copy(v, tables)
+ tcopy[i] = copy(v, tables)
end
end
local mt = getmetatable(t)
@@ -567,7 +620,9 @@ if not table.copy then
return tcopy
end
-end
+ table.copy = copy
+
+end end
-- rougly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack)
@@ -640,7 +695,9 @@ do
end
if n == #t then
local tt = { }
- for _,v in ipairs(t) do
+ -- for _,v in ipairs(t) do
+ for i=1,#t do
+ local v = t[i]
local tv = type(v)
if tv == "number" or tv == "boolean" then
tt[#tt+1] = tostring(v)
@@ -669,15 +726,16 @@ do
end
else
depth = ""
- if type(name) == "string" then
+ local tname = type(name)
+ if tname == "string" then
if name == "return" then
handle("return {")
else
handle(name .. "={")
end
- elseif type(name) == "number" then
+ elseif tname == "number" then
handle("[" .. name .. "]={")
- elseif type(name) == "boolean" then
+ elseif tname == "boolean" then
if name then
handle("return {")
else
@@ -692,7 +750,7 @@ do
local inline = compact and table.serialize_inline
local first, last = nil, 0 -- #root cannot be trusted here
if compact then
- for k,v in ipairs(root) do
+ for k,v in ipairs(root) do -- NOT: for k=1,#root do
if not first then first = k end
last = last + 1
end
@@ -1059,32 +1117,53 @@ end
do
+ local sb = string.byte
+
+--~ local nextchar = {
+--~ [ 4] = function(f)
+--~ return f:read(1), f:read(1), f:read(1), f:read(1)
+--~ end,
+--~ [ 2] = function(f)
+--~ return f:read(1), f:read(1)
+--~ end,
+--~ [ 1] = function(f)
+--~ return f:read(1)
+--~ end,
+--~ [-2] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ return b, a
+--~ end,
+--~ [-4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ return d, c, b, a
+--~ end
+--~ }
+
local nextchar = {
[ 4] = function(f)
- return f:read(1), f:read(1), f:read(1), f:read(1)
+ return f:read(1,1,1,1)
end,
[ 2] = function(f)
- return f:read(1), f:read(1)
+ return f:read(1,1)
end,
[ 1] = function(f)
return f:read(1)
end,
[-2] = function(f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
return b, a
end,
[-4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local c = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
return d, c, b, a
end
}
function io.characters(f,n)
- local sb = string.byte
if f then
return nextchar[n or 1], f
else
@@ -1096,12 +1175,62 @@ end
do
+ local sb = string.byte
+
+--~ local nextbyte = {
+--~ [4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ if d then
+--~ return sb(a), sb(b), sb(c), sb(d)
+--~ else
+--~ return nil, nil, nil, nil
+--~ end
+--~ end,
+--~ [2] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ if b then
+--~ return sb(a), sb(b)
+--~ else
+--~ return nil, nil
+--~ end
+--~ end,
+--~ [1] = function (f)
+--~ local a = f:read(1)
+--~ if a then
+--~ return sb(a)
+--~ else
+--~ return nil
+--~ end
+--~ end,
+--~ [-2] = function (f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ if b then
+--~ return sb(b), sb(a)
+--~ else
+--~ return nil, nil
+--~ end
+--~ end,
+--~ [-4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ if d then
+--~ return sb(d), sb(c), sb(b), sb(a)
+--~ else
+--~ return nil, nil, nil, nil
+--~ end
+--~ end
+--~ }
+
local nextbyte = {
[4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local d = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
if d then
return sb(a), sb(b), sb(c), sb(d)
else
@@ -1109,8 +1238,7 @@ do
end
end,
[2] = function(f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
if b then
return sb(a), sb(b)
else
@@ -1126,8 +1254,7 @@ do
end
end,
[-2] = function (f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
if b then
return sb(b), sb(a)
else
@@ -1135,10 +1262,7 @@ do
end
end,
[-4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local d = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
if d then
return sb(d), sb(c), sb(b), sb(a)
else
@@ -1148,7 +1272,6 @@ do
}
function io.bytes(f,n)
- local sb = string.byte
if f then
return nextbyte[n or 1], f
else
@@ -1256,6 +1379,40 @@ if not os.setenv then
function os.setenv() return false end
end
+if not os.times then
+ -- utime = user time
+ -- stime = system time
+ -- cutime = children user time
+ -- cstime = children system time
+ function os.times()
+ return {
+ utime = os.clock(), -- user
+ stime = 0, -- system
+ cutime = 0, -- children user
+ cstime = 0, -- children system
+ }
+ end
+end
+
+if os.gettimeofday then
+ os.clock = os.gettimeofday
+else
+ os.gettimeofday = os.clock
+end
+
+do
+ local startuptime = os.gettimeofday()
+ function os.runtime()
+ return os.gettimeofday() - startuptime
+ end
+end
+
+--~ print(os.gettimeofday()-os.time())
+--~ os.sleep(1.234)
+--~ print (">>",os.runtime())
+--~ print(os.date("%H:%M:%S",os.gettimeofday()))
+--~ print(os.date("%H:%M:%S",os.time()))
+
-- filename : l-md5.lua
-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
@@ -1490,35 +1647,25 @@ if lfs then
--~ mkdirs(".","/a/b/c")
--~ mkdirs("a","b","c")
- function dir.mkdirs(...) -- root,... or ... ; root is not split
- local pth, err = "", false
- for k,v in pairs({...}) do
- if k == 1 then
- if not lfs.isdir(v) then
- -- print("no root path " .. v)
- err = true
- else
- pth = v
- end
- elseif lfs.isdir(pth .. "/" .. v) then
- pth = pth .. "/" .. v
+ function dir.mkdirs(...)
+ local pth, err, lst = "", false, table.concat({...},"/")
+ for _, s in ipairs(lst:split("/")) do
+ if pth == "" then
+ pth = (s == "" and "/") or s
else
- for _,s in pairs(v:split("/")) do
- pth = pth .. "/" .. s
- if not lfs.isdir(pth) then
- ok = lfs.mkdir(pth)
- if not lfs.isdir(pth) then
- err = true
- end
- end
- if err then break end
- end
+ pth = pth .. "/" .. s
+ end
+ if s == "" then
+ -- can be network path
+ elseif not lfs.isdir(pth) then
+ lfs.mkdir(pth)
end
- if err then break end
end
return pth, not err
end
+ dir.makedirs = dir.mkdirs
+
end
@@ -1537,11 +1684,12 @@ end
function toboolean(str,tolerant)
if tolerant then
- if type(str) == "string" then
+ local tstr = type(str)
+ if tstr == "string" then
return str == "true" or str == "yes" or str == "on" or str == "1"
- elseif type(str) == "number" then
+ elseif tstr == "number" then
return tonumber(str) ~= 0
- elseif type(str) == "nil" then
+ elseif tstr == "nil" then
return false
else
return str
@@ -2207,7 +2355,7 @@ end
function input.bare_variable(str)
-- return string.gsub(string.gsub(string.gsub(str,"%s+$",""),'^"(.+)"$',"%1"),"^'(.+)'$","%1")
- return str:gsub("\s*([\"\']?)(.+)%1\s*", "%2")
+ return (str:gsub("\s*([\"\']?)(.+)%1\s*", "%2"))
end
if texio then
@@ -2269,27 +2417,35 @@ input.settrace(tonumber(os.getenv("MTX.INPUT.TRACE") or os.getenv("MTX_INPUT_TRA
-- These functions can be used to test the performance, especially
-- loading the database files.
-function input.starttiming(instance)
- if instance then
- instance.starttime = os.clock()
- if not instance.loadtime then
- instance.loadtime = 0
+do
+ local clock = os.clock
+
+ function input.starttiming(instance)
+ if instance then
+ instance.starttime = clock()
+ if not instance.loadtime then
+ instance.loadtime = 0
+ end
end
end
-end
-function input.stoptiming(instance, report)
- if instance and instance.starttime then
- instance.stoptime = os.clock()
- local loadtime = instance.stoptime - instance.starttime
- instance.loadtime = instance.loadtime + loadtime
- if report then
- input.report('load time', string.format("%0.3f",loadtime))
+ function input.stoptiming(instance, report)
+ if instance then
+ local starttime = instance.starttime
+ if starttime then
+ local stoptime = clock()
+ local loadtime = stoptime - starttime
+ instance.stoptime = stoptime
+ instance.loadtime = instance.loadtime + loadtime
+ if report then
+ input.report('load time', string.format("%0.3f",loadtime))
+ end
+ return loadtime
+ end
end
- return loadtime
- else
return 0
end
+
end
function input.elapsedtime(instance)
@@ -4208,12 +4364,13 @@ caches.trace = false
caches.tree = false
caches.temp = caches.temp or os.getenv("TEXMFCACHE") or os.getenv("HOME") or os.getenv("HOMEPATH") or os.getenv("VARTEXMF") or os.getenv("TEXMFVAR") or os.getenv("TMP") or os.getenv("TEMP") or os.getenv("TMPDIR") or nil
caches.paths = caches.paths or { caches.temp }
+caches.force = false
input.usecache = not toboolean(os.getenv("TEXMFSHARECACHE") or "false",true) -- true
if caches.temp and caches.temp ~= "" and lfs.attributes(caches.temp,"mode") ~= "directory" then
- if io.ask(string.format("Should I create the cache path %s?",caches.temp), "no", { "yes", "no" }) == "yes" then
- lfs.mkdir(caches.temp)
+ if caches.force or io.ask(string.format("Should I create the cache path %s?",caches.temp), "no", { "yes", "no" }) == "yes" then
+ dir.mkdirs(caches.temp)
end
end
if not caches.temp or caches.temp == "" then
@@ -4419,7 +4576,7 @@ function input.aux.save_data(instance, dataname, check)
input.report("preparing " .. dataname .. " in", luaname)
for k, v in pairs(files) do
if not check or check(v,k) then -- path, name
- if #v == 1 then
+ if type(v) == "table" and #v == 1 then
files[k] = v[1]
end
else
@@ -4602,8 +4759,8 @@ end
function input.storage.dump()
for name, data in ipairs(input.storage.data) do
local evaluate, message, original, target = data[1], data[2], data[3] ,data[4]
- local name, initialize, finalize = nil, "", ""
- for str in string.gmatch(target,"([^%.]+)") do
+ local name, initialize, finalize, code = nil, "", "", ""
+ for str in target:gmatch("([^%.]+)") do
if name then
name = name .. "." .. str
else
@@ -4617,15 +4774,15 @@ function input.storage.dump()
input.storage.max = input.storage.max + 1
if input.storage.trace then
logs.report('storage',string.format('saving %s in slot %s',message,input.storage.max))
- lua.bytecode[input.storage.max] = loadstring(
+ code =
initialize ..
string.format("logs.report('storage','restoring %s from slot %s') ",message,input.storage.max) ..
table.serialize(original,name) ..
finalize
- )
else
- lua.bytecode[input.storage.max] = loadstring(initialize .. table.serialize(original,name) .. finalize)
+ code = initialize .. table.serialize(original,name) .. finalize
end
+ lua.bytecode[input.storage.max] = loadstring(code)
end
end
@@ -4957,18 +5114,22 @@ if texconfig and not texlua then
else
input.logger('+ ' .. tag .. ' opener',filename)
-- todo: file;name -> freeze / eerste regel scannen -> freeze
+ local filters = input.filters
t = {
reader = function(self)
local line = file_handle:read()
if line == "" then
return ""
- elseif input.filters.utf_translator then
- return input.filters.utf_translator(line)
- elseif input.filters.dynamic_translator then
- return input.filters.dynamic_translator(line)
- else
- return line
end
+ local translator = filters.utf_translator
+ if translator then
+ return translator(line)
+ end
+ translator = filters.dynamic_translator
+ if translator then
+ return translator(line)
+ end
+ return line
end,
close = function()
input.logger('= ' .. tag .. ' closer',filename)
@@ -5119,8 +5280,8 @@ if texconfig and not texlua then
function input.register_start_actions(f) table.insert(input.start_actions, f) end
function input.register_stop_actions (f) table.insert(input.stop_actions, f) end
---~ callback.register('start_run', function() for _, a in pairs(input.start_actions) do a() end end)
---~ callback.register('stop_run' , function() for _, a in pairs(input.stop_actions ) do a() end end)
+ --~ callback.register('start_run', function() for _, a in pairs(input.start_actions) do a() end end)
+ --~ callback.register('stop_run' , function() for _, a in pairs(input.stop_actions ) do a() end end)
end
@@ -5263,6 +5424,103 @@ function cs.testcase(b)
end
end
+-- This is not the most ideal place, but it will do. Maybe we need to move
+-- attributes to node-att.lua.
+
+if node then
+
+ nodes = nodes or { }
+
+ do
+
+ -- just for testing
+
+ local reserved = { }
+
+ function nodes.register(n)
+ reserved[#reserved+1] = n
+ end
+
+ function nodes.cleanup_reserved(nofboxes) -- todo
+ local nr, free = #reserved, node.free
+ for i=1,nr do
+ free(reserved[i])
+ end
+ local nl, tb, flush = 0, tex.box, node.flush_list
+ if nofboxes then
+ for i=1,nofboxes do
+ local l = tb[i]
+ if l then
+ flush(l)
+ tb[i] = nil
+ nl = nl + 1
+ end
+ end
+ end
+ reserved = { }
+ return nr, nl, nofboxes
+ end
+
+ -- nodes.register = function() end
+ -- nodes.cleanup_reserved = function() end
+
+ end
+
+ do
+
+ local pdfliteral = node.new("whatsit",8) pdfliteral.next, pdfliteral.prev = nil, nil pdfliteral.mode = 1
+ local disc = node.new("disc") disc.next, disc.prev = nil, nil
+ local kern = node.new("kern",1) kern.next, kern.prev = nil, nil
+ local penalty = node.new("penalty") penalty.next, penalty.prev = nil, nil
+ local glue = node.new("glue") glue.next, glue.prev = nil, nil
+ local glue_spec = node.new("glue_spec") glue_spec.next, glue_spec.prev = nil, nil
+
+ nodes.register(pdfliteral)
+ nodes.register(disc)
+ nodes.register(kern)
+ nodes.register(penalty)
+ nodes.register(glue)
+ nodes.register(glue_spec)
+
+ local copy = node.copy
+
+ function nodes.penalty(p)
+ local n = copy(penalty)
+ n.penalty = p
+ return n
+ end
+ function nodes.kern(k)
+ local n = copy(kern)
+ n.kern = k
+ return n
+ end
+ function nodes.glue(width,stretch,shrink)
+ local n = copy(glue)
+ local s = copy(glue_spec)
+ s.width, s.stretch, s.shrink = width, stretch, shrink
+ n.spec = s
+ return n
+ end
+ function nodes.glue_spec(width,stretch,shrink)
+ local s = copy(glue_spec)
+ s.width, s.stretch, s.shrink = width, stretch, shrink
+ return s
+ end
+
+ function nodes.disc()
+ return copy(disc)
+ end
+
+ function nodes.pdfliteral(str)
+ local t = copy(pdfliteral)
+ t.data = str
+ return t
+ end
+
+ end
+
+end
+
if not modules then modules = { } end modules ['luat-kps'] = {
version = 1.001,
@@ -5754,7 +6012,7 @@ end
if input.verbose then
input.report("")
- input.report("runtime: " .. os.clock() .. " seconds")
+ input.report("runtime: " .. os.runtime() .. " seconds")
end
--~ if ok then
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index d180fa9b9..fb7ad475f 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -461,12 +461,17 @@ function table.sortedkeys(tab)
srt[#srt+1] = key
if kind == 3 then
-- no further check
- elseif type(key) == "string" then
- if kind == 2 then kind = 3 else kind = 1 end
- elseif type(key) == "number" then
- if kind == 1 then kind = 3 else kind = 2 end
else
- kind = 3
+ local tkey = type(key)
+ if tkey == "string" then
+ -- if kind == 2 then kind = 3 else kind = 1 end
+ kind = (kind == 2 and 3) or 1
+ elseif tkey == "number" then
+ -- if kind == 1 then kind = 3 else kind = 2 end
+ kind = (kind == 1 and 3) or 2
+ else
+ kind = 3
+ end
end
end
if kind == 0 or kind == 3 then
@@ -489,52 +494,96 @@ function table.prepend(t, list)
end
end
+--~ function table.merge(t, ...)
+--~ for _, list in ipairs({...}) do
+--~ for k,v in pairs(list) do
+--~ t[k] = v
+--~ end
+--~ end
+--~ return t
+--~ end
+
function table.merge(t, ...)
- for _, list in ipairs({...}) do
- for k,v in pairs(list) do
+ local lst = {...}
+ for i=1,#lst do
+ for k, v in pairs(lst[i]) do
t[k] = v
end
end
return t
end
+--~ function table.merged(...)
+--~ local tmp = { }
+--~ for _, list in ipairs({...}) do
+--~ for k,v in pairs(list) do
+--~ tmp[k] = v
+--~ end
+--~ end
+--~ return tmp
+--~ end
+
function table.merged(...)
- local tmp = { }
- for _, list in ipairs({...}) do
- for k,v in pairs(list) do
+ local tmp, lst = { }, {...}
+ for i=1,#lst do
+ for k, v in pairs(lst[i]) do
tmp[k] = v
end
end
return tmp
end
+--~ function table.imerge(t, ...)
+--~ for _, list in ipairs({...}) do
+--~ for _, v in ipairs(list) do
+--~ t[#t+1] = v
+--~ end
+--~ end
+--~ return t
+--~ end
+
function table.imerge(t, ...)
- for _, list in ipairs({...}) do
- for k,v in ipairs(list) do
- t[#t+1] = v
+ local lst = {...}
+ for i=1,#lst do
+ local nst = lst[i]
+ for j=1,#nst do
+ t[#t+1] = nst[j]
end
end
return t
end
+--~ function table.imerged(...)
+--~ local tmp = { }
+--~ for _, list in ipairs({...}) do
+--~ for _,v in pairs(list) do
+--~ tmp[#tmp+1] = v
+--~ end
+--~ end
+--~ return tmp
+--~ end
+
function table.imerged(...)
- local tmp = { }
- for _, list in ipairs({...}) do
- for _,v in pairs(list) do
- tmp[#tmp+1] = v
+ local tmp, lst = { }, {...}
+ for i=1,#lst do
+ local nst = lst[i]
+ for j=1,#nst do
+ tmp[#tmp+1] = nst[j]
end
end
return tmp
end
-if not table.fastcopy then
+if not table.fastcopy then do
+
+ local type, pairs, getmetatable, setmetatable = type, pairs, getmetatable, setmetatable
- function table.fastcopy(old) -- fast one
+ local function fastcopy(old) -- fast one
if old then
local new = { }
for k,v in pairs(old) do
if type(v) == "table" then
- new[k] = table.fastcopy(v) -- was just table.copy
+ new[k] = fastcopy(v) -- was just table.copy
else
new[k] = v
end
@@ -549,11 +598,15 @@ if not table.fastcopy then
end
end
-end
+ table.fastcopy = fastcopy
+
+end end
+
+if not table.copy then do
-if not table.copy then
+ local type, pairs, getmetatable, setmetatable = type, pairs, getmetatable, setmetatable
- function table.copy(t, tables) -- taken from lua wiki, slightly adapted
+ local function copy(t, tables) -- taken from lua wiki, slightly adapted
tables = tables or { }
local tcopy = {}
if not tables[t] then
@@ -564,7 +617,7 @@ if not table.copy then
if tables[i] then
i = tables[i]
else
- i = table.copy(i, tables)
+ i = copy(i, tables)
end
end
if type(v) ~= "table" then
@@ -572,7 +625,7 @@ if not table.copy then
elseif tables[v] then
tcopy[i] = tables[v]
else
- tcopy[i] = table.copy(v, tables)
+ tcopy[i] = copy(v, tables)
end
end
local mt = getmetatable(t)
@@ -582,7 +635,9 @@ if not table.copy then
return tcopy
end
-end
+ table.copy = copy
+
+end end
-- rougly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack)
@@ -655,7 +710,9 @@ do
end
if n == #t then
local tt = { }
- for _,v in ipairs(t) do
+ -- for _,v in ipairs(t) do
+ for i=1,#t do
+ local v = t[i]
local tv = type(v)
if tv == "number" or tv == "boolean" then
tt[#tt+1] = tostring(v)
@@ -684,15 +741,16 @@ do
end
else
depth = ""
- if type(name) == "string" then
+ local tname = type(name)
+ if tname == "string" then
if name == "return" then
handle("return {")
else
handle(name .. "={")
end
- elseif type(name) == "number" then
+ elseif tname == "number" then
handle("[" .. name .. "]={")
- elseif type(name) == "boolean" then
+ elseif tname == "boolean" then
if name then
handle("return {")
else
@@ -707,7 +765,7 @@ do
local inline = compact and table.serialize_inline
local first, last = nil, 0 -- #root cannot be trusted here
if compact then
- for k,v in ipairs(root) do
+ for k,v in ipairs(root) do -- NOT: for k=1,#root do
if not first then first = k end
last = last + 1
end
@@ -1074,32 +1132,53 @@ end
do
+ local sb = string.byte
+
+--~ local nextchar = {
+--~ [ 4] = function(f)
+--~ return f:read(1), f:read(1), f:read(1), f:read(1)
+--~ end,
+--~ [ 2] = function(f)
+--~ return f:read(1), f:read(1)
+--~ end,
+--~ [ 1] = function(f)
+--~ return f:read(1)
+--~ end,
+--~ [-2] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ return b, a
+--~ end,
+--~ [-4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ return d, c, b, a
+--~ end
+--~ }
+
local nextchar = {
[ 4] = function(f)
- return f:read(1), f:read(1), f:read(1), f:read(1)
+ return f:read(1,1,1,1)
end,
[ 2] = function(f)
- return f:read(1), f:read(1)
+ return f:read(1,1)
end,
[ 1] = function(f)
return f:read(1)
end,
[-2] = function(f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
return b, a
end,
[-4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local c = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
return d, c, b, a
end
}
function io.characters(f,n)
- local sb = string.byte
if f then
return nextchar[n or 1], f
else
@@ -1111,12 +1190,62 @@ end
do
+ local sb = string.byte
+
+--~ local nextbyte = {
+--~ [4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ if d then
+--~ return sb(a), sb(b), sb(c), sb(d)
+--~ else
+--~ return nil, nil, nil, nil
+--~ end
+--~ end,
+--~ [2] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ if b then
+--~ return sb(a), sb(b)
+--~ else
+--~ return nil, nil
+--~ end
+--~ end,
+--~ [1] = function (f)
+--~ local a = f:read(1)
+--~ if a then
+--~ return sb(a)
+--~ else
+--~ return nil
+--~ end
+--~ end,
+--~ [-2] = function (f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ if b then
+--~ return sb(b), sb(a)
+--~ else
+--~ return nil, nil
+--~ end
+--~ end,
+--~ [-4] = function(f)
+--~ local a = f:read(1)
+--~ local b = f:read(1)
+--~ local c = f:read(1)
+--~ local d = f:read(1)
+--~ if d then
+--~ return sb(d), sb(c), sb(b), sb(a)
+--~ else
+--~ return nil, nil, nil, nil
+--~ end
+--~ end
+--~ }
+
local nextbyte = {
[4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local d = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
if d then
return sb(a), sb(b), sb(c), sb(d)
else
@@ -1124,8 +1253,7 @@ do
end
end,
[2] = function(f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
if b then
return sb(a), sb(b)
else
@@ -1141,8 +1269,7 @@ do
end
end,
[-2] = function (f)
- local a = f:read(1)
- local b = f:read(1)
+ local a, b = f:read(1,1)
if b then
return sb(b), sb(a)
else
@@ -1150,10 +1277,7 @@ do
end
end,
[-4] = function(f)
- local a = f:read(1)
- local b = f:read(1)
- local c = f:read(1)
- local d = f:read(1)
+ local a, b, c, d = f:read(1,1,1,1)
if d then
return sb(d), sb(c), sb(b), sb(a)
else
@@ -1163,7 +1287,6 @@ do
}
function io.bytes(f,n)
- local sb = string.byte
if f then
return nextbyte[n or 1], f
else
@@ -1291,6 +1414,40 @@ if not os.setenv then
function os.setenv() return false end
end
+if not os.times then
+ -- utime = user time
+ -- stime = system time
+ -- cutime = children user time
+ -- cstime = children system time
+ function os.times()
+ return {
+ utime = os.clock(), -- user
+ stime = 0, -- system
+ cutime = 0, -- children user
+ cstime = 0, -- children system
+ }
+ end
+end
+
+if os.gettimeofday then
+ os.clock = os.gettimeofday
+else
+ os.gettimeofday = os.clock
+end
+
+do
+ local startuptime = os.gettimeofday()
+ function os.runtime()
+ return os.gettimeofday() - startuptime
+ end
+end
+
+--~ print(os.gettimeofday()-os.time())
+--~ os.sleep(1.234)
+--~ print (">>",os.runtime())
+--~ print(os.date("%H:%M:%S",os.gettimeofday()))
+--~ print(os.date("%H:%M:%S",os.time()))
+
-- filename : l-file.lua
-- comment : split off from luat-lib
@@ -1542,11 +1699,12 @@ end
function toboolean(str,tolerant)
if tolerant then
- if type(str) == "string" then
+ local tstr = type(str)
+ if tstr == "string" then
return str == "true" or str == "yes" or str == "on" or str == "1"
- elseif type(str) == "number" then
+ elseif tstr == "number" then
return tonumber(str) ~= 0
- elseif type(str) == "nil" then
+ elseif tstr == "nil" then
return false
else
return str
@@ -3961,7 +4119,7 @@ end
function input.bare_variable(str)
-- return string.gsub(string.gsub(string.gsub(str,"%s+$",""),'^"(.+)"$',"%1"),"^'(.+)'$","%1")
- return str:gsub("\s*([\"\']?)(.+)%1\s*", "%2")
+ return (str:gsub("\s*([\"\']?)(.+)%1\s*", "%2"))
end
if texio then
@@ -4023,27 +4181,35 @@ input.settrace(tonumber(os.getenv("MTX.INPUT.TRACE") or os.getenv("MTX_INPUT_TRA
-- These functions can be used to test the performance, especially
-- loading the database files.
-function input.starttiming(instance)
- if instance then
- instance.starttime = os.clock()
- if not instance.loadtime then
- instance.loadtime = 0
+do
+ local clock = os.clock
+
+ function input.starttiming(instance)
+ if instance then
+ instance.starttime = clock()
+ if not instance.loadtime then
+ instance.loadtime = 0
+ end
end
end
-end
-function input.stoptiming(instance, report)
- if instance and instance.starttime then
- instance.stoptime = os.clock()
- local loadtime = instance.stoptime - instance.starttime
- instance.loadtime = instance.loadtime + loadtime
- if report then
- input.report('load time', string.format("%0.3f",loadtime))
+ function input.stoptiming(instance, report)
+ if instance then
+ local starttime = instance.starttime
+ if starttime then
+ local stoptime = clock()
+ local loadtime = stoptime - starttime
+ instance.stoptime = stoptime
+ instance.loadtime = instance.loadtime + loadtime
+ if report then
+ input.report('load time', string.format("%0.3f",loadtime))
+ end
+ return loadtime
+ end
end
- return loadtime
- else
return 0
end
+
end
function input.elapsedtime(instance)
@@ -5968,7 +6134,7 @@ input.usecache = not toboolean(os.getenv("TEXMFSHARECACHE") or "false",true) --
if caches.temp and caches.temp ~= "" and lfs.attributes(caches.temp,"mode") ~= "directory" then
if caches.force or io.ask(string.format("Should I create the cache path %s?",caches.temp), "no", { "yes", "no" }) == "yes" then
- lfs.mkdirs(caches.temp)
+ dir.mkdirs(caches.temp)
end
end
if not caches.temp or caches.temp == "" then
@@ -6174,7 +6340,7 @@ function input.aux.save_data(instance, dataname, check)
input.report("preparing " .. dataname .. " in", luaname)
for k, v in pairs(files) do
if not check or check(v,k) then -- path, name
- if #v == 1 then
+ if type(v) == "table" and #v == 1 then
files[k] = v[1]
end
else
@@ -6357,8 +6523,8 @@ end
function input.storage.dump()
for name, data in ipairs(input.storage.data) do
local evaluate, message, original, target = data[1], data[2], data[3] ,data[4]
- local name, initialize, finalize = nil, "", ""
- for str in string.gmatch(target,"([^%.]+)") do
+ local name, initialize, finalize, code = nil, "", "", ""
+ for str in target:gmatch("([^%.]+)") do
if name then
name = name .. "." .. str
else
@@ -6372,15 +6538,15 @@ function input.storage.dump()
input.storage.max = input.storage.max + 1
if input.storage.trace then
logs.report('storage',string.format('saving %s in slot %s',message,input.storage.max))
- lua.bytecode[input.storage.max] = loadstring(
+ code =
initialize ..
string.format("logs.report('storage','restoring %s from slot %s') ",message,input.storage.max) ..
table.serialize(original,name) ..
finalize
- )
else
- lua.bytecode[input.storage.max] = loadstring(initialize .. table.serialize(original,name) .. finalize)
+ code = initialize .. table.serialize(original,name) .. finalize
end
+ lua.bytecode[input.storage.max] = loadstring(code)
end
end
@@ -7308,7 +7474,7 @@ end
--~ if input.verbose then
--~ input.report("")
---~ input.report("runtime: " .. os.clock() .. " seconds")
+--~ input.report("runtime: " .. os.runtime() .. " seconds")
--~ end
--~ if ok then
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 9e3a4eb37..0569696cb 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{2007.12.05 13:56}
+\newcontextversion{2007.12.06 16:24}
%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 c43b89b72..3a9c3e2c8 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{2007.12.05 13:56}
+\edef\contextversion{2007.12.06 16:24}
%D For those who want to use this:
diff --git a/tex/context/base/core-syn.lua b/tex/context/base/core-syn.lua
index 7f6ea7614..1b4eb1e92 100644
--- a/tex/context/base/core-syn.lua
+++ b/tex/context/base/core-syn.lua
@@ -105,7 +105,7 @@ function job.loadsortedlist(class)
else
entries[#entries+1] = {
v[1], -- kind (e)
- { { v[3], v[2] } }, -- entry, key
+ { { v[2], v[3] } }, -- entry, key
v[4] -- optional meaning
}
end
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index 84fb9d569..4fd54b5fc 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -425,14 +425,15 @@ function fonts.define.specify.preset_context(name,features)
local fds = fonts.define.specify
local setups, numbers, synonyms = fds.context_setups, fds.context_numbers, fds.synonyms
local number = (setups[name] and setups[name].number) or 0
- local t = aux.settings_to_hash(features)
- for k,v in pairs(t) do
- k = synonyms[k] or k
- t[k] = v:is_boolean()
- if type(t[k]) == "nil" then
- t[k] = v
- end
- end
+--~ local t = aux.settings_to_hash(features)
+--~ for k,v in pairs(t) do
+--~ k = synonyms[k] or k
+--~ t[k] = v:is_boolean()
+--~ if type(t[k]) == "nil" then
+--~ t[k] = v
+--~ end
+--~ end
+local t = fonts.otf.meanings.resolve(aux.settings_to_hash(features)) -- todo: synonyms
if number == 0 then
numbers[#numbers+1] = name
t.number = #numbers
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index b15e3812d..8e08ef2d7 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -3536,15 +3536,15 @@
\definefontfeature
[default]
- [script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes
+ [liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes
\definefontfeature
[smallcaps]
- [script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] % texligatures=yes,texquotes=yes
+ [liga=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] % texligatures=yes,texquotes=yes
\definefontfeature
[oldstyle]
- [script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes
+ [liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes
%D The next auxilliary macro is an alternative to \type
%D {\fontname}.
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 68142e4c4..b4558183e 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -612,26 +612,26 @@ fonts.otf.tables.features = {
['size'] = 'Optical Size',
['smcp'] = 'Small Capitals',
['smpl'] = 'Simplified Forms',
- ['ss01'] = 'Sylistic Set 1',
- ['ss02'] = 'Sylistic Set 2',
- ['ss03'] = 'Sylistic Set 3',
- ['ss04'] = 'Sylistic Set 4',
- ['ss05'] = 'Sylistic Set 5',
- ['ss06'] = 'Sylistic Set 6',
- ['ss07'] = 'Sylistic Set 7',
- ['ss08'] = 'Sylistic Set 8',
- ['ss09'] = 'Sylistic Set 9',
- ['ss10'] = 'Sylistic Set 10',
- ['ss11'] = 'Sylistic Set 11',
- ['ss12'] = 'Sylistic Set 12',
- ['ss13'] = 'Sylistic Set 13',
- ['ss14'] = 'Sylistic Set 14',
- ['ss15'] = 'Sylistic Set 15',
- ['ss16'] = 'Sylistic Set 16',
- ['ss17'] = 'Sylistic Set 17',
- ['ss18'] = 'Sylistic Set 18',
- ['ss19'] = 'Sylistic Set 19',
- ['ss20'] = 'Sylistic Set 20',
+ ['ss01'] = 'Stylistic Set 1',
+ ['ss02'] = 'Stylistic Set 2',
+ ['ss03'] = 'Stylistic Set 3',
+ ['ss04'] = 'Stylistic Set 4',
+ ['ss05'] = 'Stylistic Set 5',
+ ['ss06'] = 'Stylistic Set 6',
+ ['ss07'] = 'Stylistic Set 7',
+ ['ss08'] = 'Stylistic Set 8',
+ ['ss09'] = 'Stylistic Set 9',
+ ['ss10'] = 'Stylistic Set 10',
+ ['ss11'] = 'Stylistic Set 11',
+ ['ss12'] = 'Stylistic Set 12',
+ ['ss13'] = 'Stylistic Set 13',
+ ['ss14'] = 'Stylistic Set 14',
+ ['ss15'] = 'Stylistic Set 15',
+ ['ss16'] = 'Stylistic Set 16',
+ ['ss17'] = 'Stylistic Set 17',
+ ['ss18'] = 'Stylistic Set 18',
+ ['ss19'] = 'Stylistic Set 19',
+ ['ss20'] = 'Stylistic Set 20',
['subs'] = 'Subscript',
['sups'] = 'Superscript',
['swsh'] = 'Swash',
@@ -690,6 +690,76 @@ function fonts.otf.meanings.baseline(id)
return fonts.otf.meanings.resolve(fonts.otf.tables.baselines,id)
end
+function table.reverse_hash(h)
+ local r = { }
+ for k,v in pairs(h) do
+ r[v] = (k:gsub(" ","")):lower()
+ end
+ return r
+end
+
+fonts.otf.tables.to_scripts = table.reverse_hash(fonts.otf.tables.scripts )
+fonts.otf.tables.to_languages = table.reverse_hash(fonts.otf.tables.languages)
+fonts.otf.tables.to_features = table.reverse_hash(fonts.otf.tables.features )
+
+do
+
+ local scripts = fonts.otf.tables.scripts
+ local languages = fonts.otf.tables.languages
+ local features = fonts.otf.tables.features
+
+ local to_scripts = fonts.otf.tables.to_scripts
+ local to_languages = fonts.otf.tables.to_languages
+ local to_features = fonts.otf.tables.to_features
+
+ function fonts.otf.meanings.resolve(features)
+ local h = { }
+ for k,v in pairs(features) do
+ k = (k:gsub(" ","")):lower()
+ if k == "language" or k =="lang" then
+ v = (k:gsub(" ","")):lower()
+ k = language
+ if not languages[v] then
+ if to_languages[v] then
+ h.language = to_languages[v]
+ else
+ h.language = "dflt"
+ end
+ else
+ h.language = v
+ end
+ elseif k == "script" then
+ v = (k:gsub(" ","")):lower()
+ if not scripts[v] then
+ if to_scripts[v] then
+ h.script = to_scripts[v]
+ else
+ h.script = "dflt"
+ end
+ else
+ h.script = v
+ end
+ else
+ if type(v) == "string" then
+ local b = v:is_boolean()
+ if type(b) == "nil" then
+ v = (k:gsub(" ","")):lower()
+ else
+ v = b
+ end
+ end
+ if to_features[k] then
+ h[to_features[k]] = v
+ else
+ h[k] = v
+ end
+ end
+ end
+ return h
+ end
+
+end
+
--[[ldx--
<p>Here we go.</p>
--ldx]]--
@@ -1391,26 +1461,42 @@ function fonts.otf.features.prepare_base_kerns(tfmdata,kind,value) -- todo what
for _, chr in pairs(tfmdata.characters) do
local d = charlist[chr.index]
if d then
- local dk = d.kerns
+ local dk = d.mykerns
if dk then
local t, done = chr.kerns or { }, false
- for _, v in pairs(dk) do
- if somevalid[v.lookup] then
- local k = unicodes[v.char]
- if k > 0 then
- t[k], done = v.off, true
+ for lookup,kerns in pairs(dk) do
+ if somevalid[lookup] then
+ for k, v in pairs(kerns) do
+ if v > 0 then
+ t[k], done = v, true
+ end
end
end
end
if done then
chr.kerns = t -- no empty assignments
end
+ else
+ dk = d.kerns
+ if dk then
+ local t, done = chr.kerns or { }, false
+ for _, v in pairs(dk) do
+ if somevalid[v.lookup] then
+ local k = unicodes[v.char]
+ if k > 0 then
+ t[k], done = v.off, true
+ end
+ end
+ end
+ if done then
+ chr.kerns = t -- no empty assignments
+ end
+ end
end
end
end
end
end
-
function fonts.otf.copy_to_tfm(data)
if data then
local tfm = { characters = { }, parameters = { } }
diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua
index 1173a928e..522337a0f 100644
--- a/tex/context/base/l-os.lua
+++ b/tex/context/base/l-os.lua
@@ -43,6 +43,8 @@ end
if os.gettimeofday then
os.clock = os.gettimeofday
+else
+ os.gettimeofday = os.clock
end
do
diff --git a/tex/context/base/luat-inp.lua b/tex/context/base/luat-inp.lua
index ba5d97c29..ec8d04976 100644
--- a/tex/context/base/luat-inp.lua
+++ b/tex/context/base/luat-inp.lua
@@ -195,7 +195,7 @@ end
function input.bare_variable(str)
-- return string.gsub(string.gsub(string.gsub(str,"%s+$",""),'^"(.+)"$',"%1"),"^'(.+)'$","%1")
- return str:gsub("\s*([\"\']?)(.+)%1\s*", "%2")
+ return (str:gsub("\s*([\"\']?)(.+)%1\s*", "%2"))
end
if texio then
diff --git a/tex/context/base/luat-tmp.lua b/tex/context/base/luat-tmp.lua
index bd29f87f4..611e1f37a 100644
--- a/tex/context/base/luat-tmp.lua
+++ b/tex/context/base/luat-tmp.lua
@@ -40,7 +40,7 @@ input.usecache = not toboolean(os.getenv("TEXMFSHARECACHE") or "false",true) --
if caches.temp and caches.temp ~= "" and lfs.attributes(caches.temp,"mode") ~= "directory" then
if caches.force or io.ask(string.format("Should I create the cache path %s?",caches.temp), "no", { "yes", "no" }) == "yes" then
- lfs.mkdirs(caches.temp)
+ dir.mkdirs(caches.temp)
end
end
if not caches.temp or caches.temp == "" then
@@ -246,7 +246,7 @@ function input.aux.save_data(instance, dataname, check)
input.report("preparing " .. dataname .. " in", luaname)
for k, v in pairs(files) do
if not check or check(v,k) then -- path, name
- if #v == 1 then
+ if type(v) == "table" and #v == 1 then
files[k] = v[1]
end
else
diff --git a/tex/context/base/regi-ini.mkii b/tex/context/base/regi-ini.mkii
index a5b2cf177..538db3bcf 100644
--- a/tex/context/base/regi-ini.mkii
+++ b/tex/context/base/regi-ini.mkii
@@ -50,7 +50,7 @@
\def\mkenableregime#1%
{\doifelse{#1}{utf}%
- {\writestatus\m!regime{mapping utf to utf-8}%
+ {\writestatus\m!regimes{mapping utf to utf-8}%
\XeTeXinputencoding{utf-8}}
{\XeTeXinputencoding{#1}}}
diff --git a/tex/context/base/x-mmp.mkiv b/tex/context/base/x-mmp.mkiv
index 3b5d483b9..0f5137661 100644
--- a/tex/context/base/x-mmp.mkiv
+++ b/tex/context/base/x-mmp.mkiv
@@ -177,6 +177,9 @@
\defineXMLentity[textcomma] {{,}}
\defineXMLentity[textperiod] {{.}}
+\defineXMLentity[_] {{\_}}
+\defineXMLentity[^] {{\^}}
+
\startxmlsetups mml:mi % todo: mathvariant mathsize mathcolor mathbackground
\edef\MMPidentifier{\xmlstripped{#1}{*}}
\doifXMLentityelse{\detokenize\expandafter{\MMPidentifier}} {
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 077d6f2b4..af511e420 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2007.12.06 16:24">
<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 6a02edfe4..b369fddba 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2007.12.06 16:24">
<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 2bc21ab38..3dfac6279 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2007.12.06 16:24">
<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 dee31e9e3..c5fceb1c1 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2007.12.06 16:24">
<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 bf14c9594..34d228a14 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2007.12.06 16:24">
<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 859ee5984..c4f769ac5 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2007.12.06 16:24">
<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 6c8083631..51bbaf816 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="2007.12.05 13:56">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2007.12.06 16:24">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>