summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua58
1 files changed, 45 insertions, 13 deletions
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