summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/lua/mtx-context.lua2
-rw-r--r--scripts/context/lua/mtx-update.lua11
-rw-r--r--scripts/context/lua/mtxrun.lua108
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua108
-rw-r--r--scripts/context/stubs/unix/mtxrun108
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua12
-rw-r--r--tex/context/base/core-con.mkiv52
-rw-r--r--tex/context/base/data-res.lua365
-rw-r--r--tex/context/base/data-tmf.lua10
-rw-r--r--tex/context/base/data-tmp.lua22
-rw-r--r--tex/context/base/l-pdfview.lua10
-rw-r--r--tex/context/base/luat-fio.lua3
-rw-r--r--tex/context/base/status-files.pdfbin8941 -> 8943 bytes
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
18 files changed, 609 insertions, 212 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 73ff481fd..e3082e825 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -640,7 +640,7 @@ local pdfview -- delayed loading
function scripts.context.openpdf(name,method)
pdfview = pdfview or dofile(resolvers.findfile("l-pdfview.lua","tex"))
pdfview.setmethod(method)
- logs.simple("pdfview methods: %s, current method: %s, MTX_PDFVIEW_METHOD=%s",pdfview.methods(),pdfview.method,os.getenv(pdfview.METHOD) or "<unset>")
+ logs.simple(pdfview.status())
pdfview.open(file.replacesuffix(name,"pdf"))
end
diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua
index b7a815678..960dd516f 100644
--- a/scripts/context/lua/mtx-update.lua
+++ b/scripts/context/lua/mtx-update.lua
@@ -391,7 +391,7 @@ function scripts.update.synchronize()
resolvers.load_tree(texroot) -- else we operate in the wrong tree
-- update filename database for pdftex/xetex
- scripts.update.run("mktexlsr")
+ scripts.update.run(format('mtxrun --tree="%s" bin:mktexlsr',texroot))
-- update filename database for luatex
scripts.update.run(format('mtxrun --tree="%s" --generate',texroot))
@@ -420,7 +420,7 @@ function scripts.update.make()
resolvers.load_tree(texroot)
- scripts.update.run("mktexlsr")
+ scripts.update.run(format('mtxrun --tree="%s" bin:mktexlsr',texroot))
scripts.update.run(format('mtxrun --tree="%s" --generate',texroot))
local askedformats = formats
@@ -442,19 +442,18 @@ function scripts.update.make()
if engine == "luatex" then
scripts.update.run(format('mtxrun --tree="%s" --script context --autogenerate --make',texroot))
else
- -- todo: just handle make here or in mtxrun --script context --make
- scripts.update.run(format("texexec --make --all --fast --%s %s",engine,formatlist))
+ scripts.update.run(format('mtxrun --tree="%s" --script texexec --make --all --%s %s',texroot,engine,formatlist))
end
end
end
local formatlist = concat(table.fromhash(mpformats), " ")
if formatlist ~= "" then
- scripts.update.run(format("texexec --make --all --fast %s",formatlist))
+ scripts.update.run(format('mtxrun --tree="%s" --script texexec --make --all %s',texroot,formatlist))
end
if not force then
logs.report("make", "use --force to really make formats")
end
- scripts.update.run("mktexlsr")
+ scripts.update.run(format('mtxrun --tree="%s" bin:mktexlsr',texroot))
scripts.update.run(format('mtxrun --tree="%s" --generate',texroot))
logs.report("make","done")
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index fc5dd3354..fd8d826f4 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -10379,17 +10379,25 @@ function caches.loadcontent(cachename,dataname)
local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua")
if blob then
local data = blob()
- if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then
- content_state[#content_state+1] = data.uuid
- if trace_locating then
- report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ if data and data.content then
+ if data.type == dataname then
+ if data.version == resolvers.cacheversion then
+ content_state[#content_state+1] = data.uuid
+ if trace_locating then
+ report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ end
+ return data.content
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename)
+ end
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename)
end
- return data.content
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename)
end
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename)
end
end
@@ -10595,7 +10603,7 @@ if not modules then modules = { } end modules ['data-res'] = {
local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch
local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys
-local next, type, rawget, setmetatable = next, type, rawget, setmetatable
+local next, type, rawget, setmetatable, getmetatable = next, type, rawget, setmetatable, getmetatable
local os = os
local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg
@@ -10651,15 +10659,15 @@ local instance = resolvers.instance or nil -- the current one (fast access)
-- variables replaced). One can push something into the outer environment and
-- its internal copy, but only the later one will be the raw unprefixed variant.
-function resolvers.setenv(key,value)
+function resolvers.setenv(key,value,raw)
if instance then
-- this one will be consulted first when we stay inside
-- the current environment
instance.environment[key] = value
-- we feed back into the environment, and as this is used
-- by other applications (via os.execute) we need to make
- -- sure that prefixes are resolved
- ossetenv(key,resolvers.resolve(value))
+ -- sure that prefixes are resolve
+ ossetenv(key,raw and value or resolvers.resolve(value))
end
end
@@ -10708,16 +10716,12 @@ local function expandedvariable(var)
return lpegmatch(variableexpander,var) or var
end
-function resolvers.expandvariables()
- -- no longer needed
-end
-
-local function collapse_configuration_data()
- -- no longer needed
-end
-
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
+ if trace_locating then
+ report_resolvers("creating instance")
+ end
+
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
local newinstance = {
@@ -10730,6 +10734,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
found = allocate(),
foundintrees = allocate(),
hashes = allocate(),
+ hashed = allocate(),
specification = allocate(),
lists = allocate(),
data = allocate(), -- only for loading
@@ -10866,6 +10871,8 @@ local function identify_configuration_files()
if trace_locating then
report_resolvers()
end
+ elseif trace_locating then
+ report_resolvers("configuration files already identified")
end
end
@@ -10908,10 +10915,13 @@ local function load_configuration_files()
-- the following code is not tested
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
+ if trace_locating then
+ report_resolvers("reloading configuration due to TEXMF redefinition")
+ end
-- we push the value into the main environment (osenv) so
-- that it takes precedence over the default one and therefore
-- also over following definitions
- resolvers.setenv('TEXMFCNF',resolvers.resolve(cnfspec))
+ resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes
-- we now identify and load the specified configuration files
instance.specification = { }
identify_configuration_files()
@@ -11036,17 +11046,25 @@ local function load_databases()
end
function resolvers.appendhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' appended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' appended",name)
+ end
+ insert(instance.hashes, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, { type = type, name = name, cache = cache } )
end
function resolvers.prependhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' prepended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' prepended",name)
+ end
+ insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
end
function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash
@@ -11379,7 +11397,7 @@ end
local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$"))
--- this one will be split in smalle functions
+-- this one is split in smaller functions but it needs testing
local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc)
local result = { }
@@ -11488,10 +11506,10 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
else
-- search spec
local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename)
- -- tricky as filename can be bla.1.2.3
-
--- to be checked
-
+ -- -- tricky as filename can be bla.1.2.3
+ -- if not suffixmap[ext] then --- probably needs to be done elsewhere too
+ -- wantedfiles[#wantedfiles+1] = filename
+ -- end
wantedfiles[#wantedfiles+1] = filename
if askedformat == "" then
if ext == "" or not suffixmap[ext] then
@@ -11638,6 +11656,19 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
return result
end
+-- -- -- begin of main file search routing -- -- --
+
+
+
+
+
+
+
+
+
+
+-- -- -- end of main file search routing -- -- --
+
local function findfiles(filename,filetype,allresults)
local result = collect_instance_files(filename,filetype or "",allresults)
if #result == 0 then
@@ -13152,7 +13183,7 @@ local resolvers = resolvers
-- < +=
-- > =+
-function resolvers.load_tree(tree)
+function resolvers.load_tree(tree,resolve)
if type(tree) == "string" and tree ~= "" then
local getenv, setenv = resolvers.getenv, resolvers.setenv
@@ -13181,14 +13212,18 @@ function resolvers.load_tree(tree)
environment.texos = texos
environment.texmfos = texmfos
+ -- Beware, we need to obey the relocatable autoparent so we
+ -- set TEXMFCNF to its raw value. This is somewhat tricky when
+ -- we run a mkii job from within. Therefore, in mtxrun, there
+ -- is a resolve applied when we're in mkii/kpse mode.
+
setenv('SELFAUTOPARENT', newroot)
setenv('SELFAUTODIR', newtree)
setenv('SELFAUTOLOC', newpath)
setenv('TEXROOT', newroot)
setenv('TEXOS', texos)
setenv('TEXMFOS', texmfos)
- setenv('TEXROOT', newroot)
- setenv('TEXMFCNF', resolvers.luacnfspec)
+ setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
@@ -14300,6 +14335,8 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename
if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then
+ resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF
+
os.setenv("engine","")
os.setenv("progname","")
@@ -14374,9 +14411,10 @@ else
end
end
+ resolvers.load_tree(environment.argument('tree'))
+
end
-resolvers.load_tree(environment.argument('tree'))
if environment.argument("selfmerge") then
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index fc5dd3354..fd8d826f4 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -10379,17 +10379,25 @@ function caches.loadcontent(cachename,dataname)
local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua")
if blob then
local data = blob()
- if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then
- content_state[#content_state+1] = data.uuid
- if trace_locating then
- report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ if data and data.content then
+ if data.type == dataname then
+ if data.version == resolvers.cacheversion then
+ content_state[#content_state+1] = data.uuid
+ if trace_locating then
+ report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ end
+ return data.content
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename)
+ end
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename)
end
- return data.content
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename)
end
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename)
end
end
@@ -10595,7 +10603,7 @@ if not modules then modules = { } end modules ['data-res'] = {
local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch
local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys
-local next, type, rawget, setmetatable = next, type, rawget, setmetatable
+local next, type, rawget, setmetatable, getmetatable = next, type, rawget, setmetatable, getmetatable
local os = os
local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg
@@ -10651,15 +10659,15 @@ local instance = resolvers.instance or nil -- the current one (fast access)
-- variables replaced). One can push something into the outer environment and
-- its internal copy, but only the later one will be the raw unprefixed variant.
-function resolvers.setenv(key,value)
+function resolvers.setenv(key,value,raw)
if instance then
-- this one will be consulted first when we stay inside
-- the current environment
instance.environment[key] = value
-- we feed back into the environment, and as this is used
-- by other applications (via os.execute) we need to make
- -- sure that prefixes are resolved
- ossetenv(key,resolvers.resolve(value))
+ -- sure that prefixes are resolve
+ ossetenv(key,raw and value or resolvers.resolve(value))
end
end
@@ -10708,16 +10716,12 @@ local function expandedvariable(var)
return lpegmatch(variableexpander,var) or var
end
-function resolvers.expandvariables()
- -- no longer needed
-end
-
-local function collapse_configuration_data()
- -- no longer needed
-end
-
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
+ if trace_locating then
+ report_resolvers("creating instance")
+ end
+
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
local newinstance = {
@@ -10730,6 +10734,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
found = allocate(),
foundintrees = allocate(),
hashes = allocate(),
+ hashed = allocate(),
specification = allocate(),
lists = allocate(),
data = allocate(), -- only for loading
@@ -10866,6 +10871,8 @@ local function identify_configuration_files()
if trace_locating then
report_resolvers()
end
+ elseif trace_locating then
+ report_resolvers("configuration files already identified")
end
end
@@ -10908,10 +10915,13 @@ local function load_configuration_files()
-- the following code is not tested
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
+ if trace_locating then
+ report_resolvers("reloading configuration due to TEXMF redefinition")
+ end
-- we push the value into the main environment (osenv) so
-- that it takes precedence over the default one and therefore
-- also over following definitions
- resolvers.setenv('TEXMFCNF',resolvers.resolve(cnfspec))
+ resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes
-- we now identify and load the specified configuration files
instance.specification = { }
identify_configuration_files()
@@ -11036,17 +11046,25 @@ local function load_databases()
end
function resolvers.appendhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' appended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' appended",name)
+ end
+ insert(instance.hashes, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, { type = type, name = name, cache = cache } )
end
function resolvers.prependhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' prepended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' prepended",name)
+ end
+ insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
end
function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash
@@ -11379,7 +11397,7 @@ end
local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$"))
--- this one will be split in smalle functions
+-- this one is split in smaller functions but it needs testing
local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc)
local result = { }
@@ -11488,10 +11506,10 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
else
-- search spec
local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename)
- -- tricky as filename can be bla.1.2.3
-
--- to be checked
-
+ -- -- tricky as filename can be bla.1.2.3
+ -- if not suffixmap[ext] then --- probably needs to be done elsewhere too
+ -- wantedfiles[#wantedfiles+1] = filename
+ -- end
wantedfiles[#wantedfiles+1] = filename
if askedformat == "" then
if ext == "" or not suffixmap[ext] then
@@ -11638,6 +11656,19 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
return result
end
+-- -- -- begin of main file search routing -- -- --
+
+
+
+
+
+
+
+
+
+
+-- -- -- end of main file search routing -- -- --
+
local function findfiles(filename,filetype,allresults)
local result = collect_instance_files(filename,filetype or "",allresults)
if #result == 0 then
@@ -13152,7 +13183,7 @@ local resolvers = resolvers
-- < +=
-- > =+
-function resolvers.load_tree(tree)
+function resolvers.load_tree(tree,resolve)
if type(tree) == "string" and tree ~= "" then
local getenv, setenv = resolvers.getenv, resolvers.setenv
@@ -13181,14 +13212,18 @@ function resolvers.load_tree(tree)
environment.texos = texos
environment.texmfos = texmfos
+ -- Beware, we need to obey the relocatable autoparent so we
+ -- set TEXMFCNF to its raw value. This is somewhat tricky when
+ -- we run a mkii job from within. Therefore, in mtxrun, there
+ -- is a resolve applied when we're in mkii/kpse mode.
+
setenv('SELFAUTOPARENT', newroot)
setenv('SELFAUTODIR', newtree)
setenv('SELFAUTOLOC', newpath)
setenv('TEXROOT', newroot)
setenv('TEXOS', texos)
setenv('TEXMFOS', texmfos)
- setenv('TEXROOT', newroot)
- setenv('TEXMFCNF', resolvers.luacnfspec)
+ setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
@@ -14300,6 +14335,8 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename
if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then
+ resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF
+
os.setenv("engine","")
os.setenv("progname","")
@@ -14374,9 +14411,10 @@ else
end
end
+ resolvers.load_tree(environment.argument('tree'))
+
end
-resolvers.load_tree(environment.argument('tree'))
if environment.argument("selfmerge") then
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index fc5dd3354..fd8d826f4 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -10379,17 +10379,25 @@ function caches.loadcontent(cachename,dataname)
local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua")
if blob then
local data = blob()
- if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then
- content_state[#content_state+1] = data.uuid
- if trace_locating then
- report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ if data and data.content then
+ if data.type == dataname then
+ if data.version == resolvers.cacheversion then
+ content_state[#content_state+1] = data.uuid
+ if trace_locating then
+ report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ end
+ return data.content
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename)
+ end
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename)
end
- return data.content
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename)
end
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename)
end
end
@@ -10595,7 +10603,7 @@ if not modules then modules = { } end modules ['data-res'] = {
local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch
local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys
-local next, type, rawget, setmetatable = next, type, rawget, setmetatable
+local next, type, rawget, setmetatable, getmetatable = next, type, rawget, setmetatable, getmetatable
local os = os
local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg
@@ -10651,15 +10659,15 @@ local instance = resolvers.instance or nil -- the current one (fast access)
-- variables replaced). One can push something into the outer environment and
-- its internal copy, but only the later one will be the raw unprefixed variant.
-function resolvers.setenv(key,value)
+function resolvers.setenv(key,value,raw)
if instance then
-- this one will be consulted first when we stay inside
-- the current environment
instance.environment[key] = value
-- we feed back into the environment, and as this is used
-- by other applications (via os.execute) we need to make
- -- sure that prefixes are resolved
- ossetenv(key,resolvers.resolve(value))
+ -- sure that prefixes are resolve
+ ossetenv(key,raw and value or resolvers.resolve(value))
end
end
@@ -10708,16 +10716,12 @@ local function expandedvariable(var)
return lpegmatch(variableexpander,var) or var
end
-function resolvers.expandvariables()
- -- no longer needed
-end
-
-local function collapse_configuration_data()
- -- no longer needed
-end
-
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
+ if trace_locating then
+ report_resolvers("creating instance")
+ end
+
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
local newinstance = {
@@ -10730,6 +10734,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
found = allocate(),
foundintrees = allocate(),
hashes = allocate(),
+ hashed = allocate(),
specification = allocate(),
lists = allocate(),
data = allocate(), -- only for loading
@@ -10866,6 +10871,8 @@ local function identify_configuration_files()
if trace_locating then
report_resolvers()
end
+ elseif trace_locating then
+ report_resolvers("configuration files already identified")
end
end
@@ -10908,10 +10915,13 @@ local function load_configuration_files()
-- the following code is not tested
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
+ if trace_locating then
+ report_resolvers("reloading configuration due to TEXMF redefinition")
+ end
-- we push the value into the main environment (osenv) so
-- that it takes precedence over the default one and therefore
-- also over following definitions
- resolvers.setenv('TEXMFCNF',resolvers.resolve(cnfspec))
+ resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes
-- we now identify and load the specified configuration files
instance.specification = { }
identify_configuration_files()
@@ -11036,17 +11046,25 @@ local function load_databases()
end
function resolvers.appendhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' appended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' appended",name)
+ end
+ insert(instance.hashes, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, { type = type, name = name, cache = cache } )
end
function resolvers.prependhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' prepended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' prepended",name)
+ end
+ insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
end
function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash
@@ -11379,7 +11397,7 @@ end
local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$"))
--- this one will be split in smalle functions
+-- this one is split in smaller functions but it needs testing
local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc)
local result = { }
@@ -11488,10 +11506,10 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
else
-- search spec
local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename)
- -- tricky as filename can be bla.1.2.3
-
--- to be checked
-
+ -- -- tricky as filename can be bla.1.2.3
+ -- if not suffixmap[ext] then --- probably needs to be done elsewhere too
+ -- wantedfiles[#wantedfiles+1] = filename
+ -- end
wantedfiles[#wantedfiles+1] = filename
if askedformat == "" then
if ext == "" or not suffixmap[ext] then
@@ -11638,6 +11656,19 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
return result
end
+-- -- -- begin of main file search routing -- -- --
+
+
+
+
+
+
+
+
+
+
+-- -- -- end of main file search routing -- -- --
+
local function findfiles(filename,filetype,allresults)
local result = collect_instance_files(filename,filetype or "",allresults)
if #result == 0 then
@@ -13152,7 +13183,7 @@ local resolvers = resolvers
-- < +=
-- > =+
-function resolvers.load_tree(tree)
+function resolvers.load_tree(tree,resolve)
if type(tree) == "string" and tree ~= "" then
local getenv, setenv = resolvers.getenv, resolvers.setenv
@@ -13181,14 +13212,18 @@ function resolvers.load_tree(tree)
environment.texos = texos
environment.texmfos = texmfos
+ -- Beware, we need to obey the relocatable autoparent so we
+ -- set TEXMFCNF to its raw value. This is somewhat tricky when
+ -- we run a mkii job from within. Therefore, in mtxrun, there
+ -- is a resolve applied when we're in mkii/kpse mode.
+
setenv('SELFAUTOPARENT', newroot)
setenv('SELFAUTODIR', newtree)
setenv('SELFAUTOLOC', newpath)
setenv('TEXROOT', newroot)
setenv('TEXOS', texos)
setenv('TEXMFOS', texmfos)
- setenv('TEXROOT', newroot)
- setenv('TEXMFCNF', resolvers.luacnfspec)
+ setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
@@ -14300,6 +14335,8 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename
if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then
+ resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF
+
os.setenv("engine","")
os.setenv("progname","")
@@ -14374,9 +14411,10 @@ else
end
end
+ resolvers.load_tree(environment.argument('tree'))
+
end
-resolvers.load_tree(environment.argument('tree'))
if environment.argument("selfmerge") then
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 2b199b518..add8de91e 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.01 22:02}
+\newcontextversion{2011.02.02 13:03}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 8a557e7a7..a3a8e804e 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.01 22:02}
+\newcontextversion{2011.02.02 13:03}
%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.mkii b/tex/context/base/context.mkii
index b98d076be..8086f5d45 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.01 22:02}
+\edef\contextversion{2011.02.02 13:03}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 0d60cf7e8..fd6566387 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.01 22:02}
+\edef\contextversion{2011.02.02 13:03}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index f6dfad9c9..80e019c1d 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -542,11 +542,17 @@ local function convert(method,n) -- todo: language
else
local lowermethod = lower(method)
local linguistic = counters[lowermethod]
- local sequence = sequences[method]
if linguistic then
return do_alphabetic(n,linguistic,lowermethod == method and lowercharacter or uppercharacter,false)
- elseif sequence then
- return do_alphabetic(n,sequence,false,true)
+ end
+ local sequence = sequences[method]
+ if sequence then
+ local max = #sequence
+ if n > max then
+ return sequence[(n-1) % max + 1]
+ else
+ return sequence[n]
+ end
else
return n
end
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index 65dd89f47..32ae27531 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -568,43 +568,6 @@
%D \defineconversion [en] [whatever] [\something]
%D \stoptyping
-% we can consider conversions to be global in which case we can
-% delegate to lua
-
-% \unexpanded\def\defineconversion
-% {\dotripleempty\dodefineconversion}
-%
-% \def\dodefineconversion[#1][#2][#3]%
-% {\ifthirdargument
-% \dododefineconversion[#1][#2][#3]%
-% \else
-% \dododefineconversion[][#1][#2]%
-% \fi}
-%
-% \def\dododefineconversion[#1][#2][#3]%
-% {\ConvertConstantAfter\doifinstringelse{,}{#3}
-% {\scratchcounter\zerocount
-% \def\docommand##1%
-% {\advance\scratchcounter \plusone
-% \setvalue{\??cv#1#2\the\scratchcounter}{##1}}%
-% \processcommalist[#3]\docommand
-% \setevalue{\??cv#1#2}##1%
-% {\noexpand\docheckedconversion{#1#2}{\the\scratchcounter}{##1}}}
-% {\setvalue{\??cv#1#2}{#3}}}
-%
-% \def\docheckedconversion#1#2#3% class maxnumber number
-% {\executeifdefined{\??cv#1#3}\unknown}
-%
-% %D When Gerben reported problems with footnote numbering per page,
-% %D Taco came with the following wrap around solution. So, let's
-% %D overload the checked conversion macro
-%
-% %D Taco's modulo code is implemented in the system module
-% %D \type {syst-con}.
-%
-% \def\docheckedconversion#1#2#3% class maxnumber number
-% {\executeifdefined{\??cv#1\modulatednumber{#2}{#3}}\unknown}
-
\unexpanded\def\defineconversion
{\dotripleempty\dodefineconversion}
@@ -616,9 +579,9 @@
\fi}
\def\dododefineconversion#1#2#3%
- {\ConvertConstantAfter\doifinstringelse{,}{#3}
+ {\doifinstringelse{,}{\detokenize{#3}}
{\ctxcommand{defineconversion("#2",\!!bs\detokenize{#3}\!!es)}%
- \setgvalue{\??cv#1}{\docheckedconversion{#2}}}
+ \setgvalue{\??cv#1}{\checkedconversion{#2}}}
{\setgvalue{\??cv#1}{#3}}}
\def\checkedconversion#1#2%
@@ -628,17 +591,6 @@
%D that the number is indeed end up as number in the input, so we
%D need to handle the second argument.
-% \def\convertnumber#1#2%
-% {\csname\??cv
-% \ifcsname\??cv\currentlanguage#1\endcsname
-% \currentlanguage#1%
-% \else\ifcsname\??cv#1\endcsname
-% #1%
-% \else
-% \s!default
-% \fi\fi
-% \endcsname{\number#2}}
-
\def\convertnumber#1#2%
{\csname\??cv % we want a fully expandable (no if interference)
\ifcsname\??cv\currentlanguage#1\endcsname
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index c654aeeea..0c6ce1969 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['data-res'] = {
local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch
local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys
-local next, type, rawget, setmetatable = next, type, rawget, setmetatable
+local next, type, rawget, setmetatable, getmetatable = next, type, rawget, setmetatable, getmetatable
local os = os
local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg
@@ -80,15 +80,15 @@ local instance = resolvers.instance or nil -- the current one (fast access)
-- variables replaced). One can push something into the outer environment and
-- its internal copy, but only the later one will be the raw unprefixed variant.
-function resolvers.setenv(key,value)
+function resolvers.setenv(key,value,raw)
if instance then
-- this one will be consulted first when we stay inside
-- the current environment
instance.environment[key] = value
-- we feed back into the environment, and as this is used
-- by other applications (via os.execute) we need to make
- -- sure that prefixes are resolved
- ossetenv(key,resolvers.resolve(value))
+ -- sure that prefixes are resolve
+ ossetenv(key,raw and value or resolvers.resolve(value))
end
end
@@ -137,16 +137,12 @@ local function expandedvariable(var)
return lpegmatch(variableexpander,var) or var
end
-function resolvers.expandvariables()
- -- no longer needed
-end
-
-local function collapse_configuration_data()
- -- no longer needed
-end
-
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
+ if trace_locating then
+ report_resolvers("creating instance")
+ end
+
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
local newinstance = {
@@ -159,6 +155,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
found = allocate(),
foundintrees = allocate(),
hashes = allocate(),
+ hashed = allocate(),
specification = allocate(),
lists = allocate(),
data = allocate(), -- only for loading
@@ -295,6 +292,8 @@ local function identify_configuration_files()
if trace_locating then
report_resolvers()
end
+ elseif trace_locating then
+ report_resolvers("configuration files already identified")
end
end
@@ -337,10 +336,13 @@ local function load_configuration_files()
-- the following code is not tested
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
+ if trace_locating then
+ report_resolvers("reloading configuration due to TEXMF redefinition")
+ end
-- we push the value into the main environment (osenv) so
-- that it takes precedence over the default one and therefore
-- also over following definitions
- resolvers.setenv('TEXMFCNF',resolvers.resolve(cnfspec))
+ resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes
-- we now identify and load the specified configuration files
instance.specification = { }
identify_configuration_files()
@@ -465,17 +467,25 @@ local function load_databases()
end
function resolvers.appendhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' appended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' appended",name)
+ end
+ insert(instance.hashes, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, { type = type, name = name, cache = cache } )
end
function resolvers.prependhash(type,name,cache)
- if trace_locating then
- report_resolvers("hash '%s' prepended",name)
+ -- safeguard ... tricky as it's actually a bug when seen twice
+ if not instance.hashed[name] then
+ if trace_locating then
+ report_resolvers("hash '%s' prepended",name)
+ end
+ insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
+ instance.hashed[name] = cache
end
- insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
end
function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash
@@ -808,7 +818,7 @@ end
local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$"))
--- this one will be split in smalle functions
+-- this one is split in smaller functions but it needs testing
local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc)
local result = { }
@@ -917,13 +927,10 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
else
-- search spec
local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename)
- -- tricky as filename can be bla.1.2.3
---~ if not suffixmap[ext] then --- probably needs to be done elsewhere too
---~ wantedfiles[#wantedfiles+1] = filename
---~ end
-
--- to be checked
-
+ -- -- tricky as filename can be bla.1.2.3
+ -- if not suffixmap[ext] then --- probably needs to be done elsewhere too
+ -- wantedfiles[#wantedfiles+1] = filename
+ -- end
wantedfiles[#wantedfiles+1] = filename
if askedformat == "" then
if ext == "" or not suffixmap[ext] then
@@ -1070,6 +1077,310 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
return result
end
+-- -- -- begin of main file search routing -- -- --
+
+--~ local collect_instance_files
+
+--~ local function find_direct(filename)
+--~ if not dangerous[askedformat] and isreadable(filename) then
+--~ if trace_detail then
+--~ report_resolvers("file '%s' found directly",filename)
+--~ end
+--~ return { filename }
+--~ end
+--~ end
+
+--~ local function find_wildcard(filename)
+--~ if find(filename,'%*') then
+--~ if trace_locating then
+--~ report_resolvers("checking wildcard '%s'", filename)
+--~ end
+--~ return resolvers.findwildcardfiles(filename) -- we can use the local
+--~ end
+--~ end
+
+--~ local function find_qualified(filename) -- this one will be split too
+--~ if not file.is_qualified_path(filename) then
+--~ return
+--~ end
+--~ if trace_locating then
+--~ report_resolvers("checking qualified name '%s'", filename)
+--~ end
+--~ if isreadable(filename) then
+--~ if trace_detail then
+--~ report_resolvers("qualified file '%s' found", filename)
+--~ end
+--~ return { filename }
+--~ else
+--~ if trace_detail then
+--~ report_resolvers("locating qualified file '%s'", filename)
+--~ end
+--~ local forcedname, suffix = "", fileextname(filename)
+--~ if suffix == "" then -- why
+--~ local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat]
+--~ if format_suffixes then
+--~ for i=1,#format_suffixes do
+--~ local s = format_suffixes[i]
+--~ forcedname = filename .. "." .. s
+--~ if isreadable(forcedname) then
+--~ if trace_locating then
+--~ report_resolvers("no suffix, forcing format filetype '%s'", s)
+--~ end
+--~ return { forcedname }
+--~ end
+--~ end
+--~ end
+--~ end
+--~ if suffix ~= "" then
+--~ -- try to find in tree (no suffix manipulation), here we search for the
+--~ -- matching last part of the name
+--~ local basename = filebasename(filename)
+--~ local pattern = lpegmatch(preparetreepattern,filename)
+--~ -- messy .. to be sorted out
+--~ local savedformat = askedformat
+--~ local format = savedformat or ""
+--~ if format == "" then
+--~ askedformat = resolvers.formatofsuffix(suffix)
+--~ end
+--~ if not format then
+--~ askedformat = "othertextfiles" -- kind of everything, maybe all
+--~ end
+--~ --
+--~ if basename ~= filename then
+--~ local resolved = collect_instance_files(basename,askedformat,allresults)
+--~ if #resolved == 0 then
+--~ local lowered = lower(basename)
+--~ if filename ~= lowered then
+--~ resolved = collect_instance_files(lowered,askedformat,allresults)
+--~ end
+--~ end
+--~ resolvers.format = savedformat
+--~ --
+--~ if #resolved > 0 then
+--~ local result = { }
+--~ for r=1,#resolved do
+--~ local rr = resolved[r]
+--~ if find(rr,pattern) then
+--~ result[#result+1] = rr
+--~ end
+--~ end
+--~ if #result > 0 then
+--~ return result
+--~ end
+--~ end
+--~ end
+--~ -- a real wildcard:
+--~ --
+--~ -- local filelist = collect_files({basename})
+--~ -- result = { }
+--~ -- for f=1,#filelist do
+--~ -- local ff = filelist[f][3] or ""
+--~ -- if find(ff,pattern) then
+--~ -- result[#result+1], ok = ff, true
+--~ -- end
+--~ -- end
+--~ -- if #result > 0 then
+--~ -- return result
+--~ -- end
+--~ end
+--~ end
+--~ end
+
+--~ local function find_analyze(filename,askedformat)
+--~ local filetype, wantedfiles, ext = '', { }, fileextname(filename)
+--~ -- too tricky as filename can be bla.1.2.3:
+--~ --
+--~ -- if not suffixmap[ext] then
+--~ -- wantedfiles[#wantedfiles+1] = filename
+--~ -- end
+--~ wantedfiles[#wantedfiles+1] = filename
+--~ if askedformat == "" then
+--~ if ext == "" or not suffixmap[ext] then
+--~ local defaultsuffixes = resolvers.defaultsuffixes
+--~ for i=1,#defaultsuffixes do
+--~ local forcedname = filename .. '.' .. defaultsuffixes[i]
+--~ wantedfiles[#wantedfiles+1] = forcedname
+--~ filetype = resolvers.formatofsuffix(forcedname)
+--~ if trace_locating then
+--~ report_resolvers("forcing filetype '%s'",filetype)
+--~ end
+--~ end
+--~ else
+--~ filetype = resolvers.formatofsuffix(filename)
+--~ if trace_locating then
+--~ report_resolvers("using suffix based filetype '%s'",filetype)
+--~ end
+--~ end
+--~ else
+--~ if ext == "" or not suffixmap[ext] then
+--~ local format_suffixes = suffixes[askedformat]
+--~ if format_suffixes then
+--~ for i=1,#format_suffixes do
+--~ wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i]
+--~ end
+--~ end
+--~ end
+--~ filetype = askedformat
+--~ if trace_locating then
+--~ report_resolvers("using given filetype '%s'",filetype)
+--~ end
+--~ end
+--~ return filetype, wantedfiles
+--~ end
+
+--~ local function find_intree(filename,filetype,wantedfiles)
+--~ local typespec = resolvers.variableofformat(filetype)
+--~ local pathlist = resolvers.expandedpathlist(typespec)
+--~ if pathlist and #pathlist > 0 then
+--~ -- list search
+--~ local filelist = collect_files(wantedfiles)
+--~ local dirlist = { }
+--~ if filelist then
+--~ for i=1,#filelist do
+--~ dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble
+--~ end
+--~ end
+--~ if trace_detail then
+--~ report_resolvers("checking filename '%s'",filename)
+--~ end
+--~ local result = { }
+--~ for k=1,#pathlist do
+--~ local path = pathlist[k]
+--~ local pathname = lpegmatch(inhibitstripper,path)
+--~ local doscan = path == pathname -- no ^!!
+--~ local done = false
+--~ -- using file list
+--~ if filelist then
+--~ -- compare list entries with permitted pattern -- /xx /xx//
+--~ local expression = makepathexpression(pathname)
+--~ if trace_detail then
+--~ report_resolvers("using pattern '%s' for path '%s'",expression,pathname)
+--~ end
+--~ for k=1,#filelist do
+--~ local fl = filelist[k]
+--~ local f = fl[2]
+--~ local d = dirlist[k]
+--~ if find(d,expression) then
+--~ -- todo, test for readable
+--~ result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut
+--~ done = true
+--~ if allresults then
+--~ if trace_detail then
+--~ report_resolvers("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d)
+--~ end
+--~ else
+--~ if trace_detail then
+--~ report_resolvers("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d)
+--~ end
+--~ break
+--~ end
+--~ elseif trace_detail then
+--~ report_resolvers("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
+--~ end
+--~ end
+--~ end
+--~ if not done and doscan then
+--~ -- check if on disk / unchecked / does not work at all / also zips
+--~ local scheme = url.hasscheme(pathname)
+--~ if not scheme or scheme == "file" then
+--~ local pname = gsub(pathname,"%.%*$",'')
+--~ if not find(pname,"%*") then
+--~ local ppname = gsub(pname,"/+$","")
+--~ if can_be_dir(ppname) then
+--~ for k=1,#wantedfiles do
+--~ local w = wantedfiles[k]
+--~ local fname = filejoin(ppname,w)
+--~ if isreadable(fname) then
+--~ if trace_detail then
+--~ report_resolvers("found '%s' by scanning",fname)
+--~ end
+--~ result[#result+1] = fname
+--~ done = true
+--~ if not allresults then break end
+--~ end
+--~ end
+--~ else
+--~ -- no access needed for non existing path, speedup (esp in large tree with lots of fake)
+--~ end
+--~ end
+--~ end
+--~ end
+--~ if not done and doscan then
+--~ -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF
+--~ end
+--~ if done and not allresults then
+--~ return #result > 0 and result
+--~ end
+--~ end
+--~ end
+--~ end
+
+--~ local function find_onpath(filename,filetype,wantedfiles)
+--~ local done = nil
+--~ if trace_detail then
+--~ report_resolvers("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
+--~ end
+--~ for k=1,#wantedfiles do
+--~ local fname = wantedfiles[k]
+--~ if fname and isreadable(fname) then
+--~ filename, done = fname, true
+--~ result[#result+1] = filejoin('.',fname)
+--~ break
+--~ end
+--~ end
+--~ end
+
+--~ local function find_otherwise(filename,filetype,wantedfiles) -- other text files | any | whatever
+--~ local filelist = collect_files(wantedfiles)
+--~ local fl = filelist and filelist[1]
+--~ if fl then
+--~ return { fl[3] } -- filename
+--~ end
+--~ end
+
+--~ collect_instance_files = function(filename,askedformat,allresults) -- uses nested
+--~ local result, stamp, filetype, wantedfiles
+--~ askedformat = askedformat or ""
+--~ filename = collapsepath(filename)
+--~ if instance.remember and not allresults then
+--~ stamp = format("%s--%s", filename, askedformat)
+--~ result = stamp and instance.found[stamp]
+--~ if result then
+--~ if trace_locating then
+--~ report_resolvers("remembered file '%s'",filename)
+--~ end
+--~ return result
+--~ end
+--~ end
+--~ result = find_direct (filename,stamp) or
+--~ find_wildcard (filename) or
+--~ find_qualified(filename)
+--~ if not result then
+--~ filetype, wantedfiles = find_analyze(filename,askedformat)
+--~ result = find_intree (filename,filetype,wantedfiles) or
+--~ find_onpath (filename,filetype,wantedfiles) or
+--~ find_otherwise(filename,filetype,wantedfiles)
+--~ end
+--~ if result then
+--~ for k=1,#result do
+--~ local rk = collapsepath(result[k])
+--~ result[k] = rk
+--~ resolvers.registerintrees(rk) -- for tracing used files
+--~ end
+--~ else
+--~ result = { } -- maybe false
+--~ end
+--~ if stamp then
+--~ if trace_locating then
+--~ report_resolvers("remembering file '%s'",filename)
+--~ end
+--~ instance.found[stamp] = result
+--~ end
+--~ return result
+--~ end
+
+-- -- -- end of main file search routing -- -- --
+
local function findfiles(filename,filetype,allresults)
local result = collect_instance_files(filename,filetype or "",allresults)
if #result == 0 then
diff --git a/tex/context/base/data-tmf.lua b/tex/context/base/data-tmf.lua
index e343e041b..275b56150 100644
--- a/tex/context/base/data-tmf.lua
+++ b/tex/context/base/data-tmf.lua
@@ -13,7 +13,7 @@ local resolvers = resolvers
-- < +=
-- > =+
-function resolvers.load_tree(tree)
+function resolvers.load_tree(tree,resolve)
if type(tree) == "string" and tree ~= "" then
local getenv, setenv = resolvers.getenv, resolvers.setenv
@@ -42,14 +42,18 @@ function resolvers.load_tree(tree)
environment.texos = texos
environment.texmfos = texmfos
+ -- Beware, we need to obey the relocatable autoparent so we
+ -- set TEXMFCNF to its raw value. This is somewhat tricky when
+ -- we run a mkii job from within. Therefore, in mtxrun, there
+ -- is a resolve applied when we're in mkii/kpse mode.
+
setenv('SELFAUTOPARENT', newroot)
setenv('SELFAUTODIR', newtree)
setenv('SELFAUTOLOC', newpath)
setenv('TEXROOT', newroot)
setenv('TEXOS', texos)
setenv('TEXMFOS', texmfos)
- setenv('TEXROOT', newroot)
- setenv('TEXMFCNF', resolvers.luacnfspec)
+ setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
diff --git a/tex/context/base/data-tmp.lua b/tex/context/base/data-tmp.lua
index 587a93544..8dc43b179 100644
--- a/tex/context/base/data-tmp.lua
+++ b/tex/context/base/data-tmp.lua
@@ -320,17 +320,25 @@ function caches.loadcontent(cachename,dataname)
local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua")
if blob then
local data = blob()
- if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then
- content_state[#content_state+1] = data.uuid
- if trace_locating then
- report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ if data and data.content then
+ if data.type == dataname then
+ if data.version == resolvers.cacheversion then
+ content_state[#content_state+1] = data.uuid
+ if trace_locating then
+ report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename)
+ end
+ return data.content
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename)
+ end
+ else
+ report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename)
end
- return data.content
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename)
end
elseif trace_locating then
- report_resolvers("skipping '%s' for '%s' from '%s'",dataname,cachename,filename)
+ report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename)
end
end
diff --git a/tex/context/base/l-pdfview.lua b/tex/context/base/l-pdfview.lua
index f263bda8d..9bf525775 100644
--- a/tex/context/base/l-pdfview.lua
+++ b/tex/context/base/l-pdfview.lua
@@ -26,13 +26,13 @@ local allcalls = {
}
if os.type == "windows" then
---~ opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus
- opencalls['okular'] = 'start "test" "c:/data/system/kde/bin/okular.exe" --unique' -- todo: get focus
+ -- opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus
+ opencalls['okular'] = 'start "test" "c:/data/system/kde/bin/okular.exe" --unique' -- todo: get focus
else
- opencalls['okular'] = 'okular --unique'
+ opencalls['okular'] = 'okular --unique'
end
-pdfview.method = false
+pdfview.method = "default"
directives.register("pdfview.method", function(v)
pdfview.method = (opencalls[v] and v) or 'default'
@@ -49,7 +49,7 @@ function pdfview.methods()
end
function pdfview.status()
- return format("pdfview methods: %s, current method: %s (directives_pdfview_method)",pdfview.methods(),pdfview.method)
+ return format("pdfview methods: %s, current method: %s (directives_pdfview_method)",pdfview.methods(),tostring(pdfview.method))
end
local openedfiles = { }
diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua
index 64b51d58d..5deb704f6 100644
--- a/tex/context/base/luat-fio.lua
+++ b/tex/context/base/luat-fio.lua
@@ -22,6 +22,9 @@ if not resolvers.instance then
resolvers.instance.validfile = resolvers.validctxfile
+ -- we now load the file database as we might need files other than
+ -- tex and lua file on the given path
+
-- trackers.enable("resolvers.*")
resolvers.load()
-- trackers.disable("resolvers.*")
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index d15693206..bda299c0c 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 471ba0986..0c1121639 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 02/01/11 22:02:04
+-- merge date : 02/02/11 13:03:55
do -- begin closure to overcome local limits and interference