summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-11-19 23:11:00 +0100
committerHans Hagen <pragma@wxs.nl>2009-11-19 23:11:00 +0100
commitdcdaf3c02b6c05569af874841585ebe31561285f (patch)
treeb0a48a603b2533baf7e96ed2df1a622fa438e99f
parentb309379ef546b7fa819f493fa3cb1dc559d4c3b8 (diff)
downloadcontext-dcdaf3c02b6c05569af874841585ebe31561285f.tar.gz
beta 2009.11.19 23:11
-rw-r--r--scripts/context/lua/luatools.lua97
-rw-r--r--scripts/context/lua/mtx-fonts.lua61
-rw-r--r--scripts/context/lua/mtx-texworks.lua4
-rw-r--r--scripts/context/lua/mtxrun.lua97
-rw-r--r--scripts/context/stubs/mswin/luatools.lua97
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua97
-rwxr-xr-xscripts/context/stubs/unix/luatools97
-rwxr-xr-xscripts/context/stubs/unix/mtxrun97
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/data-lua.lua1
-rw-r--r--tex/context/base/data-res.lua43
-rw-r--r--tex/context/base/font-dum.lua2
-rw-r--r--tex/context/base/font-ini.mkiv4
-rw-r--r--tex/context/base/font-syn.lua32
-rw-r--r--tex/context/base/grph-inc.lua9
-rw-r--r--tex/context/base/grph-inc.mkiv2
-rw-r--r--tex/context/base/l-file.lua41
-rw-r--r--tex/context/base/l-lpeg.lua15
-rw-r--r--tex/context/base/math-vfu.lua110
-rw-r--r--tex/context/base/spec-fdf.mkii3
-rw-r--r--tex/context/base/strc-syn.lua2
-rw-r--r--tex/context/base/strc-syn.mkiv6
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua58
24 files changed, 750 insertions, 229 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index abd80b8b4..a96474620 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -379,7 +379,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -403,6 +403,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1911,20 +1924,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -4846,6 +4878,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -4856,10 +4893,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -5302,13 +5335,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 67c48d0a8..4d3e52382 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -15,14 +15,10 @@ dofile(resolvers.find_file("font-mis.lua","tex"))
scripts = scripts or { }
scripts.fonts = scripts.fonts or { }
-function scripts.fonts.reload(verbose)
- fonts.names.load(true,verbose)
-end
-
-function scripts.fonts.names(name)
+function fonts.names.simple()
local simpleversion = 1.001
local simplelist = { "ttf", "otf", "ttc", "dfont" }
- name = name or "luatex-fonts-names.lua"
+ local name = "luatex-fonts-names.lua"
fonts.names.filters.list = simplelist
fonts.names.version = simpleversion -- this number is the same as in font-dum.lua
logs.report("fontnames","generating font database for 'luatex-fonts' version %s",fonts.names.version)
@@ -53,6 +49,14 @@ function scripts.fonts.names(name)
end
end
+function scripts.fonts.reload()
+ if environment.argument("simple") then
+ fonts.names.simple()
+ else
+ fonts.names.load(true)
+ end
+end
+
local function showfeatures(tag,specification)
logs.simple("mapping : %s",tag)
logs.simple("fontname: %s",specification.fontname)
@@ -213,6 +217,18 @@ function scripts.fonts.list()
else
logs.report("fontnames","not supported: --list --spec <no specification>",name)
end
+ elseif environment.argument("file") then
+ if pattern then
+ --~ mtxrun --script font --list --file --pattern=*somename*
+ list_specifications(fonts.names.collectfiles(make_pattern(pattern),reload,all))
+ elseif filter then
+ logs.report("fontnames","not supported: --list --spec",name)
+ elseif given then
+ --~ mtxrun --script font --list --file somename
+ list_specifications(fonts.names.collectfiles(given,reload,all))
+ else
+ logs.report("fontnames","not supported: --list --file <no specification>",name)
+ end
elseif pattern then
--~ mtxrun --script font --list --pattern=*somename*
list_matches(fonts.names.list(make_pattern(pattern),reload,all))
@@ -268,21 +284,22 @@ end
logs.extendbanner("Font Tools 0.21",true)
messages.help = [[
---reload generate new font database
--save save open type font in raw table
---names generate 'luatex-fonts-names.lua' (not for context!)
---list list installed fonts (show info)
---name filter by name
---spec filter by spec
+--reload generate new font database
+--reload --simple generate 'luatex-fonts-names.lua' (not for context!)
+
+--list --name list installed fonts, filter by name [--pattern]
+--list --spec list installed fonts, filter by spec [--filter]
+--list --file list installed fonts, filter by file [--pattern]
--pattern=str filter files using pattern
--filter=list key-value pairs
---all provide alternatives
+--all show all found instances
--info give more details
--track=list enable trackers
-examples:
+examples of searches:
mtxrun --script font --list somename (== --pattern=*somename*)
@@ -294,20 +311,26 @@ mtxrun --script font --list --spec somename-bold-italic
mtxrun --script font --list --spec --pattern=*somename*
mtxrun --script font --list --spec --filter="fontname=somename"
mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"
+
+mtxrun --script font --list --file somename
+mtxrun --script font --list --file --pattern=*somename*
]]
local track = environment.argument("track")
if track then trackers.enable(track) end
-if environment.argument("reload") then
- scripts.fonts.reload(true)
-elseif environment.argument("names") then
- scripts.fonts.names()
+if environment.argument("names") then
+ environment.setargument("reload",true)
+ environment.setargument("simple",true)
+end
+
+if environment.argument("list") then
+ scripts.fonts.list()
+elseif environment.argument("reload") then
+ scripts.fonts.reload()
elseif environment.argument("save") then
scripts.fonts.save()
-elseif environment.argument("list") then
- scripts.fonts.list()
else
logs.help(messages.help)
end
diff --git a/scripts/context/lua/mtx-texworks.lua b/scripts/context/lua/mtx-texworks.lua
index f525d5336..77d257480 100644
--- a/scripts/context/lua/mtx-texworks.lua
+++ b/scripts/context/lua/mtx-texworks.lua
@@ -20,11 +20,11 @@ local texworkspaths = {
}
local texworkssignal = "texworks-context.rme"
-local texworkininame = "TeXworks.ini"
+local texworkininame = "texworks.ini"
function scripts.texworks.start(indeed)
local is_mswin = os.platform == "windows"
- local workname = (is_mswin and "texworks.exe") or "TeXworks"
+ local workname = (is_mswin and "texworks.exe") or "texworks"
local fullname = nil
local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path"))
local datapath = resolvers.find_file(texworkssignal,"other text files") or ""
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 0d3f08025..4ed4dbdd1 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -388,7 +388,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -412,6 +412,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1920,20 +1933,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -7574,6 +7606,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -7584,10 +7621,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -8030,13 +8063,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/scripts/context/stubs/mswin/luatools.lua b/scripts/context/stubs/mswin/luatools.lua
index abd80b8b4..a96474620 100644
--- a/scripts/context/stubs/mswin/luatools.lua
+++ b/scripts/context/stubs/mswin/luatools.lua
@@ -379,7 +379,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -403,6 +403,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1911,20 +1924,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -4846,6 +4878,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -4856,10 +4893,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -5302,13 +5335,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 0d3f08025..4ed4dbdd1 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -388,7 +388,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -412,6 +412,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1920,20 +1933,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -7574,6 +7606,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -7584,10 +7621,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -8030,13 +8063,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools
index abd80b8b4..a96474620 100755
--- a/scripts/context/stubs/unix/luatools
+++ b/scripts/context/stubs/unix/luatools
@@ -379,7 +379,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -403,6 +403,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1911,20 +1924,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -4846,6 +4878,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -4856,10 +4893,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -5302,13 +5335,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 0d3f08025..4ed4dbdd1 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -388,7 +388,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -412,6 +412,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1920,20 +1933,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -7574,6 +7606,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -7584,10 +7621,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -8030,13 +8063,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index b6b633877..df7e636ce 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{2009.11.18 21:51}
+\newcontextversion{2009.11.19 23:11}
%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 76233c43d..4df95ab04 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.11.18 21:51}
+\edef\contextversion{2009.11.19 23:11}
%D For those who want to use this:
diff --git a/tex/context/base/data-lua.lua b/tex/context/base/data-lua.lua
index 26e6c830d..d7f6fdcf5 100644
--- a/tex/context/base/data-lua.lua
+++ b/tex/context/base/data-lua.lua
@@ -18,6 +18,7 @@ local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' }
local libpaths = file.split_path(package.path)
package.loaders[2] = function(name) -- was [#package.loaders+1]
+--~ package.loaders[#package.loaders+1] = function(name) -- was
for i=1,#libformats do
local format = libformats[i]
local resolved = resolvers.find_file(name,format) or ""
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index 9964af421..a2bace306 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -416,6 +416,11 @@ local function splitpathexpr(str, t, validate)
return t
end
+local function validate(s)
+ s = collapse_path(s)
+ return s ~= "" and not find(s,dummy_path_expr) and s
+end
+
local function expanded_path_from_list(pathlist) -- maybe not a list, just a path
-- a previous version fed back into pathlist
local newlist, ok = { }, false
@@ -426,10 +431,6 @@ local function expanded_path_from_list(pathlist) -- maybe not a list, just a pat
end
end
if ok then
- local function validate(s)
- s = collapse_path(s)
- return s ~= "" and not find(s,dummy_path_expr) and s
- end
for k=1,#pathlist do
splitpathexpr(pathlist[k],newlist,validate)
end
@@ -872,13 +873,43 @@ function resolvers.joinconfig()
end
end
end
-function resolvers.split_path(str)
+
+local winpath = lpeg.P("!!")^-1 * (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+local function split_kpse_path(str)
+ str = gsub(str,"\\","/")
+ return splitter:match(str) or { }
+end
+
+local cache = { } -- we assume stable strings
+
+function resolvers.split_path(str) -- overkill but i need to check this module anyway
if type(str) == 'table' then
return str
else
- return file.split_path(str)
+ local s = cache[str]
+ if s then
+ return s -- happens seldom
+ else
+ s = { }
+ end
+ local t = { }
+ splitpathexpr(str,t)
+ for _, p in ipairs(t) do
+ for _, pp in ipairs(split_kpse_path(p)) do
+ s[#s+1] = pp
+ end
+ end
+ cache[str] = s
+ return s
+ --~ return file.split_path(str)
end
end
+
function resolvers.join_path(str)
if type(str) == 'table' then
return file.join_path(str)
diff --git a/tex/context/base/font-dum.lua b/tex/context/base/font-dum.lua
index d6fee5598..e13f8a255 100644
--- a/tex/context/base/font-dum.lua
+++ b/tex/context/base/font-dum.lua
@@ -70,7 +70,7 @@ function fonts.names.resolve(name,sub)
end
if type(data) == "table" and data.version == fonts.names.version then
local condensed = string.gsub(string.lower(name),"[^%a%d]","")
- local found = data.mapping and data.mapping[condensed]
+ local found = data.mappings and data.mappings[condensed]
if found then
local fontname, filename, subfont = found[1], found[2], found[3]
if subfont then
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index e36485319..eca6e5679 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -4014,9 +4014,9 @@
%D
%D \starttyping
%D \def\TestLookup#1%
-%D {pattern: #1, found: \dolookupnoffound
+%D {\dolookupfontbyspec{#1}
+%D pattern: #1, found: \dolookupnoffound
%D \blank
-%D \dolookupfontbyspec{#1}
%D \dorecurse {\dolookupnoffound} {%
%D \recurselevel:~\dolookupgetkeyofindex{fontname}{\recurselevel}\quad
%D }%
diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua
index 0b74cc73c..ec700f9de 100644
--- a/tex/context/base/font-syn.lua
+++ b/tex/context/base/font-syn.lua
@@ -33,7 +33,7 @@ fonts.names.data = fonts.names.data or { }
local names = fonts.names
local filters = fonts.names.filters
-names.version = 1.100
+names.version = 1.101
names.basename = "names"
names.saved = false
names.loaded = false
@@ -48,6 +48,8 @@ names.cache = containers.define("fonts","data",names.version,true)
local P, C, Cc, Cs, Carg = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg
+-- what to do with 'thin'
+
local weights = Cs ( -- not extra
P("demibold")
+ P("semibold")
@@ -289,7 +291,8 @@ local function walk_tree(pathlist,suffix,identify)
local pattern = path .. "**." .. suffix -- ** forces recurse
logs.report("fontnames", "globbing path %s",pattern)
local t = dir.glob(pattern)
- for _, completename in pairs(t) do -- ipairs
+ sort(t,sorter)
+ for _, completename in ipairs(t) do -- ipairs
identify(completename,file.basename(completename),suffix,completename)
end
end
@@ -355,6 +358,9 @@ local function check_name(data,result,filename,suffix,subfont)
weight = weight,
style = style,
width = width,
+ minsize = result.design_range_bottom or 0,
+ maxsize = result.design_range_top or 0,
+ designsize = result.design_size or 0,
}
local family = families[familyname]
if not family then
@@ -418,6 +424,7 @@ local function collecthashes()
local specifications = data.specifications
local nofmappings, noffallbacks = 0, 0
if specifications then
+ -- maybe multiple passes
for index=1,#specifications do
local s = specifications[index]
local format, fullname, fontname, familyname, weight, subfamily = s.format, s.fullname, s.fontname, s.familyname, s.weight, s.subfamily
@@ -440,7 +447,7 @@ local function collecthashes()
ff[extraname], noffallbacks = index, noffallbacks + 1
end
end
- if familyname and subfamily then
+ if familyname then
if not mf[familyname] and not ff[familyname] then
ff[familyname], noffallbacks = index, noffallbacks + 1
end
@@ -717,7 +724,7 @@ local function list_them(mapping,sorted,pattern,t,all)
else
for k=1,#sorted do
local v = sorted[k]
- if find(v,pattern) then
+ if not t[v] and find(v,pattern) then
t[v] = mapping[v]
if not all then
return
@@ -1152,6 +1159,23 @@ function names.resolvespec(askedname,sub)
end
end
+function names.collectfiles(askedname,reload) -- no all
+ if askedname and askedname ~= "" and names.enabled then
+ askedname = lower(askedname) -- or cleanname
+ names.load(reload)
+ local list = { }
+ local basename = file.basename
+ local specifications = names.data.specifications
+ for i=1,#specifications do
+ local s = specifications[i]
+ if find(lower(basename(s.filename)),askedname) then
+ list[#list+1] = s
+ end
+ end
+ return list
+ end
+end
+
--[[ldx--
<p>Fallbacks, not permanent but a transition thing.</p>
--ldx]]--
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 44447a7ad..ff8a78f0f 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -293,7 +293,6 @@ do
end
-- maybe move texsprint to tex
function figures.get(category,tag,default)
---~ print(table.serialize(figuredata))
local value = figuredata[category]
value = value and value[tag]
if not value or value == "" or value == true then
@@ -597,14 +596,14 @@ function figures.done(data)
return data
end
-function figures.dummy(data) -- fails
+function figures.dummy(data)
--~ data = data or figures.current()
--~ local dr, du, ds = data.request, data.used, data.status
--~ local r = node.new("rule")
--~ r.width = du.width or figures.defaultwidth
--~ r.height = du.height or figures.defaultheight
--~ r.depth = du.depth or figures.defaultdepth
---~ tex.box[figures.boxnumber] = node.write(r)
+--~ tex.box[figures.boxnumber] = node.hpack(node.write(r))
texsprint(ctxcatcodes,"\\emptyfoundexternalfigure")
end
@@ -669,10 +668,6 @@ function figures.includers.generic(data)
local n = figures.boxnumber
tex.box[n] = node.hpack(img.node(figure))
-- tex.box[n] = img.node(figure) -- img.write(figure) -- assigning img.node directly no longer valid
---~ local inode = img.node(figure)
---~ print(table.serialize(nodes.totable(inode)))
---~ tex.box[n] = inode
---~ print(table.serialize(nodes.totable(tex.box[n])))
tex.wd[n], tex.ht[n], tex.dp[n] = figure.width, figure.height, 0 -- new, hm, tricky, we need to do that in tex (yet)
ds.objectnumber = figure.objnum
texsprint(ctxcatcodes,"\\relocateexternalfigure")
diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv
index c07e0d108..d18c72e06 100644
--- a/tex/context/base/grph-inc.mkiv
+++ b/tex/context/base/grph-inc.mkiv
@@ -246,7 +246,9 @@
\ifconditional\testexternalfigureonly
\ifcase\figurestatus \else
\ctxlua{figures.check()}%
+ \ctxlua{figures.dummy()}%
\ctxlua{figures.scale()}%
+ \ctxlua{figures.done()}%
\fi
\signalexternalfigure
\else
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index 955b6cc36..a28991339 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -84,20 +84,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
-
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local checkedsplit = string.checkedsplit
+
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index b2a646fcb..1318746c4 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -77,7 +77,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -101,6 +101,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index 1a8979160..e67e50457 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -764,73 +764,73 @@ fonts.enc.math["tex-mi"] = {
fonts.enc.math["tex-it"] = {
--- [0x00041] = 0x41, -- A
+-- [0x1D434] = 0x41, -- A
[0x1D6E2] = 0x41, -- Alpha
--- [0x00042] = 0x42, -- B
+-- [0x1D435] = 0x42, -- B
[0x1D6E3] = 0x42, -- Beta
--- [0x00043] = 0x43, -- C
--- [0x00044] = 0x44, -- D
--- [0x00045] = 0x45, -- E
+-- [0x1D436] = 0x43, -- C
+-- [0x1D437] = 0x44, -- D
+-- [0x1D438] = 0x45, -- E
[0x1D6E6] = 0x45, -- Epsilon
--- [0x00046] = 0x46, -- F
--- [0x00047] = 0x47, -- G
--- [0x00048] = 0x48, -- H
+-- [0x1D439] = 0x46, -- F
+-- [0x1D43A] = 0x47, -- G
+-- [0x1D43B] = 0x48, -- H
[0x1D6E8] = 0x48, -- Eta
--- [0x00049] = 0x49, -- I
+-- [0x1D43C] = 0x49, -- I
[0x1D6EA] = 0x49, -- Iota
--- [0x0004A] = 0x4A, -- J
--- [0x0004B] = 0x4B, -- K
+-- [0x1D43D] = 0x4A, -- J
+-- [0x1D43E] = 0x4B, -- K
[0x1D6EB] = 0x4B, -- Kappa
--- [0x0004C] = 0x4C, -- L
--- [0x0004D] = 0x4D, -- M
+-- [0x1D43F] = 0x4C, -- L
+-- [0x1D440] = 0x4D, -- M
[0x1D6ED] = 0x4D, -- Mu
--- [0x0004E] = 0x4E, -- N
+-- [0x1D441] = 0x4E, -- N
[0x1D6EE] = 0x4E, -- Nu
--- [0x0004F] = 0x4F, -- O
+-- [0x1D442] = 0x4F, -- O
[0x1D6F0] = 0x4F, -- Omicron
--- [0x00050] = 0x50, -- P
+-- [0x1D443] = 0x50, -- P
[0x1D6F2] = 0x50, -- Rho
--- [0x00051] = 0x51, -- Q
--- [0x00052] = 0x52, -- R
--- [0x00053] = 0x53, -- S
--- [0x00054] = 0x54, -- T
+-- [0x1D444] = 0x51, -- Q
+-- [0x1D445] = 0x52, -- R
+-- [0x1D446] = 0x53, -- S
+-- [0x1D447] = 0x54, -- T
[0x1D6F5] = 0x54, -- Tau
--- [0x00055] = 0x55, -- U
--- [0x00056] = 0x56, -- V
--- [0x00057] = 0x57, -- W
--- [0x00058] = 0x58, -- X
+-- [0x1D448] = 0x55, -- U
+-- [0x1D449] = 0x56, -- V
+-- [0x1D44A] = 0x57, -- W
+-- [0x1D44B] = 0x58, -- X
[0x1D6F8] = 0x58, -- Chi
--- [0x00059] = 0x59, -- Y
--- [0x0005A] = 0x5A, -- Z
- [0x1D6E7] = 0x5A, -- Zeta
--- [0x00061] = 0x61, -- a
--- [0x00062] = 0x62, -- b
--- [0x00063] = 0x63, -- c
--- [0x00064] = 0x64, -- d
--- [0x00065] = 0x65, -- e
--- [0x00066] = 0x66, -- f
--- [0x00067] = 0x67, -- g
--- [0x00068] = 0x68, -- h
- [0x0210E] = 0x68, -- plank constant
--- [0x00069] = 0x69, -- i
--- [0x0006A] = 0x6A, -- j
--- [0x0006B] = 0x6B, -- k
--- [0x0006C] = 0x6C, -- l
--- [0x0006D] = 0x6D, -- m
--- [0x0006E] = 0x6E, -- n
--- [0x0006F] = 0x6F, -- o
+-- [0x1D44C] = 0x59, -- Y
+-- [0x1D44D] = 0x5A, -- Z
+--
+-- [0x1D44E] = 0x61, -- a
+-- [0x1D44F] = 0x62, -- b
+-- [0x1D450] = 0x63, -- c
+-- [0x1D451] = 0x64, -- d
+-- [0x1D452] = 0x65, -- e
+-- [0x1D453] = 0x66, -- f
+-- [0x1D454] = 0x67, -- g
+-- [0x1D455] = 0x68, -- h
+ [0x0210E] = 0x68, -- Planck constant (h)
+-- [0x1D456] = 0x69, -- i
+-- [0x1D457] = 0x6A, -- j
+-- [0x1D458] = 0x6B, -- k
+-- [0x1D459] = 0x6C, -- l
+-- [0x1D45A] = 0x6D, -- m
+-- [0x1D45B] = 0x6E, -- n
+-- [0x1D45C] = 0x6F, -- o
[0x1D70A] = 0x6F, -- omicron
--- [0x00070] = 0x70, -- p
--- [0x00071] = 0x71, -- q
--- [0x00072] = 0x72, -- r
--- [0x00073] = 0x73, -- s
--- [0x00074] = 0x74, -- t
--- [0x00075] = 0x75, -- u
--- [0x00076] = 0x76, -- v
--- [0x00077] = 0x77, -- w
--- [0x00078] = 0x78, -- x
--- [0x00079] = 0x79, -- y
--- [0x0007A] = 0x7A, -- z
+-- [0x1D45D] = 0x70, -- p
+-- [0x1D45E] = 0x71, -- q
+-- [0x1D45F] = 0x72, -- r
+-- [0x1D460] = 0x73, -- s
+-- [0x1D461] = 0x74, -- t
+-- [0x1D462] = 0x75, -- u
+-- [0x1D463] = 0x76, -- v
+-- [0x1D464] = 0x77, -- w
+-- [0x1D465] = 0x78, -- x
+-- [0x1D466] = 0x79, -- y
+-- [0x1D467] = 0x7A, -- z
}
fonts.enc.math["tex-ss"] = { }
@@ -1548,7 +1548,7 @@ mathematics.make_font ( "px-math", {
{ name = "texgyrepagella-regular.otf", features = "virtualmath", main = true },
{ name = "rpxr.tfm", vector = "tex-mr" } ,
{ name = "rpxmi.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "pxmi1.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "rpxpplri.tfm", vector = "tex-it", skewchar=0x7F },
{ name = "pxsy.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
{ name = "pxex.tfm", vector = "tex-ex", extension = true } ,
{ name = "pxsya.tfm", vector = "tex-ma" },
diff --git a/tex/context/base/spec-fdf.mkii b/tex/context/base/spec-fdf.mkii
index 509ea0596..f160be874 100644
--- a/tex/context/base/spec-fdf.mkii
+++ b/tex/context/base/spec-fdf.mkii
@@ -3275,6 +3275,9 @@
\doifobjectreferencefoundelse{FDF}{docuextgstates}
{\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
\xdef\collectedPDFresources{\collectedPDFresources/ExtGState \PDFobjectreference}}\donothing
+ \doifobjectreferencefoundelse{FDF}{docupatterns}
+ {\doPDFgetobjectreference{FDF}{docupatterns}\PDFobjectreference
+ \xdef\collectedPDFresources{\collectedPDFresources/Pattern \PDFobjectreference}}\donothing
\doifobjectreferencefoundelse{FDF}{colorspaces}
{\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
\xdef\collectedPDFresources{\collectedPDFresources/ColorSpace \PDFobjectreference}}\donothing
diff --git a/tex/context/base/strc-syn.lua b/tex/context/base/strc-syn.lua
index b410b4243..110ae7720 100644
--- a/tex/context/base/strc-syn.lua
+++ b/tex/context/base/strc-syn.lua
@@ -157,7 +157,7 @@ function joblists.flush(data,options) -- maybe pass the settings differently
--~ texsprint(ctxcatcodes,format("\\start%ssection{%s}",kind,sublist.tag))
for d=1,#data do
local entry = data[d].definition
- texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}",kind,d,entry.tag,entry.synonym))
+ texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}{%s}",kind,d,entry.tag,entry.synonym,entry.meaning or ""))
end
--~ texsprint(ctxcatcodes,format("\\stop%ssection",kind))
end
diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv
index 7b3271591..17ae7934a 100644
--- a/tex/context/base/strc-syn.mkiv
+++ b/tex/context/base/strc-syn.mkiv
@@ -217,10 +217,10 @@
\let\startsynonymsection\gobbleoneargument
\let\stopsynonymsection \relax
-\unexpanded\def\synonymentry#1#2#3%
+\unexpanded\def\synonymentry#1#2#3#4%
% {\syndef{\dosetsynonymattributes\c!textstyle\c!textcolor#2}#3\par}
% {\startsyndef{#2}#3\stopsyndef}
- {\syndef{#2}#3\par}
+ {\syndef{#3}#4\par}
\let\currentsorting\empty
@@ -359,7 +359,7 @@
\let\startsortingsection\gobbleoneargument
\let\stopsortingsection \relax
-\def\sortingentry#1#2#3%
+\def\sortingentry#1#2#3#4% #4 is meaning but empty here
{\doifelsenothing{\sortingparameter\c!command}
{\begingroup\dosetsortingattributes\c!style\c!color#3\endgroup\par} % todo
{\sortingparameter\c!command{#1}{#2}{#3}}}
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 82fe96610..c550519be 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 11/18/09 21:55:28
+-- merge date : 11/19/09 23:18:54
do -- begin closure to overcome local limits and interference
@@ -345,7 +345,7 @@ local function splitat(separator,single)
separator = P(separator)
if single then
local other, any = C((1 - separator)^0), P(1)
- splitter = other * (separator * C(any^0) + "")
+ splitter = other * (separator * C(any^0) + "") -- ?
splitters_s[separator] = splitter
else
local other = C((1 - separator)^0)
@@ -369,6 +369,19 @@ function string:split(separator)
return c:match(self)
end
+local cache = { }
+
+function string:checkedsplit(separator)
+ local c = cache[separator]
+ if not c then
+ separator = P(separator)
+ local other = C((1 - separator)^1)
+ c = Ct(other * (separator^1 + other)^1)
+ cache[separator] = c
+ end
+ return c:match(self)
+end
+
--~ function lpeg.L(list,pp)
--~ local p = pp
--~ for l=1,#list do
@@ -1475,20 +1488,39 @@ end
file.is_readable = file.isreadable
file.is_writable = file.iswritable
--- todo: lpeg
+local checkedsplit = string.checkedsplit
-function file.split_path(str)
- local t = { }
- str = gsub(str,"\\", "/")
- str = gsub(str,"(%a):([;/])", "%1\001%2")
- for name in gmatch(str,"([^;:]+)") do
- if name ~= "" then
- t[#t+1] = gsub(name,"\001",":")
- end
+local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/"))
+local separator = lpeg.P(":") + lpeg.P(";")
+local rest = (1-separator)^1
+local somepath = winpath * rest + rest
+local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+function file.split_path(str,separator)
+ str = gsub(str,"\\","/")
+ if separator then
+ return checkedsplit(str,separator) or { }
+ else
+ return splitter:match(str) or { }
end
- return t
end
+-- special one for private usage
+
+--~ local winpath = lpeg.P("!!")^-1 * winpath
+--~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0)
+
+--~ function file.split_kpse_path(str)
+--~ str = gsub(str,"\\","/")
+--~ return splitter:match(str) or { }
+--~ end
+
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+--
+-- str = os.getenv("PATH") --
+-- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]]
+-- str = [[c:/oeps:whatever]]
+
function file.join_path(tab)
return concat(tab,io.pathseparator) -- can have trailing //
end
@@ -11642,7 +11674,7 @@ function fonts.names.resolve(name,sub)
end
if type(data) == "table" and data.version == fonts.names.version then
local condensed = string.gsub(string.lower(name),"[^%a%d]","")
- local found = data.mapping and data.mapping[condensed]
+ local found = data.mappings and data.mappings[condensed]
if found then
local fontname, filename, subfont = found[1], found[2], found[3]
if subfont then