summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-tre.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-tre.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-tre.lua51
1 files changed, 38 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-tre.lua b/Master/texmf-dist/tex/context/base/data-tre.lua
index d5ca258e47b..88bf4f11275 100644
--- a/Master/texmf-dist/tex/context/base/data-tre.lua
+++ b/Master/texmf-dist/tex/context/base/data-tre.lua
@@ -8,17 +8,20 @@ if not modules then modules = { } end modules ['data-tre'] = {
-- \input tree://oeps1/**/oeps.tex
-local find, gsub = string.find, string.gsub
-local unpack = unpack or table.unpack
+local find, gsub, format = string.find, string.gsub, string.format
-local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders
+local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local done, found = { }, { }
+local report_trees = logs.reporter("resolvers","trees")
-function finders.tree(specification,filetype)
- local fnd = found[specification]
- if not fnd then
- local spec = resolvers.splitmethod(specification).path or ""
+local resolvers = resolvers
+
+local done, found, notfound = { }, { }, resolvers.finders.notfound
+
+function resolvers.finders.tree(specification)
+ local spec = specification.filename
+ local fnd = found[spec]
+ if fnd == nil then
if spec ~= "" then
local path, name = file.dirname(spec), file.basename(spec)
if path == "" then path = "." end
@@ -32,16 +35,38 @@ function finders.tree(specification,filetype)
for k=1,#hash do
local v = hash[k]
if find(v,pattern) then
- found[specification] = v
+ found[spec] = v
return v
end
end
end
- fnd = unpack(finders.notfound)
- found[specification] = fnd
+ fnd = notfound() -- false
+ found[spec] = fnd
end
return fnd
end
-openers.tree = openers.generic
-loaders.tree = loaders.generic
+function resolvers.locators.tree(specification)
+ local name = specification.filename
+ if name ~= '' and lfs.isdir(name) then
+ if trace_locating then
+ report_trees("locator '%s' found",name)
+ end
+ resolvers.appendhash('tree',name,false) -- don't cache
+ elseif trace_locating then
+ report_trees("locator '%s' not found",name)
+ end
+end
+
+function resolvers.hashers.tree(specification)
+ local name = specification.filename
+ if trace_locating then
+ report_trees("analysing '%s'",name)
+ end
+ resolvers.methodhandler("hashers",name)
+end
+
+resolvers.concatinators.tree = resolvers.concatinators.file
+resolvers.generators.tree = resolvers.generators.file
+resolvers.openers.tree = resolvers.openers.file
+resolvers.loaders.tree = resolvers.loaders.file