From 9c6992a3436a0db6a01790b29d7c0c3c65460f94 Mon Sep 17 00:00:00 2001
From: Marius This is a prelude to a more extensive logging module. For the sake
-of parsing log files, in addition to the standard logging we will
-provide an This is a prelude to a more extensive logging module. We no longer
+provide The parser used here is inspired by the variant discussed in the lua book, but
@@ -6518,7 +6575,7 @@ function xml.is_valid(root)
return root and not root.error
end
-xml.errorhandler = (logs and logs.report) or (input and logs.report) or print
+xml.errorhandler = report
--[[ldx--
We cannot load an We've now arrived at an interesting part: accessing the tree using a subset
@@ -7951,9 +8008,9 @@ local function traced_apply(list,parsed,nofparsed,order)
if trace_lparse then
lshow(parsed)
end
- report_lpath("collecting : %s",parsed.pattern)
- report_lpath(" root tags : %s",tagstostring(list))
- report_lpath(" order : %s",order or "unset")
+ report_lpath("collecting: %s",parsed.pattern)
+ report_lpath("root tags : %s",tagstostring(list))
+ report_lpath("order : %s",order or "unset")
local collected = list
for i=1,nofparsed do
local pi = parsed[i]
@@ -9224,7 +9281,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_initialization = logs.new("resolvers","initialization")
local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv
@@ -9245,7 +9302,7 @@ kpse = { original = kpse }
setmetatable(kpse, {
__index = function(kp,name)
- report_resolvers("fatal error: kpse library is accessed (key: %s)",name)
+ report_initialization("fatal error: kpse library is accessed (key: %s)",name)
os.exit()
end
} )
@@ -9329,13 +9386,13 @@ do
if lfs.chdir(p) then
local pp = lfs.currentdir()
if trace_locating and p ~= pp then
- report_resolvers("following symlink '%s' to '%s'",p,pp)
+ report_initialization("following symlink '%s' to '%s'",p,pp)
end
ownpath = pp
lfs.chdir(olddir)
else
if trace_locating then
- report_resolvers("unable to check path '%s'",p)
+ report_initialization("unable to check path '%s'",p)
end
ownpath = p
end
@@ -9346,9 +9403,9 @@ do
end
if not ownpath or ownpath == "" then
ownpath = "."
- report_resolvers("forcing fallback ownpath .")
+ report_initialization("forcing fallback ownpath .")
elseif trace_locating then
- report_resolvers("using ownpath '%s'",ownpath)
+ report_initialization("using ownpath '%s'",ownpath)
end
end
@@ -9375,7 +9432,7 @@ do
ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/.."))
ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../.."))
else
- report_resolvers("error: unable to locate ownpath")
+ report_initialization("error: unable to locate ownpath")
os.exit()
end
@@ -9461,7 +9518,7 @@ local collapsepath = file.collapsepath
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_expansions = logs.new("resolvers","expansions")
local resolvers = resolvers
@@ -9524,7 +9581,7 @@ local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
- report_resolvers("expanding variable '%s'",str)
+ report_expansions("expanding variable '%s'",str)
end
local t, ok, done = newlist or { }, false, false
local n = #t
@@ -9550,7 +9607,7 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi
end
if trace_expansions then
for k=1,#t do
- report_resolvers("% 4i: %s",k,t[k])
+ report_expansions("% 4i: %s",k,t[k])
end
end
return t
@@ -9585,7 +9642,7 @@ function resolvers.cleanpath(str)
homedir = lpegmatch(cleanup,environment.homedir or "")
if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then
if trace_expansions then
- report_resolvers("no home dir set, ignoring dependent paths")
+ report_expansions("no home dir set, ignoring dependent paths")
end
function resolvers.cleanpath(str)
if find(str,"~") then
@@ -9655,9 +9712,9 @@ local function splitconfigurationpath(str) -- beware, this can be either a path
end
end
if trace_expansions then
- report_resolvers("splitting path specification '%s'",str)
+ report_expansions("splitting path specification '%s'",str)
for k=1,noffound do
- report_resolvers("% 4i: %s",k,found[k])
+ report_expansions("% 4i: %s",k,found[k])
end
end
cache[str] = found
@@ -9742,7 +9799,7 @@ end
function resolvers.scanfiles(path,branch)
if trace_locating then
- report_resolvers("scanning path '%s', branch '%s'",path, branch or path)
+ report_expansions("scanning path '%s', branch '%s'",path, branch or path)
end
local realpath = resolvers.resolve(path) -- no shortcut
local files, n, m, r = scan({ },realpath .. '/',"",0,0,0)
@@ -9751,7 +9808,7 @@ function resolvers.scanfiles(path,branch)
files.__directories__ = m
files.__remappings__ = r
if trace_locating then
- report_resolvers("%s files found on %s directories with %s uppercase remappings",n,m,r)
+ report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r)
end
return files
end
@@ -10080,8 +10137,8 @@ local mkdirs, isdir = dir.mkdirs, lfs.isdir
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end)
-local report_cache = logs.new("cache")
-local report_resolvers = logs.new("resolvers")
+local report_caches = logs.new("resolvers","caches")
+local report_resolvers = logs.new("resolvers","caching")
local resolvers = resolvers
@@ -10141,7 +10198,7 @@ local function identify()
if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then
mkdirs(cachepath)
if isdir(cachepath) and file.is_writable(cachepath) then
- report_cache("created: %s",cachepath)
+ report_caches("created: %s",cachepath)
writable = cachepath
readables[#readables+1] = cachepath
end
@@ -10175,10 +10232,10 @@ local function identify()
-- Some extra checking. If we have no writable or readable path then we simply
-- quit.
if not writable then
- report_cache("fatal error: there is no valid writable cache path defined")
+ report_caches("fatal error: there is no valid writable cache path defined")
os.exit()
elseif #readables == 0 then
- report_cache("fatal error: there is no valid readable cache path defined")
+ report_caches("fatal error: there is no valid readable cache path defined")
os.exit()
end
-- why here
@@ -10200,9 +10257,9 @@ local function identify()
-- end
if trace_cache then
for i=1,#readables do
- report_cache("using readable path '%s' (order %s)",readables[i],i)
+ report_caches("using readable path '%s' (order %s)",readables[i],i)
end
- report_cache("using writable path '%s'",writable)
+ report_caches("using writable path '%s'",writable)
end
identify = function()
return writable, readables
@@ -10237,7 +10294,7 @@ function caches.hashed(tree)
tree = lower(tree)
local hash = md5.hex(tree)
if trace_cache or trace_locating then
- report_cache("hashing tree %s, hash %s",tree,hash)
+ report_caches("hashing tree %s, hash %s",tree,hash)
end
return hash
end
@@ -10463,7 +10520,7 @@ trackers.register("resolvers.locating", function(v) trace_methods = v end)
trackers.register("resolvers.methods", function(v) trace_methods = v end)
-local report_resolvers = logs.new("resolvers")
+local report_methods = logs.new("resolvers","methods")
local allocate = utilities.storage.allocate
@@ -10505,41 +10562,41 @@ local function methodhandler(what,first,...) -- filename can be nil or false
local resolver = namespace and namespace[scheme]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
+ report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
end
return resolver(specification,...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
end
return resolver(specification,...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, no handler",what,how)
+ report_methods("resolver: method=%s, how=%s, no handler",what,how)
end
end
elseif how == "tag" then
local resolver = namespace and namespace[first]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, tag=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first)
end
return resolver(...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default",what,how)
+ report_methods("resolver: method=%s, how=%s, default",what,how)
end
return resolver(...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, unknown",what,how)
+ report_methods("resolver: method=%s, how=%s, unknown",what,how)
end
end
end
else
- report_resolvers("resolver: method=%s, unknown",what)
+ report_methods("resolver: method=%s, unknown",what)
end
end
@@ -10610,7 +10667,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_resolving = logs.new("resolvers","resolving")
local resolvers = resolvers
@@ -10712,7 +10769,7 @@ end
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
if trace_locating then
- report_resolvers("creating instance")
+ report_resolving("creating instance")
end
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
@@ -10830,9 +10887,9 @@ local function reportcriticalvariables()
for i=1,#resolvers.criticalvars do
local k = resolvers.criticalvars[i]
local v = resolvers.getenv(k) or "unknown" -- this one will not resolve !
- report_resolvers("variable '%s' set to '%s'",k,v)
+ report_resolving("variable '%s' set to '%s'",k,v)
end
- report_resolvers()
+ report_resolving()
end
reportcriticalvariables = function() end
end
@@ -10856,17 +10913,17 @@ local function identify_configuration_files()
if lfs.isfile(realname) then
specification[#specification+1] = filename
if trace_locating then
- report_resolvers("found configuration file '%s'",realname)
+ report_resolving("found configuration file '%s'",realname)
end
elseif trace_locating then
- report_resolvers("unknown configuration file '%s'",realname)
+ report_resolving("unknown configuration file '%s'",realname)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("configuration files already identified")
+ report_resolving("configuration files already identified")
end
end
@@ -10886,8 +10943,8 @@ local function load_configuration_files()
data = data and data.content
if data then
if trace_locating then
- report_resolvers("loading configuration file '%s'",filename)
- report_resolvers()
+ report_resolving("loading configuration file '%s'",filename)
+ report_resolving()
end
local variables = data.variables or { }
local warning = false
@@ -10897,7 +10954,7 @@ local function load_configuration_files()
initializesetter(filename,k,v)
elseif variables[k] == nil then
if trace_locating and not warning then
- report_resolvers("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
+ report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
k,resolvers.resolve(filename))
warning = true
end
@@ -10910,7 +10967,7 @@ local function load_configuration_files()
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
if trace_locating then
- report_resolvers("reloading configuration due to TEXMF redefinition")
+ report_resolving("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
@@ -10929,13 +10986,13 @@ local function load_configuration_files()
else
if trace_locating then
- report_resolvers("skipping configuration file '%s' (no content)",filename)
+ report_resolving("skipping configuration file '%s' (no content)",filename)
end
setups[pathname] = { }
instance.loaderror = true
end
elseif trace_locating then
- report_resolvers("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no file)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -10943,7 +11000,7 @@ local function load_configuration_files()
end
end
elseif trace_locating then
- report_resolvers("warning: no lua configuration files found")
+ report_resolving("warning: no lua configuration files found")
end
end
@@ -10979,19 +11036,19 @@ local function locate_file_databases()
end
if trace_locating then
if runtime then
- report_resolvers("locating list of '%s' (runtime)",path)
+ report_resolving("locating list of '%s' (runtime)",path)
else
- report_resolvers("locating list of '%s' (cached)",path)
+ report_resolving("locating list of '%s' (cached)",path)
end
end
methodhandler('locators',stripped)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("no texmf paths are defined (using TEXMF)")
+ report_resolving("no texmf paths are defined (using TEXMF)")
end
end
@@ -11002,7 +11059,7 @@ local function generate_file_databases()
methodhandler('generators',hash.name)
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
end
@@ -11014,11 +11071,11 @@ local function save_file_databases() -- will become cachers
local content = instance.files[cachename]
caches.collapsecontent(content)
if trace_locating then
- report_resolvers("saving tree '%s'",cachename)
+ report_resolving("saving tree '%s'",cachename)
end
caches.savecontent(cachename,"files",content)
elseif trace_locating then
- report_resolvers("not saving runtime tree '%s'",cachename)
+ report_resolving("not saving runtime tree '%s'",cachename)
end
end
end
@@ -11043,7 +11100,7 @@ function resolvers.appendhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' appended",name)
end
insert(instance.hashes, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11054,7 +11111,7 @@ function resolvers.prependhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' prepended",name)
end
insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11287,9 +11344,9 @@ function isreadable(name)
local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir
if trace_detail then
if readable then
- report_resolvers("file '%s' is readable",name)
+ report_resolving("file '%s' is readable",name)
else
- report_resolvers("file '%s' is not readable", name)
+ report_resolving("file '%s' is not readable", name)
end
end
return readable
@@ -11303,7 +11360,7 @@ local function collect_files(names)
for k=1,#names do
local fname = names[k]
if trace_detail then
- report_resolvers("checking name '%s'",fname)
+ report_resolving("checking name '%s'",fname)
end
local bname = filebasename(fname)
local dname = filedirname(fname)
@@ -11319,7 +11376,7 @@ local function collect_files(names)
local files = blobpath and instance.files[blobpath]
if files then
if trace_detail then
- report_resolvers("deep checking '%s' (%s)",blobpath,bname)
+ report_resolving("deep checking '%s' (%s)",blobpath,bname)
end
local blobfile = files[bname]
if not blobfile then
@@ -11339,7 +11396,7 @@ local function collect_files(names)
local search = filejoin(blobroot,blobfile,bname)
local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11353,7 +11410,7 @@ local function collect_files(names)
local search = filejoin(blobroot,vv,bname)
local result = methodhandler('concatinators',hash.type,blobroot,vv,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11362,7 +11419,7 @@ local function collect_files(names)
end
end
elseif trace_locating then
- report_resolvers("no match in '%s' (%s)",blobpath,bname)
+ report_resolving("no match in '%s' (%s)",blobpath,bname)
end
end
end
@@ -11403,7 +11460,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
stamp = filename .. "--" .. askedformat
if instance.found[stamp] then
if trace_locating then
- report_resolvers("remembered file '%s'",filename)
+ report_resolving("remembered file '%s'",filename)
end
resolvers.registerintrees(filename) -- for tracing used files
return instance.found[stamp]
@@ -11412,7 +11469,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not dangerous[askedformat] then
if isreadable(filename) then
if trace_detail then
- report_resolvers("file '%s' found directly",filename)
+ report_resolving("file '%s' found directly",filename)
end
if stamp then
instance.found[stamp] = { filename }
@@ -11422,13 +11479,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
if find(filename,'%*') then
if trace_locating then
- report_resolvers("checking wildcard '%s'", filename)
+ report_resolving("checking wildcard '%s'", filename)
end
result = resolvers.findwildcardfiles(filename) -- we can use th elocal
elseif file.is_qualified_path(filename) then
if isreadable(filename) then
if trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
result = { filename }
else
@@ -11441,7 +11498,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
forcedname = filename .. "." .. s
if isreadable(forcedname) then
if trace_locating then
- report_resolvers("no suffix, forcing format filetype '%s'", s)
+ report_resolving("no suffix, forcing format filetype '%s'", s)
end
result, ok = { forcedname }, true
break
@@ -11494,7 +11551,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- end
end
if not ok and trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
end
else
@@ -11513,13 +11570,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
wantedfiles[#wantedfiles+1] = forcedname
filetype = resolvers.formatofsuffix(forcedname)
if trace_locating then
- report_resolvers("forcing filetype '%s'",filetype)
+ report_resolving("forcing filetype '%s'",filetype)
end
end
else
filetype = resolvers.formatofsuffix(filename)
if trace_locating then
- report_resolvers("using suffix based filetype '%s'",filetype)
+ report_resolving("using suffix based filetype '%s'",filetype)
end
end
else
@@ -11533,7 +11590,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
filetype = askedformat
if trace_locating then
- report_resolvers("using given filetype '%s'",filetype)
+ report_resolving("using given filetype '%s'",filetype)
end
end
local typespec = resolvers.variableofformat(filetype)
@@ -11541,7 +11598,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not pathlist or #pathlist == 0 then
-- no pathlist, access check only / todo == wildcard
if trace_detail then
- report_resolvers("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
+ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
end
for k=1,#wantedfiles do
local fname = wantedfiles[k]
@@ -11569,7 +11626,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
end
if trace_detail then
- report_resolvers("checking filename '%s'",filename)
+ report_resolving("checking filename '%s'",filename)
end
for k=1,#pathlist do
local path = pathlist[k]
@@ -11581,7 +11638,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- 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)
+ report_resolving("using pattern '%s' for path '%s'",expression,pathname)
end
for k=1,#filelist do
local fl = filelist[k]
@@ -11593,16 +11650,16 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
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)
+ report_resolving("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)
+ report_resolving("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)
+ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
end
end
end
@@ -11619,7 +11676,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
local fname = filejoin(ppname,w)
if isreadable(fname) then
if trace_detail then
- report_resolvers("found '%s' by scanning",fname)
+ report_resolving("found '%s' by scanning",fname)
end
result[#result+1] = fname
done = true
@@ -11824,7 +11881,7 @@ end
local function report(str)
if trace_locating then
- report_resolvers(str) -- has already verbose
+ report_resolving(str) -- has already verbose
else
print(str)
end
@@ -12219,7 +12276,7 @@ if not modules then modules = { } end modules ['data-fil'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_files = logs.new("resolvers","files")
local resolvers = resolvers
@@ -12233,11 +12290,11 @@ function locators.file(specification)
local realname = resolvers.resolve(name) -- no shortcut
if realname and realname ~= '' and lfs.isdir(realname) then
if trace_locating then
- report_resolvers("file locator '%s' found as '%s'",name,realname)
+ report_files("file locator '%s' found as '%s'",name,realname)
end
resolvers.appendhash('file',name,true) -- cache
elseif trace_locating then
- report_resolvers("file locator '%s' not found",name)
+ report_files("file locator '%s' not found",name)
end
end
@@ -12260,12 +12317,12 @@ function finders.file(specification,filetype)
local foundname = resolvers.findfile(filename,filetype)
if foundname and foundname ~= "" then
if trace_locating then
- report_resolvers("file finder: '%s' found",filename)
+ report_files("file finder: '%s' found",filename)
end
return foundname
else
if trace_locating then
- report_resolvers("file finder: %s' not found",filename)
+ report_files("file finder: %s' not found",filename)
end
return finders.notfound()
end
@@ -12286,13 +12343,13 @@ function openers.file(specification,filetype)
local f = io.open(filename,"r")
if f then
if trace_locating then
- report_resolvers("file opener, '%s' opened",filename)
+ report_files("file opener, '%s' opened",filename)
end
return openers.helpers.textopener("file",filename,f)
end
end
if trace_locating then
- report_resolvers("file opener, '%s' not found",filename)
+ report_files("file opener, '%s' not found",filename)
end
return openers.notfound()
end
@@ -12304,7 +12361,7 @@ function loaders.file(specification,filetype)
if f then
logs.show_load(filename)
if trace_locating then
- report_resolvers("file loader, '%s' loaded",filename)
+ report_files("file loader, '%s' loaded",filename)
end
local s = f:read("*a")
if checkgarbage then
@@ -12317,7 +12374,7 @@ function loaders.file(specification,filetype)
end
end
if trace_locating then
- report_resolvers("file loader, '%s' not found",filename)
+ report_files("file loader, '%s' not found",filename)
end
return loaders.notfound()
end
@@ -12358,11 +12415,11 @@ containers = containers or { }
local containers = containers
containers.usecache = true
-local report_cache = logs.new("cache")
+local report_containers = logs.new("resolvers","containers")
local function report(container,tag,name)
if trace_cache or trace_containers then
- report_cache("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
+ report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
end
end
@@ -12480,7 +12537,7 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_mounts = logs.new("resolvers","mounts")
local resolvers = resolvers
@@ -12505,7 +12562,7 @@ function resolvers.automount(usecache)
-- skip
elseif find(line,"^zip://") then
if trace_locating then
- report_resolvers("mounting %s",line)
+ report_mounts("mounting %s",line)
end
table.insert(resolvers.automounted,line)
resolvers.usezipfile(line)
@@ -12585,7 +12642,7 @@ local format, find, match = string.format, string.find, string.match
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_zip = logs.new("resolvers","zip")
-- zip:///oeps.zip?name=bla/bla.tex
-- zip:///oeps.zip?tree=tex/texmf-local
@@ -12638,9 +12695,9 @@ function resolvers.locators.zip(specification)
local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree
if trace_locating then
if zipfile then
- report_resolvers("zip locator, archive '%s' found",archive)
+ report_zip("locator, archive '%s' found",archive)
else
- report_resolvers("zip locator, archive '%s' not found",archive)
+ report_zip("locator, archive '%s' not found",archive)
end
end
end
@@ -12648,7 +12705,7 @@ end
function resolvers.hashers.zip(specification)
local archive = specification.filename
if trace_locating then
- report_resolvers("loading zip file '%s'",archive)
+ report_zip("loading file '%s'",archive)
end
resolvers.usezipfile(specification.original)
end
@@ -12671,25 +12728,25 @@ function resolvers.finders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip finder, archive '%s' found",archive)
+ report_zip("finder, archive '%s' found",archive)
end
local dfile = zfile:open(queryname)
if dfile then
dfile = zfile:close()
if trace_locating then
- report_resolvers("zip finder, file '%s' found",queryname)
+ report_zip("finder, file '%s' found",queryname)
end
return specification.original
elseif trace_locating then
- report_resolvers("zip finder, file '%s' not found",queryname)
+ report_zip("finder, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip finder, unknown archive '%s'",archive)
+ report_zip("finder, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip finder, '%s' not found",original)
+ report_zip("finder, '%s' not found",original)
end
return resolvers.finders.notfound()
end
@@ -12704,24 +12761,24 @@ function resolvers.openers.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip opener, archive '%s' opened",archive)
+ report_zip("opener, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
if trace_locating then
- report_resolvers("zip opener, file '%s' found",queryname)
+ report_zip("opener, file '%s' found",queryname)
end
return resolvers.openers.helpers.textopener('zip',original,dfile)
elseif trace_locating then
- report_resolvers("zip opener, file '%s' not found",queryname)
+ report_zip("opener, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip opener, unknown archive '%s'",archive)
+ report_zip("opener, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip opener, '%s' not found",original)
+ report_zip("opener, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12736,27 +12793,27 @@ function resolvers.loaders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip loader, archive '%s' opened",archive)
+ report_zip("loader, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
logs.show_load(original)
if trace_locating then
- report_resolvers("zip loader, file '%s' loaded",original)
+ report_zip("loader, file '%s' loaded",original)
end
local s = dfile:read("*all")
dfile:close()
return true, s, #s
elseif trace_locating then
- report_resolvers("zip loader, file '%s' not found",queryname)
+ report_zip("loader, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip loader, unknown archive '%s'",archive)
+ report_zip("loader, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip loader, '%s' not found",original)
+ report_zip("loader, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12772,7 +12829,7 @@ function resolvers.usezipfile(archive)
if z then
local tree = url.query(specification.query).tree or ""
if trace_locating then
- report_resolvers("zip registering, registering archive '%s'",archive)
+ report_zip("registering, registering archive '%s'",archive)
end
statistics.starttiming(resolvers.instance)
resolvers.prependhash('zip',archive)
@@ -12781,10 +12838,10 @@ function resolvers.usezipfile(archive)
instance.files[archive] = resolvers.registerzipfile(z,tree)
statistics.stoptiming(resolvers.instance)
elseif trace_locating then
- report_resolvers("zip registering, unknown archive '%s'",archive)
+ report_zip("registering, unknown archive '%s'",archive)
end
elseif trace_locating then
- report_resolvers("zip registering, '%s' not found",archive)
+ report_zip("registering, '%s' not found",archive)
end
end
@@ -12796,7 +12853,7 @@ function resolvers.registerzipfile(z,tree)
filter = format("^%s/(.+)/(.-)$",tree)
end
if trace_locating then
- report_resolvers("zip registering, using filter '%s'",filter)
+ report_zip("registering, using filter '%s'",filter)
end
local register, n = resolvers.registerfile, 0
for i in z:files() do
@@ -12813,7 +12870,7 @@ function resolvers.registerzipfile(z,tree)
n = n + 1
end
end
- report_resolvers("zip registering, %s files registered",n)
+ report_zip("registering, %s files registered",n)
return files
end
@@ -12836,7 +12893,7 @@ local find, gsub, format = string.find, string.gsub, string.format
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_trees = logs.new("resolvers","trees")
local resolvers = resolvers
@@ -12874,18 +12931,18 @@ function resolvers.locators.tree(specification)
local name = specification.filename
if name ~= '' and lfs.isdir(name) then
if trace_locating then
- report_resolvers("tree locator '%s' found",name)
+ report_trees("locator '%s' found",name)
end
resolvers.appendhash('tree',name,false) -- don't cache
elseif trace_locating then
- report_resolvers("tree locator '%s' not found",name)
+ report_trees("locator '%s' not found",name)
end
end
function resolvers.hashers.tree(specification)
local name = specification.filename
if trace_locating then
- report_resolvers("analysing tree '%s'",name)
+ report_trees("analysing '%s'",name)
end
resolvers.methodhandler("hashers",name)
end
@@ -12981,7 +13038,7 @@ if not modules then modules = { } end modules ['data-lua'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_libraries = logs.new("resolvers","libraries")
local gsub, insert = string.gsub, table.insert
local unpack = unpack or table.unpack
@@ -13013,7 +13070,7 @@ local function thepath(...)
local t = { ... } t[#t+1] = "?.lua"
local path = file.join(unpack(t))
if trace_locating then
- report_resolvers("! appending '%s' to 'package.path'",path)
+ report_libraries("! appending '%s' to 'package.path'",path)
end
return path
end
@@ -13035,11 +13092,11 @@ local function loaded(libpaths,name,simple)
local libpath = libpaths[i]
local resolved = gsub(libpath,"%?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
+ report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.path': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13048,17 +13105,17 @@ end
package.loaders[2] = function(name) -- was [#package.loaders+1]
if trace_locating then -- mode detail
- report_resolvers("! locating '%s'",name)
+ report_libraries("! locating '%s'",name)
end
for i=1,#libformats do
local format = libformats[i]
local resolved = resolvers.findfile(name,format) or ""
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'libformat path': '%s'",name,format)
+ report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format)
end
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13081,11 +13138,11 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local path = paths[p]
local resolved = file.join(path,libname)
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'clibformat path': '%s'",libname,path)
+ report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
+ report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
end
return package.loadlib(resolved,name)
end
@@ -13095,28 +13152,28 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local libpath = clibpaths[i]
local resolved = gsub(libpath,"?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
+ report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
end
return package.loadlib(resolved,name)
end
end
-- just in case the distribution is messed up
if trace_loading then -- more detail
- report_resolvers("! checking for '%s' using 'luatexlibs': '%s'",name)
+ report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name)
end
local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or ""
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located by basename via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
if trace_locating then
- report_resolvers('? unable to locate lib: %s',name)
+ report_libraries('? unable to locate lib: %s',name)
end
-- return "unable to locate " .. name
end
@@ -13153,48 +13210,48 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local resolvers = resolvers
-local report_resolvers = logs.new("resolvers")
+local report_scripts = logs.new("resolvers","scripts")
function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix
local scriptpath = "scripts/context/lua"
newname = file.addsuffix(newname,"lua")
local oldscript = resolvers.cleanpath(oldname)
if trace_locating then
- report_resolvers("to be replaced old script %s", oldscript)
+ report_scripts("to be replaced old script %s", oldscript)
end
local newscripts = resolvers.findfiles(newname) or { }
if #newscripts == 0 then
if trace_locating then
- report_resolvers("unable to locate new script")
+ report_scripts("unable to locate new script")
end
else
for i=1,#newscripts do
local newscript = resolvers.cleanpath(newscripts[i])
if trace_locating then
- report_resolvers("checking new script %s", newscript)
+ report_scripts("checking new script %s", newscript)
end
if oldscript == newscript then
if trace_locating then
- report_resolvers("old and new script are the same")
+ report_scripts("old and new script are the same")
end
elseif not find(newscript,scriptpath) then
if trace_locating then
- report_resolvers("new script should come from %s",scriptpath)
+ report_scripts("new script should come from %s",scriptpath)
end
elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then
if trace_locating then
- report_resolvers("invalid new script name")
+ report_scripts("invalid new script name")
end
else
local newdata = io.loaddata(newscript)
if newdata then
if trace_locating then
- report_resolvers("old script content replaced by new content")
+ report_scripts("old script content replaced by new content")
end
io.savedata(oldscript,newdata)
break
elseif trace_locating then
- report_resolvers("unable to load new script")
+ report_scripts("unable to load new script")
end
end
end
@@ -13216,6 +13273,8 @@ if not modules then modules = { } end modules ['data-tmf'] = {
local resolvers = resolvers
+local report_tds = logs.new("resolvers","tds")
+
-- = <<
-- ? ??
-- < +=
@@ -13236,11 +13295,11 @@ function resolvers.load_tree(tree,resolve)
local newpath = file.join(newtree,"bin")
if not lfs.isdir(newtree) then
- logs.simple("no '%s' under tree %s",texos,tree)
+ report_tds("no '%s' under tree %s",texos,tree)
os.exit()
end
if not lfs.isdir(newpath) then
- logs.simple("no '%s/bin' under tree %s",texos,tree)
+ report_tds("no '%s/bin' under tree %s",texos,tree)
os.exit()
end
@@ -13264,9 +13323,9 @@ function resolvers.load_tree(tree,resolve)
setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
- logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
- logs.simple("prepending '%s' to binary path",newpath)
- logs.simple()
+ report_tds("changing from root '%s' to '%s'",oldroot,newroot)
+ report_tds("prepending '%s' to binary path",newpath)
+ report_tds()
end
end
@@ -13291,6 +13350,8 @@ resolvers.listers = resolvers.listers or { }
local resolvers = resolvers
+local report_lists = logs.new("resolvers","lists")
+
local function tabstr(str)
if type(str) == 'table' then
return concat(str," | ")
@@ -13319,11 +13380,11 @@ function resolvers.listers.variables(pattern)
local exp = table.fastcopy(expansions)
for key, value in table.sortedpairs(configured) do
if key ~= "" and (pattern == "" or find(upper(key),pattern)) then
- logs.simple(key)
- logs.simple(" env: %s",tabstr(rawget(environment,key)) or "unset")
- logs.simple(" var: %s",tabstr(configured[key]) or "unset")
- logs.simple(" exp: %s",tabstr(expansions[key]) or "unset")
- logs.simple(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(key)
+ report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
+ report_lists(" var: %s",tabstr(configured[key]) or "unset")
+ report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
+ report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
end
end
instance.environment = table.fastcopy(env)
@@ -13477,6 +13538,8 @@ if not modules then modules = { } end modules ['luat-fmt'] = {
local format = string.format
+local report_format = logs.new("resolvers","formats")
+
-- helper for mtxrun
local quoted = string.quoted
@@ -13501,7 +13564,7 @@ function environment.make_format(name)
if path ~= "" then
lfs.chdir(path)
end
- logs.simple("format path: %s",lfs.currentdir())
+ report_format("format path: %s",lfs.currentdir())
-- check source file
local texsourcename = file.addsuffix(name,"mkiv")
local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
@@ -13510,11 +13573,11 @@ function environment.make_format(name)
fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename == "" then
- logs.simple("no tex source file with name: %s (mkiv or tex)",name)
+ report_format("no tex source file with name: %s (mkiv or tex)",name)
lfs.chdir(olddir)
return
else
- logs.simple("using tex source file: %s",fulltexsourcename)
+ report_format("using tex source file: %s",fulltexsourcename)
end
local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed
-- check specification
@@ -13525,7 +13588,7 @@ function environment.make_format(name)
fullspecificationname = resolvers.findfile(specificationname,"tex") or ""
end
if fullspecificationname == "" then
- logs.simple("unknown stub specification: %s",specificationname)
+ report_format("unknown stub specification: %s",specificationname)
lfs.chdir(olddir)
return
end
@@ -13536,39 +13599,39 @@ function environment.make_format(name)
if type(usedlualibs) == "string" then
usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs)
elseif type(usedlualibs) == "table" then
- logs.simple("using stub specification: %s",fullspecificationname)
+ report_format("using stub specification: %s",fullspecificationname)
local texbasename = file.basename(name)
local luastubname = file.addsuffix(texbasename,"lua")
local lucstubname = file.addsuffix(texbasename,"luc")
-- pack libraries in stub
- logs.simple("creating initialization file: %s",luastubname)
+ report_format("creating initialization file: %s",luastubname)
utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
-- compile stub file (does not save that much as we don't use this stub at startup any more)
local strip = resolvers.booleanvariable("LUACSTRIP", true)
if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- logs.simple("using compiled initialization file: %s",lucstubname)
+ report_format("using compiled initialization file: %s",lucstubname)
usedluastub = lucstubname
else
- logs.simple("using uncompiled initialization file: %s",luastubname)
+ report_format("using uncompiled initialization file: %s",luastubname)
usedluastub = luastubname
end
else
- logs.simple("invalid stub specification: %s",fullspecificationname)
+ report_format("invalid stub specification: %s",fullspecificationname)
lfs.chdir(olddir)
return
end
-- generate format
local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\")
- logs.simple("running command: %s\n",command)
+ report_format("running command: %s\n",command)
os.spawn(command)
-- remove related mem files
local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem"
- -- logs.simple("removing related mplib format with pattern '%s'", pattern)
+ -- report_format("removing related mplib format with pattern '%s'", pattern)
local mp = dir.glob(pattern)
if mp then
for i=1,#mp do
local name = mp[i]
- logs.simple("removing related mplib format %s", file.basename(name))
+ report_format("removing related mplib format %s", file.basename(name))
os.remove(name)
end
end
@@ -13585,7 +13648,7 @@ function environment.run_format(name,data,more)
end
fmtname = resolvers.cleanpath(fmtname)
if fmtname == "" then
- logs.simple("no format with name: %s",name)
+ report_format("no format with name: %s",name)
else
local barename = file.removesuffix(name) -- expanded name
local luaname = file.addsuffix(barename,"luc")
@@ -13593,11 +13656,11 @@ function environment.run_format(name,data,more)
luaname = file.addsuffix(barename,"lua")
end
if not lfs.isfile(luaname) then
- logs.simple("using format name: %s",fmtname)
- logs.simple("no luc/lua with name: %s",barename)
+ report_format("using format name: %s",fmtname)
+ report_format("no luc/lua with name: %s",barename)
else
local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "")
- logs.simple("running command: %s",command)
+ report_format("running command: %s",command)
os.spawn(command)
end
end
@@ -13750,8 +13813,6 @@ if not resolvers then
os.exit()
end
-logs.setprogram('MTXrun',"TDS Runner Tool 1.30")
-
if environment.arguments["verbose"] then
trackers.enable("resolvers.locating")
end
@@ -13764,10 +13825,7 @@ if trackspec then
trackers.enable(trackspec)
end
-runners = runners or { } -- global
-messages = messages or { }
-
-messages.help = [[
+local helpinfo = [[
--script run an mtx script (lua prefered method) (--noquotes), no script gives list
--execute run a script or program (texmfstart method) (--noquotes)
--resolve resolve prefixed arguments
@@ -13819,6 +13877,19 @@ messages.help = [[
--pattern=str filter variables
]]
+local application = logs.application {
+ name = "mtxrun",
+ banner = "ConTeXt TDS Runner Tool 1.30",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
+local verbose = environment.argument("verbose")
+
+messages = messages or { } -- for the mo
+
+runners = runners or { } -- global
runners.applications = {
["lua"] = "luatex --luaonly",
@@ -13872,17 +13943,16 @@ end
function runners.prepare()
local checkname = environment.argument("ifchanged")
- local verbose = environment.argument("verbose")
if type(checkname) == "string" and checkname ~= "" then
local oldchecksum = file.loadchecksum(checkname)
local newchecksum = file.checksum(checkname)
if oldchecksum == newchecksum then
if verbose then
- logs.simple("file '%s' is unchanged",checkname)
+ report("file '%s' is unchanged",checkname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is changed, processing started",checkname)
+ report("file '%s' is changed, processing started",checkname)
end
file.savechecksum(checkname)
end
@@ -13892,17 +13962,17 @@ function runners.prepare()
if oldname and newname and oldname ~= "" and newname ~= "" then
if not file.needs_updating(oldname,newname) then
if verbose then
- logs.simple("file '%s' and '%s' have same age",oldname,newname)
+ report("file '%s' and '%s' have same age",oldname,newname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is older than '%s'",oldname,newname)
+ report("file '%s' is older than '%s'",oldname,newname)
end
end
end
local runpath = environment.argument("path")
if type(runpath) == "string" and not lfs.chdir(runpath) then
- logs.simple("unable to change to path '%s'",runpath)
+ report("unable to change to path '%s'",runpath)
return "error"
end
runners.prepare = function() end
@@ -13961,11 +14031,11 @@ function runners.execute_script(fullname,internal,nosplit)
result = binary .. " " .. result
end
local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote)
- if logs.verbose then
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ if verbose then
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
end
-- no os.exec because otherwise we get the wrong return value
@@ -13980,9 +14050,9 @@ function runners.execute_script(fullname,internal,nosplit)
return false
end
end
- logs.simpleline()
- logs.simple("This script needs '%s' which seems not to be installed.",binary)
- logs.simpleline()
+ report()
+ report("This script needs '%s' which seems not to be installed.",binary)
+ report()
end
return false
end
@@ -14007,10 +14077,10 @@ function runners.execute_program(fullname)
environment.initializearguments(after)
fullname = fullname:gsub("^bin:","")
local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "")
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn
return code == 0
@@ -14042,18 +14112,18 @@ function runners.handle_stubs(create)
if create then
if windows then
io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name))
- logs.simple("windows stub for '%s' created",base)
+ report("windows stub for '%s' created",base)
end
if unix then
io.savedata(file.join(stubpath,base),string.format(unix_stub,name))
- logs.simple("unix stub for '%s' created",base)
+ report("unix stub for '%s' created",base)
end
else
if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then
- logs.simple("windows stub for '%s' removed", base)
+ report("windows stub for '%s' removed", base)
end
if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then
- logs.simple("unix stub for '%s' removed",base)
+ report("unix stub for '%s' removed",base)
end
end
end
@@ -14078,12 +14148,12 @@ function runners.locate_platform()
end
function runners.report_location(result)
- if logs.verbose then
- logs.simpleline()
+ if verbose then
+ reportline()
if result and result ~= "" then
- logs.simple(result)
+ report(result)
else
- logs.simple("not found")
+ report("not found")
end
else
io.write(result)
@@ -14095,11 +14165,11 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
local rest = resolvers.resolve(filename)
if rest ~= "" then
local command = editor .. " " .. rest
- if logs.verbose then
- logs.simpleline()
- logs.simple("starting editor: %s",command)
- logs.simple_line()
- logs.simple_line()
+ if verbose then
+ report()
+ report("starting editor: %s",command)
+ report()
+ report()
end
os.launch(command)
end
@@ -14148,7 +14218,7 @@ function runners.launch_file(filename)
pattern = filename
end
if not pattern or pattern == "" then
- logs.simple("provide name or --pattern=")
+ report("provide name or --pattern=")
else
local t = resolvers.findfiles(pattern)
if not t or #t == 0 then
@@ -14160,15 +14230,15 @@ function runners.launch_file(filename)
if t and #t > 0 then
if environment.arguments["all"] then
for _, v in pairs(t) do
- logs.simple("launching %s", v)
+ report("launching %s", v)
resolvers.launch(v)
end
else
- logs.simple("launching %s", t[1])
+ report("launching %s", t[1])
resolvers.launch(t[1])
end
else
- logs.simple("no match for %s", pattern)
+ report("no match for %s", pattern)
end
end
end
@@ -14239,7 +14309,7 @@ function runners.execute_ctx_script(filename,...)
local fullname = runners.find_mtx_script(filename) or ""
if file.extname(fullname) == "cld" then
-- handy in editors where we force --autopdf
- logs.simple("running cld script: %s",filename)
+ report("running cld script: %s",filename)
table.insert(arguments,1,fullname)
table.insert(arguments,"--autopdf")
fullname = runners.find_mtx_script("context") or ""
@@ -14270,8 +14340,8 @@ function runners.execute_ctx_script(filename,...)
runners.load_script_session(loadname)
end
filename = environment.files[1]
- if logs.verbose then
- logs.simple("using script: %s\n",fullname)
+ if verbose then
+ report("using script: %s\n",fullname)
end
environment.ownscript = fullname
dofile(fullname)
@@ -14306,24 +14376,23 @@ function runners.execute_ctx_script(filename,...)
end
end
if #valid > 0 then
- logs.reportbanner()
- logs.reportline()
- logs.simple("no script name given, known scripts:")
- logs.simple()
+ application.identify()
+ report("no script name given, known scripts:")
+ report()
for k=1,#valid do
local v = valid[k]
- logs.simple("%-12s %4s %s",v[1],v[2],v[3])
+ report("%-12s %4s %s",v[1],v[2],v[3])
end
end
else
- logs.simple("no script name given")
+ report("no script name given")
end
else
filename = file.addsuffix(filename,"lua")
if file.is_qualified_path(filename) then
- logs.simple("unknown script '%s'",filename)
+ report("unknown script '%s'",filename)
else
- logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename)
+ report("unknown script '%s' or 'mtx-%s'",filename,filename)
end
end
return false
@@ -14331,9 +14400,9 @@ function runners.execute_ctx_script(filename,...)
end
function runners.prefixes()
- logs.reportbanner()
- logs.reportline()
- logs.simple(table.concat(resolvers.allprefixes(true)," "))
+ application.identify()
+ report()
+ report(table.concat(resolvers.allprefixes(true)," "))
end
function runners.timedrun(filename) -- just for me
@@ -14385,7 +14454,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk
local t = os.clock()
local k = kpse.original.new("luatex",progname)
local dummy = k:find_file("mtxrun.lua") -- so that we're initialized
- logs.simple("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
+ report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
kpse_initialized = function() return k end
return k
end
@@ -14432,11 +14501,11 @@ else
function runners.loadbase(...)
if not resolvers.load(...) then
- logs.simple("forcing cache reload")
+ report("forcing cache reload")
instance.renewcache = true
trackers.enable("resolvers.locating")
if not resolvers.load(...) then
- logs.simple("the resolver databases are not present or outdated")
+ report("the resolver databases are not present or outdated")
end
end
end
@@ -14595,8 +14664,8 @@ elseif environment.argument("find-path") then
resolvers.load()
local path = resolvers.findpath(filename, instance.my_format)
- if logs.verbose then
- logs.simple(path)
+ if verbose then
+ report(path)
else
print(path)
end
@@ -14651,7 +14720,7 @@ elseif environment.argument("format-path") then
-- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename)
resolvers.load()
- logs.simple(caches.getwritablepath("format"))
+ report(caches.getwritablepath("format"))
elseif environment.argument("pattern") then
@@ -14695,7 +14764,7 @@ elseif environment.argument("help") and filename=='base' then
elseif environment.argument("help") or filename=='help' or filename == "" then
- logs.help(messages.help)
+ application.help()
elseif filename:find("^bin:") then
@@ -14729,9 +14798,9 @@ else
end
-if logs.verbose then
- logs.simpleline()
- logs.simple("runtime: %0.3f seconds",os.runtime())
+if verbose then
+ report()
+ report("runtime: %0.3f seconds",os.runtime())
end
if os.type ~= "windows" then
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 31d7d9b0f..afc472d1c 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = {
license = "see context related readme files"
}
-
-- one can make a stub:
--
-- #!/bin/sh
@@ -132,11 +131,7 @@ local simple_escapes = {
}
function string.escapedpattern(str,simple)
- if simple then
- return (gsub(str,".",simple_escapes))
- else
- return (gsub(str,".",patterns_escapes))
- end
+ return (gsub(str,".",simple and simple_escapes or patterns_escapes))
end
function string.topattern(str,lowercase,strict)
@@ -556,11 +551,7 @@ local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0)
local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0)
function string.escapedpattern(str,simple)
- if simple then
- return match(s,str)
- else
- return match(p,str)
- end
+ return match(simple and s or p,str)
end
-- utf extensies
@@ -3826,7 +3817,7 @@ local type, next = type, next
utilities = utilities or {}
utilities.merger = utilities.merger or { } -- maybe mergers
-utilities.report = utilities.report or print
+utilities.report = logs and logs.new("system") or print
local merger = utilities.merger
@@ -3964,7 +3955,7 @@ if not modules then modules = { } end modules ['util-lua'] = {
utilities = utilities or {}
utilities.lua = utilities.lua or { }
-utilities.report = utilities.report or print
+utilities.report = logs and logs.new("system") or print
function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true
utilities.report("lua: compiling %s into %s",luafile,lucfile)
@@ -4577,19 +4568,21 @@ function statistics.show(reporter)
end
end
-
-local template, nn = nil, 0 -- we only calcute it once
+local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once
function statistics.showjobstat(tag,data,n)
- if type(data) == "table" then
+ if not logs then
+ -- sorry
+ elseif type(data) == "table" then
for i=1,#data do
statistics.showjobstat(tag,data[i],n)
end
else
if not template or n > nn then
- template, n = format("%%-%ss: %%-%ss - %%s",15,n), nn
+ template, n = format("%%-%ss - %%s",n), nn
+ report_statistics = logs.new("mkiv lua stats")
end
- write_nl(format(template,"mkiv lua stats",tag,data))
+ report_statistics(format(template,tag,data))
end
end
@@ -4610,7 +4603,7 @@ function statistics.runtime()
end
function statistics.timed(action,report)
- report = report or logs.simple
+ report = report or logs.new("system")
starttiming("run")
action()
stoptiming("run")
@@ -4664,14 +4657,10 @@ local data = { } -- maybe just local
local trace_initialize = false -- only for testing during development
-local function report(a,b,...)
- texio.write_nl(format("%-16s> %s",a,format(b,...)))
-end
-
function setters.initialize(filename,name,values) -- filename only for diagnostics
- local data = data[name]
- if data then
- data = data.data
+ local setter = data[name]
+ if setter then
+ local data = data.data
if data then
for key, value in next, values do
-- key = gsub(key,"_",".")
@@ -4680,7 +4669,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
if functions then
if #functions > 0 and not functions.value then
if trace_initialize then
- report(name,"executing %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("executing %s (%s -> %s)",key,filename,tostring(value))
end
for i=1,#functions do
functions[i](value)
@@ -4688,7 +4677,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
functions.value = value
else
if trace_initialize then
- report(name,"skipping %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("skipping %s (%s -> %s)",key,filename,tostring(value))
end
end
else
@@ -4697,7 +4686,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
functions = { default = value }
data[key] = functions
if trace_initialize then
- report(name,"storing %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("storing %s (%s -> %s)",key,filename,tostring(value))
end
end
end
@@ -4724,10 +4713,11 @@ local function set(t,what,newvalue)
else
value = is_boolean(value,value)
end
+ w = escapedpattern(w,true)
for name, functions in next, data do
if done[name] then
-- prevent recursion due to wildcards
- elseif find(name,escapedpattern(w,true)) then
+ elseif find(name,w) then
done[name] = true
for i=1,#functions do
functions[i](value)
@@ -4769,7 +4759,7 @@ function setters.register(t,what,...)
functions = { }
data[what] = functions
if trace_initialize then
- report(t.name,"defining %s",what)
+ t.report("defining %s",what)
end
end
local default = functions.default -- can be set from cnf file
@@ -4777,7 +4767,7 @@ function setters.register(t,what,...)
local typ = type(fnc)
if typ == "string" then
if trace_initialize then
- report(t.name,"coupling %s to %s",what,fnc)
+ t.report("coupling %s to %s",what,fnc)
end
local s = fnc -- else wrong reference
fnc = function(value) set(t,s,value) end
@@ -4831,9 +4821,9 @@ function setters.list(t) -- pattern
end
function setters.show(t)
- commands.writestatus("","")
- local list = setters.list(t)
local category = t.name
+ local list = setters.list(t)
+ t.report()
for k=1,#list do
local name = list[k]
local functions = t.data[name]
@@ -4841,10 +4831,10 @@ function setters.show(t)
local value, default, modules = functions.value, functions.default, #functions
value = value == nil and "unset" or tostring(value)
default = default == nil and "unset" or tostring(default)
- commands.writestatus(category,format("%-30s modules: %2i default: %5s value: %5s",name,modules,default,value))
+ t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value)
end
end
- commands.writestatus("","")
+ t.report()
end
-- we could have used a bit of oo and the trackers:enable syntax but
@@ -4854,57 +4844,62 @@ end
local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show
+local function report(setter,...)
+ local report = logs and logs.report
+ if report then
+ report(setter.name,...)
+ else -- fallback, as this module is loaded before the logger
+ write_nl(format("%-16s: %s\n",setter.name,format(...)))
+ end
+end
+
function setters.new(name)
- local t -- we need to access it in t
- t = {
+ local setter -- we need to access it in setter itself
+ setter = {
data = allocate(), -- indexed, but also default and value fields
name = name,
- enable = function(...) enable (t,...) end,
- disable = function(...) disable (t,...) end,
- register = function(...) register(t,...) end,
- list = function(...) list (t,...) end,
- show = function(...) show (t,...) end,
+ report = function(...) report (setter,...) end,
+ enable = function(...) enable (setter,...) end,
+ disable = function(...) disable (setter,...) end,
+ register = function(...) register(setter,...) end,
+ list = function(...) list (setter,...) end,
+ show = function(...) show (setter,...) end,
}
- data[name] = t
- return t
+ data[name] = setter
+ return setter
end
trackers = setters.new("trackers")
directives = setters.new("directives")
experiments = setters.new("experiments")
-local t_enable, t_disable = trackers .enable, trackers .disable
-local d_enable, d_disable = directives .enable, directives .disable
-local e_enable, e_disable = experiments.enable, experiments.disable
+local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report
+local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report
+local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report
-- nice trick: we overload two of the directives related functions with variants that
-- do tracing (itself using a tracker) .. proof of concept
-local function report(...) -- messy .. chicken or egg
- local p = (commands and commands.writestatus) or (logs and logs.report)
- if p then p(...) end
-end
-
local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end)
local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end)
function directives.enable(...)
- report("directives","enabling: %s",concat({...}," "))
+ d_report("enabling: %s",concat({...}," "))
d_enable(...)
end
function directives.disable(...)
- report("directives","disabling: %s",concat({...}," "))
+ d_report("disabling: %s",concat({...}," "))
d_disable(...)
end
function experiments.enable(...)
- report("experiments","enabling: %s",concat({...}," "))
+ e_report("enabling: %s",concat({...}," "))
e_enable(...)
end
function experiments.disable(...)
- report("experiments","disabling: %s",concat({...}," "))
+ e_report("disabling: %s",concat({...}," "))
e_disable(...)
end
@@ -4967,20 +4962,19 @@ if not modules then modules = { } end modules ['trac-log'] = {
license = "see context related readme files"
}
--- xml logging is only usefull in normal runs, not in ini mode
--- it looks like some tex logging (like filenames) is broken (no longer
--- interceoted at the tex end so the xml variant is not that useable now)
+-- todo: less categories, more subcategories (e.g. nodes)
local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write
-local format, gmatch = string.format, string.gmatch
+local format, gmatch, find = string.format, string.gmatch, string.find
+local concat = table.concat
+local escapedpattern = string.escapedpattern
local texcount = tex and tex.count
+local next, type = next, type
--[[ldx--
- This is a prelude to a more extensive logging module. For the sake
-of parsing log files, in addition to the standard logging we will
-provide an This is a prelude to a more extensive logging module. We no longer
+provide The parser used here is inspired by the variant discussed in the lua book, but
@@ -6518,7 +6575,7 @@ function xml.is_valid(root)
return root and not root.error
end
-xml.errorhandler = (logs and logs.report) or (input and logs.report) or print
+xml.errorhandler = report
--[[ldx--
We cannot load an We've now arrived at an interesting part: accessing the tree using a subset
@@ -7951,9 +8008,9 @@ local function traced_apply(list,parsed,nofparsed,order)
if trace_lparse then
lshow(parsed)
end
- report_lpath("collecting : %s",parsed.pattern)
- report_lpath(" root tags : %s",tagstostring(list))
- report_lpath(" order : %s",order or "unset")
+ report_lpath("collecting: %s",parsed.pattern)
+ report_lpath("root tags : %s",tagstostring(list))
+ report_lpath("order : %s",order or "unset")
local collected = list
for i=1,nofparsed do
local pi = parsed[i]
@@ -9224,7 +9281,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_initialization = logs.new("resolvers","initialization")
local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv
@@ -9245,7 +9302,7 @@ kpse = { original = kpse }
setmetatable(kpse, {
__index = function(kp,name)
- report_resolvers("fatal error: kpse library is accessed (key: %s)",name)
+ report_initialization("fatal error: kpse library is accessed (key: %s)",name)
os.exit()
end
} )
@@ -9329,13 +9386,13 @@ do
if lfs.chdir(p) then
local pp = lfs.currentdir()
if trace_locating and p ~= pp then
- report_resolvers("following symlink '%s' to '%s'",p,pp)
+ report_initialization("following symlink '%s' to '%s'",p,pp)
end
ownpath = pp
lfs.chdir(olddir)
else
if trace_locating then
- report_resolvers("unable to check path '%s'",p)
+ report_initialization("unable to check path '%s'",p)
end
ownpath = p
end
@@ -9346,9 +9403,9 @@ do
end
if not ownpath or ownpath == "" then
ownpath = "."
- report_resolvers("forcing fallback ownpath .")
+ report_initialization("forcing fallback ownpath .")
elseif trace_locating then
- report_resolvers("using ownpath '%s'",ownpath)
+ report_initialization("using ownpath '%s'",ownpath)
end
end
@@ -9375,7 +9432,7 @@ do
ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/.."))
ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../.."))
else
- report_resolvers("error: unable to locate ownpath")
+ report_initialization("error: unable to locate ownpath")
os.exit()
end
@@ -9461,7 +9518,7 @@ local collapsepath = file.collapsepath
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_expansions = logs.new("resolvers","expansions")
local resolvers = resolvers
@@ -9524,7 +9581,7 @@ local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
- report_resolvers("expanding variable '%s'",str)
+ report_expansions("expanding variable '%s'",str)
end
local t, ok, done = newlist or { }, false, false
local n = #t
@@ -9550,7 +9607,7 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi
end
if trace_expansions then
for k=1,#t do
- report_resolvers("% 4i: %s",k,t[k])
+ report_expansions("% 4i: %s",k,t[k])
end
end
return t
@@ -9585,7 +9642,7 @@ function resolvers.cleanpath(str)
homedir = lpegmatch(cleanup,environment.homedir or "")
if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then
if trace_expansions then
- report_resolvers("no home dir set, ignoring dependent paths")
+ report_expansions("no home dir set, ignoring dependent paths")
end
function resolvers.cleanpath(str)
if find(str,"~") then
@@ -9655,9 +9712,9 @@ local function splitconfigurationpath(str) -- beware, this can be either a path
end
end
if trace_expansions then
- report_resolvers("splitting path specification '%s'",str)
+ report_expansions("splitting path specification '%s'",str)
for k=1,noffound do
- report_resolvers("% 4i: %s",k,found[k])
+ report_expansions("% 4i: %s",k,found[k])
end
end
cache[str] = found
@@ -9742,7 +9799,7 @@ end
function resolvers.scanfiles(path,branch)
if trace_locating then
- report_resolvers("scanning path '%s', branch '%s'",path, branch or path)
+ report_expansions("scanning path '%s', branch '%s'",path, branch or path)
end
local realpath = resolvers.resolve(path) -- no shortcut
local files, n, m, r = scan({ },realpath .. '/',"",0,0,0)
@@ -9751,7 +9808,7 @@ function resolvers.scanfiles(path,branch)
files.__directories__ = m
files.__remappings__ = r
if trace_locating then
- report_resolvers("%s files found on %s directories with %s uppercase remappings",n,m,r)
+ report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r)
end
return files
end
@@ -10080,8 +10137,8 @@ local mkdirs, isdir = dir.mkdirs, lfs.isdir
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end)
-local report_cache = logs.new("cache")
-local report_resolvers = logs.new("resolvers")
+local report_caches = logs.new("resolvers","caches")
+local report_resolvers = logs.new("resolvers","caching")
local resolvers = resolvers
@@ -10141,7 +10198,7 @@ local function identify()
if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then
mkdirs(cachepath)
if isdir(cachepath) and file.is_writable(cachepath) then
- report_cache("created: %s",cachepath)
+ report_caches("created: %s",cachepath)
writable = cachepath
readables[#readables+1] = cachepath
end
@@ -10175,10 +10232,10 @@ local function identify()
-- Some extra checking. If we have no writable or readable path then we simply
-- quit.
if not writable then
- report_cache("fatal error: there is no valid writable cache path defined")
+ report_caches("fatal error: there is no valid writable cache path defined")
os.exit()
elseif #readables == 0 then
- report_cache("fatal error: there is no valid readable cache path defined")
+ report_caches("fatal error: there is no valid readable cache path defined")
os.exit()
end
-- why here
@@ -10200,9 +10257,9 @@ local function identify()
-- end
if trace_cache then
for i=1,#readables do
- report_cache("using readable path '%s' (order %s)",readables[i],i)
+ report_caches("using readable path '%s' (order %s)",readables[i],i)
end
- report_cache("using writable path '%s'",writable)
+ report_caches("using writable path '%s'",writable)
end
identify = function()
return writable, readables
@@ -10237,7 +10294,7 @@ function caches.hashed(tree)
tree = lower(tree)
local hash = md5.hex(tree)
if trace_cache or trace_locating then
- report_cache("hashing tree %s, hash %s",tree,hash)
+ report_caches("hashing tree %s, hash %s",tree,hash)
end
return hash
end
@@ -10463,7 +10520,7 @@ trackers.register("resolvers.locating", function(v) trace_methods = v end)
trackers.register("resolvers.methods", function(v) trace_methods = v end)
-local report_resolvers = logs.new("resolvers")
+local report_methods = logs.new("resolvers","methods")
local allocate = utilities.storage.allocate
@@ -10505,41 +10562,41 @@ local function methodhandler(what,first,...) -- filename can be nil or false
local resolver = namespace and namespace[scheme]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
+ report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
end
return resolver(specification,...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
end
return resolver(specification,...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, no handler",what,how)
+ report_methods("resolver: method=%s, how=%s, no handler",what,how)
end
end
elseif how == "tag" then
local resolver = namespace and namespace[first]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, tag=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first)
end
return resolver(...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default",what,how)
+ report_methods("resolver: method=%s, how=%s, default",what,how)
end
return resolver(...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, unknown",what,how)
+ report_methods("resolver: method=%s, how=%s, unknown",what,how)
end
end
end
else
- report_resolvers("resolver: method=%s, unknown",what)
+ report_methods("resolver: method=%s, unknown",what)
end
end
@@ -10610,7 +10667,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_resolving = logs.new("resolvers","resolving")
local resolvers = resolvers
@@ -10712,7 +10769,7 @@ end
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
if trace_locating then
- report_resolvers("creating instance")
+ report_resolving("creating instance")
end
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
@@ -10830,9 +10887,9 @@ local function reportcriticalvariables()
for i=1,#resolvers.criticalvars do
local k = resolvers.criticalvars[i]
local v = resolvers.getenv(k) or "unknown" -- this one will not resolve !
- report_resolvers("variable '%s' set to '%s'",k,v)
+ report_resolving("variable '%s' set to '%s'",k,v)
end
- report_resolvers()
+ report_resolving()
end
reportcriticalvariables = function() end
end
@@ -10856,17 +10913,17 @@ local function identify_configuration_files()
if lfs.isfile(realname) then
specification[#specification+1] = filename
if trace_locating then
- report_resolvers("found configuration file '%s'",realname)
+ report_resolving("found configuration file '%s'",realname)
end
elseif trace_locating then
- report_resolvers("unknown configuration file '%s'",realname)
+ report_resolving("unknown configuration file '%s'",realname)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("configuration files already identified")
+ report_resolving("configuration files already identified")
end
end
@@ -10886,8 +10943,8 @@ local function load_configuration_files()
data = data and data.content
if data then
if trace_locating then
- report_resolvers("loading configuration file '%s'",filename)
- report_resolvers()
+ report_resolving("loading configuration file '%s'",filename)
+ report_resolving()
end
local variables = data.variables or { }
local warning = false
@@ -10897,7 +10954,7 @@ local function load_configuration_files()
initializesetter(filename,k,v)
elseif variables[k] == nil then
if trace_locating and not warning then
- report_resolvers("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
+ report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
k,resolvers.resolve(filename))
warning = true
end
@@ -10910,7 +10967,7 @@ local function load_configuration_files()
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
if trace_locating then
- report_resolvers("reloading configuration due to TEXMF redefinition")
+ report_resolving("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
@@ -10929,13 +10986,13 @@ local function load_configuration_files()
else
if trace_locating then
- report_resolvers("skipping configuration file '%s' (no content)",filename)
+ report_resolving("skipping configuration file '%s' (no content)",filename)
end
setups[pathname] = { }
instance.loaderror = true
end
elseif trace_locating then
- report_resolvers("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no file)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -10943,7 +11000,7 @@ local function load_configuration_files()
end
end
elseif trace_locating then
- report_resolvers("warning: no lua configuration files found")
+ report_resolving("warning: no lua configuration files found")
end
end
@@ -10979,19 +11036,19 @@ local function locate_file_databases()
end
if trace_locating then
if runtime then
- report_resolvers("locating list of '%s' (runtime)",path)
+ report_resolving("locating list of '%s' (runtime)",path)
else
- report_resolvers("locating list of '%s' (cached)",path)
+ report_resolving("locating list of '%s' (cached)",path)
end
end
methodhandler('locators',stripped)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("no texmf paths are defined (using TEXMF)")
+ report_resolving("no texmf paths are defined (using TEXMF)")
end
end
@@ -11002,7 +11059,7 @@ local function generate_file_databases()
methodhandler('generators',hash.name)
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
end
@@ -11014,11 +11071,11 @@ local function save_file_databases() -- will become cachers
local content = instance.files[cachename]
caches.collapsecontent(content)
if trace_locating then
- report_resolvers("saving tree '%s'",cachename)
+ report_resolving("saving tree '%s'",cachename)
end
caches.savecontent(cachename,"files",content)
elseif trace_locating then
- report_resolvers("not saving runtime tree '%s'",cachename)
+ report_resolving("not saving runtime tree '%s'",cachename)
end
end
end
@@ -11043,7 +11100,7 @@ function resolvers.appendhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' appended",name)
end
insert(instance.hashes, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11054,7 +11111,7 @@ function resolvers.prependhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' prepended",name)
end
insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11287,9 +11344,9 @@ function isreadable(name)
local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir
if trace_detail then
if readable then
- report_resolvers("file '%s' is readable",name)
+ report_resolving("file '%s' is readable",name)
else
- report_resolvers("file '%s' is not readable", name)
+ report_resolving("file '%s' is not readable", name)
end
end
return readable
@@ -11303,7 +11360,7 @@ local function collect_files(names)
for k=1,#names do
local fname = names[k]
if trace_detail then
- report_resolvers("checking name '%s'",fname)
+ report_resolving("checking name '%s'",fname)
end
local bname = filebasename(fname)
local dname = filedirname(fname)
@@ -11319,7 +11376,7 @@ local function collect_files(names)
local files = blobpath and instance.files[blobpath]
if files then
if trace_detail then
- report_resolvers("deep checking '%s' (%s)",blobpath,bname)
+ report_resolving("deep checking '%s' (%s)",blobpath,bname)
end
local blobfile = files[bname]
if not blobfile then
@@ -11339,7 +11396,7 @@ local function collect_files(names)
local search = filejoin(blobroot,blobfile,bname)
local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11353,7 +11410,7 @@ local function collect_files(names)
local search = filejoin(blobroot,vv,bname)
local result = methodhandler('concatinators',hash.type,blobroot,vv,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11362,7 +11419,7 @@ local function collect_files(names)
end
end
elseif trace_locating then
- report_resolvers("no match in '%s' (%s)",blobpath,bname)
+ report_resolving("no match in '%s' (%s)",blobpath,bname)
end
end
end
@@ -11403,7 +11460,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
stamp = filename .. "--" .. askedformat
if instance.found[stamp] then
if trace_locating then
- report_resolvers("remembered file '%s'",filename)
+ report_resolving("remembered file '%s'",filename)
end
resolvers.registerintrees(filename) -- for tracing used files
return instance.found[stamp]
@@ -11412,7 +11469,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not dangerous[askedformat] then
if isreadable(filename) then
if trace_detail then
- report_resolvers("file '%s' found directly",filename)
+ report_resolving("file '%s' found directly",filename)
end
if stamp then
instance.found[stamp] = { filename }
@@ -11422,13 +11479,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
if find(filename,'%*') then
if trace_locating then
- report_resolvers("checking wildcard '%s'", filename)
+ report_resolving("checking wildcard '%s'", filename)
end
result = resolvers.findwildcardfiles(filename) -- we can use th elocal
elseif file.is_qualified_path(filename) then
if isreadable(filename) then
if trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
result = { filename }
else
@@ -11441,7 +11498,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
forcedname = filename .. "." .. s
if isreadable(forcedname) then
if trace_locating then
- report_resolvers("no suffix, forcing format filetype '%s'", s)
+ report_resolving("no suffix, forcing format filetype '%s'", s)
end
result, ok = { forcedname }, true
break
@@ -11494,7 +11551,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- end
end
if not ok and trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
end
else
@@ -11513,13 +11570,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
wantedfiles[#wantedfiles+1] = forcedname
filetype = resolvers.formatofsuffix(forcedname)
if trace_locating then
- report_resolvers("forcing filetype '%s'",filetype)
+ report_resolving("forcing filetype '%s'",filetype)
end
end
else
filetype = resolvers.formatofsuffix(filename)
if trace_locating then
- report_resolvers("using suffix based filetype '%s'",filetype)
+ report_resolving("using suffix based filetype '%s'",filetype)
end
end
else
@@ -11533,7 +11590,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
filetype = askedformat
if trace_locating then
- report_resolvers("using given filetype '%s'",filetype)
+ report_resolving("using given filetype '%s'",filetype)
end
end
local typespec = resolvers.variableofformat(filetype)
@@ -11541,7 +11598,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not pathlist or #pathlist == 0 then
-- no pathlist, access check only / todo == wildcard
if trace_detail then
- report_resolvers("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
+ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
end
for k=1,#wantedfiles do
local fname = wantedfiles[k]
@@ -11569,7 +11626,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
end
if trace_detail then
- report_resolvers("checking filename '%s'",filename)
+ report_resolving("checking filename '%s'",filename)
end
for k=1,#pathlist do
local path = pathlist[k]
@@ -11581,7 +11638,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- 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)
+ report_resolving("using pattern '%s' for path '%s'",expression,pathname)
end
for k=1,#filelist do
local fl = filelist[k]
@@ -11593,16 +11650,16 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
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)
+ report_resolving("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)
+ report_resolving("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)
+ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
end
end
end
@@ -11619,7 +11676,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
local fname = filejoin(ppname,w)
if isreadable(fname) then
if trace_detail then
- report_resolvers("found '%s' by scanning",fname)
+ report_resolving("found '%s' by scanning",fname)
end
result[#result+1] = fname
done = true
@@ -11824,7 +11881,7 @@ end
local function report(str)
if trace_locating then
- report_resolvers(str) -- has already verbose
+ report_resolving(str) -- has already verbose
else
print(str)
end
@@ -12219,7 +12276,7 @@ if not modules then modules = { } end modules ['data-fil'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_files = logs.new("resolvers","files")
local resolvers = resolvers
@@ -12233,11 +12290,11 @@ function locators.file(specification)
local realname = resolvers.resolve(name) -- no shortcut
if realname and realname ~= '' and lfs.isdir(realname) then
if trace_locating then
- report_resolvers("file locator '%s' found as '%s'",name,realname)
+ report_files("file locator '%s' found as '%s'",name,realname)
end
resolvers.appendhash('file',name,true) -- cache
elseif trace_locating then
- report_resolvers("file locator '%s' not found",name)
+ report_files("file locator '%s' not found",name)
end
end
@@ -12260,12 +12317,12 @@ function finders.file(specification,filetype)
local foundname = resolvers.findfile(filename,filetype)
if foundname and foundname ~= "" then
if trace_locating then
- report_resolvers("file finder: '%s' found",filename)
+ report_files("file finder: '%s' found",filename)
end
return foundname
else
if trace_locating then
- report_resolvers("file finder: %s' not found",filename)
+ report_files("file finder: %s' not found",filename)
end
return finders.notfound()
end
@@ -12286,13 +12343,13 @@ function openers.file(specification,filetype)
local f = io.open(filename,"r")
if f then
if trace_locating then
- report_resolvers("file opener, '%s' opened",filename)
+ report_files("file opener, '%s' opened",filename)
end
return openers.helpers.textopener("file",filename,f)
end
end
if trace_locating then
- report_resolvers("file opener, '%s' not found",filename)
+ report_files("file opener, '%s' not found",filename)
end
return openers.notfound()
end
@@ -12304,7 +12361,7 @@ function loaders.file(specification,filetype)
if f then
logs.show_load(filename)
if trace_locating then
- report_resolvers("file loader, '%s' loaded",filename)
+ report_files("file loader, '%s' loaded",filename)
end
local s = f:read("*a")
if checkgarbage then
@@ -12317,7 +12374,7 @@ function loaders.file(specification,filetype)
end
end
if trace_locating then
- report_resolvers("file loader, '%s' not found",filename)
+ report_files("file loader, '%s' not found",filename)
end
return loaders.notfound()
end
@@ -12358,11 +12415,11 @@ containers = containers or { }
local containers = containers
containers.usecache = true
-local report_cache = logs.new("cache")
+local report_containers = logs.new("resolvers","containers")
local function report(container,tag,name)
if trace_cache or trace_containers then
- report_cache("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
+ report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
end
end
@@ -12480,7 +12537,7 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_mounts = logs.new("resolvers","mounts")
local resolvers = resolvers
@@ -12505,7 +12562,7 @@ function resolvers.automount(usecache)
-- skip
elseif find(line,"^zip://") then
if trace_locating then
- report_resolvers("mounting %s",line)
+ report_mounts("mounting %s",line)
end
table.insert(resolvers.automounted,line)
resolvers.usezipfile(line)
@@ -12585,7 +12642,7 @@ local format, find, match = string.format, string.find, string.match
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_zip = logs.new("resolvers","zip")
-- zip:///oeps.zip?name=bla/bla.tex
-- zip:///oeps.zip?tree=tex/texmf-local
@@ -12638,9 +12695,9 @@ function resolvers.locators.zip(specification)
local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree
if trace_locating then
if zipfile then
- report_resolvers("zip locator, archive '%s' found",archive)
+ report_zip("locator, archive '%s' found",archive)
else
- report_resolvers("zip locator, archive '%s' not found",archive)
+ report_zip("locator, archive '%s' not found",archive)
end
end
end
@@ -12648,7 +12705,7 @@ end
function resolvers.hashers.zip(specification)
local archive = specification.filename
if trace_locating then
- report_resolvers("loading zip file '%s'",archive)
+ report_zip("loading file '%s'",archive)
end
resolvers.usezipfile(specification.original)
end
@@ -12671,25 +12728,25 @@ function resolvers.finders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip finder, archive '%s' found",archive)
+ report_zip("finder, archive '%s' found",archive)
end
local dfile = zfile:open(queryname)
if dfile then
dfile = zfile:close()
if trace_locating then
- report_resolvers("zip finder, file '%s' found",queryname)
+ report_zip("finder, file '%s' found",queryname)
end
return specification.original
elseif trace_locating then
- report_resolvers("zip finder, file '%s' not found",queryname)
+ report_zip("finder, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip finder, unknown archive '%s'",archive)
+ report_zip("finder, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip finder, '%s' not found",original)
+ report_zip("finder, '%s' not found",original)
end
return resolvers.finders.notfound()
end
@@ -12704,24 +12761,24 @@ function resolvers.openers.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip opener, archive '%s' opened",archive)
+ report_zip("opener, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
if trace_locating then
- report_resolvers("zip opener, file '%s' found",queryname)
+ report_zip("opener, file '%s' found",queryname)
end
return resolvers.openers.helpers.textopener('zip',original,dfile)
elseif trace_locating then
- report_resolvers("zip opener, file '%s' not found",queryname)
+ report_zip("opener, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip opener, unknown archive '%s'",archive)
+ report_zip("opener, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip opener, '%s' not found",original)
+ report_zip("opener, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12736,27 +12793,27 @@ function resolvers.loaders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip loader, archive '%s' opened",archive)
+ report_zip("loader, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
logs.show_load(original)
if trace_locating then
- report_resolvers("zip loader, file '%s' loaded",original)
+ report_zip("loader, file '%s' loaded",original)
end
local s = dfile:read("*all")
dfile:close()
return true, s, #s
elseif trace_locating then
- report_resolvers("zip loader, file '%s' not found",queryname)
+ report_zip("loader, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip loader, unknown archive '%s'",archive)
+ report_zip("loader, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip loader, '%s' not found",original)
+ report_zip("loader, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12772,7 +12829,7 @@ function resolvers.usezipfile(archive)
if z then
local tree = url.query(specification.query).tree or ""
if trace_locating then
- report_resolvers("zip registering, registering archive '%s'",archive)
+ report_zip("registering, registering archive '%s'",archive)
end
statistics.starttiming(resolvers.instance)
resolvers.prependhash('zip',archive)
@@ -12781,10 +12838,10 @@ function resolvers.usezipfile(archive)
instance.files[archive] = resolvers.registerzipfile(z,tree)
statistics.stoptiming(resolvers.instance)
elseif trace_locating then
- report_resolvers("zip registering, unknown archive '%s'",archive)
+ report_zip("registering, unknown archive '%s'",archive)
end
elseif trace_locating then
- report_resolvers("zip registering, '%s' not found",archive)
+ report_zip("registering, '%s' not found",archive)
end
end
@@ -12796,7 +12853,7 @@ function resolvers.registerzipfile(z,tree)
filter = format("^%s/(.+)/(.-)$",tree)
end
if trace_locating then
- report_resolvers("zip registering, using filter '%s'",filter)
+ report_zip("registering, using filter '%s'",filter)
end
local register, n = resolvers.registerfile, 0
for i in z:files() do
@@ -12813,7 +12870,7 @@ function resolvers.registerzipfile(z,tree)
n = n + 1
end
end
- report_resolvers("zip registering, %s files registered",n)
+ report_zip("registering, %s files registered",n)
return files
end
@@ -12836,7 +12893,7 @@ local find, gsub, format = string.find, string.gsub, string.format
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_trees = logs.new("resolvers","trees")
local resolvers = resolvers
@@ -12874,18 +12931,18 @@ function resolvers.locators.tree(specification)
local name = specification.filename
if name ~= '' and lfs.isdir(name) then
if trace_locating then
- report_resolvers("tree locator '%s' found",name)
+ report_trees("locator '%s' found",name)
end
resolvers.appendhash('tree',name,false) -- don't cache
elseif trace_locating then
- report_resolvers("tree locator '%s' not found",name)
+ report_trees("locator '%s' not found",name)
end
end
function resolvers.hashers.tree(specification)
local name = specification.filename
if trace_locating then
- report_resolvers("analysing tree '%s'",name)
+ report_trees("analysing '%s'",name)
end
resolvers.methodhandler("hashers",name)
end
@@ -12981,7 +13038,7 @@ if not modules then modules = { } end modules ['data-lua'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_libraries = logs.new("resolvers","libraries")
local gsub, insert = string.gsub, table.insert
local unpack = unpack or table.unpack
@@ -13013,7 +13070,7 @@ local function thepath(...)
local t = { ... } t[#t+1] = "?.lua"
local path = file.join(unpack(t))
if trace_locating then
- report_resolvers("! appending '%s' to 'package.path'",path)
+ report_libraries("! appending '%s' to 'package.path'",path)
end
return path
end
@@ -13035,11 +13092,11 @@ local function loaded(libpaths,name,simple)
local libpath = libpaths[i]
local resolved = gsub(libpath,"%?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
+ report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.path': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13048,17 +13105,17 @@ end
package.loaders[2] = function(name) -- was [#package.loaders+1]
if trace_locating then -- mode detail
- report_resolvers("! locating '%s'",name)
+ report_libraries("! locating '%s'",name)
end
for i=1,#libformats do
local format = libformats[i]
local resolved = resolvers.findfile(name,format) or ""
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'libformat path': '%s'",name,format)
+ report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format)
end
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13081,11 +13138,11 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local path = paths[p]
local resolved = file.join(path,libname)
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'clibformat path': '%s'",libname,path)
+ report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
+ report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
end
return package.loadlib(resolved,name)
end
@@ -13095,28 +13152,28 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local libpath = clibpaths[i]
local resolved = gsub(libpath,"?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
+ report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
end
return package.loadlib(resolved,name)
end
end
-- just in case the distribution is messed up
if trace_loading then -- more detail
- report_resolvers("! checking for '%s' using 'luatexlibs': '%s'",name)
+ report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name)
end
local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or ""
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located by basename via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
if trace_locating then
- report_resolvers('? unable to locate lib: %s',name)
+ report_libraries('? unable to locate lib: %s',name)
end
-- return "unable to locate " .. name
end
@@ -13153,48 +13210,48 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local resolvers = resolvers
-local report_resolvers = logs.new("resolvers")
+local report_scripts = logs.new("resolvers","scripts")
function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix
local scriptpath = "scripts/context/lua"
newname = file.addsuffix(newname,"lua")
local oldscript = resolvers.cleanpath(oldname)
if trace_locating then
- report_resolvers("to be replaced old script %s", oldscript)
+ report_scripts("to be replaced old script %s", oldscript)
end
local newscripts = resolvers.findfiles(newname) or { }
if #newscripts == 0 then
if trace_locating then
- report_resolvers("unable to locate new script")
+ report_scripts("unable to locate new script")
end
else
for i=1,#newscripts do
local newscript = resolvers.cleanpath(newscripts[i])
if trace_locating then
- report_resolvers("checking new script %s", newscript)
+ report_scripts("checking new script %s", newscript)
end
if oldscript == newscript then
if trace_locating then
- report_resolvers("old and new script are the same")
+ report_scripts("old and new script are the same")
end
elseif not find(newscript,scriptpath) then
if trace_locating then
- report_resolvers("new script should come from %s",scriptpath)
+ report_scripts("new script should come from %s",scriptpath)
end
elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then
if trace_locating then
- report_resolvers("invalid new script name")
+ report_scripts("invalid new script name")
end
else
local newdata = io.loaddata(newscript)
if newdata then
if trace_locating then
- report_resolvers("old script content replaced by new content")
+ report_scripts("old script content replaced by new content")
end
io.savedata(oldscript,newdata)
break
elseif trace_locating then
- report_resolvers("unable to load new script")
+ report_scripts("unable to load new script")
end
end
end
@@ -13216,6 +13273,8 @@ if not modules then modules = { } end modules ['data-tmf'] = {
local resolvers = resolvers
+local report_tds = logs.new("resolvers","tds")
+
-- = <<
-- ? ??
-- < +=
@@ -13236,11 +13295,11 @@ function resolvers.load_tree(tree,resolve)
local newpath = file.join(newtree,"bin")
if not lfs.isdir(newtree) then
- logs.simple("no '%s' under tree %s",texos,tree)
+ report_tds("no '%s' under tree %s",texos,tree)
os.exit()
end
if not lfs.isdir(newpath) then
- logs.simple("no '%s/bin' under tree %s",texos,tree)
+ report_tds("no '%s/bin' under tree %s",texos,tree)
os.exit()
end
@@ -13264,9 +13323,9 @@ function resolvers.load_tree(tree,resolve)
setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
- logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
- logs.simple("prepending '%s' to binary path",newpath)
- logs.simple()
+ report_tds("changing from root '%s' to '%s'",oldroot,newroot)
+ report_tds("prepending '%s' to binary path",newpath)
+ report_tds()
end
end
@@ -13291,6 +13350,8 @@ resolvers.listers = resolvers.listers or { }
local resolvers = resolvers
+local report_lists = logs.new("resolvers","lists")
+
local function tabstr(str)
if type(str) == 'table' then
return concat(str," | ")
@@ -13319,11 +13380,11 @@ function resolvers.listers.variables(pattern)
local exp = table.fastcopy(expansions)
for key, value in table.sortedpairs(configured) do
if key ~= "" and (pattern == "" or find(upper(key),pattern)) then
- logs.simple(key)
- logs.simple(" env: %s",tabstr(rawget(environment,key)) or "unset")
- logs.simple(" var: %s",tabstr(configured[key]) or "unset")
- logs.simple(" exp: %s",tabstr(expansions[key]) or "unset")
- logs.simple(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(key)
+ report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
+ report_lists(" var: %s",tabstr(configured[key]) or "unset")
+ report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
+ report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
end
end
instance.environment = table.fastcopy(env)
@@ -13477,6 +13538,8 @@ if not modules then modules = { } end modules ['luat-fmt'] = {
local format = string.format
+local report_format = logs.new("resolvers","formats")
+
-- helper for mtxrun
local quoted = string.quoted
@@ -13501,7 +13564,7 @@ function environment.make_format(name)
if path ~= "" then
lfs.chdir(path)
end
- logs.simple("format path: %s",lfs.currentdir())
+ report_format("format path: %s",lfs.currentdir())
-- check source file
local texsourcename = file.addsuffix(name,"mkiv")
local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
@@ -13510,11 +13573,11 @@ function environment.make_format(name)
fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename == "" then
- logs.simple("no tex source file with name: %s (mkiv or tex)",name)
+ report_format("no tex source file with name: %s (mkiv or tex)",name)
lfs.chdir(olddir)
return
else
- logs.simple("using tex source file: %s",fulltexsourcename)
+ report_format("using tex source file: %s",fulltexsourcename)
end
local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed
-- check specification
@@ -13525,7 +13588,7 @@ function environment.make_format(name)
fullspecificationname = resolvers.findfile(specificationname,"tex") or ""
end
if fullspecificationname == "" then
- logs.simple("unknown stub specification: %s",specificationname)
+ report_format("unknown stub specification: %s",specificationname)
lfs.chdir(olddir)
return
end
@@ -13536,39 +13599,39 @@ function environment.make_format(name)
if type(usedlualibs) == "string" then
usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs)
elseif type(usedlualibs) == "table" then
- logs.simple("using stub specification: %s",fullspecificationname)
+ report_format("using stub specification: %s",fullspecificationname)
local texbasename = file.basename(name)
local luastubname = file.addsuffix(texbasename,"lua")
local lucstubname = file.addsuffix(texbasename,"luc")
-- pack libraries in stub
- logs.simple("creating initialization file: %s",luastubname)
+ report_format("creating initialization file: %s",luastubname)
utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
-- compile stub file (does not save that much as we don't use this stub at startup any more)
local strip = resolvers.booleanvariable("LUACSTRIP", true)
if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- logs.simple("using compiled initialization file: %s",lucstubname)
+ report_format("using compiled initialization file: %s",lucstubname)
usedluastub = lucstubname
else
- logs.simple("using uncompiled initialization file: %s",luastubname)
+ report_format("using uncompiled initialization file: %s",luastubname)
usedluastub = luastubname
end
else
- logs.simple("invalid stub specification: %s",fullspecificationname)
+ report_format("invalid stub specification: %s",fullspecificationname)
lfs.chdir(olddir)
return
end
-- generate format
local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\")
- logs.simple("running command: %s\n",command)
+ report_format("running command: %s\n",command)
os.spawn(command)
-- remove related mem files
local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem"
- -- logs.simple("removing related mplib format with pattern '%s'", pattern)
+ -- report_format("removing related mplib format with pattern '%s'", pattern)
local mp = dir.glob(pattern)
if mp then
for i=1,#mp do
local name = mp[i]
- logs.simple("removing related mplib format %s", file.basename(name))
+ report_format("removing related mplib format %s", file.basename(name))
os.remove(name)
end
end
@@ -13585,7 +13648,7 @@ function environment.run_format(name,data,more)
end
fmtname = resolvers.cleanpath(fmtname)
if fmtname == "" then
- logs.simple("no format with name: %s",name)
+ report_format("no format with name: %s",name)
else
local barename = file.removesuffix(name) -- expanded name
local luaname = file.addsuffix(barename,"luc")
@@ -13593,11 +13656,11 @@ function environment.run_format(name,data,more)
luaname = file.addsuffix(barename,"lua")
end
if not lfs.isfile(luaname) then
- logs.simple("using format name: %s",fmtname)
- logs.simple("no luc/lua with name: %s",barename)
+ report_format("using format name: %s",fmtname)
+ report_format("no luc/lua with name: %s",barename)
else
local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "")
- logs.simple("running command: %s",command)
+ report_format("running command: %s",command)
os.spawn(command)
end
end
@@ -13750,8 +13813,6 @@ if not resolvers then
os.exit()
end
-logs.setprogram('MTXrun',"TDS Runner Tool 1.30")
-
if environment.arguments["verbose"] then
trackers.enable("resolvers.locating")
end
@@ -13764,10 +13825,7 @@ if trackspec then
trackers.enable(trackspec)
end
-runners = runners or { } -- global
-messages = messages or { }
-
-messages.help = [[
+local helpinfo = [[
--script run an mtx script (lua prefered method) (--noquotes), no script gives list
--execute run a script or program (texmfstart method) (--noquotes)
--resolve resolve prefixed arguments
@@ -13819,6 +13877,19 @@ messages.help = [[
--pattern=str filter variables
]]
+local application = logs.application {
+ name = "mtxrun",
+ banner = "ConTeXt TDS Runner Tool 1.30",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
+local verbose = environment.argument("verbose")
+
+messages = messages or { } -- for the mo
+
+runners = runners or { } -- global
runners.applications = {
["lua"] = "luatex --luaonly",
@@ -13872,17 +13943,16 @@ end
function runners.prepare()
local checkname = environment.argument("ifchanged")
- local verbose = environment.argument("verbose")
if type(checkname) == "string" and checkname ~= "" then
local oldchecksum = file.loadchecksum(checkname)
local newchecksum = file.checksum(checkname)
if oldchecksum == newchecksum then
if verbose then
- logs.simple("file '%s' is unchanged",checkname)
+ report("file '%s' is unchanged",checkname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is changed, processing started",checkname)
+ report("file '%s' is changed, processing started",checkname)
end
file.savechecksum(checkname)
end
@@ -13892,17 +13962,17 @@ function runners.prepare()
if oldname and newname and oldname ~= "" and newname ~= "" then
if not file.needs_updating(oldname,newname) then
if verbose then
- logs.simple("file '%s' and '%s' have same age",oldname,newname)
+ report("file '%s' and '%s' have same age",oldname,newname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is older than '%s'",oldname,newname)
+ report("file '%s' is older than '%s'",oldname,newname)
end
end
end
local runpath = environment.argument("path")
if type(runpath) == "string" and not lfs.chdir(runpath) then
- logs.simple("unable to change to path '%s'",runpath)
+ report("unable to change to path '%s'",runpath)
return "error"
end
runners.prepare = function() end
@@ -13961,11 +14031,11 @@ function runners.execute_script(fullname,internal,nosplit)
result = binary .. " " .. result
end
local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote)
- if logs.verbose then
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ if verbose then
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
end
-- no os.exec because otherwise we get the wrong return value
@@ -13980,9 +14050,9 @@ function runners.execute_script(fullname,internal,nosplit)
return false
end
end
- logs.simpleline()
- logs.simple("This script needs '%s' which seems not to be installed.",binary)
- logs.simpleline()
+ report()
+ report("This script needs '%s' which seems not to be installed.",binary)
+ report()
end
return false
end
@@ -14007,10 +14077,10 @@ function runners.execute_program(fullname)
environment.initializearguments(after)
fullname = fullname:gsub("^bin:","")
local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "")
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn
return code == 0
@@ -14042,18 +14112,18 @@ function runners.handle_stubs(create)
if create then
if windows then
io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name))
- logs.simple("windows stub for '%s' created",base)
+ report("windows stub for '%s' created",base)
end
if unix then
io.savedata(file.join(stubpath,base),string.format(unix_stub,name))
- logs.simple("unix stub for '%s' created",base)
+ report("unix stub for '%s' created",base)
end
else
if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then
- logs.simple("windows stub for '%s' removed", base)
+ report("windows stub for '%s' removed", base)
end
if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then
- logs.simple("unix stub for '%s' removed",base)
+ report("unix stub for '%s' removed",base)
end
end
end
@@ -14078,12 +14148,12 @@ function runners.locate_platform()
end
function runners.report_location(result)
- if logs.verbose then
- logs.simpleline()
+ if verbose then
+ reportline()
if result and result ~= "" then
- logs.simple(result)
+ report(result)
else
- logs.simple("not found")
+ report("not found")
end
else
io.write(result)
@@ -14095,11 +14165,11 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
local rest = resolvers.resolve(filename)
if rest ~= "" then
local command = editor .. " " .. rest
- if logs.verbose then
- logs.simpleline()
- logs.simple("starting editor: %s",command)
- logs.simple_line()
- logs.simple_line()
+ if verbose then
+ report()
+ report("starting editor: %s",command)
+ report()
+ report()
end
os.launch(command)
end
@@ -14148,7 +14218,7 @@ function runners.launch_file(filename)
pattern = filename
end
if not pattern or pattern == "" then
- logs.simple("provide name or --pattern=")
+ report("provide name or --pattern=")
else
local t = resolvers.findfiles(pattern)
if not t or #t == 0 then
@@ -14160,15 +14230,15 @@ function runners.launch_file(filename)
if t and #t > 0 then
if environment.arguments["all"] then
for _, v in pairs(t) do
- logs.simple("launching %s", v)
+ report("launching %s", v)
resolvers.launch(v)
end
else
- logs.simple("launching %s", t[1])
+ report("launching %s", t[1])
resolvers.launch(t[1])
end
else
- logs.simple("no match for %s", pattern)
+ report("no match for %s", pattern)
end
end
end
@@ -14239,7 +14309,7 @@ function runners.execute_ctx_script(filename,...)
local fullname = runners.find_mtx_script(filename) or ""
if file.extname(fullname) == "cld" then
-- handy in editors where we force --autopdf
- logs.simple("running cld script: %s",filename)
+ report("running cld script: %s",filename)
table.insert(arguments,1,fullname)
table.insert(arguments,"--autopdf")
fullname = runners.find_mtx_script("context") or ""
@@ -14270,8 +14340,8 @@ function runners.execute_ctx_script(filename,...)
runners.load_script_session(loadname)
end
filename = environment.files[1]
- if logs.verbose then
- logs.simple("using script: %s\n",fullname)
+ if verbose then
+ report("using script: %s\n",fullname)
end
environment.ownscript = fullname
dofile(fullname)
@@ -14306,24 +14376,23 @@ function runners.execute_ctx_script(filename,...)
end
end
if #valid > 0 then
- logs.reportbanner()
- logs.reportline()
- logs.simple("no script name given, known scripts:")
- logs.simple()
+ application.identify()
+ report("no script name given, known scripts:")
+ report()
for k=1,#valid do
local v = valid[k]
- logs.simple("%-12s %4s %s",v[1],v[2],v[3])
+ report("%-12s %4s %s",v[1],v[2],v[3])
end
end
else
- logs.simple("no script name given")
+ report("no script name given")
end
else
filename = file.addsuffix(filename,"lua")
if file.is_qualified_path(filename) then
- logs.simple("unknown script '%s'",filename)
+ report("unknown script '%s'",filename)
else
- logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename)
+ report("unknown script '%s' or 'mtx-%s'",filename,filename)
end
end
return false
@@ -14331,9 +14400,9 @@ function runners.execute_ctx_script(filename,...)
end
function runners.prefixes()
- logs.reportbanner()
- logs.reportline()
- logs.simple(table.concat(resolvers.allprefixes(true)," "))
+ application.identify()
+ report()
+ report(table.concat(resolvers.allprefixes(true)," "))
end
function runners.timedrun(filename) -- just for me
@@ -14385,7 +14454,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk
local t = os.clock()
local k = kpse.original.new("luatex",progname)
local dummy = k:find_file("mtxrun.lua") -- so that we're initialized
- logs.simple("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
+ report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
kpse_initialized = function() return k end
return k
end
@@ -14432,11 +14501,11 @@ else
function runners.loadbase(...)
if not resolvers.load(...) then
- logs.simple("forcing cache reload")
+ report("forcing cache reload")
instance.renewcache = true
trackers.enable("resolvers.locating")
if not resolvers.load(...) then
- logs.simple("the resolver databases are not present or outdated")
+ report("the resolver databases are not present or outdated")
end
end
end
@@ -14595,8 +14664,8 @@ elseif environment.argument("find-path") then
resolvers.load()
local path = resolvers.findpath(filename, instance.my_format)
- if logs.verbose then
- logs.simple(path)
+ if verbose then
+ report(path)
else
print(path)
end
@@ -14651,7 +14720,7 @@ elseif environment.argument("format-path") then
-- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename)
resolvers.load()
- logs.simple(caches.getwritablepath("format"))
+ report(caches.getwritablepath("format"))
elseif environment.argument("pattern") then
@@ -14695,7 +14764,7 @@ elseif environment.argument("help") and filename=='base' then
elseif environment.argument("help") or filename=='help' or filename == "" then
- logs.help(messages.help)
+ application.help()
elseif filename:find("^bin:") then
@@ -14729,9 +14798,9 @@ else
end
-if logs.verbose then
- logs.simpleline()
- logs.simple("runtime: %0.3f seconds",os.runtime())
+if verbose then
+ report()
+ report("runtime: %0.3f seconds",os.runtime())
end
if os.type ~= "windows" then
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 31d7d9b0f..afc472d1c 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = {
license = "see context related readme files"
}
-
-- one can make a stub:
--
-- #!/bin/sh
@@ -132,11 +131,7 @@ local simple_escapes = {
}
function string.escapedpattern(str,simple)
- if simple then
- return (gsub(str,".",simple_escapes))
- else
- return (gsub(str,".",patterns_escapes))
- end
+ return (gsub(str,".",simple and simple_escapes or patterns_escapes))
end
function string.topattern(str,lowercase,strict)
@@ -556,11 +551,7 @@ local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0)
local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0)
function string.escapedpattern(str,simple)
- if simple then
- return match(s,str)
- else
- return match(p,str)
- end
+ return match(simple and s or p,str)
end
-- utf extensies
@@ -3826,7 +3817,7 @@ local type, next = type, next
utilities = utilities or {}
utilities.merger = utilities.merger or { } -- maybe mergers
-utilities.report = utilities.report or print
+utilities.report = logs and logs.new("system") or print
local merger = utilities.merger
@@ -3964,7 +3955,7 @@ if not modules then modules = { } end modules ['util-lua'] = {
utilities = utilities or {}
utilities.lua = utilities.lua or { }
-utilities.report = utilities.report or print
+utilities.report = logs and logs.new("system") or print
function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true
utilities.report("lua: compiling %s into %s",luafile,lucfile)
@@ -4577,19 +4568,21 @@ function statistics.show(reporter)
end
end
-
-local template, nn = nil, 0 -- we only calcute it once
+local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once
function statistics.showjobstat(tag,data,n)
- if type(data) == "table" then
+ if not logs then
+ -- sorry
+ elseif type(data) == "table" then
for i=1,#data do
statistics.showjobstat(tag,data[i],n)
end
else
if not template or n > nn then
- template, n = format("%%-%ss: %%-%ss - %%s",15,n), nn
+ template, n = format("%%-%ss - %%s",n), nn
+ report_statistics = logs.new("mkiv lua stats")
end
- write_nl(format(template,"mkiv lua stats",tag,data))
+ report_statistics(format(template,tag,data))
end
end
@@ -4610,7 +4603,7 @@ function statistics.runtime()
end
function statistics.timed(action,report)
- report = report or logs.simple
+ report = report or logs.new("system")
starttiming("run")
action()
stoptiming("run")
@@ -4664,14 +4657,10 @@ local data = { } -- maybe just local
local trace_initialize = false -- only for testing during development
-local function report(a,b,...)
- texio.write_nl(format("%-16s> %s",a,format(b,...)))
-end
-
function setters.initialize(filename,name,values) -- filename only for diagnostics
- local data = data[name]
- if data then
- data = data.data
+ local setter = data[name]
+ if setter then
+ local data = data.data
if data then
for key, value in next, values do
-- key = gsub(key,"_",".")
@@ -4680,7 +4669,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
if functions then
if #functions > 0 and not functions.value then
if trace_initialize then
- report(name,"executing %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("executing %s (%s -> %s)",key,filename,tostring(value))
end
for i=1,#functions do
functions[i](value)
@@ -4688,7 +4677,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
functions.value = value
else
if trace_initialize then
- report(name,"skipping %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("skipping %s (%s -> %s)",key,filename,tostring(value))
end
end
else
@@ -4697,7 +4686,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
functions = { default = value }
data[key] = functions
if trace_initialize then
- report(name,"storing %s (%s -> %s)",key,filename,tostring(value))
+ setter.report("storing %s (%s -> %s)",key,filename,tostring(value))
end
end
end
@@ -4724,10 +4713,11 @@ local function set(t,what,newvalue)
else
value = is_boolean(value,value)
end
+ w = escapedpattern(w,true)
for name, functions in next, data do
if done[name] then
-- prevent recursion due to wildcards
- elseif find(name,escapedpattern(w,true)) then
+ elseif find(name,w) then
done[name] = true
for i=1,#functions do
functions[i](value)
@@ -4769,7 +4759,7 @@ function setters.register(t,what,...)
functions = { }
data[what] = functions
if trace_initialize then
- report(t.name,"defining %s",what)
+ t.report("defining %s",what)
end
end
local default = functions.default -- can be set from cnf file
@@ -4777,7 +4767,7 @@ function setters.register(t,what,...)
local typ = type(fnc)
if typ == "string" then
if trace_initialize then
- report(t.name,"coupling %s to %s",what,fnc)
+ t.report("coupling %s to %s",what,fnc)
end
local s = fnc -- else wrong reference
fnc = function(value) set(t,s,value) end
@@ -4831,9 +4821,9 @@ function setters.list(t) -- pattern
end
function setters.show(t)
- commands.writestatus("","")
- local list = setters.list(t)
local category = t.name
+ local list = setters.list(t)
+ t.report()
for k=1,#list do
local name = list[k]
local functions = t.data[name]
@@ -4841,10 +4831,10 @@ function setters.show(t)
local value, default, modules = functions.value, functions.default, #functions
value = value == nil and "unset" or tostring(value)
default = default == nil and "unset" or tostring(default)
- commands.writestatus(category,format("%-30s modules: %2i default: %5s value: %5s",name,modules,default,value))
+ t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value)
end
end
- commands.writestatus("","")
+ t.report()
end
-- we could have used a bit of oo and the trackers:enable syntax but
@@ -4854,57 +4844,62 @@ end
local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show
+local function report(setter,...)
+ local report = logs and logs.report
+ if report then
+ report(setter.name,...)
+ else -- fallback, as this module is loaded before the logger
+ write_nl(format("%-16s: %s\n",setter.name,format(...)))
+ end
+end
+
function setters.new(name)
- local t -- we need to access it in t
- t = {
+ local setter -- we need to access it in setter itself
+ setter = {
data = allocate(), -- indexed, but also default and value fields
name = name,
- enable = function(...) enable (t,...) end,
- disable = function(...) disable (t,...) end,
- register = function(...) register(t,...) end,
- list = function(...) list (t,...) end,
- show = function(...) show (t,...) end,
+ report = function(...) report (setter,...) end,
+ enable = function(...) enable (setter,...) end,
+ disable = function(...) disable (setter,...) end,
+ register = function(...) register(setter,...) end,
+ list = function(...) list (setter,...) end,
+ show = function(...) show (setter,...) end,
}
- data[name] = t
- return t
+ data[name] = setter
+ return setter
end
trackers = setters.new("trackers")
directives = setters.new("directives")
experiments = setters.new("experiments")
-local t_enable, t_disable = trackers .enable, trackers .disable
-local d_enable, d_disable = directives .enable, directives .disable
-local e_enable, e_disable = experiments.enable, experiments.disable
+local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report
+local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report
+local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report
-- nice trick: we overload two of the directives related functions with variants that
-- do tracing (itself using a tracker) .. proof of concept
-local function report(...) -- messy .. chicken or egg
- local p = (commands and commands.writestatus) or (logs and logs.report)
- if p then p(...) end
-end
-
local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end)
local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end)
function directives.enable(...)
- report("directives","enabling: %s",concat({...}," "))
+ d_report("enabling: %s",concat({...}," "))
d_enable(...)
end
function directives.disable(...)
- report("directives","disabling: %s",concat({...}," "))
+ d_report("disabling: %s",concat({...}," "))
d_disable(...)
end
function experiments.enable(...)
- report("experiments","enabling: %s",concat({...}," "))
+ e_report("enabling: %s",concat({...}," "))
e_enable(...)
end
function experiments.disable(...)
- report("experiments","disabling: %s",concat({...}," "))
+ e_report("disabling: %s",concat({...}," "))
e_disable(...)
end
@@ -4967,20 +4962,19 @@ if not modules then modules = { } end modules ['trac-log'] = {
license = "see context related readme files"
}
--- xml logging is only usefull in normal runs, not in ini mode
--- it looks like some tex logging (like filenames) is broken (no longer
--- interceoted at the tex end so the xml variant is not that useable now)
+-- todo: less categories, more subcategories (e.g. nodes)
local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write
-local format, gmatch = string.format, string.gmatch
+local format, gmatch, find = string.format, string.gmatch, string.find
+local concat = table.concat
+local escapedpattern = string.escapedpattern
local texcount = tex and tex.count
+local next, type = next, type
--[[ldx--
- This is a prelude to a more extensive logging module. For the sake
-of parsing log files, in addition to the standard logging we will
-provide an This is a prelude to a more extensive logging module. We no longer
+provide The parser used here is inspired by the variant discussed in the lua book, but
@@ -6518,7 +6575,7 @@ function xml.is_valid(root)
return root and not root.error
end
-xml.errorhandler = (logs and logs.report) or (input and logs.report) or print
+xml.errorhandler = report
--[[ldx--
We cannot load an We've now arrived at an interesting part: accessing the tree using a subset
@@ -7951,9 +8008,9 @@ local function traced_apply(list,parsed,nofparsed,order)
if trace_lparse then
lshow(parsed)
end
- report_lpath("collecting : %s",parsed.pattern)
- report_lpath(" root tags : %s",tagstostring(list))
- report_lpath(" order : %s",order or "unset")
+ report_lpath("collecting: %s",parsed.pattern)
+ report_lpath("root tags : %s",tagstostring(list))
+ report_lpath("order : %s",order or "unset")
local collected = list
for i=1,nofparsed do
local pi = parsed[i]
@@ -9224,7 +9281,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_initialization = logs.new("resolvers","initialization")
local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv
@@ -9245,7 +9302,7 @@ kpse = { original = kpse }
setmetatable(kpse, {
__index = function(kp,name)
- report_resolvers("fatal error: kpse library is accessed (key: %s)",name)
+ report_initialization("fatal error: kpse library is accessed (key: %s)",name)
os.exit()
end
} )
@@ -9329,13 +9386,13 @@ do
if lfs.chdir(p) then
local pp = lfs.currentdir()
if trace_locating and p ~= pp then
- report_resolvers("following symlink '%s' to '%s'",p,pp)
+ report_initialization("following symlink '%s' to '%s'",p,pp)
end
ownpath = pp
lfs.chdir(olddir)
else
if trace_locating then
- report_resolvers("unable to check path '%s'",p)
+ report_initialization("unable to check path '%s'",p)
end
ownpath = p
end
@@ -9346,9 +9403,9 @@ do
end
if not ownpath or ownpath == "" then
ownpath = "."
- report_resolvers("forcing fallback ownpath .")
+ report_initialization("forcing fallback ownpath .")
elseif trace_locating then
- report_resolvers("using ownpath '%s'",ownpath)
+ report_initialization("using ownpath '%s'",ownpath)
end
end
@@ -9375,7 +9432,7 @@ do
ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/.."))
ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../.."))
else
- report_resolvers("error: unable to locate ownpath")
+ report_initialization("error: unable to locate ownpath")
os.exit()
end
@@ -9461,7 +9518,7 @@ local collapsepath = file.collapsepath
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_expansions = logs.new("resolvers","expansions")
local resolvers = resolvers
@@ -9524,7 +9581,7 @@ local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
- report_resolvers("expanding variable '%s'",str)
+ report_expansions("expanding variable '%s'",str)
end
local t, ok, done = newlist or { }, false, false
local n = #t
@@ -9550,7 +9607,7 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi
end
if trace_expansions then
for k=1,#t do
- report_resolvers("% 4i: %s",k,t[k])
+ report_expansions("% 4i: %s",k,t[k])
end
end
return t
@@ -9585,7 +9642,7 @@ function resolvers.cleanpath(str)
homedir = lpegmatch(cleanup,environment.homedir or "")
if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then
if trace_expansions then
- report_resolvers("no home dir set, ignoring dependent paths")
+ report_expansions("no home dir set, ignoring dependent paths")
end
function resolvers.cleanpath(str)
if find(str,"~") then
@@ -9655,9 +9712,9 @@ local function splitconfigurationpath(str) -- beware, this can be either a path
end
end
if trace_expansions then
- report_resolvers("splitting path specification '%s'",str)
+ report_expansions("splitting path specification '%s'",str)
for k=1,noffound do
- report_resolvers("% 4i: %s",k,found[k])
+ report_expansions("% 4i: %s",k,found[k])
end
end
cache[str] = found
@@ -9742,7 +9799,7 @@ end
function resolvers.scanfiles(path,branch)
if trace_locating then
- report_resolvers("scanning path '%s', branch '%s'",path, branch or path)
+ report_expansions("scanning path '%s', branch '%s'",path, branch or path)
end
local realpath = resolvers.resolve(path) -- no shortcut
local files, n, m, r = scan({ },realpath .. '/',"",0,0,0)
@@ -9751,7 +9808,7 @@ function resolvers.scanfiles(path,branch)
files.__directories__ = m
files.__remappings__ = r
if trace_locating then
- report_resolvers("%s files found on %s directories with %s uppercase remappings",n,m,r)
+ report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r)
end
return files
end
@@ -10080,8 +10137,8 @@ local mkdirs, isdir = dir.mkdirs, lfs.isdir
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end)
-local report_cache = logs.new("cache")
-local report_resolvers = logs.new("resolvers")
+local report_caches = logs.new("resolvers","caches")
+local report_resolvers = logs.new("resolvers","caching")
local resolvers = resolvers
@@ -10141,7 +10198,7 @@ local function identify()
if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then
mkdirs(cachepath)
if isdir(cachepath) and file.is_writable(cachepath) then
- report_cache("created: %s",cachepath)
+ report_caches("created: %s",cachepath)
writable = cachepath
readables[#readables+1] = cachepath
end
@@ -10175,10 +10232,10 @@ local function identify()
-- Some extra checking. If we have no writable or readable path then we simply
-- quit.
if not writable then
- report_cache("fatal error: there is no valid writable cache path defined")
+ report_caches("fatal error: there is no valid writable cache path defined")
os.exit()
elseif #readables == 0 then
- report_cache("fatal error: there is no valid readable cache path defined")
+ report_caches("fatal error: there is no valid readable cache path defined")
os.exit()
end
-- why here
@@ -10200,9 +10257,9 @@ local function identify()
-- end
if trace_cache then
for i=1,#readables do
- report_cache("using readable path '%s' (order %s)",readables[i],i)
+ report_caches("using readable path '%s' (order %s)",readables[i],i)
end
- report_cache("using writable path '%s'",writable)
+ report_caches("using writable path '%s'",writable)
end
identify = function()
return writable, readables
@@ -10237,7 +10294,7 @@ function caches.hashed(tree)
tree = lower(tree)
local hash = md5.hex(tree)
if trace_cache or trace_locating then
- report_cache("hashing tree %s, hash %s",tree,hash)
+ report_caches("hashing tree %s, hash %s",tree,hash)
end
return hash
end
@@ -10463,7 +10520,7 @@ trackers.register("resolvers.locating", function(v) trace_methods = v end)
trackers.register("resolvers.methods", function(v) trace_methods = v end)
-local report_resolvers = logs.new("resolvers")
+local report_methods = logs.new("resolvers","methods")
local allocate = utilities.storage.allocate
@@ -10505,41 +10562,41 @@ local function methodhandler(what,first,...) -- filename can be nil or false
local resolver = namespace and namespace[scheme]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
+ report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
end
return resolver(specification,...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
end
return resolver(specification,...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, no handler",what,how)
+ report_methods("resolver: method=%s, how=%s, no handler",what,how)
end
end
elseif how == "tag" then
local resolver = namespace and namespace[first]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, tag=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first)
end
return resolver(...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default",what,how)
+ report_methods("resolver: method=%s, how=%s, default",what,how)
end
return resolver(...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, unknown",what,how)
+ report_methods("resolver: method=%s, how=%s, unknown",what,how)
end
end
end
else
- report_resolvers("resolver: method=%s, unknown",what)
+ report_methods("resolver: method=%s, unknown",what)
end
end
@@ -10610,7 +10667,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_resolving = logs.new("resolvers","resolving")
local resolvers = resolvers
@@ -10712,7 +10769,7 @@ end
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
if trace_locating then
- report_resolvers("creating instance")
+ report_resolving("creating instance")
end
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
@@ -10830,9 +10887,9 @@ local function reportcriticalvariables()
for i=1,#resolvers.criticalvars do
local k = resolvers.criticalvars[i]
local v = resolvers.getenv(k) or "unknown" -- this one will not resolve !
- report_resolvers("variable '%s' set to '%s'",k,v)
+ report_resolving("variable '%s' set to '%s'",k,v)
end
- report_resolvers()
+ report_resolving()
end
reportcriticalvariables = function() end
end
@@ -10856,17 +10913,17 @@ local function identify_configuration_files()
if lfs.isfile(realname) then
specification[#specification+1] = filename
if trace_locating then
- report_resolvers("found configuration file '%s'",realname)
+ report_resolving("found configuration file '%s'",realname)
end
elseif trace_locating then
- report_resolvers("unknown configuration file '%s'",realname)
+ report_resolving("unknown configuration file '%s'",realname)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("configuration files already identified")
+ report_resolving("configuration files already identified")
end
end
@@ -10886,8 +10943,8 @@ local function load_configuration_files()
data = data and data.content
if data then
if trace_locating then
- report_resolvers("loading configuration file '%s'",filename)
- report_resolvers()
+ report_resolving("loading configuration file '%s'",filename)
+ report_resolving()
end
local variables = data.variables or { }
local warning = false
@@ -10897,7 +10954,7 @@ local function load_configuration_files()
initializesetter(filename,k,v)
elseif variables[k] == nil then
if trace_locating and not warning then
- report_resolvers("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
+ report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
k,resolvers.resolve(filename))
warning = true
end
@@ -10910,7 +10967,7 @@ local function load_configuration_files()
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
if trace_locating then
- report_resolvers("reloading configuration due to TEXMF redefinition")
+ report_resolving("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
@@ -10929,13 +10986,13 @@ local function load_configuration_files()
else
if trace_locating then
- report_resolvers("skipping configuration file '%s' (no content)",filename)
+ report_resolving("skipping configuration file '%s' (no content)",filename)
end
setups[pathname] = { }
instance.loaderror = true
end
elseif trace_locating then
- report_resolvers("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no file)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -10943,7 +11000,7 @@ local function load_configuration_files()
end
end
elseif trace_locating then
- report_resolvers("warning: no lua configuration files found")
+ report_resolving("warning: no lua configuration files found")
end
end
@@ -10979,19 +11036,19 @@ local function locate_file_databases()
end
if trace_locating then
if runtime then
- report_resolvers("locating list of '%s' (runtime)",path)
+ report_resolving("locating list of '%s' (runtime)",path)
else
- report_resolvers("locating list of '%s' (cached)",path)
+ report_resolving("locating list of '%s' (cached)",path)
end
end
methodhandler('locators',stripped)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("no texmf paths are defined (using TEXMF)")
+ report_resolving("no texmf paths are defined (using TEXMF)")
end
end
@@ -11002,7 +11059,7 @@ local function generate_file_databases()
methodhandler('generators',hash.name)
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
end
@@ -11014,11 +11071,11 @@ local function save_file_databases() -- will become cachers
local content = instance.files[cachename]
caches.collapsecontent(content)
if trace_locating then
- report_resolvers("saving tree '%s'",cachename)
+ report_resolving("saving tree '%s'",cachename)
end
caches.savecontent(cachename,"files",content)
elseif trace_locating then
- report_resolvers("not saving runtime tree '%s'",cachename)
+ report_resolving("not saving runtime tree '%s'",cachename)
end
end
end
@@ -11043,7 +11100,7 @@ function resolvers.appendhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' appended",name)
end
insert(instance.hashes, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11054,7 +11111,7 @@ function resolvers.prependhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' prepended",name)
end
insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -11287,9 +11344,9 @@ function isreadable(name)
local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir
if trace_detail then
if readable then
- report_resolvers("file '%s' is readable",name)
+ report_resolving("file '%s' is readable",name)
else
- report_resolvers("file '%s' is not readable", name)
+ report_resolving("file '%s' is not readable", name)
end
end
return readable
@@ -11303,7 +11360,7 @@ local function collect_files(names)
for k=1,#names do
local fname = names[k]
if trace_detail then
- report_resolvers("checking name '%s'",fname)
+ report_resolving("checking name '%s'",fname)
end
local bname = filebasename(fname)
local dname = filedirname(fname)
@@ -11319,7 +11376,7 @@ local function collect_files(names)
local files = blobpath and instance.files[blobpath]
if files then
if trace_detail then
- report_resolvers("deep checking '%s' (%s)",blobpath,bname)
+ report_resolving("deep checking '%s' (%s)",blobpath,bname)
end
local blobfile = files[bname]
if not blobfile then
@@ -11339,7 +11396,7 @@ local function collect_files(names)
local search = filejoin(blobroot,blobfile,bname)
local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11353,7 +11410,7 @@ local function collect_files(names)
local search = filejoin(blobroot,vv,bname)
local result = methodhandler('concatinators',hash.type,blobroot,vv,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -11362,7 +11419,7 @@ local function collect_files(names)
end
end
elseif trace_locating then
- report_resolvers("no match in '%s' (%s)",blobpath,bname)
+ report_resolving("no match in '%s' (%s)",blobpath,bname)
end
end
end
@@ -11403,7 +11460,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
stamp = filename .. "--" .. askedformat
if instance.found[stamp] then
if trace_locating then
- report_resolvers("remembered file '%s'",filename)
+ report_resolving("remembered file '%s'",filename)
end
resolvers.registerintrees(filename) -- for tracing used files
return instance.found[stamp]
@@ -11412,7 +11469,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not dangerous[askedformat] then
if isreadable(filename) then
if trace_detail then
- report_resolvers("file '%s' found directly",filename)
+ report_resolving("file '%s' found directly",filename)
end
if stamp then
instance.found[stamp] = { filename }
@@ -11422,13 +11479,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
if find(filename,'%*') then
if trace_locating then
- report_resolvers("checking wildcard '%s'", filename)
+ report_resolving("checking wildcard '%s'", filename)
end
result = resolvers.findwildcardfiles(filename) -- we can use th elocal
elseif file.is_qualified_path(filename) then
if isreadable(filename) then
if trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
result = { filename }
else
@@ -11441,7 +11498,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
forcedname = filename .. "." .. s
if isreadable(forcedname) then
if trace_locating then
- report_resolvers("no suffix, forcing format filetype '%s'", s)
+ report_resolving("no suffix, forcing format filetype '%s'", s)
end
result, ok = { forcedname }, true
break
@@ -11494,7 +11551,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- end
end
if not ok and trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
end
else
@@ -11513,13 +11570,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
wantedfiles[#wantedfiles+1] = forcedname
filetype = resolvers.formatofsuffix(forcedname)
if trace_locating then
- report_resolvers("forcing filetype '%s'",filetype)
+ report_resolving("forcing filetype '%s'",filetype)
end
end
else
filetype = resolvers.formatofsuffix(filename)
if trace_locating then
- report_resolvers("using suffix based filetype '%s'",filetype)
+ report_resolving("using suffix based filetype '%s'",filetype)
end
end
else
@@ -11533,7 +11590,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
filetype = askedformat
if trace_locating then
- report_resolvers("using given filetype '%s'",filetype)
+ report_resolving("using given filetype '%s'",filetype)
end
end
local typespec = resolvers.variableofformat(filetype)
@@ -11541,7 +11598,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not pathlist or #pathlist == 0 then
-- no pathlist, access check only / todo == wildcard
if trace_detail then
- report_resolvers("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
+ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
end
for k=1,#wantedfiles do
local fname = wantedfiles[k]
@@ -11569,7 +11626,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
end
if trace_detail then
- report_resolvers("checking filename '%s'",filename)
+ report_resolving("checking filename '%s'",filename)
end
for k=1,#pathlist do
local path = pathlist[k]
@@ -11581,7 +11638,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- 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)
+ report_resolving("using pattern '%s' for path '%s'",expression,pathname)
end
for k=1,#filelist do
local fl = filelist[k]
@@ -11593,16 +11650,16 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
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)
+ report_resolving("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)
+ report_resolving("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)
+ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
end
end
end
@@ -11619,7 +11676,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
local fname = filejoin(ppname,w)
if isreadable(fname) then
if trace_detail then
- report_resolvers("found '%s' by scanning",fname)
+ report_resolving("found '%s' by scanning",fname)
end
result[#result+1] = fname
done = true
@@ -11824,7 +11881,7 @@ end
local function report(str)
if trace_locating then
- report_resolvers(str) -- has already verbose
+ report_resolving(str) -- has already verbose
else
print(str)
end
@@ -12219,7 +12276,7 @@ if not modules then modules = { } end modules ['data-fil'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_files = logs.new("resolvers","files")
local resolvers = resolvers
@@ -12233,11 +12290,11 @@ function locators.file(specification)
local realname = resolvers.resolve(name) -- no shortcut
if realname and realname ~= '' and lfs.isdir(realname) then
if trace_locating then
- report_resolvers("file locator '%s' found as '%s'",name,realname)
+ report_files("file locator '%s' found as '%s'",name,realname)
end
resolvers.appendhash('file',name,true) -- cache
elseif trace_locating then
- report_resolvers("file locator '%s' not found",name)
+ report_files("file locator '%s' not found",name)
end
end
@@ -12260,12 +12317,12 @@ function finders.file(specification,filetype)
local foundname = resolvers.findfile(filename,filetype)
if foundname and foundname ~= "" then
if trace_locating then
- report_resolvers("file finder: '%s' found",filename)
+ report_files("file finder: '%s' found",filename)
end
return foundname
else
if trace_locating then
- report_resolvers("file finder: %s' not found",filename)
+ report_files("file finder: %s' not found",filename)
end
return finders.notfound()
end
@@ -12286,13 +12343,13 @@ function openers.file(specification,filetype)
local f = io.open(filename,"r")
if f then
if trace_locating then
- report_resolvers("file opener, '%s' opened",filename)
+ report_files("file opener, '%s' opened",filename)
end
return openers.helpers.textopener("file",filename,f)
end
end
if trace_locating then
- report_resolvers("file opener, '%s' not found",filename)
+ report_files("file opener, '%s' not found",filename)
end
return openers.notfound()
end
@@ -12304,7 +12361,7 @@ function loaders.file(specification,filetype)
if f then
logs.show_load(filename)
if trace_locating then
- report_resolvers("file loader, '%s' loaded",filename)
+ report_files("file loader, '%s' loaded",filename)
end
local s = f:read("*a")
if checkgarbage then
@@ -12317,7 +12374,7 @@ function loaders.file(specification,filetype)
end
end
if trace_locating then
- report_resolvers("file loader, '%s' not found",filename)
+ report_files("file loader, '%s' not found",filename)
end
return loaders.notfound()
end
@@ -12358,11 +12415,11 @@ containers = containers or { }
local containers = containers
containers.usecache = true
-local report_cache = logs.new("cache")
+local report_containers = logs.new("resolvers","containers")
local function report(container,tag,name)
if trace_cache or trace_containers then
- report_cache("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
+ report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
end
end
@@ -12480,7 +12537,7 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_mounts = logs.new("resolvers","mounts")
local resolvers = resolvers
@@ -12505,7 +12562,7 @@ function resolvers.automount(usecache)
-- skip
elseif find(line,"^zip://") then
if trace_locating then
- report_resolvers("mounting %s",line)
+ report_mounts("mounting %s",line)
end
table.insert(resolvers.automounted,line)
resolvers.usezipfile(line)
@@ -12585,7 +12642,7 @@ local format, find, match = string.format, string.find, string.match
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_zip = logs.new("resolvers","zip")
-- zip:///oeps.zip?name=bla/bla.tex
-- zip:///oeps.zip?tree=tex/texmf-local
@@ -12638,9 +12695,9 @@ function resolvers.locators.zip(specification)
local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree
if trace_locating then
if zipfile then
- report_resolvers("zip locator, archive '%s' found",archive)
+ report_zip("locator, archive '%s' found",archive)
else
- report_resolvers("zip locator, archive '%s' not found",archive)
+ report_zip("locator, archive '%s' not found",archive)
end
end
end
@@ -12648,7 +12705,7 @@ end
function resolvers.hashers.zip(specification)
local archive = specification.filename
if trace_locating then
- report_resolvers("loading zip file '%s'",archive)
+ report_zip("loading file '%s'",archive)
end
resolvers.usezipfile(specification.original)
end
@@ -12671,25 +12728,25 @@ function resolvers.finders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip finder, archive '%s' found",archive)
+ report_zip("finder, archive '%s' found",archive)
end
local dfile = zfile:open(queryname)
if dfile then
dfile = zfile:close()
if trace_locating then
- report_resolvers("zip finder, file '%s' found",queryname)
+ report_zip("finder, file '%s' found",queryname)
end
return specification.original
elseif trace_locating then
- report_resolvers("zip finder, file '%s' not found",queryname)
+ report_zip("finder, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip finder, unknown archive '%s'",archive)
+ report_zip("finder, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip finder, '%s' not found",original)
+ report_zip("finder, '%s' not found",original)
end
return resolvers.finders.notfound()
end
@@ -12704,24 +12761,24 @@ function resolvers.openers.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip opener, archive '%s' opened",archive)
+ report_zip("opener, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
if trace_locating then
- report_resolvers("zip opener, file '%s' found",queryname)
+ report_zip("opener, file '%s' found",queryname)
end
return resolvers.openers.helpers.textopener('zip',original,dfile)
elseif trace_locating then
- report_resolvers("zip opener, file '%s' not found",queryname)
+ report_zip("opener, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip opener, unknown archive '%s'",archive)
+ report_zip("opener, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip opener, '%s' not found",original)
+ report_zip("opener, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12736,27 +12793,27 @@ function resolvers.loaders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip loader, archive '%s' opened",archive)
+ report_zip("loader, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
logs.show_load(original)
if trace_locating then
- report_resolvers("zip loader, file '%s' loaded",original)
+ report_zip("loader, file '%s' loaded",original)
end
local s = dfile:read("*all")
dfile:close()
return true, s, #s
elseif trace_locating then
- report_resolvers("zip loader, file '%s' not found",queryname)
+ report_zip("loader, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip loader, unknown archive '%s'",archive)
+ report_zip("loader, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip loader, '%s' not found",original)
+ report_zip("loader, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -12772,7 +12829,7 @@ function resolvers.usezipfile(archive)
if z then
local tree = url.query(specification.query).tree or ""
if trace_locating then
- report_resolvers("zip registering, registering archive '%s'",archive)
+ report_zip("registering, registering archive '%s'",archive)
end
statistics.starttiming(resolvers.instance)
resolvers.prependhash('zip',archive)
@@ -12781,10 +12838,10 @@ function resolvers.usezipfile(archive)
instance.files[archive] = resolvers.registerzipfile(z,tree)
statistics.stoptiming(resolvers.instance)
elseif trace_locating then
- report_resolvers("zip registering, unknown archive '%s'",archive)
+ report_zip("registering, unknown archive '%s'",archive)
end
elseif trace_locating then
- report_resolvers("zip registering, '%s' not found",archive)
+ report_zip("registering, '%s' not found",archive)
end
end
@@ -12796,7 +12853,7 @@ function resolvers.registerzipfile(z,tree)
filter = format("^%s/(.+)/(.-)$",tree)
end
if trace_locating then
- report_resolvers("zip registering, using filter '%s'",filter)
+ report_zip("registering, using filter '%s'",filter)
end
local register, n = resolvers.registerfile, 0
for i in z:files() do
@@ -12813,7 +12870,7 @@ function resolvers.registerzipfile(z,tree)
n = n + 1
end
end
- report_resolvers("zip registering, %s files registered",n)
+ report_zip("registering, %s files registered",n)
return files
end
@@ -12836,7 +12893,7 @@ local find, gsub, format = string.find, string.gsub, string.format
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_trees = logs.new("resolvers","trees")
local resolvers = resolvers
@@ -12874,18 +12931,18 @@ function resolvers.locators.tree(specification)
local name = specification.filename
if name ~= '' and lfs.isdir(name) then
if trace_locating then
- report_resolvers("tree locator '%s' found",name)
+ report_trees("locator '%s' found",name)
end
resolvers.appendhash('tree',name,false) -- don't cache
elseif trace_locating then
- report_resolvers("tree locator '%s' not found",name)
+ report_trees("locator '%s' not found",name)
end
end
function resolvers.hashers.tree(specification)
local name = specification.filename
if trace_locating then
- report_resolvers("analysing tree '%s'",name)
+ report_trees("analysing '%s'",name)
end
resolvers.methodhandler("hashers",name)
end
@@ -12981,7 +13038,7 @@ if not modules then modules = { } end modules ['data-lua'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_libraries = logs.new("resolvers","libraries")
local gsub, insert = string.gsub, table.insert
local unpack = unpack or table.unpack
@@ -13013,7 +13070,7 @@ local function thepath(...)
local t = { ... } t[#t+1] = "?.lua"
local path = file.join(unpack(t))
if trace_locating then
- report_resolvers("! appending '%s' to 'package.path'",path)
+ report_libraries("! appending '%s' to 'package.path'",path)
end
return path
end
@@ -13035,11 +13092,11 @@ local function loaded(libpaths,name,simple)
local libpath = libpaths[i]
local resolved = gsub(libpath,"%?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
+ report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.path': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13048,17 +13105,17 @@ end
package.loaders[2] = function(name) -- was [#package.loaders+1]
if trace_locating then -- mode detail
- report_resolvers("! locating '%s'",name)
+ report_libraries("! locating '%s'",name)
end
for i=1,#libformats do
local format = libformats[i]
local resolved = resolvers.findfile(name,format) or ""
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'libformat path': '%s'",name,format)
+ report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format)
end
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -13081,11 +13138,11 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local path = paths[p]
local resolved = file.join(path,libname)
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'clibformat path': '%s'",libname,path)
+ report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
+ report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
end
return package.loadlib(resolved,name)
end
@@ -13095,28 +13152,28 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local libpath = clibpaths[i]
local resolved = gsub(libpath,"?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
+ report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
end
return package.loadlib(resolved,name)
end
end
-- just in case the distribution is messed up
if trace_loading then -- more detail
- report_resolvers("! checking for '%s' using 'luatexlibs': '%s'",name)
+ report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name)
end
local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or ""
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located by basename via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
if trace_locating then
- report_resolvers('? unable to locate lib: %s',name)
+ report_libraries('? unable to locate lib: %s',name)
end
-- return "unable to locate " .. name
end
@@ -13153,48 +13210,48 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local resolvers = resolvers
-local report_resolvers = logs.new("resolvers")
+local report_scripts = logs.new("resolvers","scripts")
function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix
local scriptpath = "scripts/context/lua"
newname = file.addsuffix(newname,"lua")
local oldscript = resolvers.cleanpath(oldname)
if trace_locating then
- report_resolvers("to be replaced old script %s", oldscript)
+ report_scripts("to be replaced old script %s", oldscript)
end
local newscripts = resolvers.findfiles(newname) or { }
if #newscripts == 0 then
if trace_locating then
- report_resolvers("unable to locate new script")
+ report_scripts("unable to locate new script")
end
else
for i=1,#newscripts do
local newscript = resolvers.cleanpath(newscripts[i])
if trace_locating then
- report_resolvers("checking new script %s", newscript)
+ report_scripts("checking new script %s", newscript)
end
if oldscript == newscript then
if trace_locating then
- report_resolvers("old and new script are the same")
+ report_scripts("old and new script are the same")
end
elseif not find(newscript,scriptpath) then
if trace_locating then
- report_resolvers("new script should come from %s",scriptpath)
+ report_scripts("new script should come from %s",scriptpath)
end
elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then
if trace_locating then
- report_resolvers("invalid new script name")
+ report_scripts("invalid new script name")
end
else
local newdata = io.loaddata(newscript)
if newdata then
if trace_locating then
- report_resolvers("old script content replaced by new content")
+ report_scripts("old script content replaced by new content")
end
io.savedata(oldscript,newdata)
break
elseif trace_locating then
- report_resolvers("unable to load new script")
+ report_scripts("unable to load new script")
end
end
end
@@ -13216,6 +13273,8 @@ if not modules then modules = { } end modules ['data-tmf'] = {
local resolvers = resolvers
+local report_tds = logs.new("resolvers","tds")
+
-- = <<
-- ? ??
-- < +=
@@ -13236,11 +13295,11 @@ function resolvers.load_tree(tree,resolve)
local newpath = file.join(newtree,"bin")
if not lfs.isdir(newtree) then
- logs.simple("no '%s' under tree %s",texos,tree)
+ report_tds("no '%s' under tree %s",texos,tree)
os.exit()
end
if not lfs.isdir(newpath) then
- logs.simple("no '%s/bin' under tree %s",texos,tree)
+ report_tds("no '%s/bin' under tree %s",texos,tree)
os.exit()
end
@@ -13264,9 +13323,9 @@ function resolvers.load_tree(tree,resolve)
setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
- logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
- logs.simple("prepending '%s' to binary path",newpath)
- logs.simple()
+ report_tds("changing from root '%s' to '%s'",oldroot,newroot)
+ report_tds("prepending '%s' to binary path",newpath)
+ report_tds()
end
end
@@ -13291,6 +13350,8 @@ resolvers.listers = resolvers.listers or { }
local resolvers = resolvers
+local report_lists = logs.new("resolvers","lists")
+
local function tabstr(str)
if type(str) == 'table' then
return concat(str," | ")
@@ -13319,11 +13380,11 @@ function resolvers.listers.variables(pattern)
local exp = table.fastcopy(expansions)
for key, value in table.sortedpairs(configured) do
if key ~= "" and (pattern == "" or find(upper(key),pattern)) then
- logs.simple(key)
- logs.simple(" env: %s",tabstr(rawget(environment,key)) or "unset")
- logs.simple(" var: %s",tabstr(configured[key]) or "unset")
- logs.simple(" exp: %s",tabstr(expansions[key]) or "unset")
- logs.simple(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(key)
+ report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
+ report_lists(" var: %s",tabstr(configured[key]) or "unset")
+ report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
+ report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
end
end
instance.environment = table.fastcopy(env)
@@ -13477,6 +13538,8 @@ if not modules then modules = { } end modules ['luat-fmt'] = {
local format = string.format
+local report_format = logs.new("resolvers","formats")
+
-- helper for mtxrun
local quoted = string.quoted
@@ -13501,7 +13564,7 @@ function environment.make_format(name)
if path ~= "" then
lfs.chdir(path)
end
- logs.simple("format path: %s",lfs.currentdir())
+ report_format("format path: %s",lfs.currentdir())
-- check source file
local texsourcename = file.addsuffix(name,"mkiv")
local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
@@ -13510,11 +13573,11 @@ function environment.make_format(name)
fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename == "" then
- logs.simple("no tex source file with name: %s (mkiv or tex)",name)
+ report_format("no tex source file with name: %s (mkiv or tex)",name)
lfs.chdir(olddir)
return
else
- logs.simple("using tex source file: %s",fulltexsourcename)
+ report_format("using tex source file: %s",fulltexsourcename)
end
local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed
-- check specification
@@ -13525,7 +13588,7 @@ function environment.make_format(name)
fullspecificationname = resolvers.findfile(specificationname,"tex") or ""
end
if fullspecificationname == "" then
- logs.simple("unknown stub specification: %s",specificationname)
+ report_format("unknown stub specification: %s",specificationname)
lfs.chdir(olddir)
return
end
@@ -13536,39 +13599,39 @@ function environment.make_format(name)
if type(usedlualibs) == "string" then
usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs)
elseif type(usedlualibs) == "table" then
- logs.simple("using stub specification: %s",fullspecificationname)
+ report_format("using stub specification: %s",fullspecificationname)
local texbasename = file.basename(name)
local luastubname = file.addsuffix(texbasename,"lua")
local lucstubname = file.addsuffix(texbasename,"luc")
-- pack libraries in stub
- logs.simple("creating initialization file: %s",luastubname)
+ report_format("creating initialization file: %s",luastubname)
utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
-- compile stub file (does not save that much as we don't use this stub at startup any more)
local strip = resolvers.booleanvariable("LUACSTRIP", true)
if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- logs.simple("using compiled initialization file: %s",lucstubname)
+ report_format("using compiled initialization file: %s",lucstubname)
usedluastub = lucstubname
else
- logs.simple("using uncompiled initialization file: %s",luastubname)
+ report_format("using uncompiled initialization file: %s",luastubname)
usedluastub = luastubname
end
else
- logs.simple("invalid stub specification: %s",fullspecificationname)
+ report_format("invalid stub specification: %s",fullspecificationname)
lfs.chdir(olddir)
return
end
-- generate format
local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\")
- logs.simple("running command: %s\n",command)
+ report_format("running command: %s\n",command)
os.spawn(command)
-- remove related mem files
local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem"
- -- logs.simple("removing related mplib format with pattern '%s'", pattern)
+ -- report_format("removing related mplib format with pattern '%s'", pattern)
local mp = dir.glob(pattern)
if mp then
for i=1,#mp do
local name = mp[i]
- logs.simple("removing related mplib format %s", file.basename(name))
+ report_format("removing related mplib format %s", file.basename(name))
os.remove(name)
end
end
@@ -13585,7 +13648,7 @@ function environment.run_format(name,data,more)
end
fmtname = resolvers.cleanpath(fmtname)
if fmtname == "" then
- logs.simple("no format with name: %s",name)
+ report_format("no format with name: %s",name)
else
local barename = file.removesuffix(name) -- expanded name
local luaname = file.addsuffix(barename,"luc")
@@ -13593,11 +13656,11 @@ function environment.run_format(name,data,more)
luaname = file.addsuffix(barename,"lua")
end
if not lfs.isfile(luaname) then
- logs.simple("using format name: %s",fmtname)
- logs.simple("no luc/lua with name: %s",barename)
+ report_format("using format name: %s",fmtname)
+ report_format("no luc/lua with name: %s",barename)
else
local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "")
- logs.simple("running command: %s",command)
+ report_format("running command: %s",command)
os.spawn(command)
end
end
@@ -13750,8 +13813,6 @@ if not resolvers then
os.exit()
end
-logs.setprogram('MTXrun',"TDS Runner Tool 1.30")
-
if environment.arguments["verbose"] then
trackers.enable("resolvers.locating")
end
@@ -13764,10 +13825,7 @@ if trackspec then
trackers.enable(trackspec)
end
-runners = runners or { } -- global
-messages = messages or { }
-
-messages.help = [[
+local helpinfo = [[
--script run an mtx script (lua prefered method) (--noquotes), no script gives list
--execute run a script or program (texmfstart method) (--noquotes)
--resolve resolve prefixed arguments
@@ -13819,6 +13877,19 @@ messages.help = [[
--pattern=str filter variables
]]
+local application = logs.application {
+ name = "mtxrun",
+ banner = "ConTeXt TDS Runner Tool 1.30",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
+local verbose = environment.argument("verbose")
+
+messages = messages or { } -- for the mo
+
+runners = runners or { } -- global
runners.applications = {
["lua"] = "luatex --luaonly",
@@ -13872,17 +13943,16 @@ end
function runners.prepare()
local checkname = environment.argument("ifchanged")
- local verbose = environment.argument("verbose")
if type(checkname) == "string" and checkname ~= "" then
local oldchecksum = file.loadchecksum(checkname)
local newchecksum = file.checksum(checkname)
if oldchecksum == newchecksum then
if verbose then
- logs.simple("file '%s' is unchanged",checkname)
+ report("file '%s' is unchanged",checkname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is changed, processing started",checkname)
+ report("file '%s' is changed, processing started",checkname)
end
file.savechecksum(checkname)
end
@@ -13892,17 +13962,17 @@ function runners.prepare()
if oldname and newname and oldname ~= "" and newname ~= "" then
if not file.needs_updating(oldname,newname) then
if verbose then
- logs.simple("file '%s' and '%s' have same age",oldname,newname)
+ report("file '%s' and '%s' have same age",oldname,newname)
end
return "skip"
elseif verbose then
- logs.simple("file '%s' is older than '%s'",oldname,newname)
+ report("file '%s' is older than '%s'",oldname,newname)
end
end
end
local runpath = environment.argument("path")
if type(runpath) == "string" and not lfs.chdir(runpath) then
- logs.simple("unable to change to path '%s'",runpath)
+ report("unable to change to path '%s'",runpath)
return "error"
end
runners.prepare = function() end
@@ -13961,11 +14031,11 @@ function runners.execute_script(fullname,internal,nosplit)
result = binary .. " " .. result
end
local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote)
- if logs.verbose then
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ if verbose then
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
end
-- no os.exec because otherwise we get the wrong return value
@@ -13980,9 +14050,9 @@ function runners.execute_script(fullname,internal,nosplit)
return false
end
end
- logs.simpleline()
- logs.simple("This script needs '%s' which seems not to be installed.",binary)
- logs.simpleline()
+ report()
+ report("This script needs '%s' which seems not to be installed.",binary)
+ report()
end
return false
end
@@ -14007,10 +14077,10 @@ function runners.execute_program(fullname)
environment.initializearguments(after)
fullname = fullname:gsub("^bin:","")
local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "")
- logs.simpleline()
- logs.simple("executing: %s",command)
- logs.simpleline()
- logs.simpleline()
+ report()
+ report("executing: %s",command)
+ report()
+ report()
io.flush()
local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn
return code == 0
@@ -14042,18 +14112,18 @@ function runners.handle_stubs(create)
if create then
if windows then
io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name))
- logs.simple("windows stub for '%s' created",base)
+ report("windows stub for '%s' created",base)
end
if unix then
io.savedata(file.join(stubpath,base),string.format(unix_stub,name))
- logs.simple("unix stub for '%s' created",base)
+ report("unix stub for '%s' created",base)
end
else
if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then
- logs.simple("windows stub for '%s' removed", base)
+ report("windows stub for '%s' removed", base)
end
if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then
- logs.simple("unix stub for '%s' removed",base)
+ report("unix stub for '%s' removed",base)
end
end
end
@@ -14078,12 +14148,12 @@ function runners.locate_platform()
end
function runners.report_location(result)
- if logs.verbose then
- logs.simpleline()
+ if verbose then
+ reportline()
if result and result ~= "" then
- logs.simple(result)
+ report(result)
else
- logs.simple("not found")
+ report("not found")
end
else
io.write(result)
@@ -14095,11 +14165,11 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
local rest = resolvers.resolve(filename)
if rest ~= "" then
local command = editor .. " " .. rest
- if logs.verbose then
- logs.simpleline()
- logs.simple("starting editor: %s",command)
- logs.simple_line()
- logs.simple_line()
+ if verbose then
+ report()
+ report("starting editor: %s",command)
+ report()
+ report()
end
os.launch(command)
end
@@ -14148,7 +14218,7 @@ function runners.launch_file(filename)
pattern = filename
end
if not pattern or pattern == "" then
- logs.simple("provide name or --pattern=")
+ report("provide name or --pattern=")
else
local t = resolvers.findfiles(pattern)
if not t or #t == 0 then
@@ -14160,15 +14230,15 @@ function runners.launch_file(filename)
if t and #t > 0 then
if environment.arguments["all"] then
for _, v in pairs(t) do
- logs.simple("launching %s", v)
+ report("launching %s", v)
resolvers.launch(v)
end
else
- logs.simple("launching %s", t[1])
+ report("launching %s", t[1])
resolvers.launch(t[1])
end
else
- logs.simple("no match for %s", pattern)
+ report("no match for %s", pattern)
end
end
end
@@ -14239,7 +14309,7 @@ function runners.execute_ctx_script(filename,...)
local fullname = runners.find_mtx_script(filename) or ""
if file.extname(fullname) == "cld" then
-- handy in editors where we force --autopdf
- logs.simple("running cld script: %s",filename)
+ report("running cld script: %s",filename)
table.insert(arguments,1,fullname)
table.insert(arguments,"--autopdf")
fullname = runners.find_mtx_script("context") or ""
@@ -14270,8 +14340,8 @@ function runners.execute_ctx_script(filename,...)
runners.load_script_session(loadname)
end
filename = environment.files[1]
- if logs.verbose then
- logs.simple("using script: %s\n",fullname)
+ if verbose then
+ report("using script: %s\n",fullname)
end
environment.ownscript = fullname
dofile(fullname)
@@ -14306,24 +14376,23 @@ function runners.execute_ctx_script(filename,...)
end
end
if #valid > 0 then
- logs.reportbanner()
- logs.reportline()
- logs.simple("no script name given, known scripts:")
- logs.simple()
+ application.identify()
+ report("no script name given, known scripts:")
+ report()
for k=1,#valid do
local v = valid[k]
- logs.simple("%-12s %4s %s",v[1],v[2],v[3])
+ report("%-12s %4s %s",v[1],v[2],v[3])
end
end
else
- logs.simple("no script name given")
+ report("no script name given")
end
else
filename = file.addsuffix(filename,"lua")
if file.is_qualified_path(filename) then
- logs.simple("unknown script '%s'",filename)
+ report("unknown script '%s'",filename)
else
- logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename)
+ report("unknown script '%s' or 'mtx-%s'",filename,filename)
end
end
return false
@@ -14331,9 +14400,9 @@ function runners.execute_ctx_script(filename,...)
end
function runners.prefixes()
- logs.reportbanner()
- logs.reportline()
- logs.simple(table.concat(resolvers.allprefixes(true)," "))
+ application.identify()
+ report()
+ report(table.concat(resolvers.allprefixes(true)," "))
end
function runners.timedrun(filename) -- just for me
@@ -14385,7 +14454,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk
local t = os.clock()
local k = kpse.original.new("luatex",progname)
local dummy = k:find_file("mtxrun.lua") -- so that we're initialized
- logs.simple("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
+ report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t)
kpse_initialized = function() return k end
return k
end
@@ -14432,11 +14501,11 @@ else
function runners.loadbase(...)
if not resolvers.load(...) then
- logs.simple("forcing cache reload")
+ report("forcing cache reload")
instance.renewcache = true
trackers.enable("resolvers.locating")
if not resolvers.load(...) then
- logs.simple("the resolver databases are not present or outdated")
+ report("the resolver databases are not present or outdated")
end
end
end
@@ -14595,8 +14664,8 @@ elseif environment.argument("find-path") then
resolvers.load()
local path = resolvers.findpath(filename, instance.my_format)
- if logs.verbose then
- logs.simple(path)
+ if verbose then
+ report(path)
else
print(path)
end
@@ -14651,7 +14720,7 @@ elseif environment.argument("format-path") then
-- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename)
resolvers.load()
- logs.simple(caches.getwritablepath("format"))
+ report(caches.getwritablepath("format"))
elseif environment.argument("pattern") then
@@ -14695,7 +14764,7 @@ elseif environment.argument("help") and filename=='base' then
elseif environment.argument("help") or filename=='help' or filename == "" then
- logs.help(messages.help)
+ application.help()
elseif filename:find("^bin:") then
@@ -14729,9 +14798,9 @@ else
end
-if logs.verbose then
- logs.simpleline()
- logs.simple("runtime: %0.3f seconds",os.runtime())
+if verbose then
+ report()
+ report("runtime: %0.3f seconds",os.runtime())
end
if os.type ~= "windows" then
diff --git a/tex/context/base/attr-col.lua b/tex/context/base/attr-col.lua
index d4f1c1198..451cf0ee1 100644
--- a/tex/context/base/attr-col.lua
+++ b/tex/context/base/attr-col.lua
@@ -15,9 +15,9 @@ local concat = table.concat
local allocate = utilities.storage.allocate
-local report_attributes = logs.new("attributes")
-local report_colors = logs.new("colors")
-local report_transparencies = logs.new("transparencies")
+local report_attributes = logs.new("attributes","colors")
+local report_colors = logs.new("colors","support")
+local report_transparencies = logs.new("transparencies","support")
local attributes, nodes = attributes, nodes
diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv
index 5de366ed9..e2952166a 100644
--- a/tex/context/base/attr-ini.mkiv
+++ b/tex/context/base/attr-ini.mkiv
@@ -44,7 +44,7 @@
\expandafter\newconstant \csname :attr:#1\endcsname
\csname :attr:#1\endcsname\lastallocatedattribute
\ctxcommand{defineattribute("#1",\number\lastallocatedattribute)}%
- %\writestatus\m!systems{defining attribute #1 with number \number\lastallocatedattribute}%
+ %\writestatus\m!system{defining attribute #1 with number \number\lastallocatedattribute}%
\doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}%
\doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}}
@@ -56,7 +56,7 @@
\expandafter\attributedef\csname @attr@#1\endcsname\scratchcounter
\expandafter\newconstant \csname :attr:#1\endcsname
\csname :attr:#1\endcsname\scratchcounter
- %\writestatus\m!systems{defining system attribute #1 with number \number\scratchcounter}%
+ %\writestatus\m!system{defining system attribute #1 with number \number\scratchcounter}%
\doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}%
\doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}}
diff --git a/tex/context/base/attr-lay.lua b/tex/context/base/attr-lay.lua
index 1c13762c4..949c9dbe8 100644
--- a/tex/context/base/attr-lay.lua
+++ b/tex/context/base/attr-lay.lua
@@ -77,7 +77,7 @@ local function reviver(data,n)
data[n] = d
return d
else
- logs.report("viewerlayers","error, unknown reference '%s'",tostring(n))
+ report_viewerlayers("error, unknown reference '%s'",tostring(n))
end
end
end
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index 56eea251b..8c01e365c 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -50,7 +50,7 @@ local trace_tree = false trackers.register ("structures.export.showtree",
local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end)
local page_breaks = false directives.register("structures.export.pagebreaks", function(v) page_breaks = v end)
-local report_export = logs.new("export")
+local report_export = logs.new("backend","export")
local nodes = nodes
local attributes = attributes
diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua
index 10f908798..3cbfb9a30 100644
--- a/tex/context/base/back-ini.lua
+++ b/tex/context/base/back-ini.lua
@@ -14,7 +14,7 @@ local backends = backends
local trace_backend = false trackers.register("backend.initializers", function(v) trace_finalizers = v end)
-local report_backends = logs.new("backends")
+local report_backend = logs.new("backend","initializing")
local function nothing() return nil end
@@ -158,7 +158,7 @@ function backends.install(what)
local backend = backends[what]
if backend then
if trace_backend then
- report_backends("initializing backend %s (%s)",what,backend.comment or "no comment")
+ report_backend("initializing backend %s (%s)",what,backend.comment or "no comment")
end
backends.current = what
for _, category in next, { "nodeinjections", "codeinjections", "registrations", "tables" } do
@@ -168,28 +168,28 @@ function backends.install(what)
for name, meaning in next, whereto do
if plugin[name] then
whereto[name] = plugin[name]
- -- report_backends("installing function %s in category %s of %s",name,category,what)
+ -- report_backend("installing function %s in category %s of %s",name,category,what)
elseif trace_backend then
- report_backends("no function %s in category %s of %s",name,category,what)
+ report_backend("no function %s in category %s of %s",name,category,what)
end
end
elseif trace_backend then
- report_backends("no category %s in %s",category,what)
+ report_backend("no category %s in %s",category,what)
end
-- extra checks
for k, v in next, whereto do
if not plugin[k] then
- report_backends("entry %s in %s is not set",k,category)
+ report_backend("entry %s in %s is not set",k,category)
end
end
for k, v in next, plugin do
if not whereto[k] then
- report_backends("entry %s in %s is not used",k,category)
+ report_backend("entry %s in %s is not used",k,category)
end
end
end
elseif trace_backend then
- report_backends("no backend named %s",what)
+ report_backend("no backend named %s",what)
end
end
end
diff --git a/tex/context/base/bibl-bib.lua b/tex/context/base/bibl-bib.lua
index f301d9689..518518b42 100644
--- a/tex/context/base/bibl-bib.lua
+++ b/tex/context/base/bibl-bib.lua
@@ -27,7 +27,7 @@ local P, R, S, C, Cc, Cs, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs,
local trace_bibxml = false trackers.register("publications.bibxml", function(v) trace_bibtex = v end)
-local report_publications = logs.new("publications")
+local report_xml = logs.new("publications","xml")
bibtex = bibtex or { }
local bibtex = bibtex
@@ -144,9 +144,9 @@ function bibtex.load(session,filename)
if filename ~= "" then
local data = io.loaddata(filename) or ""
if data == "" then
- report_publications("empty file '%s', no conversion to xml",filename)
+ report_xml("empty file '%s', no conversion to xml",filename)
elseif trace_bibxml then
- report_publications("converting file '%s' to xml",filename)
+ report_xml("converting file '%s' to xml",filename)
end
bibtex.convert(session,data)
end
diff --git a/tex/context/base/bibl-tra.lua b/tex/context/base/bibl-tra.lua
index 3e16e050d..6b44d1b67 100644
--- a/tex/context/base/bibl-tra.lua
+++ b/tex/context/base/bibl-tra.lua
@@ -17,7 +17,7 @@ local variables, constants = interfaces.variables, interfaces.constants
local trace_bibtex = false trackers.register("publications.bibtex", function(v) trace_bibtex = v end)
-local report_publications = logs.new("publications")
+local report_tex = logs.new("publications","tex")
local context, structures = context, structures
@@ -41,7 +41,7 @@ function hacks.process(settings)
interfaces.showmessage("publications",3)
io.savedata(file.addsuffix(jobname,"aux"),format(template,style,database))
if trace_bibtex then
- report_publications("processing bibtex file '%s'",jobname)
+ report_tex("processing bibtex file '%s'",jobname)
end
os.execute(format("bibtex %s",jobname))
-- purge 'm
@@ -50,7 +50,7 @@ end
function hacks.register(str)
if trace_bibtex then
- report_publications("registering bibtex entry '%s'",str)
+ report_tex("registering bibtex entry '%s'",str)
end
registered[#registered+1] = str
ordered[str] = #registered
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index de5a880e3..be602d0a0 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['buff-ini'] = {
local trace_run = false trackers.register("buffers.run", function(v) trace_run = v end)
local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
-local report_buffers = logs.new("buffers")
+local report_buffers = logs.new("buffers","usage")
local concat = table.concat
local type, next = type, next
@@ -162,12 +162,12 @@ function commands.runbuffer(name,list,encapsulate)
local data = io.loaddata(name)
if data ~= content then
if trace_run then
- commands.writestatus("buffers","changes in '%s', processing forced",name)
+ report_buffers("changes in '%s', processing forced",name)
end
io.savedata(name,content)
os.execute(format(command,name))
elseif trace_run then
- commands.writestatus("buffers","no changes in '%s', not processed",name)
+ report_buffers("no changes in '%s', not processed",name)
end
end
diff --git a/tex/context/base/buff-par.lua b/tex/context/base/buff-par.lua
index 763d3481d..aa4841d8a 100644
--- a/tex/context/base/buff-par.lua
+++ b/tex/context/base/buff-par.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['buff-ini'] = {
local trace_parallel = false trackers.register("buffers.parallel", function(v) trace_parallel = v end)
-local report_parallel = logs.new("parallel")
+local report_parallel = logs.new("buffers","parallel")
local insert, remove, find, gmatch = table.insert, table.remove, string.find, string.gmatch
local strip, format = string.strip, string.format
diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua
index 9c7f6e371..a8721f6ec 100644
--- a/tex/context/base/buff-ver.lua
+++ b/tex/context/base/buff-ver.lua
@@ -22,7 +22,7 @@ local settings_to_array = utilities.parsers.settings_to_array
local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
-local report_buffers = logs.new("buffers")
+local report_visualizers = logs.new("buffers","visualizers")
visualizers = visualizers or { }
@@ -160,7 +160,7 @@ function visualizers.newgrammar(name,t)
g = g and g.grammar
if g then
if trace_visualize then
- report_buffers("cloning grammar '%s'",name)
+ report_visualizers("cloning grammar '%s'",name)
end
for k,v in next, g do
if not t[k] then
@@ -179,12 +179,12 @@ local function getvisualizer(method,nature)
local m = specifications[method] or specifications.default
if nature then
if trace_visualize then
- report_buffers("getting visualizer '%s' with nature '%s'",method,nature)
+ report_visualizers("getting visualizer '%s' with nature '%s'",method,nature)
end
return m and (m[nature] or m.parser) or nil
else
if trace_visualize then
- report_buffers("getting visualizer '%s'",method)
+ report_visualizers("getting visualizer '%s'",method)
end
return m and m.parser or nil
end
@@ -194,7 +194,7 @@ local fallback = context.verbatim
local function makepattern(visualizer,kind,pattern)
if not pattern then
- logs.simple("error in visualizer: %s",kind)
+ report_visualizers("error in visualizer: %s",kind)
return patterns.alwaystrue
else
if type(visualizer) == "table" and type(kind) == "string" then
@@ -233,11 +233,11 @@ function visualizers.load(name)
end
if texname == "" or luaname == "" then
if trace_visualize then
- report_buffers("unknown visualizer '%s'",name)
+ report_visualizers("unknown visualizer '%s'",name)
end
else
if trace_visualize then
- report_buffers("loading visualizer '%s'",name)
+ report_visualizers("loading visualizer '%s'",name)
end
lua.registercode(luaname)
context.input(texname)
@@ -255,7 +255,7 @@ end
function visualizers.register(name,specification)
name = lower(name)
if trace_visualize then
- report_buffers("registering visualizer '%s'",name)
+ report_visualizers("registering visualizer '%s'",name)
end
specifications[name] = specification
local parser, handler = specification.parser, specification.handler
@@ -345,7 +345,7 @@ function visualizers.registerescapepattern(name,before,after,normalmethod,escape
local escapepattern = escapepatterns[name]
if not escapepattern then
if trace_visualize then
- report_buffers("registering escape pattern, name: '%s', before: '%s', after: '%s'",name,before,after)
+ report_visualizers("registering escape pattern, name: '%s', before: '%s', after: '%s'",name,before,after)
end
before, after = P(before) * space_pattern, space_pattern * P(after)
escapepattern = (
@@ -363,7 +363,7 @@ function visualizers.registerescapecommand(name,token,normalmethod,escapecommand
local escapepattern = escapepatterns[name]
if not escapepattern then
if trace_visualize then
- report_buffers("registering escape token, name: '%s', token: '%s'",name,token)
+ report_visualizers("registering escape token, name: '%s', token: '%s'",name,token)
end
token = P(token)
local notoken = hack((1 - token)^1)
@@ -417,12 +417,12 @@ local function visualize(content,settings) -- maybe also method in settings
local n = m and m[nature]
if n then
if trace_visualize then
- report_buffers("visualize using method '%s' and nature '%s'",method,nature)
+ report_visualizers("visualize using method '%s' and nature '%s'",method,nature)
end
n(content,settings)
else
if trace_visualize then
- report_buffers("visualize using method '%s'",method)
+ report_visualizers("visualize using method '%s'",method)
end
fallback(content,1,settings)
end
@@ -652,7 +652,6 @@ function commands.typefile(settings)
if str and str ~= "" then
local regime = settings.regime
if regime and regime ~= "" then
- regimes.load(regime)
str = regimes.translate(str,regime)
end
if str and str~= "" then
diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv
index 1f8a46808..67ba25173 100644
--- a/tex/context/base/char-ini.mkiv
+++ b/tex/context/base/char-ini.mkiv
@@ -21,6 +21,20 @@
\unprotect
+% ¨äëïöüÿ
+% ´áćéíĺńóŕśúýź
+% ˙ċėġiż
+% ¯āēīōū
+% ˝őű
+% ˆâĉêĝĥîĵôŝûŵŷ
+% `àèìòùỳ
+% ¸çķļņŗşţ
+% ˛ąęįų
+% ˚åů
+% ˘ăĕğĭŏŭ
+% ˇčďěľňřšťž
+% ˜ãĩñõũ
+
% \def\checkedchar#1% #2%
% {\relax\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}}
%
diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua
index 42333a65f..5d84bc9fa 100644
--- a/tex/context/base/cldf-ini.lua
+++ b/tex/context/base/cldf-ini.lua
@@ -50,8 +50,8 @@ local xmlcatcodes = tex.xmlcatcodes
local flush = texsprint
-local report_context = logs.new("context") -- here
-local report_cld = logs.new("cld")
+local report_context = logs.new("cld","tex")
+local report_cld = logs.new("cld","stack")
local processlines = true -- experiments.register("context.processlines", function(v) processlines = v end)
diff --git a/tex/context/base/colo-icc.lua b/tex/context/base/colo-icc.lua
index fb2f83983..4687bfe3f 100644
--- a/tex/context/base/colo-icc.lua
+++ b/tex/context/base/colo-icc.lua
@@ -11,6 +11,8 @@ local readstring, readnumber = io.readstring, io.readnumber
local colors = attributes and attributes.colors or { } -- when used in mtxrun
+local report_colors = logs.new("colors","icc")
+
local R, Cs, lpegmatch = lpeg.R, lpeg.Cs, lpeg.match
local invalid = R(char(0)..char(31))
@@ -97,7 +99,7 @@ function colors.iccprofile(filename,verbose)
}
else
if verbose then
- logs.simple("ignoring tag '%s' or type '%s' in profile '%s'",tag,kind,fullname)
+ report_colors("ignoring tag '%s' or type '%s' in profile '%s'",tag,kind,fullname)
end
tags[tag] = nil
end
diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua
index 6f4c73336..eed68d4c6 100644
--- a/tex/context/base/colo-ini.lua
+++ b/tex/context/base/colo-ini.lua
@@ -14,7 +14,7 @@ local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local trace_define = false trackers.register("colors.define",function(v) trace_define = v end)
-local report_colors = logs.new("colors")
+local report_colors = logs.new("colors","defining")
local attributes, context, commands = attributes, context, commands
@@ -39,12 +39,12 @@ local function definecolor(name, ca, global)
if ca and ca > 0 then
if global then
if trace_define then
- commands.writestatus("color","define global color '%s' with attribute: %s",name,ca)
+ report_colors("define global color '%s' with attribute: %s",name,ca)
end
context.colordefagc(name,ca)
else
if trace_define then
- commands.writestatus("color","define local color '%s' with attribute: %s",name,ca)
+ report_colors("define local color '%s' with attribute: %s",name,ca)
end
context.colordefalc(name,ca)
end
@@ -61,12 +61,12 @@ local function inheritcolor(name, ca, global)
if ca and ca ~= "" then
if global then
if trace_define then
- commands.writestatus("color","inherit global color '%s' with attribute: %s",name,ca)
+ report_colors("inherit global color '%s' with attribute: %s",name,ca)
end
context.colordeffgc(name,ca) -- some day we will set the macro directly
else
if trace_define then
- commands.writestatus("color","inherit local color '%s' with attribute: %s",name,ca)
+ report_colors("inherit local color '%s' with attribute: %s",name,ca)
end
context.colordefflc(name,ca)
end
@@ -83,12 +83,12 @@ local function definetransparent(name, ta, global)
if ta and ta > 0 then
if global then
if trace_define then
- commands.writestatus("color","define global transparency '%s' with attribute: %s",name,ta)
+ report_colors("define global transparency '%s' with attribute: %s",name,ta)
end
context.colordefagt(name,ta)
else
if trace_define then
- commands.writestatus("color","define local transparency '%s' with attribute: %s",name,ta)
+ report_colors("define local transparency '%s' with attribute: %s",name,ta)
end
context.colordefalt(name,ta)
end
@@ -105,12 +105,12 @@ local function inherittransparent(name, ta, global)
if ta and ta ~= "" then
if global then
if trace_define then
- commands.writestatus("color","inherit global transparency '%s' with attribute: %s",name,ta)
+ report_colors("inherit global transparency '%s' with attribute: %s",name,ta)
end
context.colordeffgt(name,ta)
else
if trace_define then
- commands.writestatus("color","inherit local transparency '%s' with attribute: %s",name,ta)
+ report_colors("inherit local transparency '%s' with attribute: %s",name,ta)
end
context.colordefflt(name,ta)
end
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index be1fb6c3e..a136dc695 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.05 11:37}
+\newcontextversion{2011.02.08 10:06}
%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 89a3b364f..d14bf8c28 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.05 11:37}
+\newcontextversion{2011.02.08 10:06}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
@@ -19,7 +19,7 @@
\unprotect
-\writestatus\m!systems{beware: some patches loaded from cont-new.mkiv}
+\writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
\def\fastscale#1%
@@ -581,8 +581,6 @@
%
% \setbreakpoints[compound]
-% \ctxlua{logs.report = commands.writereport} % this will become default
-
% till we fixed all styles:
\let\\=\crlf
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index be404ddf3..54f284089 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.05 11:37}
+\edef\contextversion{2011.02.08 10:06}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 7eba6d64e..a735801c0 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.05 11:37}
+\edef\contextversion{2011.02.08 10:06}
%D For those who want to use this:
diff --git a/tex/context/base/core-ctx.lua b/tex/context/base/core-ctx.lua
index 111c125da..b6ea7e66b 100644
--- a/tex/context/base/core-ctx.lua
+++ b/tex/context/base/core-ctx.lua
@@ -6,7 +6,9 @@ if not modules then modules = { } end modules ['core-ctx'] = {
license = "see context related readme files"
}
-local trace_prepfiles = false trackers.register("resolvers.prepfiles", function(v) trace_prepfiles = v end)
+local trace_prepfiles = false trackers.register("system.prepfiles", function(v) trace_prepfiles = v end)
+
+local report_prepfiles = logs.new("system","prepfiles")
commands = commands or { }
local commands = commands
@@ -21,9 +23,9 @@ function commands.loadctxpreplist()
islocal = xml.found(x,"ctx:preplist[@local=='yes']")
--~ if trace_prepfiles then
if islocal then
- commands.writestatus("systems","loading ctx log file (local)") -- todo: m!systems
+ report_prepfiles("loading ctx log file (local)") -- todo: m!systems
else
- commands.writestatus("systems","loading ctx log file (specified)") -- todo: m!systems
+ report_prepfiles("loading ctx log file (specified)") -- todo: m!systems
end
--~ end
for e in xml.collected(x,"ctx:prepfile") do
@@ -33,7 +35,7 @@ function commands.loadctxpreplist()
end
local done = e.at['done'] or 'no'
if trace_prepfiles then
- commands.writestatus("systems","registering %s -> %s",done)
+ report_prepfiles("registering %s -> %s",done)
end
found = true
list[name] = done -- 'yes' or 'no'
@@ -48,7 +50,7 @@ local function found(name) -- used in resolve
local prepname = name .. "." .. suffix
if list[name] and lfs.isfile(prepname) then
if trace_prepfiles then
- commands.writestatus("systems", "preprocessing: using %s",prepname)
+ report_prepfiles("preprocessing: using %s",prepname)
end
return prepname
end
diff --git a/tex/context/base/core-fil.mkiv b/tex/context/base/core-fil.mkiv
index 4ab78f082..263030a9b 100644
--- a/tex/context/base/core-fil.mkiv
+++ b/tex/context/base/core-fil.mkiv
@@ -217,7 +217,7 @@
\stopreadingfile
\doglobal\setflag{#2}}%
\ifx#1\undefined
- \writestatus\m!systems{command \string#1 not found in file #2}%
+ \writestatus\m!system{command \string#1 not found in file #2}%
\gdef#1{{\infofont[unknown command \string#1]}}%
\fi
#1}
diff --git a/tex/context/base/core-job.lua b/tex/context/base/core-job.lua
index abbbf4e5e..07ff5259e 100644
--- a/tex/context/base/core-job.lua
+++ b/tex/context/base/core-job.lua
@@ -19,6 +19,8 @@ resolvers.maxreadlevel = 3
directives.register("resolvers.maxreadlevel", function(v) resolvers.maxreadlevel = tonumber(v) or resolvers.maxreadlevel end)
+local report_examodes = logs.new("system","examodes") -- maybe another category
+
local function exists(n)
if io.exists(n) then
return n
@@ -121,10 +123,10 @@ function commands.loadexamodes(filename)
end
filename = resolvers.findfile(file.addsuffix(filename,'ctm')) or ""
if filename ~= "" then
- commands.writestatus("examodes","loading %s",filename) -- todo: message system
+ report_examodes("loading %s",filename) -- todo: message system
convertexamodes(io.loaddata(filename))
else
- commands.writestatus("examodes","no mode file %s",filename) -- todo: message system
+ report_examodes("no mode file %s",filename) -- todo: message system
end
end
diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv
index 200bc9be3..28a864655 100644
--- a/tex/context/base/core-job.mkiv
+++ b/tex/context/base/core-job.mkiv
@@ -62,10 +62,10 @@
\def\doloadexamodes [#1]{\ctxcommand{loadexamodes("#1")}}
\def\registerfileinfo[#1#2]#3% geen \showmessage ?
- {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}}
+ {\writestatus\m!system{#1#2 file #3 at line \the\inputlineno}}
\def\doloadsystemfile#1% only mkiv files
- {\readsysfile{#1.\mksuffix}{\showmessage\m!systems2{#1.\mksuffix}}\donothing}
+ {\readsysfile{#1.\mksuffix}{\showmessage\m!system2{#1.\mksuffix}}\donothing}
\def\loadsystemfiles
{\doloadsystemfile\f!newfilename % new code, to be integrated at some point, plus fixes posted on the list
@@ -77,9 +77,9 @@
\def\loadoptionfile % todo : mark document.* tables as storage
{\readjobfile{\jobname.\f!optionextension}
- {\showmessage\m!systems2{\jobname.\f!optionextension}%
+ {\writestatus\m!system{\jobname.\f!optionextension\space loaded}%
\ctxcommand{logoptionfile("\jobname.\f!optionextension")}}%
- {\writestatus\m!systems {no \jobname.\f!optionextension}}}
+ {\writestatus\m!system{no \jobname.\f!optionextension}}}
% Most natural ...
%
@@ -119,7 +119,7 @@
\fi}
\def\forcequitjob#1%
- {\writestatus\m!systems{forcing quit: #1}%
+ {\writestatus\m!system{forcing quit: #1}%
\batchmode
\dorecurse\textlevel{\stoptext}
\normalend}
@@ -129,7 +129,7 @@
\def\autostarttext
{\ifcase\textlevel
\starttext
- \writestatus\m!systems{auto \string\starttext..\string\stoptext}%
+ \writestatus\m!system{auto \string\starttext..\string\stoptext}%
\let\autostoptext\stoptext
\fi}
@@ -146,7 +146,7 @@
\let\end\finalend
\def\emergencyend
- {\writestatus\m!systems{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}%
+ {\writestatus\m!system{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}%
\stoptext}
\def\currentfile{\inputfilename}
diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv
index 98f245e0d..2214d77c1 100644
--- a/tex/context/base/core-mis.mkiv
+++ b/tex/context/base/core-mis.mkiv
@@ -21,7 +21,7 @@
% %D
% %D Obsolete now:
% %
-% % \def\documentstyle{\showmessage\m!systems3\empty\stoptekst}
+% % \def\documentstyle{\showmessage\m!system3\empty\stoptekst}
% %
% % \let\documentclass=\documentstyle
% %D \macros
diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv
index ec10fa1fa..f61cabec3 100644
--- a/tex/context/base/core-sys.mkiv
+++ b/tex/context/base/core-sys.mkiv
@@ -142,7 +142,7 @@
\s!default=>\getnewrandomseed\scratchcounter,
\s!unknown=>\scratchcounter#1]%
\expanded{\setrandomseed{\the\scratchcounter}}%
- % \writestatus\m!systems{randomseed: \the\scratchcounter}%
+ % \writestatus\m!system{randomseed: \the\scratchcounter}%
\egroup}}
\setupsystem
@@ -294,7 +294,7 @@
\def\complexdefine[#1]#2#3%
{\ifx#2\undefined
\else
- \showmessage\m!systems4{\string#2}%
+ \showmessage\m!system4{\string#2}%
\fi
\ifcase0#1\def#2{#3}%
\or\def#2##1{#3}%
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua
index 88afb35a9..f302d6051 100644
--- a/tex/context/base/core-uti.lua
+++ b/tex/context/base/core-uti.lua
@@ -78,20 +78,22 @@ if not checksums.new then checksums.new = md5.HEX("new") end -- used in experime
job.register('job.variables.checksums', checksums)
+local rmethod, rvalue
+
local function initializer()
tobesaved = mark(jobvariables.tobesaved)
collected = mark(jobvariables.collected)
checksums = mark(jobvariables.checksums)
- local r = collected.randomseed
- if not r then
- r = math.random()
- math.setrandomseedi(r,"initialize")
- report_jobcontrol("initializing randomizer with %s",r)
+ rvalue = collected.randomseed
+ if not rvalue then
+ rvalue = math.random()
+ math.setrandomseedi(rvalue,"initialize")
+ rmethod = "initialized"
else
- math.setrandomseedi(r,"previous run")
- report_jobcontrol("resuming randomizer with %s",r)
+ math.setrandomseedi(rvalue,"previous run")
+ rmethod = "resumed"
end
- tobesaved.randomseed = r
+ tobesaved.randomseed = rvalue
for cs, value in next, collected do
context.setxvalue(cs,value)
end
@@ -199,6 +201,12 @@ statistics.register("callbacks", function()
end
end)
+statistics.register("randomizer", function()
+ if rmethod and rvalue then
+ return format("%s with value %s",rmethod,rvalue)
+ end
+end)
+
function statistics.formatruntime(runtime)
local shipped = tex.count['nofshipouts']
local pages = tex.count['realpageno'] - 1
diff --git a/tex/context/base/data-aux.lua b/tex/context/base/data-aux.lua
index 0a80e04ce..480005a45 100644
--- a/tex/context/base/data-aux.lua
+++ b/tex/context/base/data-aux.lua
@@ -13,48 +13,48 @@ local trace_locating = false trackers.register("resolvers.locating", function(v
local resolvers = resolvers
-local report_resolvers = logs.new("resolvers")
+local report_scripts = logs.new("resolvers","scripts")
function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix
local scriptpath = "scripts/context/lua"
newname = file.addsuffix(newname,"lua")
local oldscript = resolvers.cleanpath(oldname)
if trace_locating then
- report_resolvers("to be replaced old script %s", oldscript)
+ report_scripts("to be replaced old script %s", oldscript)
end
local newscripts = resolvers.findfiles(newname) or { }
if #newscripts == 0 then
if trace_locating then
- report_resolvers("unable to locate new script")
+ report_scripts("unable to locate new script")
end
else
for i=1,#newscripts do
local newscript = resolvers.cleanpath(newscripts[i])
if trace_locating then
- report_resolvers("checking new script %s", newscript)
+ report_scripts("checking new script %s", newscript)
end
if oldscript == newscript then
if trace_locating then
- report_resolvers("old and new script are the same")
+ report_scripts("old and new script are the same")
end
elseif not find(newscript,scriptpath) then
if trace_locating then
- report_resolvers("new script should come from %s",scriptpath)
+ report_scripts("new script should come from %s",scriptpath)
end
elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then
if trace_locating then
- report_resolvers("invalid new script name")
+ report_scripts("invalid new script name")
end
else
local newdata = io.loaddata(newscript)
if newdata then
if trace_locating then
- report_resolvers("old script content replaced by new content")
+ report_scripts("old script content replaced by new content")
end
io.savedata(oldscript,newdata)
break
elseif trace_locating then
- report_resolvers("unable to load new script")
+ report_scripts("unable to load new script")
end
end
end
diff --git a/tex/context/base/data-con.lua b/tex/context/base/data-con.lua
index 5d9650f8e..673361d74 100644
--- a/tex/context/base/data-con.lua
+++ b/tex/context/base/data-con.lua
@@ -29,11 +29,11 @@ containers = containers or { }
local containers = containers
containers.usecache = true
-local report_cache = logs.new("cache")
+local report_containers = logs.new("resolvers","containers")
local function report(container,tag,name)
if trace_cache or trace_containers then
- report_cache("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
+ report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid')
end
end
diff --git a/tex/context/base/data-ctx.lua b/tex/context/base/data-ctx.lua
index 1bb3f9e71..6b9dc23ab 100644
--- a/tex/context/base/data-ctx.lua
+++ b/tex/context/base/data-ctx.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['data-ctx'] = {
local format = string.format
-local report_resolvers = logs.new("resolvers")
+local report_dump = logs.new("resolvers","dump")
local resolvers = resolvers
@@ -36,7 +36,7 @@ local function saveusedfilesin_trees()
end
f:write("\n")
f:close()
- report_resolvers("saving used tree files in '%s'",filename)
+ report_dump("saving used tree files in '%s'",filename)
end
end
diff --git a/tex/context/base/data-exp.lua b/tex/context/base/data-exp.lua
index feab32273..7ddf7e319 100644
--- a/tex/context/base/data-exp.lua
+++ b/tex/context/base/data-exp.lua
@@ -18,7 +18,7 @@ local collapsepath = file.collapsepath
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_expansions = logs.new("resolvers","expansions")
local resolvers = resolvers
@@ -81,7 +81,7 @@ local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
- report_resolvers("expanding variable '%s'",str)
+ report_expansions("expanding variable '%s'",str)
end
local t, ok, done = newlist or { }, false, false
local n = #t
@@ -107,7 +107,7 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi
end
if trace_expansions then
for k=1,#t do
- report_resolvers("% 4i: %s",k,t[k])
+ report_expansions("% 4i: %s",k,t[k])
end
end
return t
@@ -142,7 +142,7 @@ function resolvers.cleanpath(str)
homedir = lpegmatch(cleanup,environment.homedir or "")
if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then
if trace_expansions then
- report_resolvers("no home dir set, ignoring dependent paths")
+ report_expansions("no home dir set, ignoring dependent paths")
end
function resolvers.cleanpath(str)
if find(str,"~") then
@@ -212,9 +212,9 @@ local function splitconfigurationpath(str) -- beware, this can be either a path
end
end
if trace_expansions then
- report_resolvers("splitting path specification '%s'",str)
+ report_expansions("splitting path specification '%s'",str)
for k=1,noffound do
- report_resolvers("% 4i: %s",k,found[k])
+ report_expansions("% 4i: %s",k,found[k])
end
end
cache[str] = found
@@ -313,7 +313,7 @@ end
function resolvers.scanfiles(path,branch)
if trace_locating then
- report_resolvers("scanning path '%s', branch '%s'",path, branch or path)
+ report_expansions("scanning path '%s', branch '%s'",path, branch or path)
end
local realpath = resolvers.resolve(path) -- no shortcut
local files, n, m, r = scan({ },realpath .. '/',"",0,0,0)
@@ -322,7 +322,7 @@ function resolvers.scanfiles(path,branch)
files.__directories__ = m
files.__remappings__ = r
if trace_locating then
- report_resolvers("%s files found on %s directories with %s uppercase remappings",n,m,r)
+ report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r)
end
return files
end
diff --git a/tex/context/base/data-fil.lua b/tex/context/base/data-fil.lua
index ecbeb52e6..c9d8b23e1 100644
--- a/tex/context/base/data-fil.lua
+++ b/tex/context/base/data-fil.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['data-fil'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_files = logs.new("resolvers","files")
local resolvers = resolvers
@@ -22,11 +22,11 @@ function locators.file(specification)
local realname = resolvers.resolve(name) -- no shortcut
if realname and realname ~= '' and lfs.isdir(realname) then
if trace_locating then
- report_resolvers("file locator '%s' found as '%s'",name,realname)
+ report_files("file locator '%s' found as '%s'",name,realname)
end
resolvers.appendhash('file',name,true) -- cache
elseif trace_locating then
- report_resolvers("file locator '%s' not found",name)
+ report_files("file locator '%s' not found",name)
end
end
@@ -49,12 +49,12 @@ function finders.file(specification,filetype)
local foundname = resolvers.findfile(filename,filetype)
if foundname and foundname ~= "" then
if trace_locating then
- report_resolvers("file finder: '%s' found",filename)
+ report_files("file finder: '%s' found",filename)
end
return foundname
else
if trace_locating then
- report_resolvers("file finder: %s' not found",filename)
+ report_files("file finder: %s' not found",filename)
end
return finders.notfound()
end
@@ -75,13 +75,13 @@ function openers.file(specification,filetype)
local f = io.open(filename,"r")
if f then
if trace_locating then
- report_resolvers("file opener, '%s' opened",filename)
+ report_files("file opener, '%s' opened",filename)
end
return openers.helpers.textopener("file",filename,f)
end
end
if trace_locating then
- report_resolvers("file opener, '%s' not found",filename)
+ report_files("file opener, '%s' not found",filename)
end
return openers.notfound()
end
@@ -93,7 +93,7 @@ function loaders.file(specification,filetype)
if f then
logs.show_load(filename)
if trace_locating then
- report_resolvers("file loader, '%s' loaded",filename)
+ report_files("file loader, '%s' loaded",filename)
end
local s = f:read("*a")
if checkgarbage then
@@ -106,7 +106,7 @@ function loaders.file(specification,filetype)
end
end
if trace_locating then
- report_resolvers("file loader, '%s' not found",filename)
+ report_files("file loader, '%s' not found",filename)
end
return loaders.notfound()
end
diff --git a/tex/context/base/data-ini.lua b/tex/context/base/data-ini.lua
index 63a7571fe..5579ea964 100644
--- a/tex/context/base/data-ini.lua
+++ b/tex/context/base/data-ini.lua
@@ -16,7 +16,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_initialization = logs.new("resolvers","initialization")
local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv
@@ -37,7 +37,7 @@ kpse = { original = kpse }
setmetatable(kpse, {
__index = function(kp,name)
- report_resolvers("fatal error: kpse library is accessed (key: %s)",name)
+ report_initialization("fatal error: kpse library is accessed (key: %s)",name)
os.exit()
end
} )
@@ -121,13 +121,13 @@ do
if lfs.chdir(p) then
local pp = lfs.currentdir()
if trace_locating and p ~= pp then
- report_resolvers("following symlink '%s' to '%s'",p,pp)
+ report_initialization("following symlink '%s' to '%s'",p,pp)
end
ownpath = pp
lfs.chdir(olddir)
else
if trace_locating then
- report_resolvers("unable to check path '%s'",p)
+ report_initialization("unable to check path '%s'",p)
end
ownpath = p
end
@@ -138,9 +138,9 @@ do
end
if not ownpath or ownpath == "" then
ownpath = "."
- report_resolvers("forcing fallback ownpath .")
+ report_initialization("forcing fallback ownpath .")
elseif trace_locating then
- report_resolvers("using ownpath '%s'",ownpath)
+ report_initialization("using ownpath '%s'",ownpath)
end
end
@@ -167,7 +167,7 @@ do
ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/.."))
ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../.."))
else
- report_resolvers("error: unable to locate ownpath")
+ report_initialization("error: unable to locate ownpath")
os.exit()
end
diff --git a/tex/context/base/data-lst.lua b/tex/context/base/data-lst.lua
index 23a2fc2fe..e2ad5164e 100644
--- a/tex/context/base/data-lst.lua
+++ b/tex/context/base/data-lst.lua
@@ -14,6 +14,8 @@ resolvers.listers = resolvers.listers or { }
local resolvers = resolvers
+local report_lists = logs.new("resolvers","lists")
+
local function tabstr(str)
if type(str) == 'table' then
return concat(str," | ")
@@ -42,11 +44,11 @@ function resolvers.listers.variables(pattern)
local exp = table.fastcopy(expansions)
for key, value in table.sortedpairs(configured) do
if key ~= "" and (pattern == "" or find(upper(key),pattern)) then
- logs.simple(key)
- logs.simple(" env: %s",tabstr(rawget(environment,key)) or "unset")
- logs.simple(" var: %s",tabstr(configured[key]) or "unset")
- logs.simple(" exp: %s",tabstr(expansions[key]) or "unset")
- logs.simple(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(key)
+ report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
+ report_lists(" var: %s",tabstr(configured[key]) or "unset")
+ report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
+ report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
end
end
instance.environment = table.fastcopy(env)
diff --git a/tex/context/base/data-lua.lua b/tex/context/base/data-lua.lua
index 9509c97f0..ead64fe42 100644
--- a/tex/context/base/data-lua.lua
+++ b/tex/context/base/data-lua.lua
@@ -12,7 +12,7 @@ if not modules then modules = { } end modules ['data-lua'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_libraries = logs.new("resolvers","libraries")
local gsub, insert = string.gsub, table.insert
local unpack = unpack or table.unpack
@@ -44,7 +44,7 @@ local function thepath(...)
local t = { ... } t[#t+1] = "?.lua"
local path = file.join(unpack(t))
if trace_locating then
- report_resolvers("! appending '%s' to 'package.path'",path)
+ report_libraries("! appending '%s' to 'package.path'",path)
end
return path
end
@@ -66,11 +66,11 @@ local function loaded(libpaths,name,simple)
local libpath = libpaths[i]
local resolved = gsub(libpath,"%?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
+ report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.path': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -79,17 +79,17 @@ end
package.loaders[2] = function(name) -- was [#package.loaders+1]
if trace_locating then -- mode detail
- report_resolvers("! locating '%s'",name)
+ report_libraries("! locating '%s'",name)
end
for i=1,#libformats do
local format = libformats[i]
local resolved = resolvers.findfile(name,format) or ""
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'libformat path': '%s'",name,format)
+ report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format)
end
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
@@ -112,11 +112,11 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local path = paths[p]
local resolved = file.join(path,libname)
if trace_locating then -- mode detail
- report_resolvers("! checking for '%s' using 'clibformat path': '%s'",libname,path)
+ report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
+ report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved)
end
return package.loadlib(resolved,name)
end
@@ -126,28 +126,28 @@ package.loaders[2] = function(name) -- was [#package.loaders+1]
local libpath = clibpaths[i]
local resolved = gsub(libpath,"?",simple)
if trace_locating then -- more detail
- report_resolvers("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
+ report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath)
end
if file.is_readable(resolved) then
if trace_locating then
- report_resolvers("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
+ report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved)
end
return package.loadlib(resolved,name)
end
end
-- just in case the distribution is messed up
if trace_loading then -- more detail
- report_resolvers("! checking for '%s' using 'luatexlibs': '%s'",name)
+ report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name)
end
local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or ""
if resolved ~= "" then
if trace_locating then
- report_resolvers("! lib '%s' located by basename via environment: '%s'",name,resolved)
+ report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved)
end
return loadfile(resolved)
end
if trace_locating then
- report_resolvers('? unable to locate lib: %s',name)
+ report_libraries('? unable to locate lib: %s',name)
end
-- return "unable to locate " .. name
end
diff --git a/tex/context/base/data-met.lua b/tex/context/base/data-met.lua
index a02e7eeb4..f9906c854 100644
--- a/tex/context/base/data-met.lua
+++ b/tex/context/base/data-met.lua
@@ -17,7 +17,7 @@ trackers.register("resolvers.methods", function(v) trace_methods = v end)
--~ trace_methods = true
-local report_resolvers = logs.new("resolvers")
+local report_methods = logs.new("resolvers","methods")
local allocate = utilities.storage.allocate
@@ -59,41 +59,41 @@ local function methodhandler(what,first,...) -- filename can be nil or false
local resolver = namespace and namespace[scheme]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
+ report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first)
end
return resolver(specification,...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first)
end
return resolver(specification,...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, no handler",what,how)
+ report_methods("resolver: method=%s, how=%s, no handler",what,how)
end
end
elseif how == "tag" then
local resolver = namespace and namespace[first]
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, tag=%s",what,how,first)
+ report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first)
end
return resolver(...)
else
resolver = namespace.default or namespace.file
if resolver then
if trace_methods then
- report_resolvers("resolver: method=%s, how=%s, default",what,how)
+ report_methods("resolver: method=%s, how=%s, default",what,how)
end
return resolver(...)
elseif trace_methods then
- report_resolvers("resolver: method=%s, how=%s, unknown",what,how)
+ report_methods("resolver: method=%s, how=%s, unknown",what,how)
end
end
end
else
- report_resolvers("resolver: method=%s, unknown",what)
+ report_methods("resolver: method=%s, unknown",what)
end
end
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index e9dbc5e67..cd63941da 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -30,7 +30,7 @@ local trace_locating = false trackers.register("resolvers.locating", functi
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end)
-local report_resolvers = logs.new("resolvers")
+local report_resolving = logs.new("resolvers","resolving")
local resolvers = resolvers
@@ -140,7 +140,7 @@ end
function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only
if trace_locating then
- report_resolvers("creating instance")
+ report_resolving("creating instance")
end
local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate()
@@ -258,9 +258,9 @@ local function reportcriticalvariables()
for i=1,#resolvers.criticalvars do
local k = resolvers.criticalvars[i]
local v = resolvers.getenv(k) or "unknown" -- this one will not resolve !
- report_resolvers("variable '%s' set to '%s'",k,v)
+ report_resolving("variable '%s' set to '%s'",k,v)
end
- report_resolvers()
+ report_resolving()
end
reportcriticalvariables = function() end
end
@@ -284,17 +284,17 @@ local function identify_configuration_files()
if lfs.isfile(realname) then
specification[#specification+1] = filename
if trace_locating then
- report_resolvers("found configuration file '%s'",realname)
+ report_resolving("found configuration file '%s'",realname)
end
elseif trace_locating then
- report_resolvers("unknown configuration file '%s'",realname)
+ report_resolving("unknown configuration file '%s'",realname)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("configuration files already identified")
+ report_resolving("configuration files already identified")
end
end
@@ -314,8 +314,8 @@ local function load_configuration_files()
data = data and data.content
if data then
if trace_locating then
- report_resolvers("loading configuration file '%s'",filename)
- report_resolvers()
+ report_resolving("loading configuration file '%s'",filename)
+ report_resolving()
end
local variables = data.variables or { }
local warning = false
@@ -325,7 +325,7 @@ local function load_configuration_files()
initializesetter(filename,k,v)
elseif variables[k] == nil then
if trace_locating and not warning then
- report_resolvers("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
+ report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable",
k,resolvers.resolve(filename))
warning = true
end
@@ -338,7 +338,7 @@ local function load_configuration_files()
local cnfspec = variables["TEXMFCNF"]
if cnfspec then
if trace_locating then
- report_resolvers("reloading configuration due to TEXMF redefinition")
+ report_resolving("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
@@ -357,13 +357,13 @@ local function load_configuration_files()
else
if trace_locating then
- report_resolvers("skipping configuration file '%s' (no content)",filename)
+ report_resolving("skipping configuration file '%s' (no content)",filename)
end
setups[pathname] = { }
instance.loaderror = true
end
elseif trace_locating then
- report_resolvers("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no file)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -371,7 +371,7 @@ local function load_configuration_files()
end
end
elseif trace_locating then
- report_resolvers("warning: no lua configuration files found")
+ report_resolving("warning: no lua configuration files found")
end
end
@@ -407,19 +407,19 @@ local function locate_file_databases()
end
if trace_locating then
if runtime then
- report_resolvers("locating list of '%s' (runtime)",path)
+ report_resolving("locating list of '%s' (runtime)",path)
else
- report_resolvers("locating list of '%s' (cached)",path)
+ report_resolving("locating list of '%s' (cached)",path)
end
end
methodhandler('locators',stripped)
end
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
elseif trace_locating then
- report_resolvers("no texmf paths are defined (using TEXMF)")
+ report_resolving("no texmf paths are defined (using TEXMF)")
end
end
@@ -430,7 +430,7 @@ local function generate_file_databases()
methodhandler('generators',hash.name)
end
if trace_locating then
- report_resolvers()
+ report_resolving()
end
end
@@ -442,11 +442,11 @@ local function save_file_databases() -- will become cachers
local content = instance.files[cachename]
caches.collapsecontent(content)
if trace_locating then
- report_resolvers("saving tree '%s'",cachename)
+ report_resolving("saving tree '%s'",cachename)
end
caches.savecontent(cachename,"files",content)
elseif trace_locating then
- report_resolvers("not saving runtime tree '%s'",cachename)
+ report_resolving("not saving runtime tree '%s'",cachename)
end
end
end
@@ -471,7 +471,7 @@ function resolvers.appendhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' appended",name)
end
insert(instance.hashes, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -482,7 +482,7 @@ function resolvers.prependhash(type,name,cache)
-- 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)
+ report_resolving("hash '%s' prepended",name)
end
insert(instance.hashes, 1, { type = type, name = name, cache = cache } )
instance.hashed[name] = cache
@@ -715,9 +715,9 @@ function isreadable(name)
local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir
if trace_detail then
if readable then
- report_resolvers("file '%s' is readable",name)
+ report_resolving("file '%s' is readable",name)
else
- report_resolvers("file '%s' is not readable", name)
+ report_resolving("file '%s' is not readable", name)
end
end
return readable
@@ -731,7 +731,7 @@ local function collect_files(names)
for k=1,#names do
local fname = names[k]
if trace_detail then
- report_resolvers("checking name '%s'",fname)
+ report_resolving("checking name '%s'",fname)
end
local bname = filebasename(fname)
local dname = filedirname(fname)
@@ -747,7 +747,7 @@ local function collect_files(names)
local files = blobpath and instance.files[blobpath]
if files then
if trace_detail then
- report_resolvers("deep checking '%s' (%s)",blobpath,bname)
+ report_resolving("deep checking '%s' (%s)",blobpath,bname)
end
local blobfile = files[bname]
if not blobfile then
@@ -767,7 +767,7 @@ local function collect_files(names)
local search = filejoin(blobroot,blobfile,bname)
local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -781,7 +781,7 @@ local function collect_files(names)
local search = filejoin(blobroot,vv,bname)
local result = methodhandler('concatinators',hash.type,blobroot,vv,bname)
if trace_detail then
- report_resolvers("match: kind '%s', search '%s', result '%s'",kind,search,result)
+ report_resolving("match: kind '%s', search '%s', result '%s'",kind,search,result)
end
noffiles = noffiles + 1
filelist[noffiles] = { kind, search, result }
@@ -790,7 +790,7 @@ local function collect_files(names)
end
end
elseif trace_locating then
- report_resolvers("no match in '%s' (%s)",blobpath,bname)
+ report_resolving("no match in '%s' (%s)",blobpath,bname)
end
end
end
@@ -831,7 +831,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
stamp = filename .. "--" .. askedformat
if instance.found[stamp] then
if trace_locating then
- report_resolvers("remembered file '%s'",filename)
+ report_resolving("remembered file '%s'",filename)
end
resolvers.registerintrees(filename) -- for tracing used files
return instance.found[stamp]
@@ -840,7 +840,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not dangerous[askedformat] then
if isreadable(filename) then
if trace_detail then
- report_resolvers("file '%s' found directly",filename)
+ report_resolving("file '%s' found directly",filename)
end
if stamp then
instance.found[stamp] = { filename }
@@ -850,13 +850,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
if find(filename,'%*') then
if trace_locating then
- report_resolvers("checking wildcard '%s'", filename)
+ report_resolving("checking wildcard '%s'", filename)
end
result = resolvers.findwildcardfiles(filename) -- we can use th elocal
elseif file.is_qualified_path(filename) then
if isreadable(filename) then
if trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
result = { filename }
else
@@ -869,7 +869,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
forcedname = filename .. "." .. s
if isreadable(forcedname) then
if trace_locating then
- report_resolvers("no suffix, forcing format filetype '%s'", s)
+ report_resolving("no suffix, forcing format filetype '%s'", s)
end
result, ok = { forcedname }, true
break
@@ -922,7 +922,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- end
end
if not ok and trace_locating then
- report_resolvers("qualified name '%s'", filename)
+ report_resolving("qualified name '%s'", filename)
end
end
else
@@ -941,13 +941,13 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
wantedfiles[#wantedfiles+1] = forcedname
filetype = resolvers.formatofsuffix(forcedname)
if trace_locating then
- report_resolvers("forcing filetype '%s'",filetype)
+ report_resolving("forcing filetype '%s'",filetype)
end
end
else
filetype = resolvers.formatofsuffix(filename)
if trace_locating then
- report_resolvers("using suffix based filetype '%s'",filetype)
+ report_resolving("using suffix based filetype '%s'",filetype)
end
end
else
@@ -961,7 +961,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
filetype = askedformat
if trace_locating then
- report_resolvers("using given filetype '%s'",filetype)
+ report_resolving("using given filetype '%s'",filetype)
end
end
local typespec = resolvers.variableofformat(filetype)
@@ -969,7 +969,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
if not pathlist or #pathlist == 0 then
-- no pathlist, access check only / todo == wildcard
if trace_detail then
- report_resolvers("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
+ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
end
for k=1,#wantedfiles do
local fname = wantedfiles[k]
@@ -997,7 +997,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
end
end
if trace_detail then
- report_resolvers("checking filename '%s'",filename)
+ report_resolving("checking filename '%s'",filename)
end
for k=1,#pathlist do
local path = pathlist[k]
@@ -1009,7 +1009,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
-- 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)
+ report_resolving("using pattern '%s' for path '%s'",expression,pathname)
end
for k=1,#filelist do
local fl = filelist[k]
@@ -1021,16 +1021,16 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
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)
+ report_resolving("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)
+ report_resolving("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)
+ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
end
end
end
@@ -1047,7 +1047,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo :
local fname = filejoin(ppname,w)
if isreadable(fname) then
if trace_detail then
- report_resolvers("found '%s' by scanning",fname)
+ report_resolving("found '%s' by scanning",fname)
end
result[#result+1] = fname
done = true
@@ -1085,7 +1085,7 @@ end
--~ local function find_direct(filename)
--~ if not dangerous[askedformat] and isreadable(filename) then
--~ if trace_detail then
---~ report_resolvers("file '%s' found directly",filename)
+--~ report_resolving("file '%s' found directly",filename)
--~ end
--~ return { filename }
--~ end
@@ -1094,7 +1094,7 @@ end
--~ local function find_wildcard(filename)
--~ if find(filename,'%*') then
--~ if trace_locating then
---~ report_resolvers("checking wildcard '%s'", filename)
+--~ report_resolving("checking wildcard '%s'", filename)
--~ end
--~ return resolvers.findwildcardfiles(filename) -- we can use the local
--~ end
@@ -1105,16 +1105,16 @@ end
--~ return
--~ end
--~ if trace_locating then
---~ report_resolvers("checking qualified name '%s'", filename)
+--~ report_resolving("checking qualified name '%s'", filename)
--~ end
--~ if isreadable(filename) then
--~ if trace_detail then
---~ report_resolvers("qualified file '%s' found", filename)
+--~ report_resolving("qualified file '%s' found", filename)
--~ end
--~ return { filename }
--~ else
--~ if trace_detail then
---~ report_resolvers("locating qualified file '%s'", filename)
+--~ report_resolving("locating qualified file '%s'", filename)
--~ end
--~ local forcedname, suffix = "", fileextname(filename)
--~ if suffix == "" then -- why
@@ -1125,7 +1125,7 @@ end
--~ forcedname = filename .. "." .. s
--~ if isreadable(forcedname) then
--~ if trace_locating then
---~ report_resolvers("no suffix, forcing format filetype '%s'", s)
+--~ report_resolving("no suffix, forcing format filetype '%s'", s)
--~ end
--~ return { forcedname }
--~ end
@@ -1203,13 +1203,13 @@ end
--~ wantedfiles[#wantedfiles+1] = forcedname
--~ filetype = resolvers.formatofsuffix(forcedname)
--~ if trace_locating then
---~ report_resolvers("forcing filetype '%s'",filetype)
+--~ report_resolving("forcing filetype '%s'",filetype)
--~ end
--~ end
--~ else
--~ filetype = resolvers.formatofsuffix(filename)
--~ if trace_locating then
---~ report_resolvers("using suffix based filetype '%s'",filetype)
+--~ report_resolving("using suffix based filetype '%s'",filetype)
--~ end
--~ end
--~ else
@@ -1223,7 +1223,7 @@ end
--~ end
--~ filetype = askedformat
--~ if trace_locating then
---~ report_resolvers("using given filetype '%s'",filetype)
+--~ report_resolving("using given filetype '%s'",filetype)
--~ end
--~ end
--~ return filetype, wantedfiles
@@ -1242,7 +1242,7 @@ end
--~ end
--~ end
--~ if trace_detail then
---~ report_resolvers("checking filename '%s'",filename)
+--~ report_resolving("checking filename '%s'",filename)
--~ end
--~ local result = { }
--~ for k=1,#pathlist do
@@ -1255,7 +1255,7 @@ end
--~ -- 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)
+--~ report_resolving("using pattern '%s' for path '%s'",expression,pathname)
--~ end
--~ for k=1,#filelist do
--~ local fl = filelist[k]
@@ -1267,16 +1267,16 @@ end
--~ 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)
+--~ report_resolving("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)
+--~ report_resolving("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)
+--~ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
--~ end
--~ end
--~ end
@@ -1293,7 +1293,7 @@ end
--~ local fname = filejoin(ppname,w)
--~ if isreadable(fname) then
--~ if trace_detail then
---~ report_resolvers("found '%s' by scanning",fname)
+--~ report_resolving("found '%s' by scanning",fname)
--~ end
--~ result[#result+1] = fname
--~ done = true
@@ -1319,7 +1319,7 @@ 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," | "))
+--~ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | "))
--~ end
--~ for k=1,#wantedfiles do
--~ local fname = wantedfiles[k]
@@ -1348,7 +1348,7 @@ end
--~ result = stamp and instance.found[stamp]
--~ if result then
--~ if trace_locating then
---~ report_resolvers("remembered file '%s'",filename)
+--~ report_resolving("remembered file '%s'",filename)
--~ end
--~ return result
--~ end
@@ -1373,7 +1373,7 @@ end
--~ end
--~ if stamp then
--~ if trace_locating then
---~ report_resolvers("remembering file '%s'",filename)
+--~ report_resolving("remembering file '%s'",filename)
--~ end
--~ instance.found[stamp] = result
--~ end
@@ -1543,7 +1543,7 @@ end
local function report(str)
if trace_locating then
- report_resolvers(str) -- has already verbose
+ report_resolving(str) -- has already verbose
else
print(str)
end
diff --git a/tex/context/base/data-sch.lua b/tex/context/base/data-sch.lua
index af86cd726..7d777319f 100644
--- a/tex/context/base/data-sch.lua
+++ b/tex/context/base/data-sch.lua
@@ -13,7 +13,7 @@ local finders, openers, loaders = resolvers.finders, resolvers.openers, resolver
local trace_schemes = false trackers.register("resolvers.schemes",function(v) trace_schemes = v end)
-local report_schemes = logs.new("schemes")
+local report_schemes = logs.new("resolvers","schemes")
local resolvers = resolvers
diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua
index f8c847b22..38ecaed74 100644
--- a/tex/context/base/data-tex.lua
+++ b/tex/context/base/data-tex.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['data-tex'] = {
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_tex = logs.new("resolvers","tex")
local resolvers = resolvers
@@ -62,7 +62,7 @@ function helpers.textopener(tag,filename,filehandle)
if type(lines) == "string" then
local kind = utffiletype(lines)
if trace_locating then
- report_resolvers("%s opener, '%s' opened using method '%s'",tag,filename,kind)
+ report_tex("%s opener, '%s' opened using method '%s'",tag,filename,kind)
end
if kind == "utf-16-be" then
lines = unicode.utf16_to_utf8_be(lines)
@@ -80,7 +80,7 @@ function helpers.textopener(tag,filename,filehandle)
lines = splitlines(lines)
end
elseif trace_locating then
- report_resolvers("%s opener, '%s' opened",tag,filename)
+ report_tex("%s opener, '%s' opened",tag,filename)
end
logs.show_open(filename)
return {
@@ -89,7 +89,7 @@ function helpers.textopener(tag,filename,filehandle)
currentline = 0,
close = function()
if trace_locating then
- report_resolvers("%s closer, '%s' closed",tag,filename)
+ report_tex("%s closer, '%s' closed",tag,filename)
end
logs.show_close(filename)
t = nil
@@ -146,7 +146,7 @@ local function installhandler(namespace,what,where,func)
if where == "before" or where == "after" then
sequencers.appendaction(namespace,where,func)
else
- report_resolvers("installing input %s handlers in %s is not possible",what,tostring(where))
+ report_tex("installing input %s handlers in %s is not possible",what,tostring(where))
end
end
@@ -155,8 +155,8 @@ function resolvers.installinputfilehandler(...) installhandler(helpers.textfilea
-- local basename = file.basename
-- resolvers.installinputlinehandler(function(str,filename,linenumber,noflines)
--- logs.simple("[lc] file: %s, line: %s of %s, length: %s",basename(filename),linenumber,noflines,#str)
+-- report_tex("[lc] file: %s, line: %s of %s, length: %s",basename(filename),linenumber,noflines,#str)
-- end)
-- resolvers.installinputfilehandler(function(str,filename)
--- logs.simple("[fc] file: %s, length: %s",basename(filename),#str)
+-- report_tex("[fc] file: %s, length: %s",basename(filename),#str)
-- end)
diff --git a/tex/context/base/data-tmf.lua b/tex/context/base/data-tmf.lua
index 275b56150..4c39b57cf 100644
--- a/tex/context/base/data-tmf.lua
+++ b/tex/context/base/data-tmf.lua
@@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['data-tmf'] = {
local resolvers = resolvers
+local report_tds = logs.new("resolvers","tds")
+
-- = <<
-- ? ??
-- < +=
@@ -28,11 +30,11 @@ function resolvers.load_tree(tree,resolve)
local newpath = file.join(newtree,"bin")
if not lfs.isdir(newtree) then
- logs.simple("no '%s' under tree %s",texos,tree)
+ report_tds("no '%s' under tree %s",texos,tree)
os.exit()
end
if not lfs.isdir(newpath) then
- logs.simple("no '%s/bin' under tree %s",texos,tree)
+ report_tds("no '%s/bin' under tree %s",texos,tree)
os.exit()
end
@@ -56,8 +58,8 @@ function resolvers.load_tree(tree,resolve)
setenv('TEXMFCNF', resolvers.luacnfspec, not resolve)
setenv("PATH", newpath .. io.pathseparator .. getenv("PATH"))
- logs.simple("changing from root '%s' to '%s'",oldroot,newroot)
- logs.simple("prepending '%s' to binary path",newpath)
- logs.simple()
+ report_tds("changing from root '%s' to '%s'",oldroot,newroot)
+ report_tds("prepending '%s' to binary path",newpath)
+ report_tds()
end
end
diff --git a/tex/context/base/data-tmp.lua b/tex/context/base/data-tmp.lua
index 8dc43b179..4084eda62 100644
--- a/tex/context/base/data-tmp.lua
+++ b/tex/context/base/data-tmp.lua
@@ -28,8 +28,8 @@ local mkdirs, isdir = dir.mkdirs, lfs.isdir
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end)
-local report_cache = logs.new("cache")
-local report_resolvers = logs.new("resolvers")
+local report_caches = logs.new("resolvers","caches")
+local report_resolvers = logs.new("resolvers","caching")
local resolvers = resolvers
@@ -89,7 +89,7 @@ local function identify()
if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then
mkdirs(cachepath)
if isdir(cachepath) and file.is_writable(cachepath) then
- report_cache("created: %s",cachepath)
+ report_caches("created: %s",cachepath)
writable = cachepath
readables[#readables+1] = cachepath
end
@@ -123,10 +123,10 @@ local function identify()
-- Some extra checking. If we have no writable or readable path then we simply
-- quit.
if not writable then
- report_cache("fatal error: there is no valid writable cache path defined")
+ report_caches("fatal error: there is no valid writable cache path defined")
os.exit()
elseif #readables == 0 then
- report_cache("fatal error: there is no valid readable cache path defined")
+ report_caches("fatal error: there is no valid readable cache path defined")
os.exit()
end
-- why here
@@ -148,9 +148,9 @@ local function identify()
-- end
if trace_cache then
for i=1,#readables do
- report_cache("using readable path '%s' (order %s)",readables[i],i)
+ report_caches("using readable path '%s' (order %s)",readables[i],i)
end
- report_cache("using writable path '%s'",writable)
+ report_caches("using writable path '%s'",writable)
end
identify = function()
return writable, readables
@@ -185,7 +185,7 @@ function caches.hashed(tree)
tree = lower(tree)
local hash = md5.hex(tree)
if trace_cache or trace_locating then
- report_cache("hashing tree %s, hash %s",tree,hash)
+ report_caches("hashing tree %s, hash %s",tree,hash)
end
return hash
end
diff --git a/tex/context/base/data-tre.lua b/tex/context/base/data-tre.lua
index b3b96094a..3de7bc5b5 100644
--- a/tex/context/base/data-tre.lua
+++ b/tex/context/base/data-tre.lua
@@ -12,7 +12,7 @@ local find, gsub, format = string.find, string.gsub, string.format
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_trees = logs.new("resolvers","trees")
local resolvers = resolvers
@@ -50,18 +50,18 @@ function resolvers.locators.tree(specification)
local name = specification.filename
if name ~= '' and lfs.isdir(name) then
if trace_locating then
- report_resolvers("tree locator '%s' found",name)
+ report_trees("locator '%s' found",name)
end
resolvers.appendhash('tree',name,false) -- don't cache
elseif trace_locating then
- report_resolvers("tree locator '%s' not found",name)
+ report_trees("locator '%s' not found",name)
end
end
function resolvers.hashers.tree(specification)
local name = specification.filename
if trace_locating then
- report_resolvers("analysing tree '%s'",name)
+ report_trees("analysing '%s'",name)
end
resolvers.methodhandler("hashers",name)
end
diff --git a/tex/context/base/data-use.lua b/tex/context/base/data-use.lua
index d4e9b53fe..9a31b13c8 100644
--- a/tex/context/base/data-use.lua
+++ b/tex/context/base/data-use.lua
@@ -10,7 +10,7 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_mounts = logs.new("resolvers","mounts")
local resolvers = resolvers
@@ -35,7 +35,7 @@ function resolvers.automount(usecache)
-- skip
elseif find(line,"^zip://") then
if trace_locating then
- report_resolvers("mounting %s",line)
+ report_mounts("mounting %s",line)
end
table.insert(resolvers.automounted,line)
resolvers.usezipfile(line)
diff --git a/tex/context/base/data-vir.lua b/tex/context/base/data-vir.lua
index c1a6b3366..2a7ee1d8b 100644
--- a/tex/context/base/data-vir.lua
+++ b/tex/context/base/data-vir.lua
@@ -8,8 +8,8 @@ if not modules then modules = { } end modules ['data-vir'] = {
local format = string.format
-local trace_virtual = false
-local report_resolvers = logs.new("resolvers")
+local trace_virtual = false
+local report_virtual = logs.new("resolvers","virtual")
trackers.register("resolvers.locating", function(v) trace_virtual = v end)
trackers.register("resolvers.virtual", function(v) trace_virtual = v end)
@@ -25,7 +25,7 @@ function savers.virtual(specification,content)
local path = specification.path
local filename = format(template,path ~= "" and path or "virtualfile",n)
if trace_virtual then
- report_resolvers("virtual saver: file '%s' saved",filename)
+ report_virtual("saver: file '%s' saved",filename)
end
data[filename] = content
return filename
@@ -36,12 +36,12 @@ function finders.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_resolvers("virtual finder: file '%s' found",original)
+ report_virtual("finder: file '%s' found",original)
end
return original
else
if trace_virtual then
- report_resolvers("virtual finder: unknown file '%s'",original)
+ report_virtual("finder: unknown file '%s'",original)
end
return finders.notfound()
end
@@ -52,13 +52,13 @@ function openers.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_resolvers("virtual opener, file '%s' opened",original)
+ report_virtual("opener, file '%s' opened",original)
end
data[original] = nil
return openers.helpers.textopener("virtual",original,d)
else
if trace_virtual then
- report_resolvers("virtual opener, file '%s' not found",original)
+ report_virtual("opener, file '%s' not found",original)
end
return openers.notfound()
end
@@ -69,13 +69,13 @@ function loaders.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_resolvers("virtual loader, file '%s' loaded",original)
+ report_virtual("loader, file '%s' loaded",original)
end
data[original] = nil
return true, d, #d
end
if trace_virtual then
- report_resolvers("virtual loader, file '%s' not loaded",original)
+ report_virtual("loader, file '%s' not loaded",original)
end
return loaders.notfound()
end
diff --git a/tex/context/base/data-zip.lua b/tex/context/base/data-zip.lua
index 25d31fb6b..706461aaf 100644
--- a/tex/context/base/data-zip.lua
+++ b/tex/context/base/data-zip.lua
@@ -12,7 +12,7 @@ local format, find, match = string.format, string.find, string.match
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
-local report_resolvers = logs.new("resolvers")
+local report_zip = logs.new("resolvers","zip")
-- zip:///oeps.zip?name=bla/bla.tex
-- zip:///oeps.zip?tree=tex/texmf-local
@@ -65,9 +65,9 @@ function resolvers.locators.zip(specification)
local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree
if trace_locating then
if zipfile then
- report_resolvers("zip locator, archive '%s' found",archive)
+ report_zip("locator, archive '%s' found",archive)
else
- report_resolvers("zip locator, archive '%s' not found",archive)
+ report_zip("locator, archive '%s' not found",archive)
end
end
end
@@ -75,7 +75,7 @@ end
function resolvers.hashers.zip(specification)
local archive = specification.filename
if trace_locating then
- report_resolvers("loading zip file '%s'",archive)
+ report_zip("loading file '%s'",archive)
end
resolvers.usezipfile(specification.original)
end
@@ -98,25 +98,25 @@ function resolvers.finders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip finder, archive '%s' found",archive)
+ report_zip("finder, archive '%s' found",archive)
end
local dfile = zfile:open(queryname)
if dfile then
dfile = zfile:close()
if trace_locating then
- report_resolvers("zip finder, file '%s' found",queryname)
+ report_zip("finder, file '%s' found",queryname)
end
return specification.original
elseif trace_locating then
- report_resolvers("zip finder, file '%s' not found",queryname)
+ report_zip("finder, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip finder, unknown archive '%s'",archive)
+ report_zip("finder, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip finder, '%s' not found",original)
+ report_zip("finder, '%s' not found",original)
end
return resolvers.finders.notfound()
end
@@ -131,24 +131,24 @@ function resolvers.openers.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip opener, archive '%s' opened",archive)
+ report_zip("opener, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
if trace_locating then
- report_resolvers("zip opener, file '%s' found",queryname)
+ report_zip("opener, file '%s' found",queryname)
end
return resolvers.openers.helpers.textopener('zip',original,dfile)
elseif trace_locating then
- report_resolvers("zip opener, file '%s' not found",queryname)
+ report_zip("opener, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip opener, unknown archive '%s'",archive)
+ report_zip("opener, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip opener, '%s' not found",original)
+ report_zip("opener, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -163,27 +163,27 @@ function resolvers.loaders.zip(specification)
local zfile = zip.openarchive(archive)
if zfile then
if trace_locating then
- report_resolvers("zip loader, archive '%s' opened",archive)
+ report_zip("loader, archive '%s' opened",archive)
end
local dfile = zfile:open(queryname)
if dfile then
logs.show_load(original)
if trace_locating then
- report_resolvers("zip loader, file '%s' loaded",original)
+ report_zip("loader, file '%s' loaded",original)
end
local s = dfile:read("*all")
dfile:close()
return true, s, #s
elseif trace_locating then
- report_resolvers("zip loader, file '%s' not found",queryname)
+ report_zip("loader, file '%s' not found",queryname)
end
elseif trace_locating then
- report_resolvers("zip loader, unknown archive '%s'",archive)
+ report_zip("loader, unknown archive '%s'",archive)
end
end
end
if trace_locating then
- report_resolvers("zip loader, '%s' not found",original)
+ report_zip("loader, '%s' not found",original)
end
return resolvers.openers.notfound()
end
@@ -199,7 +199,7 @@ function resolvers.usezipfile(archive)
if z then
local tree = url.query(specification.query).tree or ""
if trace_locating then
- report_resolvers("zip registering, registering archive '%s'",archive)
+ report_zip("registering, registering archive '%s'",archive)
end
statistics.starttiming(resolvers.instance)
resolvers.prependhash('zip',archive)
@@ -208,10 +208,10 @@ function resolvers.usezipfile(archive)
instance.files[archive] = resolvers.registerzipfile(z,tree)
statistics.stoptiming(resolvers.instance)
elseif trace_locating then
- report_resolvers("zip registering, unknown archive '%s'",archive)
+ report_zip("registering, unknown archive '%s'",archive)
end
elseif trace_locating then
- report_resolvers("zip registering, '%s' not found",archive)
+ report_zip("registering, '%s' not found",archive)
end
end
@@ -223,7 +223,7 @@ function resolvers.registerzipfile(z,tree)
filter = format("^%s/(.+)/(.-)$",tree)
end
if trace_locating then
- report_resolvers("zip registering, using filter '%s'",filter)
+ report_zip("registering, using filter '%s'",filter)
end
local register, n = resolvers.registerfile, 0
for i in z:files() do
@@ -240,6 +240,6 @@ function resolvers.registerzipfile(z,tree)
n = n + 1
end
end
- report_resolvers("zip registering, %s files registered",n)
+ report_zip("registering, %s files registered",n)
return files
end
diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv
index 2c15e2ab7..737a8b6f1 100644
--- a/tex/context/base/enco-ini.mkiv
+++ b/tex/context/base/enco-ini.mkiv
@@ -36,6 +36,10 @@
\unprotect
+%D Obsolete (but sometimes used in styles)
+
+\let\defaultencoding\s!default
+
%D \macros
%D {defineaccent, definecharacter, definecommand}
diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua
index 635780ac9..71c4f9fc3 100644
--- a/tex/context/base/font-afm.lua
+++ b/tex/context/base/font-afm.lua
@@ -21,7 +21,7 @@ local trace_features = false trackers.register("afm.features", function(v) trac
local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end)
local trace_loading = false trackers.register("afm.loading", function(v) trace_loading = v end)
-local report_afm = logs.new("load afm")
+local report_afm = logs.new("fonts","afm loading")
local next, type = next, type
local format, match, gmatch, lower, gsub, strip = string.format, string.match, string.gmatch, string.lower, string.gsub, string.strip
diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua
index b8a4e924c..b3a08e50c 100644
--- a/tex/context/base/font-chk.lua
+++ b/tex/context/base/font-chk.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-chk'] = {
-- possible optimization: delayed initialization of vectors
-local report_fonts = logs.new("fonts")
+local report_fonts = logs.new("fonts","checking")
local fonts = fonts
diff --git a/tex/context/base/font-cid.lua b/tex/context/base/font-cid.lua
index 1d03bca4d..ed9a25563 100644
--- a/tex/context/base/font-cid.lua
+++ b/tex/context/base/font-cid.lua
@@ -12,7 +12,7 @@ local lpegmatch = lpeg.match
local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
local fonts = fonts
diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua
index ef08c0b8c..5b5eaf8ea 100644
--- a/tex/context/base/font-col.lua
+++ b/tex/context/base/font-col.lua
@@ -15,7 +15,7 @@ local settings_to_hash = utilities.parsers.settings_to_hash
local trace_collecting = false trackers.register("fonts.collecting", function(v) trace_collecting = v end)
-local report_fonts = logs.new("fonts")
+local report_fonts = logs.new("fonts","collections")
local fonts, context = fonts, context
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index ac7334c10..22b908825 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -22,9 +22,9 @@ local trace_defining = false trackers.register("fonts.defining", function(v) tr
local trace_usage = false trackers.register("fonts.usage", function(v) trace_usage = v end)
local trace_mapfiles = false trackers.register("fonts.mapfiles", function(v) trace_mapfiles = v end)
-local report_define = logs.new("define fonts")
-local report_usage = logs.new("fonts usage")
-local report_mapfiles = logs.new("mapfiles")
+local report_defining = logs.new("fonts","defining")
+local report_status = logs.new("fonts","status")
+local report_mapfiles = logs.new("fonts","mapfiles")
local fonts = fonts
local tfm = fonts.tfm
@@ -162,7 +162,7 @@ function definers.register(tfmdata,id)
if not fonts.internalized[hash] then
fonts.internalized[hash] = id
if trace_defining then
- report_define("registering font, id: %s, hash: %s",id or "?",hash or "?")
+ report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?")
end
-- enhancetfmdata(tfmdata)
local characters = tfmdata.characters
@@ -492,7 +492,7 @@ function definers.stage_one(str)
local fullname, size = lpegmatch(splitpattern,str)
local lookup, name, sub, method, detail = getspecification(fullname)
if not name then
- report_define("strange definition '%s'",str)
+ report_defining("strange definition '%s'",str)
setdefaultfontname()
elseif name == "unknown" then
setdefaultfontname()
@@ -527,7 +527,7 @@ local n = 0
function definers.stage_two(global,cs,str,size,classfeatures,fontfeatures,classfallbacks,fontfallbacks,
mathsize,textsize,relativeid,classgoodies,goodies)
if trace_defining then
- report_define("memory usage before: %s",statistics.memused())
+ report_defining("memory usage before: %s",statistics.memused())
end
-- name is now resolved and size is scaled cf sa/mo
local lookup, name, sub, method, detail = getspecification(str or "")
@@ -567,12 +567,12 @@ function definers.stage_two(global,cs,str,size,classfeatures,fontfeatures,classf
fonts.csnames[cs] = tfmdata -- new (beware: locals can be forgotten)
end
if not tfmdata then
- report_define("unable to define %s as \\%s",name,cs)
+ report_defining("unable to define %s as \\%s",name,cs)
texsetcount("global","lastfontid",-1)
context.letvaluerelax(cs) -- otherwise the current definition takes the previous one
elseif type(tfmdata) == "number" then
if trace_defining then
- report_define("reusing %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s, goodies: %s/%s)",
+ report_defining("reusing %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s, goodies: %s/%s)",
name,tfmdata,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies)
end
tex.definefont(global,cs,tfmdata)
@@ -588,7 +588,7 @@ function definers.stage_two(global,cs,str,size,classfeatures,fontfeatures,classf
tex.definefont(global,cs,id)
tfm.cleanuptable(tfmdata)
if trace_defining then
- report_define("defining %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s)",name,id,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks)
+ report_defining("defining %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s)",name,id,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks)
end
-- resolved (when designsize is used):
setsomefontsize((tfmdata.size or 655360) .. "sp")
@@ -598,7 +598,7 @@ function definers.stage_two(global,cs,str,size,classfeatures,fontfeatures,classf
texsetcount("global","lastfontid",id)
end
if trace_defining then
- report_define("memory usage after: %s",statistics.memused())
+ report_defining("memory usage after: %s",statistics.memused())
end
statistics.stoptiming(fonts)
end
@@ -894,11 +894,11 @@ function fonts.reportdefinedfonts()
}
end
formatcolumns(t," ")
- report_usage()
- report_usage("defined fonts:")
- report_usage()
+ report_status()
+ report_status("defined fonts:")
+ report_status()
for k=1,tn do
- report_usage(t[k])
+ report_status(t[k])
end
end
end
@@ -918,11 +918,11 @@ function fonts.reportusedfeatures()
setup.number = n -- restore it (normally not needed as we're done anyway)
end
formatcolumns(t," ")
- report_usage()
- report_usage("defined featuresets:")
- report_usage()
+ report_status()
+ report_status("defined featuresets:")
+ report_status()
for k=1,n do
- report_usage(t[k])
+ report_status(t[k])
end
end
end
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index a195fabd1..e8e6cfffe 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -19,8 +19,8 @@ local directive_embedall = false directives.register("fonts.embedall", function
trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading", "tfm.loading")
trackers.register("fonts.all", "fonts.*", "otf.*", "afm.*", "tfm.*")
-local report_define = logs.new("define fonts")
-local report_afm = logs.new("load afm")
+local report_defining = logs.new("fonts","defining")
+local report_afm = logs.new("fonts","afm loading")
--[[ldx--
Here we deal with defining fonts. We do so by intercepting the
@@ -135,7 +135,7 @@ end
function definers.makespecification(specification, lookup, name, sub, method, detail, size)
size = size or 655360
if trace_defining then
- report_define("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s",
+ report_defining("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s",
specification, (lookup ~= "" and lookup) or "[file]", (name ~= "" and name) or "-",
(sub ~= "" and sub) or "-", (method ~= "" and method) or "-", (detail ~= "" and detail) or "-")
end
@@ -343,14 +343,14 @@ function tfm.read(specification)
local reader = readers[lower(forced)]
tfmtable = reader and reader(specification)
if not tfmtable then
- report_define("forced type %s of %s not found",forced,specification.name)
+ report_defining("forced type %s of %s not found",forced,specification.name)
end
else
for s=1,#sequence do -- reader sequence
local reader = sequence[s]
if readers[reader] then -- not really needed
if trace_defining then
- report_define("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown")
+ report_defining("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown")
end
tfmtable = readers[reader](specification)
if tfmtable then
@@ -375,7 +375,7 @@ function tfm.read(specification)
end
end
if not tfmtable then
- report_define("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup)
+ report_defining("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup)
end
return tfmtable
end
@@ -593,7 +593,7 @@ function definers.register(tfmdata,id) -- will be overloaded
local hash = tfmdata.hash
if not internalized[hash] then
if trace_defining then
- report_define("registering font, id: %s, hash: %s",id or "?",hash or "?")
+ report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?")
end
fonts.identifiers[id] = tfmdata
internalized[hash] = id
@@ -661,9 +661,9 @@ function definers.read(specification,size,id) -- id can be optional, name can al
end
lastdefined = tfmdata or id -- todo ! ! ! ! !
if not tfmdata then -- or id?
- report_define( "unknown font %s, loading aborted",specification.name)
+ report_defining( "unknown font %s, loading aborted",specification.name)
elseif trace_defining and type(tfmdata) == "table" then
- report_define("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s",
+ report_defining("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s",
tfmdata.type or "unknown",
id or "?",
tfmdata.name or "?",
@@ -683,18 +683,18 @@ function vf.find(name)
local format = fonts.logger.format(name)
if format == 'tfm' or format == 'ofm' then
if trace_defining then
- report_define("locating vf for %s",name)
+ report_defining("locating vf for %s",name)
end
return findbinfile(name,"ovf")
else
if trace_defining then
- report_define("vf for %s is already taken care of",name)
+ report_defining("vf for %s is already taken care of",name)
end
return nil -- ""
end
else
if trace_defining then
- report_define("locating vf for %s",name)
+ report_defining("locating vf for %s",name)
end
return findbinfile(name,"ovf")
end
diff --git a/tex/context/base/font-enh.lua b/tex/context/base/font-enh.lua
index 183ca848b..b745b8f6c 100644
--- a/tex/context/base/font-enh.lua
+++ b/tex/context/base/font-enh.lua
@@ -12,7 +12,7 @@ local next, match = next, string.match
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
-local report_define = logs.new("define fonts")
+local report_defining = logs.new("fonts","defining")
-- tfmdata has also fast access to indices and unicodes
-- to be checked: otf -> tfm -> tfmscaled
@@ -90,7 +90,7 @@ function tfm.setfeatures(tfmdata)
local fitfmf = fi.tfm[f] -- brr
if fitfmf then
if tfm.trace_features then
- report_define("initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown')
+ report_defining("initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown')
end
fitfmf(tfmdata,value)
mode = tfmdata.mode or features.mode or "base"
@@ -153,7 +153,7 @@ function tfm.reencode(tfmdata,encoding)
for k,v in next, data.unicodes do
if k ~= v then
if trace_defining then
- report_define("reencoding U+%04X to U+%04X",k,v)
+ report_defining("reencoding U+%04X to U+%04X",k,v)
end
characters[k] = original[v]
end
@@ -180,7 +180,7 @@ function tfm.remap(tfmdata,remapping)
for k,v in next, vector do
if k ~= v then
if trace_defining then
- report_define("remapping U+%04X to U+%04X",k,v)
+ report_defining("remapping U+%04X to U+%04X",k,v)
end
local c = original[k]
characters[v] = c
@@ -217,7 +217,7 @@ initializers.node.tfm.remap = tfm.remap
--~ for k,v in next, data.unicodes do
--~ if k ~= v then
--~ if trace_defining then
---~ report_define("mapping %s onto %s",k,v)
+--~ report_defining("mapping %s onto %s",k,v)
--~ end
--~ characters[k] = original[v]
--~ end
diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua
index 16665d373..ff9a70108 100644
--- a/tex/context/base/font-ext.lua
+++ b/tex/context/base/font-ext.lua
@@ -17,7 +17,8 @@ local allocate = utilities.storage.allocate
local trace_protrusion = false trackers.register("fonts.protrusion", function(v) trace_protrusion = v end)
local trace_expansion = false trackers.register("fonts.expansion", function(v) trace_expansion = v end)
-local report_fonts = logs.new("fonts")
+local report_expansions = logs.new("fonts","expansions")
+local report_protrusions = logs.new("fonts","protrusions")
commands = commands or { }
@@ -171,7 +172,7 @@ function initializers.common.expansion(tfmdata,value)
if vector then
local stretch, shrink, step, factor = class.stretch or 0, class.shrink or 0, class.step or 0, class.factor or 1
if trace_expansion then
- report_fonts("set expansion class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s",
+ report_expansions("setting class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s",
value,class.vector,factor,stretch,shrink,step)
end
tfmdata.stretch, tfmdata.shrink, tfmdata.step, tfmdata.auto_expand = stretch * 10, shrink * 10, step * 10, true
@@ -198,10 +199,10 @@ function initializers.common.expansion(tfmdata,value)
end
end
elseif trace_expansion then
- report_fonts("unknown expansion vector '%s' in class '%s",class.vector,value)
+ report_expansions("unknown vector '%s' in class '%s",class.vector,value)
end
elseif trace_expansion then
- report_fonts("unknown expansion class '%s'",value)
+ report_expansions("unknown class '%s'",value)
end
end
end
@@ -216,7 +217,7 @@ initializers.node.afm.expansion = initializers.common.expansion
fonts.goodies.register("expansions", function(...) return fonts.goodies.report("expansions", trace_expansion, ...) end)
-local report_opbd = logs.new("otf opbd")
+local report_opbd = logs.new("fonts","otf opbd")
-- -- -- -- -- --
-- protrusion
@@ -390,7 +391,7 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)
local data = singles[lookup]
if data then
if trace_protrusion then
- report_fonts("set left protrusion using lfbd lookup '%s'",lookup)
+ report_protrusions("setting left using lfbd lookup '%s'",lookup)
end
for k, v in next, data do
-- local p = - v[3] / descriptions[k].width-- or 1 ~= 0 too but the same
@@ -413,7 +414,7 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)
local data = singles[lookup]
if data then
if trace_protrusion then
- report_fonts("set right protrusion using rtbd lookup '%s'",lookup)
+ report_protrusions("setting right using rtbd lookup '%s'",lookup)
end
for k, v in next, data do
-- local p = v[3] / descriptions[k].width -- or 3
@@ -450,7 +451,7 @@ function initializers.common.protrusion(tfmdata,value)
local left = class.left or 1
local right = class.right or 1
if trace_protrusion then
- report_fonts("set protrusion class %s, vector: %s, factor: %s, left: %s, right: %s",
+ report_protrusions("setting class %s, vector: %s, factor: %s, left: %s, right: %s",
value,class.vector,factor,left,right)
end
local data = characters.data
@@ -486,10 +487,10 @@ function initializers.common.protrusion(tfmdata,value)
end
end
elseif trace_protrusion then
- report_fonts("unknown protrusion vector '%s' in class '%s",class.vector,value)
+ report_protrusions("unknown vector '%s' in class '%s",class.vector,value)
end
elseif trace_protrusion then
- report_fonts("unknown protrusion class '%s'",value)
+ report_protrusions("unknown class '%s'",value)
end
end
end
diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua
index 0ddee6680..6092f7442 100644
--- a/tex/context/base/font-fbk.lua
+++ b/tex/context/base/font-fbk.lua
@@ -14,7 +14,7 @@ local trace_combining_all = false trackers.register("fonts.combining.all", func
trackers.register("fonts.composing", "fonts.combining")
-local report_combining = logs.new("combining")
+local report_combining = logs.new("fonts","combining")
local allocate = utilities.storage.allocate
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index e85662af6..29142e45e 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -11,7 +11,7 @@ local gmatch = string.gmatch
local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end)
-local report_fonts = logs.new("fonts")
+local report_fonts = logs.new("fonts","goodies")
local allocate = utilities.storage.allocate
diff --git a/tex/context/base/font-ini.lua b/tex/context/base/font-ini.lua
index eb741f0f7..216e6c23a 100644
--- a/tex/context/base/font-ini.lua
+++ b/tex/context/base/font-ini.lua
@@ -16,7 +16,7 @@ local write_nl = texio.write_nl
local lower = string.lower
local allocate, mark = utilities.storage.allocate, utilities.storage.mark
-local report_define = logs.new("define fonts")
+local report_defining = logs.new("fonts","defining")
fontloader.totable = fontloader.to_table
@@ -105,7 +105,7 @@ function fonts.fontformat(filename,default)
if format then
return format
else
- report_define("unable to determine font format for '%s'",filename)
+ report_defining("unable to determine font format for '%s'",filename)
return default
end
end
diff --git a/tex/context/base/font-log.lua b/tex/context/base/font-log.lua
index e16a945f9..d7fc16f58 100644
--- a/tex/context/base/font-log.lua
+++ b/tex/context/base/font-log.lua
@@ -10,7 +10,7 @@ local next, format, lower, concat = next, string.format, string.lower, table.con
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
-local report_define = logs.new("define fonts")
+local report_defining = logs.new("fonts","defining")
local fonts = fonts
fonts.logger = fonts.logger or { }
@@ -27,7 +27,7 @@ function logger.save(tfmtable,source,specification) -- save file name in spec he
if tfmtable and specification and specification.specification then
local name = lower(specification.name)
if trace_defining and not fonts.used[name] then
- report_define("registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename))
+ report_defining("registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename))
end
specification.source = source
fonts.loaded[lower(specification.specification)] = specification
diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua
index b20663273..48ba29a78 100644
--- a/tex/context/base/font-map.lua
+++ b/tex/context/base/font-map.lua
@@ -14,7 +14,7 @@ local utfbyte = utf.byte
local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
local trace_unimapping = false trackers.register("otf.unimapping", function(v) trace_unimapping = v end)
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
--[[ldx--
Eventually this code will disappear because map files are kind
diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua
index 241845f24..23326607f 100644
--- a/tex/context/base/font-otb.lua
+++ b/tex/context/base/font-otb.lua
@@ -23,7 +23,7 @@ local trace_ligatures = false trackers.register("otf.ligatures", function
local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end)
local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end)
-local report_prepare = logs.new("otf prepare")
+local report_prepare = logs.new("fonts","otf prepare")
local wildcard = "*"
local default = "dflt"
diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua
index f9d749123..17e442978 100644
--- a/tex/context/base/font-otc.lua
+++ b/tex/context/base/font-otc.lua
@@ -16,7 +16,7 @@ local trace_loading = false trackers.register("otf.loading", function(v) trace_
local fonts = fonts
local otf = fonts.otf
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
-- instead of "script = "DFLT", langs = { 'dflt' }" we now use wildcards (we used to
-- have always); some day we can write a "force always when true" trick for other
diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua
index 4d078017a..299b703c6 100644
--- a/tex/context/base/font-otd.lua
+++ b/tex/context/base/font-otd.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-otd'] = {
local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end)
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
local fonts = fonts
local otf = fonts.otf
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index ee7964b60..a543e0b0e 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -32,7 +32,7 @@ local trace_sequences = false trackers.register("otf.sequences", function(v)
local trace_math = false trackers.register("otf.math", function(v) trace_math = v end)
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
local starttiming, stoptiming, elapsedtime = statistics.starttiming, statistics.stoptiming, statistics.elapsedtime
@@ -52,6 +52,7 @@ otf.features.default = otf.features.default or { }
otf.enhancers = allocate()
local enhancers = otf.enhancers
enhancers.patches = { }
+local patches = enhancers.patches
local definers = fonts.definers
@@ -264,11 +265,11 @@ local ordered_enhancers = {
local actions = { }
-enhancers.patches.before = allocate()
-enhancers.patches.after = allocate()
+patches.before = allocate()
+patches.after = allocate()
-local before = enhancers.patches.before
-local after = enhancers.patches.after
+local before = patches.before
+local after = patches.after
local function enhance(name,data,filename,raw,verbose)
local enhancer = actions[name]
@@ -312,9 +313,9 @@ function enhancers.apply(data,filename,raw,verbose)
ioflush() -- we want instant messages
end
--- enhancers.patches.register("before","migrate metadata","cambria",function() end)
+-- patches.register("before","migrate metadata","cambria",function() end)
-function enhancers.patches.register(what,where,pattern,action)
+function patches.register(what,where,pattern,action)
local ww = what[where]
if ww then
ww[pattern] = action
@@ -323,6 +324,12 @@ function enhancers.patches.register(what,where,pattern,action)
end
end
+function patches.report(fmt,...)
+ if trace_loading then
+ report_otf("patching: " ..fmt,...)
+ end
+end
+
function enhancers.register(what,action) -- only already registered can be overloaded
actions[what] = action
end
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 29fed2944..c4abeba22 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -148,11 +148,11 @@ local trace_steps = false trackers.register("otf.steps", function
local trace_skips = false trackers.register("otf.skips", function(v) trace_skips = v end)
local trace_directions = false trackers.register("otf.directions", function(v) trace_directions = v end)
-local report_direct = logs.new("otf direct")
-local report_subchain = logs.new("otf subchain")
-local report_chain = logs.new("otf chain")
-local report_process = logs.new("otf process")
-local report_prepare = logs.new("otf prepare")
+local report_direct = logs.new("fonts","otf direct")
+local report_subchain = logs.new("fonts","otf subchain")
+local report_chain = logs.new("fonts","otf chain")
+local report_process = logs.new("fonts","otf process")
+local report_prepare = logs.new("fonts","otf prepare")
trackers.register("otf.verbose_chain", function(v) otf.setcontextchain(v and "verbose") end)
trackers.register("otf.normal_chain", function(v) otf.setcontextchain(v and "normal") end)
diff --git a/tex/context/base/font-otp.lua b/tex/context/base/font-otp.lua
index 6c4f185b3..fe5ced658 100644
--- a/tex/context/base/font-otp.lua
+++ b/tex/context/base/font-otp.lua
@@ -13,7 +13,7 @@ local sort, concat = table.sort, table.concat
local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
-local report_otf = logs.new("load otf")
+local report_otf = logs.new("fonts","otf loading")
fonts = fonts or { } -- this module is also used in mtxrun
local fonts = fonts
diff --git a/tex/context/base/font-pat.lua b/tex/context/base/font-pat.lua
index c43d283b1..8748f0ed1 100644
--- a/tex/context/base/font-pat.lua
+++ b/tex/context/base/font-pat.lua
@@ -6,26 +6,21 @@ if not modules then modules = { } end modules ['font-pat'] = {
license = "see context related readme files"
}
-local match, lower, find = string.match, string.lower, string.find
+local match, lower = string.match, string.lower
-local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
-
-local report_otf = logs.new("load otf")
-
--- this will become a per font patch file
---
-- older versions of latin modern didn't have the designsize set
-- so for them we get it from the name
+-- reporter moved to elsewhere
-local register = enhancers.patches.register
+local patches = fonts.otf.enhancers.patches
+local register = patches.register
+local report = patches.report
local function patch(data,filename)
if data.design_size == 0 then
local ds = match(file.basename(lower(filename)),"(%d+)")
if ds then
- if trace_loading then
- report_otf("patching design size (%s)",ds)
- end
+ report("design size (%s)",ds)
data.design_size = tonumber(ds) * 10
end
end
@@ -35,34 +30,6 @@ register("after","migrate metadata","^lmroman", patch)
register("after","migrate metadata","^lmsans", patch)
register("after","migrate metadata","^lmtypewriter",patch)
-local function patch(data,filename)
- local uni_to_ind = data.map.map
- if not uni_to_ind[0x391] then
- -- beware, this is a hack, features for latin often don't apply to greek
- -- but lm has not much features anyway (and only greek for math)
- if trace_loading then
- report_otf("adding 13 greek capitals")
- end
- uni_to_ind[0x391] = uni_to_ind[0x41]
- uni_to_ind[0x392] = uni_to_ind[0x42]
- uni_to_ind[0x395] = uni_to_ind[0x45]
- uni_to_ind[0x397] = uni_to_ind[0x48]
- uni_to_ind[0x399] = uni_to_ind[0x49]
- uni_to_ind[0x39A] = uni_to_ind[0x4B]
- uni_to_ind[0x39C] = uni_to_ind[0x4D]
- uni_to_ind[0x39D] = uni_to_ind[0x4E]
- uni_to_ind[0x39F] = uni_to_ind[0x4F]
- uni_to_ind[0x3A1] = uni_to_ind[0x52]
- uni_to_ind[0x3A4] = uni_to_ind[0x54]
- uni_to_ind[0x3A7] = uni_to_ind[0x58]
- uni_to_ind[0x396] = uni_to_ind[0x5A]
- end
-end
-
-register("after","prepare glyphs","^lmroman", patch)
-register("after","prepare glyphs","^lmsans", patch)
-register("after","prepare glyphs","^lmtypewriter",patch)
-
-- for some reason (either it's a bug in the font, or it's
-- a problem in the library) the palatino arabic fonts don't
-- have the mkmk features properly set up
@@ -73,13 +40,18 @@ local function patch(data,filename)
for k=1,#gpos do
local v = gpos[k]
if not v.features and v.type == "gpos_mark2mark" then
- if trace_loading then
- report_otf("patching mkmk feature (name: %s)", v.name or "?")
- end
+ report("mkmk feature (name: %s)", v.name or "?")
v.features = {
{
- scripts = { arab = { "ARA " = true, "FAR " = true, "URD " = true, "dflt" = true } },
- tag = "mkmk"
+ scripts = {
+ arab = {
+ ["ARA "] = true,
+ ["FAR "] = true,
+ ["URD "] = true,
+ ["dflt"] = true,
+ }
+ },
+ tag = "mkmk",
}
}
end
@@ -89,19 +61,47 @@ end
register("after","rehash features","palatino.*arabic",patch)
-local function patch_domh(data,filename,threshold)
- local m = data.metadata.math
- if m then
- local d = m.DisplayOperatorMinHeight or 0
- if d < threshold then
- if trace_loading then
- report_otf("patching DisplayOperatorMinHeight(%s -> %s)",d,threshold)
- end
- m.DisplayOperatorMinHeight = threshold
- end
- end
-end
-
-register("after","check math parameters","cambria", function(data,filename) patch_domh(data,filename,2800) end)
-register("after","check math parameters","cambmath",function(data,filename) patch_domh(data,filename,2800) end)
-register("after","check math parameters","asana", function(data,filename) patch_domh(data,filename,1350) end)
+-- -- this code is now in lm-math.lfg
+--
+-- local function patch(data,filename)
+-- local uni_to_ind = data.map.map
+-- if not uni_to_ind[0x391] then
+-- -- beware, this is a hack, features for latin often don't apply to greek
+-- -- but lm has not much features anyway (and only greek for math)
+-- report("adding 13 greek capitals")
+-- uni_to_ind[0x391] = uni_to_ind[0x41]
+-- uni_to_ind[0x392] = uni_to_ind[0x42]
+-- uni_to_ind[0x395] = uni_to_ind[0x45]
+-- uni_to_ind[0x397] = uni_to_ind[0x48]
+-- uni_to_ind[0x399] = uni_to_ind[0x49]
+-- uni_to_ind[0x39A] = uni_to_ind[0x4B]
+-- uni_to_ind[0x39C] = uni_to_ind[0x4D]
+-- uni_to_ind[0x39D] = uni_to_ind[0x4E]
+-- uni_to_ind[0x39F] = uni_to_ind[0x4F]
+-- uni_to_ind[0x3A1] = uni_to_ind[0x52]
+-- uni_to_ind[0x3A4] = uni_to_ind[0x54]
+-- uni_to_ind[0x3A7] = uni_to_ind[0x58]
+-- uni_to_ind[0x396] = uni_to_ind[0x5A]
+-- end
+-- end
+--
+-- register("after","prepare glyphs","^lmroman", patch)
+-- register("after","prepare glyphs","^lmsans", patch)
+-- register("after","prepare glyphs","^lmtypewriter",patch)
+--
+-- -- this code is now in cambria-math.lfg and asana-math.lfg
+--
+-- local function patch_domh(data,filename,threshold)
+-- local m = data.metadata.math
+-- if m then
+-- local d = m.DisplayOperatorMinHeight or 0
+-- if d < threshold then
+-- report("DisplayOperatorMinHeight(%s -> %s)",d,threshold)
+-- m.DisplayOperatorMinHeight = threshold
+-- end
+-- end
+-- end
+--
+-- register("after","check math parameters","cambria", function(data,filename) patch_domh(data,filename,2800) end)
+-- register("after","check math parameters","cambmath",function(data,filename) patch_domh(data,filename,2800) end)
+-- register("after","check math parameters","asana", function(data,filename) patch_domh(data,filename,1350) end)
diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua
index 5eb7551cd..5efdab3b4 100644
--- a/tex/context/base/font-syn.lua
+++ b/tex/context/base/font-syn.lua
@@ -24,7 +24,7 @@ local trace_names = false trackers.register("fonts.names", fu
local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end)
local trace_specifications = false trackers.register("fonts.specifications", function(v) trace_specifications = v end)
-local report_names = logs.new("fontnames")
+local report_names = logs.new("fonts","names")
--[[ldx--
This module implements a name to filename resolver. Names are resolved
@@ -642,7 +642,6 @@ local function analyzefiles()
-- already done (avoid otf afm clash)
if trace_names then
report_names("%s font %s already done",suffix,completename)
- logs.push()
end
nofduplicates = nofduplicates + 1
nofskipped = nofskipped + 1
@@ -650,14 +649,12 @@ local function analyzefiles()
-- weird error
if trace_names then
report_names("%s font %s does not really exist",suffix,completename)
- logs.push()
end
nofskipped = nofskipped + 1
elseif not file.is_qualified_path(completename) and resolvers.findfile(completename,suffix) == "" then
-- not locateble by backend anyway
if trace_names then
report_names("%s font %s cannot be found by backend",suffix,completename)
- logs.push()
end
nofskipped = nofskipped + 1
else
@@ -666,7 +663,6 @@ local function analyzefiles()
if find(basepath,skip_paths[i]) then
if trace_names then
report_names("rejecting path of %s font %s",suffix,completename)
- logs.push()
end
nofskipped = nofskipped + 1
return
@@ -679,7 +675,6 @@ local function analyzefiles()
done[name] = true
if trace_names then
report_names("rejecting name of %s font %s",suffix,completename)
- logs.push()
end
nofskipped = nofskipped + 1
return
@@ -688,12 +683,8 @@ local function analyzefiles()
end
if trace_names then
report_names("identifying %s font %s",suffix,completename)
- logs.push()
end
local result, message = filters[lower(suffix)](completename)
- if trace_names then
- logs.pop()
- end
if result then
if result[1] then
for r=1,#result do
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index baa6ffb69..3be220e80 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -16,7 +16,7 @@ local allocate = utilities.storage.allocate
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
local trace_scaling = false trackers.register("fonts.scaling" , function(v) trace_scaling = v end)
-local report_define = logs.new("define fonts")
+local report_defining = logs.new("fonts","defining")
-- tfmdata has also fast access to indices and unicodes
-- to be checked: otf -> tfm -> tfmscaled
@@ -62,7 +62,7 @@ function tfm.read_from_tfm(specification)
local fname, tfmdata = specification.filename or "", nil
if fname ~= "" then
if trace_defining then
- report_define("loading tfm file %s at size %s",fname,specification.size)
+ report_defining("loading tfm file %s at size %s",fname,specification.size)
end
tfmdata = font.read_tfm(fname,specification.size) -- not cached, fast enough
if tfmdata then
@@ -85,7 +85,7 @@ function tfm.read_from_tfm(specification)
tfm.enhance(tfmdata,specification)
end
elseif trace_defining then
- report_define("loading tfm with name %s fails",specification.name)
+ report_defining("loading tfm with name %s fails",specification.name)
end
return tfmdata
end
@@ -421,7 +421,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
end
end
-- if trace_scaling then
- -- report_define("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-')
+ -- report_defining("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-')
-- end
if tounicode then
local tu = tounicode[index] -- nb: index!
@@ -458,7 +458,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
if vn then
chr.next = vn
--~ if v.vert_variants or v.horiz_variants then
- --~ report_define("glyph 0x%05X has combination of next, vert_variants and horiz_variants",index)
+ --~ report_defining("glyph 0x%05X has combination of next, vert_variants and horiz_variants",index)
--~ end
else
local vv = v.vert_variants
@@ -630,11 +630,11 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
-- can have multiple subfonts
if hasmath then
if trace_defining then
- report_define("math enabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
+ report_defining("math enabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
end
else
if trace_defining then
- report_define("math disabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
+ report_defining("math disabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
end
t.nomath, t.MathConstants = true, nil
end
@@ -643,8 +643,8 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
t.psname = t.fontname or (t.fullname and fonts.names.cleanname(t.fullname))
end
if trace_defining then
- report_define("used for accessing (sub)font: '%s'",t.psname or "nopsname")
- report_define("used for subsetting: '%s'",t.fontname or "nofontname")
+ report_defining("used for accessing (sub)font: '%s'",t.psname or "nopsname")
+ report_defining("used for subsetting: '%s'",t.fontname or "nofontname")
end
-- this will move up (side effect of merging split call)
t.factor = delta
@@ -747,18 +747,18 @@ function tfm.checkedfilename(metadata,whatever)
askedfilename = resolvers.resolve(askedfilename) -- no shortcut
foundfilename = resolvers.findbinfile(askedfilename,"") or ""
if foundfilename == "" then
- report_define("source file '%s' is not found",askedfilename)
+ report_defining("source file '%s' is not found",askedfilename)
foundfilename = resolvers.findbinfile(file.basename(askedfilename),"") or ""
if foundfilename ~= "" then
- report_define("using source file '%s' (cache mismatch)",foundfilename)
+ report_defining("using source file '%s' (cache mismatch)",foundfilename)
end
end
elseif whatever then
- report_define("no source file for '%s'",whatever)
+ report_defining("no source file for '%s'",whatever)
foundfilename = ""
end
metadata.foundfilename = foundfilename
- -- report_define("using source file '%s'",foundfilename)
+ -- report_defining("using source file '%s'",foundfilename)
end
return foundfilename
end
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index 75f85103c..26b93435b 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -259,7 +259,7 @@
\let\currentresourcecomment\empty
\def\showexternalfigures % maybe run time command is better, but no core-run, unless figs-run ...
- {%\writestatus\m!systems{for \string\showexternalfigures\space see \truefilename{x-res-20}.tex}
+ {%\writestatus\m!system{for \string\showexternalfigures\space see \truefilename{x-res-20}.tex}
\usemodule[res-20]\showexternalfigures} % so for the moment we do it this way
\def\overlayfigure#1%
diff --git a/tex/context/base/grph-fil.lua b/tex/context/base/grph-fil.lua
index 4bd1e7d0f..95141d03e 100644
--- a/tex/context/base/grph-fil.lua
+++ b/tex/context/base/grph-fil.lua
@@ -8,7 +8,9 @@ if not modules then modules = { } end modules ['grph-fil'] = {
local format, concat = string.format, table.concat
-local trace_run = false trackers.register("files.run",function(v) trace_run = v end)
+local trace_run = false trackers.register("graphic.runfile",function(v) trace_run = v end)
+
+local report_run = logs.new("graphics","run")
local allocate, mark = utilities.storage.allocate, utilities.storage.mark
@@ -35,15 +37,15 @@ function jobfiles.run(name,command)
local newchecksum = file.checksum(name)
if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then
if trace_run then
- commands.writestatus("processing","changes in '%s', processing forced",name)
+ report_run("processing file, changes in '%s', processing forced",name)
end
if command and command ~= "" then
os.execute(command)
else
- commands.writestatus("processing","no command given for processing '%s'",name)
+ report_run("processing file, no command given for processing '%s'",name)
end
elseif trace_run then
- commands.writestatus("processing","no changes in '%s', not processed",name)
+ report_run("processing file, no changes in '%s', not processed",name)
end
tobesaved[name] = newchecksum
end
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 14a5bfa60..9546218ef 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -37,8 +37,6 @@ The TeX-Lua mix is suboptimal. This has to do with the fact that we cannot
run TeX code from within Lua. Some more functionality will move to Lua.
]]--
--- commands.writestatus -> report
-
local format, lower, find, match, gsub, gmatch = string.format, string.lower, string.find, string.match, string.gsub, string.gmatch
local texbox = tex.box
local contains = table.contains
@@ -51,13 +49,13 @@ local variables = interfaces.variables
local codeinjections = backends.codeinjections
local nodeinjections = backends.nodeinjections
-local trace_figures = false trackers.register("figures.locating", function(v) trace_figures = v end)
-local trace_bases = false trackers.register("figures.bases", function(v) trace_bases = v end)
-local trace_programs = false trackers.register("figures.programs", function(v) trace_programs = v end)
-local trace_conversion = false trackers.register("figures.conversion", function(v) trace_conversion = v end)
-local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end)
+local trace_figures = false trackers.register("graphics.locating", function(v) trace_figures = v end)
+local trace_bases = false trackers.register("graphics.bases", function(v) trace_bases = v end)
+local trace_programs = false trackers.register("graphics.programs", function(v) trace_programs = v end)
+local trace_conversion = false trackers.register("graphics.conversion", function(v) trace_conversion = v end)
+local trace_inclusion = false trackers.register("graphics.inclusion", function(v) trace_inclusion = v end)
-local report_graphics = logs.new("graphics")
+local report_inclusion = logs.new("graphics","inclusion")
local context, img = context, img
@@ -239,8 +237,8 @@ function figures.setpaths(locationset,pathlist)
end
figures.paths, last_pathlist = t, pathlist
if trace_figures then
- commands.writestatus("figures","locations: %s",last_locationset)
- commands.writestatus("figures","path list: %s",concat(figures.paths, " "))
+ report_inclusion("locations: %s",last_locationset)
+ report_inclusion("path list: %s",concat(figures.paths, " "))
end
end
@@ -367,12 +365,12 @@ local function forbiddenname(filename)
local expandedfullname = file.collapsepath(filename,true)
local expandedinputname = file.collapsepath(file.addsuffix(environment.jobfilename,environment.jobfilesuffix),true)
if expandedfullname == expandedinputname then
- report_graphics("skipping graphic with same name as input filename (%s), enforce suffix",expandedinputname)
+ report_inclusion("skipping graphic with same name as input filename (%s), enforce suffix",expandedinputname)
return true
end
local expandedoutputname = file.collapsepath(codeinjections.getoutputfilename(),true)
if expandedfullname == expandedoutputname then
- report_graphics("skipping graphic with same name as output filename (%s), enforce suffix",expandedoutputname)
+ report_inclusion("skipping graphic with same name as output filename (%s), enforce suffix",expandedoutputname)
return true
end
end
@@ -397,7 +395,7 @@ local function register(askedname,specification)
newformat = defaultformat
end
if trace_conversion then
- report_graphics("checking conversion of '%s': old format '%s', new format '%s', conversion '%s', resolution '%s'",
+ report_inclusion("checking conversion of '%s': old format '%s', new format '%s', conversion '%s', resolution '%s'",
askedname,format,newformat,conversion or "default",resolution or "default")
end
local converter = (newformat ~= format) and converters[format]
@@ -414,7 +412,7 @@ local function register(askedname,specification)
end
end
elseif trace_conversion then
- report_graphics("no converter for '%s' -> '%s'",format,newformat)
+ report_inclusion("no converter for '%s' -> '%s'",format,newformat)
end
if converter then
-- local oldname = specification.fullname
@@ -430,7 +428,7 @@ local function register(askedname,specification)
end
if not file.is_writable(newpath) then
if trace_conversion then
- report_graphics("[ath '%s'is not writable, forcing conversion path '.' ",newpath)
+ report_inclusion("[ath '%s'is not writable, forcing conversion path '.' ",newpath)
end
newpath = "."
end
@@ -454,12 +452,12 @@ local function register(askedname,specification)
local newtime = lfs.attributes(newname,'modification') or 0
if newtime == 0 or oldtime > newtime then
if trace_conversion then
- report_graphics("converting '%s' from '%s' to '%s'",askedname,format,newformat)
+ report_inclusion("converting '%s' from '%s' to '%s'",askedname,format,newformat)
end
converter(oldname,newname,resolution or "")
else
if trace_conversion then
- report_graphics("no need to convert '%s' from '%s' to '%s'",askedname,format,newformat)
+ report_inclusion("no need to convert '%s' from '%s' to '%s'",askedname,format,newformat)
end
end
if io.exists(newname) then
@@ -479,15 +477,15 @@ local function register(askedname,specification)
if not found then
specification.found = false
if trace_figures then
- commands.writestatus("figures","format not supported: %s",format)
+ report_inclusion("format not supported: %s",format)
end
else
specification.found = true
if trace_figures then
if validtypes[format] then
- commands.writestatus("figures","format natively supported by backend: %s",format)
+ report_inclusion("format natively supported by backend: %s",format)
else
- commands.writestatus("figures","format supported by output file format: %s",format)
+ report_inclusion("format supported by output file format: %s",format)
end
end
end
@@ -532,7 +530,7 @@ local function locate(request) -- name, format, cache
local askedresolution = request.resolution
if askedformat ~= "" then
if trace_figures then
- commands.writestatus("figures","strategy: forced format")
+ report_inclusion("strategy: forced format")
end
askedformat = lower(askedformat)
local format = figures.suffixes[askedformat]
@@ -607,7 +605,7 @@ local function locate(request) -- name, format, cache
end
elseif askedpath then
if trace_figures then
- commands.writestatus("figures","strategy: rootbased path")
+ report_inclusion("strategy: rootbased path")
end
local figureorder = figures.order
for i=1,#figureorder do
@@ -631,7 +629,7 @@ local function locate(request) -- name, format, cache
else
if figures.preferquality then
if trace_figures then
- commands.writestatus("figures","strategy: unknown format, prefer quality")
+ report_inclusion("strategy: unknown format, prefer quality")
end
local figurepaths = figures.paths
local figureorder = figures.order
@@ -648,7 +646,7 @@ local function locate(request) -- name, format, cache
local isfile = url.hashed(check).scheme == "file"
if not isfile then
if trace_figures then
- commands.writestatus("figures","warning: skipping path %s",path)
+ report_inclusion("warning: skipping path %s",path)
end
elseif figures.exists(check,format,true) then
return register(askedname, {
@@ -665,7 +663,7 @@ local function locate(request) -- name, format, cache
end
else -- 'location'
if trace_figures then
- commands.writestatus("figures","strategy: unknown format, prefer path")
+ report_inclusion("strategy: unknown format, prefer path")
end
local figurepaths = figures.paths
local figureorder = figures.order
@@ -693,7 +691,7 @@ local function locate(request) -- name, format, cache
end
if figures.defaultsearch then
if trace_figures then
- commands.writestatus("figures","strategy: default tex path")
+ report_inclusion("strategy: default tex path")
end
local figureorder = figures.order
for j=1,#figureorder do
@@ -807,9 +805,9 @@ function existers.generic(askedname,resolve)
end
if trace_figures then
if result then
- commands.writestatus("figures","found: %s -> %s",askedname,result)
+ report_inclusion("found: %s -> %s",askedname,result)
else
- commands.writestatus("figures","not found: %s",askedname)
+ report_inclusion("not found: %s",askedname)
end
end
return result
@@ -835,11 +833,11 @@ function checkers.generic(data)
figure, data = f or figure, d or data
figures.loaded[hash] = figure
if trace_conversion then
- report_graphics("new graphic, hash: %s",hash)
+ report_inclusion("new graphic, hash: %s",hash)
end
else
if trace_conversion then
- report_graphics("existing graphic, hash: %s",hash)
+ report_inclusion("existing graphic, hash: %s",hash)
end
end
if figure then
@@ -920,7 +918,7 @@ function checkers.mov(data)
dr.width, dr.height = width, height
du.width, du.height, du.foundname = width, height, foundname
if trace_inclusion then
- report_graphics("including movie '%s': width %s, height %s",foundname,width,height)
+ report_inclusion("including movie '%s': width %s, height %s",foundname,width,height)
end
-- we need to push the node.write in between ... we could make a shared helper for this
context.startfoundexternalfigure(width .. "sp",height .. "sp")
@@ -1008,7 +1006,7 @@ end
local function runprogram(...)
local command = format(...)
if trace_conversion or trace_programs then
- report_graphics("running %s",command)
+ report_inclusion("running %s",command)
end
os.spawn(command)
end
@@ -1126,7 +1124,7 @@ function bases.use(basename)
xml.registerns("rlx","http://www.pragma-ade.com/schemas/rlx") -- we should be able to do this per xml file
end
if trace_bases then
- commands.writestatus("figures","registering base '%s'",basename)
+ report_inclusion("registering base '%s'",basename)
end
end
end
@@ -1134,7 +1132,7 @@ end
function bases.find(basename,askedlabel)
if trace_bases then
- commands.writestatus("figures","checking for '%s' in base '%s'",askedlabel,basename)
+ report_inclusion("checking for '%s' in base '%s'",askedlabel,basename)
end
basename = file.addsuffix(basename,"xml")
local t = bases.found[askedlabel]
@@ -1151,7 +1149,7 @@ function bases.find(basename,askedlabel)
base[2] = xmlfile
base[3] = xml.load(xmlfile)
if trace_bases then
- commands.writestatus("figures","base '%s' loaded",xmlfile)
+ report_inclusion("base '%s' loaded",xmlfile)
end
break
end
@@ -1170,13 +1168,13 @@ function bases.find(basename,askedlabel)
}
bases.found[askedlabel] = t
if trace_bases then
- commands.writestatus("figures","figure '%s' found in base '%s'",askedlabel,base[2])
+ report_inclusion("figure '%s' found in base '%s'",askedlabel,base[2])
end
return t
end
end
if trace_bases and not t then
- commands.writestatus("figures","figure '%s' not found in base '%s'",askedlabel,base[2])
+ report_inclusion("figure '%s' not found in base '%s'",askedlabel,base[2])
end
end
end
diff --git a/tex/context/base/grph-u3d.lua b/tex/context/base/grph-u3d.lua
index e20655e3f..25a5addef 100644
--- a/tex/context/base/grph-u3d.lua
+++ b/tex/context/base/grph-u3d.lua
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['grph-u3d'] = {
local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end)
-local report_graphics = logs.new("graphics")
+local report_u3d = logs.new("graphics","u3d")
local figures = figures
@@ -23,11 +23,11 @@ function figures.checkers.u3d(data)
local dr, du, ds = data.request, data.used, data.status
local width = todimen(dr.width or figures.defaultwidth)
local height = todimen(dr.height or figures.defaultheight)
- local foundname = du.report_graphics(
+ local foundname = du.report_u3ds(
dr.width, dr.height = width, height
du.width, du.height, du.foundname = width, height, foundname
if trace_inclusion then
- report_graphics("including u3d '%s': width %s, height %s",foundname,width,height)
+ report_u3d("including u3d '%s': width %s, height %s",foundname,width,height)
end
context.startfoundexternalfigure(width .. "sp",height .. "sp")
context(function()
diff --git a/tex/context/base/grph-wnd.lua b/tex/context/base/grph-wnd.lua
index 0047651bf..5e048ad46 100644
--- a/tex/context/base/grph-wnd.lua
+++ b/tex/context/base/grph-wnd.lua
@@ -14,13 +14,13 @@ local converters, suffixes = figures.converters, figures.suffixes
local trace_conversion = false trackers.register("figures.conversion", function(v) trace_conversion = v end)
-local report_graphics = logs.new("graphics")
+local report_wand = logs.new("graphics","wand")
local function togray(oldname,newname)
if lfs.isfile(oldname) then
require("gmwand")
if trace_conversion then
- report_graphics("converting '%s' to '%s' using gmwand",oldname,newname)
+ report_wand("converting '%s' to '%s' using gmwand",oldname,newname)
end
gmwand.InitializeMagick("./") -- What does this path do?
local wand = gmwand.NewMagickWand()
@@ -29,7 +29,7 @@ local function togray(oldname,newname)
gmwand.MagickWriteImages(wand,newname,1)
gmwand.DestroyMagickWand(wand)
else
- report_graphics("unable to convert '%s' to '%s' using gmwand",oldname,newname)
+ report_wand("unable to convert '%s' to '%s' using gmwand",oldname,newname)
end
end
@@ -39,7 +39,7 @@ for i=1,#formats do
local oldformat = formats[i]
local newformat = "gray." .. oldformat
if trace_conversion then
- report_graphics("installing converter: %s -> %s",oldformat,newformat)
+ report_wand("installing converter: %s -> %s",oldformat,newformat)
end
converters[oldformat] = converters[oldformat] or { }
converters[oldformat][newformat] = togray
diff --git a/tex/context/base/java-ini.lua b/tex/context/base/java-ini.lua
index efe00ffce..cbe8ab30a 100644
--- a/tex/context/base/java-ini.lua
+++ b/tex/context/base/java-ini.lua
@@ -17,7 +17,7 @@ local variables = interfaces.variables
local trace_javascript = false trackers.register("backends.javascript", function(v) trace_javascript = v end)
-local report_javascript = logs.new("javascript")
+local report_javascripts = logs.new("interactions","javascripts")
interactions.javascripts = interactions.javascripts or { }
local javascripts = interactions.javascripts
@@ -68,7 +68,7 @@ function javascripts.storepreamble(str) -- now later
preambles[n] = { name, used, script }
preambled[name] = n
if trace_javascript then
- report_javascript("storing preamble '%s', state '%s', order '%s'",name,used,n)
+ report_javascripts("storing preamble '%s', state '%s', order '%s'",name,used,n)
end
lpegmatch(parsefunctions,script,1,n)
end
@@ -80,7 +80,7 @@ function javascripts.setpreamble(name,script) -- now later
preambles[n] = { name, "now", script }
preambled[name] = n
if trace_javascript then
- report_javascript("setting preamble '%s', state 'now', order '%s'",name,n)
+ report_javascripts("setting preamble '%s', state 'now', order '%s'",name,n)
end
lpegmatch(parsefunctions,script,1,n)
end
@@ -92,14 +92,14 @@ function javascripts.addtopreamble(name,script) -- now later
if p then
preambles[p] = { "now", preambles[p] .. " ;\n" .. script }
if trace_javascript then
- report_javascript("extending preamble '%s', state 'now'",name)
+ report_javascripts("extending preamble '%s', state 'now'",name)
end
else
local n = #preambles + 1
preambles[n] = { name, "now", script }
preambled[name] = n
if trace_javascript then
- report_javascript("storing preamble '%s', state 'now', order '%s'",name,n)
+ report_javascripts("storing preamble '%s', state 'now', order '%s'",name,n)
end
lpegmatch(parsefunctions,script,1,n)
end
@@ -114,7 +114,7 @@ function javascripts.usepreamblenow(name) -- now later
if not preambled[somename] then
preambles[preambled[somename]][2] = "now"
if trace_javascript then
- report_javascript("using preamble '%s', state 'now'",somename)
+ report_javascripts("using preamble '%s', state 'now'",somename)
end
end
end
@@ -135,15 +135,15 @@ function javascripts.code(name,arguments)
preambles[p][2] = "now"
if trace_javascript and not reported[name] then
reported[name] = true
- report_javascript("using code '%s', preamble '%s'",name,u)
+ report_javascripts("using code '%s', preamble '%s'",name,u)
end
elseif trace_javascript and not reported[name] then
reported[name] = true
- report_javascript("using code '%s'",name)
+ report_javascripts("using code '%s'",name)
end
elseif trace_javascript and not reported[name] then
reported[name] = true
- report_javascript("using code '%s'",name)
+ report_javascripts("using code '%s'",name)
end
used = true
return code
@@ -153,7 +153,7 @@ function javascripts.code(name,arguments)
used = true
if trace_javascript and not reported[name] then
reported[name] = true
- report_javascript("using function '%s'",name)
+ report_javascripts("using function '%s'",name)
end
preambles[f][2] = "now" -- automatically tag preambles that define the function (as later)
if arguments then
@@ -175,7 +175,7 @@ function javascripts.flushpreambles()
local preamble = preambles[i]
if preamble[2] == "now" then
if trace_javascript then
- report_javascript("flushing preamble '%s'",preamble[1])
+ report_javascripts("flushing preamble '%s'",preamble[1])
end
t[#t+1] = { preamble[1], preamble[3] }
end
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 868a6d52e..b20bc8853 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -423,11 +423,7 @@ local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0)
local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0)
function string.escapedpattern(str,simple)
- if simple then
- return match(s,str)
- else
- return match(p,str)
- end
+ return match(simple and s or p,str)
end
-- utf extensies
diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua
index 7e4f7a95c..989e57f75 100644
--- a/tex/context/base/l-string.lua
+++ b/tex/context/base/l-string.lua
@@ -93,11 +93,7 @@ local simple_escapes = {
}
function string.escapedpattern(str,simple)
- if simple then
- return (gsub(str,".",simple_escapes))
- else
- return (gsub(str,".",patterns_escapes))
- end
+ return (gsub(str,".",simple and simple_escapes or patterns_escapes))
end
function string.topattern(str,lowercase,strict)
diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv
index 19c2c676d..871e4f528 100644
--- a/tex/context/base/lang-def.mkiv
+++ b/tex/context/base/lang-def.mkiv
@@ -134,6 +134,7 @@
rightquotation=\rightguillemot,
date={day,{.},\ ,month,\ ,year}]
+
\installlanguage [\s!no] [\s!nb]
\installlanguage [\s!norwegian] [\s!nb]
\installlanguage [\s!bokmal] [\s!nb]
@@ -510,6 +511,10 @@
% CJK
+\definesystemconstant {chinese} \definesystemconstant {cn}
+\definesystemconstant {japanese} \definesystemconstant {ja}
+\definesystemconstant {korean} \definesystemconstant {kr}
+
\installlanguage
[\s!cn]
[\c!leftsentence=——,
@@ -543,8 +548,8 @@
\c!leftquote=‘,
\c!rightquote=’,
\c!leftquotation=“,
- \c!rightquotation=”」,
- \c!date={서기,\v!year,年,\v!month,月,\v!day,日}]
+ \c!rightquotation=”,
+ \c!date={서기,\v!year,년,\v!month,월,\v!day,일}]
% Greek
diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua
index 8744bff95..c3bed03a6 100644
--- a/tex/context/base/lang-ini.lua
+++ b/tex/context/base/lang-ini.lua
@@ -27,7 +27,7 @@ local settings_to_array = utilities.parsers.settings_to_array
local trace_patterns = false trackers.register("languages.patterns", function(v) trace_patterns = v end)
-local report_languages = logs.new("languages")
+local report_initialization = logs.new("languages","initialization")
local prehyphenchar, posthyphenchar = lang.prehyphenchar, lang.posthyphenchar -- global per language
local lefthyphenmin, righthyphenmin = lang.lefthyphenmin, lang.righthyphenmin
@@ -92,7 +92,7 @@ local function loaddefinitions(tag,specification)
if definition ~= "" then
if definition == "reset" then -- interfaces.variables.reset
if trace_patterns then
- report_languages("clearing patterns for language '%s'",tag)
+ report_initialization("clearing patterns for language '%s'",tag)
end
instance:clear_patterns()
elseif not dataused[definition] then
@@ -101,7 +101,7 @@ local function loaddefinitions(tag,specification)
local fullname = resolvers.findfile(filename) or ""
if fullname ~= "" then
if trace_patterns then
- report_languages("loading definition '%s' for language '%s' from '%s'",definition,tag,fullname)
+ report_initialization("loading definition '%s' for language '%s' from '%s'",definition,tag,fullname)
end
local defs = dofile(fullname) -- use regular loader instead
if defs then -- todo: version test
@@ -109,18 +109,18 @@ local function loaddefinitions(tag,specification)
instance:patterns (defs.patterns and defs.patterns.data or "")
instance:hyphenation(defs.exceptions and defs.exceptions.data or "")
else
- report_languages("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename)
+ report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename)
end
elseif trace_patterns then
- report_languages("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename)
+ report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename)
end
elseif trace_patterns then
- report_languages("definition '%s' for language '%s' already loaded",definition,tag)
+ report_initialization("definition '%s' for language '%s' already loaded",definition,tag)
end
end
end
elseif trace_patterns then
- report_languages("no definitions for language '%s'",tag)
+ report_initialization("no definitions for language '%s'",tag)
end
statistics.stoptiming(languages)
return ok
@@ -133,7 +133,7 @@ local noflanguages = storage.shared.noflanguages
function languages.define(tag,parent)
noflanguages = noflanguages + 1
if trace_patterns then
- report_languages("assigning number %s to %s",noflanguages,tag)
+ report_initialization("assigning number %s to %s",noflanguages,tag)
end
numbers[noflanguages] = tag
registered[tag] = {
@@ -213,14 +213,14 @@ else
if l then
if l.dirty then
if trace_patterns then
- report_languages("checking patterns for %s (%s)",tag,default)
+ report_initialization("checking patterns for %s (%s)",tag,default)
end
-- patterns is already resolved to parent patterns if applicable
if patterns ~= "" then
if l.patterns ~= patterns then
l.patterns = patterns
if trace_patterns then
- report_languages("loading patterns for '%s' using specification '%s'",tag,patterns)
+ report_initialization("loading patterns for '%s' using specification '%s'",tag,patterns)
end
loaddefinitions(tag,l)
else
@@ -229,13 +229,13 @@ else
elseif l.patterns == "" then
l.patterns = tag
if trace_patterns then
- report_languages("loading patterns for '%s' using tag",tag)
+ report_initialization("loading patterns for '%s' using tag",tag)
end
local ok = loaddefinitions(tag,l)
if not ok and tag ~= default then
l.patterns = defaukt
if trace_patterns then
- report_languages("loading patterns for '%s' using default",tag)
+ report_initialization("loading patterns for '%s' using default",tag)
end
loaddefinitions(tag,l)
end
@@ -366,12 +366,12 @@ end)
--~ local ok = fullname ~= ""
--~ if ok then
--~ if trace_patterns then
---~ report_languages("filtering %s for language '%s' from '%s'",target,tag,fullname)
+--~ report_initialization("filtering %s for language '%s' from '%s'",target,tag,fullname)
--~ end
--~ lang[target](data,filter(fullname) or "")
--~ else
--~ if trace_patterns then
---~ report_languages("no %s for language '%s' in '%s'",target,tag,filename or "?")
+--~ report_initialization("no %s for language '%s' in '%s'",target,tag,filename or "?")
--~ end
--~ lang[target](instance,"")
--~ end
diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv
index 88b26ddb0..fe8aee917 100644
--- a/tex/context/base/lang-ini.mkiv
+++ b/tex/context/base/lang-ini.mkiv
@@ -387,7 +387,7 @@
\docomplexlanguage
\fi
\else
- \showmessage\m!linguals6{#1}%
+ \showmessage\m!languages6{#1}%
\fi
\fi}
@@ -545,7 +545,7 @@
\def\initializemainlanguage
{\mainlanguage[\currentlanguage]%
- \showmessage\m!linguals9\currentlanguage}
+ \showmessage\m!languages9\currentlanguage}
%D New:
diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua
index 0f4fa0a30..41cd40df7 100644
--- a/tex/context/base/lang-lab.lua
+++ b/tex/context/base/lang-lab.lua
@@ -69,7 +69,7 @@ languages.data = languages.data or { }
local trace_labels = false trackers.register("languages.labels", function(v) trace_labels = v end)
-local report_labels = logs.new("language labels")
+local report_labels = logs.new("languages","labels")
function languages.labels.define()
local variables = interfaces.variables
@@ -119,7 +119,7 @@ end
--~ for tag, specification in next, list do
--~ for language, text in next, specification.labels do
--~ if type(text) == "string" and find(text,",") then
---~ logs.simple("label with comma: category '%s', language '%s', tag '%s', text '%s'",
+--~ report_labels("label with comma: category '%s', language '%s', tag '%s', text '%s'",
--~ category, language, tag, text)
--~ end
--~ end
diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv
index 80b36c810..231697c7e 100644
--- a/tex/context/base/lang-mis.mkiv
+++ b/tex/context/base/lang-mis.mkiv
@@ -221,7 +221,7 @@
\def\handlemathmodediscretionary#1{\executeifdefined{\@tmd@math@\detokenize{#1}}\donothing}
\def\handletextmodediscretionary#1{\executeifdefined{\@tmd@text@\detokenize{#1}}\donothing}
-\def\installdiscretionaries#1#2{\writestatus\m!systems{use \string \installdiscretionary}} % obsolete
+\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete
\setnewconstant\discretionarymode\plusone
diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua
index 7becc63fc..8b245ff12 100644
--- a/tex/context/base/lang-txt.lua
+++ b/tex/context/base/lang-txt.lua
@@ -9,8 +9,45 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- The content of this file is derived from the mkii lang-* files and
-- early 2011 the mkii labels are generated from this file. The
-- translations have been collected over years by users, using named
--- glyphs. This file uses utf exclusively. For those involved in the
--- translations see the 'lang-*.mkii' files.
+-- glyphs. This file uses utf exclusively.
+--
+-- Many of the initial translations were done by Tobias Burnus but
+-- completed by numerous users. The following list is incomplete so feel
+-- free to send me corrections.
+--
+-- af Afrikaans ...
+-- ar Arabic Idris Samawi Hamid, Khaled Hosny
+-- ca Catalan ...
+-- cn Chinese Wang Lei, ...
+-- cs Czech Tom Hudec, Petr Sojka, Richard Gabriel
+-- da Danish Arne Jorgensen
+-- de German Tobias Burnus, ...
+-- en English Hans Hagen, ...
+-- es Spanish ...
+-- fi Finish ...
+-- fr French Daniel Flipo, Arthur Reutenauer
+-- gr Greek Apostolos Syropoulos, Thomas Schmitz
+-- hr Croatian Željko Vrba, Richard Gabriel
+-- hu Hungarian ...
+-- it Italian Giuseppe Bilotta, Luigi Scarso
+-- ja Japanese Richard Gabriel
+-- kr Korean Jeong Dalyoung
+-- la Latin ...
+-- lt Lithuanian Marius Aleknevičius
+-- nb Norwegian Hans Fredrik Nordhaug, ...
+-- nn Norwegian Hans Fredrik Nordhaug, ...
+-- nl Dutch Hans Hagen
+-- pl Polish Grzegorz Sapijaszko
+-- pt Portuguese Pedro F. M. Mendonça
+-- ro Romanian Dan Seracu, ...
+-- ru Russian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ...
+-- sk Slovak ...
+-- sl Slovenian Mojca Miklavec
+-- sv Swedish ...
+-- tk Turkish Tobias Burnus
+-- tr Turkmen Nazar Annagurban
+-- ua Ukrainian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ...
+-- vi Vietnamese Han The Thanh
-- For the moment we keep this table in memory. In the future we can then
-- enable labels.
@@ -513,7 +550,7 @@ data.labels={
hu=",. fejezet:",
it="",
ja={"第","章"},
- kr="장",
+ kr={"제", "장"},
la="",
lt="",
nb="",
@@ -801,7 +838,6 @@ data.labels={
hu=",. kép:",
it="Grafico ",
ja="イラスト",
- kr="삽화",
la="Typus ",
lt="Graphic ",
nb="Bilde ",
@@ -835,6 +871,7 @@ data.labels={
gr="",
hr="vidi gore",
hu="",
+ kr="그러므로",
it="come mostrato sopra",
la="",
lt="kaip parodyta aukščiau",
@@ -906,7 +943,7 @@ data.labels={
hu=",. intermezzo:",
it="Intermezzo ",
ja="間奏曲",
- kr="",
+ kr="간주곡",
la="Intermissum ",
lt="Intermezzo ",
nb="Intermesso ",
@@ -945,7 +982,7 @@ data.labels={
hu="január",
it="gennaio",
ja="1",
- kr="들어가기",
+ kr="1월",
la="Ianuarius",
lt="sausio",
nb="januar",
@@ -1197,6 +1234,7 @@ data.labels={
hu="sorok",
it="righe ",
ja="線",
+ kr="행",
la="versus ",
lt="lines ",
nb="linjer ",
@@ -1555,6 +1593,7 @@ data.labels={
hr="stranica ",
hu="",
it="pagina ",
+ kr="쪽",
la="",
lt="puslapis ",
nb="side ",
@@ -1591,7 +1630,7 @@ data.labels={
hu=",. rész:",
it="Parte ",
ja={"第","パート"},
- kr="부",
+ kr={"제","부"},
la="Pars ",
lt=", dalis",
nb="Del",
@@ -1666,7 +1705,7 @@ data.labels={
hu="",
it="",
ja={"第","項"},
- kr="절",
+ kr={"제","절"},
la="",
lt="",
nb="",
@@ -1701,6 +1740,7 @@ data.labels={
hr="vidi ",
hu="",
it="cf. ",
+ kr="",
la="",
lt="žiūrėti ",
nb="se ",
@@ -1810,7 +1850,6 @@ data.labels={
hu="",
it="",
ja="",
- kr="",
la="",
lt="",
nb="",
@@ -1848,7 +1887,6 @@ data.labels={
hu="",
it="",
ja="",
- kr="",
la="",
lt="",
nb="",
@@ -1886,7 +1924,6 @@ data.labels={
hu="",
it="",
ja="",
- kr="",
la="",
lt="",
nb="",
@@ -2295,7 +2332,7 @@ data.labels={
hu="Intermezzok",
it="Intermezzi",
ja="間奏曲",
- kr="",
+ kr="간주곡",
la="Intermissa",
lt="Intermezzos",
nb="Intermesso",
diff --git a/tex/context/base/lang-wrd.lua b/tex/context/base/lang-wrd.lua
index d008ed341..b8eb19353 100644
--- a/tex/context/base/lang-wrd.lua
+++ b/tex/context/base/lang-wrd.lua
@@ -12,7 +12,7 @@ local concat = table.concat
local lpegmatch = lpeg.match
local P, S, Cs = lpeg.P, lpeg.S, lpeg.Cs
-local report_languages = logs.new("languages")
+local report_words = logs.new("languages","words")
local nodes, node, languages = nodes, node, languages
@@ -60,7 +60,7 @@ local loaded = { } -- we share lists
function words.load(tag,filename)
local fullname = resolvers.findfile(filename,'other text file') or ""
if fullname ~= "" then
- report_languages("loading word file '%s'",fullname)
+ report_words("loading word file '%s'",fullname)
statistics.starttiming(languages)
local list = loaded[fullname]
if not list then
@@ -72,7 +72,7 @@ function words.load(tag,filename)
wordsdata[tag] = list
statistics.stoptiming(languages)
else
- report_languages("missing words file '%s'",filename)
+ report_words("missing word file '%s'",filename)
end
end
@@ -374,7 +374,7 @@ local function dumpusedwords()
if dumpthem then
collected.threshold = words.threshold
dumpname = dumpname or file.addsuffix(tex.jobname,"words")
- report_languages("saving list of used words in '%s'",dumpname)
+ report_words("saving list of used words in '%s'",dumpname)
io.savedata(dumpname,table.serialize(collected,true))
-- table.tofile(dumpname,list,true)
end
diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua
index 6d25a9c42..d020c8a78 100644
--- a/tex/context/base/lpdf-ano.lua
+++ b/tex/context/base/lpdf-ano.lua
@@ -16,9 +16,9 @@ local trace_references = false trackers.register("references.references", f
local trace_destinations = false trackers.register("references.destinations", function(v) trace_destinations = v end)
local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end)
-local report_references = logs.new("references")
-local report_destinations = logs.new("destinations")
-local report_bookmarks = logs.new("bookmarks")
+local report_reference = logs.new("backend","references")
+local report_destination = logs.new("backend","destinations")
+local report_bookmark = logs.new("backend","bookmarks")
local variables = interfaces.variables
local constants = interfaces.constants
@@ -151,7 +151,7 @@ local function link(url,filename,destination,page,actions)
}
}
else
- commands.writestatus("references","invalid page reference: %s",page or "?")
+ report_reference("invalid page reference: %s",page or "?")
end
end
return false
@@ -236,7 +236,7 @@ local function use_normal_annotations()
local function reference(width,height,depth,prerolled) -- keep this one
if prerolled then
if trace_references then
- report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled)
+ report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled)
end
return pdfannotation_node(width,height,depth,prerolled)
end
@@ -277,7 +277,7 @@ local function use_shared_annotations()
local function reference(width,height,depth,prerolled)
if prerolled then
if trace_references then
- report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled)
+ report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled)
end
local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled)
return latelua_node(luacode)
@@ -321,7 +321,7 @@ end node.free(lln)
function nodeinjections.destination(width,height,depth,name,view)
if trace_destinations then
- report_destinations("w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view")
+ report_destination("w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view")
end
return pdfdestination_node(width,height,depth,name,view)
end
@@ -342,7 +342,7 @@ runners["inner"] = function(var,actions)
end
runners["inner with arguments"] = function(var,actions)
- report_references("todo: inner with arguments")
+ report_reference("todo: inner with arguments")
return false
end
@@ -362,7 +362,7 @@ runners["special outer with operation"] = function(var,actions)
end
runners["special outer"] = function(var,actions)
- report_references("todo: special outer")
+ report_reference("todo: special outer")
return false
end
@@ -372,22 +372,22 @@ runners["special"] = function(var,actions)
end
runners["outer with inner with arguments"] = function(var,actions)
- report_references("todo: outer with inner with arguments")
+ report_reference("todo: outer with inner with arguments")
return false
end
runners["outer with special and operation and arguments"] = function(var,actions)
- report_references("todo: outer with special and operation and arguments")
+ report_reference("todo: outer with special and operation and arguments")
return false
end
runners["outer with special"] = function(var,actions)
- report_references("todo: outer with special")
+ report_reference("todo: outer with special")
return false
end
runners["outer with special and operation"] = function(var,actions)
- report_references("todo: outer with special and operation")
+ report_reference("todo: outer with special and operation")
return false
end
@@ -399,7 +399,7 @@ function specials.internal(var,actions) -- better resolve in strc-ref
local v = references.internals[i]
if not v then
-- error
- report_references("no internal reference '%s'",var.operation)
+ report_reference("no internal reference '%s'",var.operation)
elseif getinnermethod() == "names" then
-- named
return link(nil,nil,"aut:"..i,v.references.realpage,actions)
@@ -630,7 +630,7 @@ local function build(levels,start,parent,method)
return i, n, first, last
elseif level == startlevel then
if trace_bookmarks then
- report_bookmarks("%3i %s%s %s",reference.realpage,rep(" ",level-1),(open and "+") or "-",title)
+ report_bookmark("%3i %s%s %s",reference.realpage,rep(" ",level-1),(open and "+") or "-",title)
end
local prev = child
child = pdfreserveobject()
diff --git a/tex/context/base/lpdf-epa.lua b/tex/context/base/lpdf-epa.lua
index 1e5b3646a..14d0da84f 100644
--- a/tex/context/base/lpdf-epa.lua
+++ b/tex/context/base/lpdf-epa.lua
@@ -14,7 +14,7 @@ local format = string.format
local trace_links = false trackers.register("figures.links", function(v) trace_links = v end)
-local report_link = logs.new("links")
+local report_link = logs.new("backend","merging")
local backends, lpdf = backends, lpdf
diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua
index 622b56098..8b2ccaaec 100644
--- a/tex/context/base/lpdf-fld.lua
+++ b/tex/context/base/lpdf-fld.lua
@@ -16,7 +16,7 @@ local bpfactor, todimen = number.dimenfactors.bp, string.todimen
local trace_fields = false trackers.register("widgets.fields", function(v) trace_fields = v end)
-local report_fields = logs.new("fields")
+local report_fields = logs.new("backend","fields")
local backends, lpdf = backends, lpdf
@@ -178,153 +178,154 @@ end
-- fonts and color
-
local pdfdocencodingvector, pdfdocencodingcapsule
local function checkpdfdocencoding()
+ -- not using pdfconstant for all these names saves us quite
+ -- some bytecode
local encoding = pdfdictionary {
Type = pdfconstant("Encoding"),
Differences = pdfarray {
24,
- pdfconstant("breve"),
- pdfconstant("caron"),
- pdfconstant("circumflex"),
- pdfconstant("dotaccent"),
- pdfconstant("hungarumlaut"),
- pdfconstant("ogonek"),
- pdfconstant("ring"),
- pdfconstant("tilde"),
+ "/breve",
+ "/caron",
+ "/circumflex",
+ "/dotaccent",
+ "/hungarumlaut",
+ "/ogonek",
+ "/ring",
+ "/tilde",
39,
- pdfconstant("quotesingle"),
+ "/quotesingle",
96,
- pdfconstant("grave"),
+ "/grave",
128,
- pdfconstant("bullet"),
- pdfconstant("dagger"),
- pdfconstant("daggerdbl"),
- pdfconstant("ellipsis"),
- pdfconstant("emdash"),
- pdfconstant("endash"),
- pdfconstant("florin"),
- pdfconstant("fraction"),
- pdfconstant("guilsinglleft"),
- pdfconstant("guilsinglright"),
- pdfconstant("minus"),
- pdfconstant("perthousand"),
- pdfconstant("quotedblbase"),
- pdfconstant("quotedblleft"),
- pdfconstant("quotedblright"),
- pdfconstant("quoteleft"),
- pdfconstant("quoteright"),
- pdfconstant("quotesinglbase"),
- pdfconstant("trademark"),
- pdfconstant("fi"),
- pdfconstant("fl"),
- pdfconstant("Lslash"),
- pdfconstant("OE"),
- pdfconstant("Scaron"),
- pdfconstant("Ydieresis"),
- pdfconstant("Zcaron"),
- pdfconstant("dotlessi"),
- pdfconstant("lslash"),
- pdfconstant("oe"),
- pdfconstant("scaron"),
- pdfconstant("zcaron"),
+ "/bullet",
+ "/dagger",
+ "/daggerdbl",
+ "/ellipsis",
+ "/emdash",
+ "/endash",
+ "/florin",
+ "/fraction",
+ "/guilsinglleft",
+ "/guilsinglright",
+ "/minus",
+ "/perthousand",
+ "/quotedblbase",
+ "/quotedblleft",
+ "/quotedblright",
+ "/quoteleft",
+ "/quoteright",
+ "/quotesinglbase",
+ "/trademark",
+ "/fi",
+ "/fl",
+ "/Lslash",
+ "/OE",
+ "/Scaron",
+ "/Ydieresis",
+ "/Zcaron",
+ "/dotlessi",
+ "/lslash",
+ "/oe",
+ "/scaron",
+ "/zcaron",
160,
- pdfconstant("Euro"),
+ "/Euro",
164,
- pdfconstant("currency"),
+ "/currency",
166,
- pdfconstant("brokenbar"),
+ "/brokenbar",
168,
- pdfconstant("dieresis"),
- pdfconstant("copyright"),
- pdfconstant("ordfeminine"),
+ "/dieresis",
+ "/copyright",
+ "/ordfeminine",
172,
- pdfconstant("logicalnot"),
- pdfconstant(".notdef"),
- pdfconstant("registered"),
- pdfconstant("macron"),
- pdfconstant("degree"),
- pdfconstant("plusminus"),
- pdfconstant("twosuperior"),
- pdfconstant("threesuperior"),
- pdfconstant("acute"),
- pdfconstant("mu"),
+ "/logicalnot",
+ "/.notdef",
+ "/registered",
+ "/macron",
+ "/degree",
+ "/plusminus",
+ "/twosuperior",
+ "/threesuperior",
+ "/acute",
+ "/mu",
183,
- pdfconstant("periodcentered"),
- pdfconstant("cedilla"),
- pdfconstant("onesuperior"),
- pdfconstant("ordmasculine"),
+ "/periodcentered",
+ "/cedilla",
+ "/onesuperior",
+ "/ordmasculine",
188,
- pdfconstant("onequarter"),
- pdfconstant("onehalf"),
- pdfconstant("threequarters"),
+ "/onequarter",
+ "/onehalf",
+ "/threequarters",
192,
- pdfconstant("Agrave"),
- pdfconstant("Aacute"),
- pdfconstant("Acircumflex"),
- pdfconstant("Atilde"),
- pdfconstant("Adieresis"),
- pdfconstant("Aring"),
- pdfconstant("AE"),
- pdfconstant("Ccedilla"),
- pdfconstant("Egrave"),
- pdfconstant("Eacute"),
- pdfconstant("Ecircumflex"),
- pdfconstant("Edieresis"),
- pdfconstant("Igrave"),
- pdfconstant("Iacute"),
- pdfconstant("Icircumflex"),
- pdfconstant("Idieresis"),
- pdfconstant("Eth"),
- pdfconstant("Ntilde"),
- pdfconstant("Ograve"),
- pdfconstant("Oacute"),
- pdfconstant("Ocircumflex"),
- pdfconstant("Otilde"),
- pdfconstant("Odieresis"),
- pdfconstant("multiply"),
- pdfconstant("Oslash"),
- pdfconstant("Ugrave"),
- pdfconstant("Uacute"),
- pdfconstant("Ucircumflex"),
- pdfconstant("Udieresis"),
- pdfconstant("Yacute"),
- pdfconstant("Thorn"),
- pdfconstant("germandbls"),
- pdfconstant("agrave"),
- pdfconstant("aacute"),
- pdfconstant("acircumflex"),
- pdfconstant("atilde"),
- pdfconstant("adieresis"),
- pdfconstant("aring"),
- pdfconstant("ae"),
- pdfconstant("ccedilla"),
- pdfconstant("egrave"),
- pdfconstant("eacute"),
- pdfconstant("ecircumflex"),
- pdfconstant("edieresis"),
- pdfconstant("igrave"),
- pdfconstant("iacute"),
- pdfconstant("icircumflex"),
- pdfconstant("idieresis"),
- pdfconstant("eth"),
- pdfconstant("ntilde"),
- pdfconstant("ograve"),
- pdfconstant("oacute"),
- pdfconstant("ocircumflex"),
- pdfconstant("otilde"),
- pdfconstant("odieresis"),
- pdfconstant("divide"),
- pdfconstant("oslash"),
- pdfconstant("ugrave"),
- pdfconstant("uacute"),
- pdfconstant("ucircumflex"),
- pdfconstant("udieresis"),
- pdfconstant("yacute"),
- pdfconstant("thorn"),
- pdfconstant("ydieresis"),
+ "/Agrave",
+ "/Aacute",
+ "/Acircumflex",
+ "/Atilde",
+ "/Adieresis",
+ "/Aring",
+ "/AE",
+ "/Ccedilla",
+ "/Egrave",
+ "/Eacute",
+ "/Ecircumflex",
+ "/Edieresis",
+ "/Igrave",
+ "/Iacute",
+ "/Icircumflex",
+ "/Idieresis",
+ "/Eth",
+ "/Ntilde",
+ "/Ograve",
+ "/Oacute",
+ "/Ocircumflex",
+ "/Otilde",
+ "/Odieresis",
+ "/multiply",
+ "/Oslash",
+ "/Ugrave",
+ "/Uacute",
+ "/Ucircumflex",
+ "/Udieresis",
+ "/Yacute",
+ "/Thorn",
+ "/germandbls",
+ "/agrave",
+ "/aacute",
+ "/acircumflex",
+ "/atilde",
+ "/adieresis",
+ "/aring",
+ "/ae",
+ "/ccedilla",
+ "/egrave",
+ "/eacute",
+ "/ecircumflex",
+ "/edieresis",
+ "/igrave",
+ "/iacute",
+ "/icircumflex",
+ "/idieresis",
+ "/eth",
+ "/ntilde",
+ "/ograve",
+ "/oacute",
+ "/ocircumflex",
+ "/otilde",
+ "/odieresis",
+ "/divide",
+ "/oslash",
+ "/ugrave",
+ "/uacute",
+ "/ucircumflex",
+ "/udieresis",
+ "/yacute",
+ "/thorn",
+ "/ydieresis",
},
}
pdfdocencodingvector = pdfreference(pdfflushobject(encoding))
@@ -398,10 +399,11 @@ local function registerfonts()
if next(usedfonts) then
checkpdfdocencoding()
local d = pdfdictionary()
+ local pdffonttype, pdffontsubtype = pdfconstant("Font"), pdfconstant("Type1")
for tag, name in next, usedfonts do
local f = pdfdictionary {
- Type = pdfconstant("Font"),
- Subtype = pdfconstant("Type1"),
+ Type = pdffonttype,
+ Subtype = pdffontsubtype,
Name = pdfconstant(tag),
BaseFont = pdfconstant(name),
Encoding = pdfdocencodingvector,
diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua
index 348f6eada..8f0a57bf4 100644
--- a/tex/context/base/lpdf-fmt.lua
+++ b/tex/context/base/lpdf-fmt.lua
@@ -13,7 +13,7 @@ if not modules then modules = { } end modules ['lpdf-fmt'] = {
local trace_format = false trackers.register("backend.format", function(v) trace_format = v end)
local trace_variables = false trackers.register("backend.variables", function(v) trace_variables = v end)
-local report_backends = logs.new("backends")
+local report_backend = logs.new("backend","profiles")
local backends, lpdf = backends, lpdf
@@ -380,16 +380,16 @@ local function loadprofile(name,filename)
end
if profile then
if next(profile) then
- report_backends("profile specification '%s' loaded from '%s'",name,filename)
+ report_backend("profile specification '%s' loaded from '%s'",name,filename)
return profile
elseif trace_format then
- report_backends("profile specification '%s' loaded from '%s' but empty",name,filename)
+ report_backend("profile specification '%s' loaded from '%s' but empty",name,filename)
end
return false
end
end
end
- report_backends("profile specification '%s' not found in '%s'",name,concat(filenames, ", "))
+ report_backend("profile specification '%s' not found in '%s'",name,concat(filenames, ", "))
end
local function urls(url)
@@ -418,7 +418,7 @@ local internalprofiles = { }
local function handleinternalprofile(s,include)
local filename, colorspace = s.filename or "", s.colorspace or ""
if filename == "" or colorspace == "" then
- report_backends("error in internal profile specification: %s",serialize(s,false))
+ report_backend("error in internal profile specification: %s",serialize(s,false))
else
local tag = profilename(filename)
local profile = internalprofiles[tag]
@@ -429,9 +429,9 @@ local function handleinternalprofile(s,include)
local fullname = locatefile(filename)
local channel = channels[colorspace] or nil
if fullname == "" then
- report_backends("error, couldn't locate profile '%s'",filename)
+ report_backend("error, couldn't locate profile '%s'",filename)
elseif not channel then
- report_backends("error, couldn't resolve channel entry for colorspace '%s'",colorspace)
+ report_backend("error, couldn't resolve channel entry for colorspace '%s'",colorspace)
else
local a = pdfdictionary { N = channel }
profile = pdfobject { -- does a flush too
@@ -443,13 +443,13 @@ local function handleinternalprofile(s,include)
}
internalprofiles[tag] = profile
if trace_format then
- report_backends("including '%s' color profile from '%s'",colorspace,fullname)
+ report_backend("including '%s' color profile from '%s'",colorspace,fullname)
end
end
else
internalprofiles[tag] = true
if trace_format then
- report_backends("not including '%s' color profile '%s'",colorspace,filename)
+ report_backend("not including '%s' color profile '%s'",colorspace,filename)
end
end
end
@@ -476,9 +476,9 @@ local function handleexternalprofile(s,include) -- specification (include ignore
if name == "" or url == "" or checksum == "" or version == "" or colorspace == "" or filename == "" then
local profile = handleinternalprofile(s)
if profile then
- report_backends("incomplete external profile specification, falling back to internal")
+ report_backend("incomplete external profile specification, falling back to internal")
else
- report_backends("error in external profile specification: %s",serialize(s,false))
+ report_backend("error in external profile specification: %s",serialize(s,false))
end
else
local tag = profilename(filename)
@@ -503,12 +503,12 @@ local loadeddefaults = { }
local function handledefaultprofile(s,spec) -- specification
local filename, colorspace = s.filename or "", lower(s.colorspace or "")
if filename == "" or colorspace == "" then
- report_backends("error in default profile specification: %s",serialize(s,false))
+ report_backend("error in default profile specification: %s",serialize(s,false))
elseif not loadeddefaults[colorspace] then
local tag = profilename(filename)
local n = internalprofiles[tag] -- or externalprofiles[tag]
if n == true then -- not internalized
- report_backends("no default profile '%s' for colorspace '%s'",filename,colorspace)
+ report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace)
elseif n then
local a = pdfarray {
pdfconstant("ICCBased"),
@@ -517,12 +517,12 @@ local function handledefaultprofile(s,spec) -- specification
-- used in page /Resources, so this must be inserted at runtime
lpdf.adddocumentcolorspace(prefixes[colorspace],pdfreference(pdfflushobject(a)))
loadeddefaults[colorspace] = true
- report_backends("setting '%s' as default '%s' color space",filename,colorspace)
+ report_backend("setting '%s' as default '%s' color space",filename,colorspace)
else
- report_backends("no default profile '%s' for colorspace '%s'",filename,colorspace)
+ report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace)
end
elseif trace_format then
- report_backends("a default '%s' colorspace is already in use",colorspace)
+ report_backend("a default '%s' colorspace is already in use",colorspace)
end
end
@@ -531,7 +531,7 @@ local loadedintents, intents = { }, pdfarray()
local function handleoutputintent(s,spec)
local name, url, filename, id, outputcondition, info = s.info or s.filename or "", s.url or "", s.filename or "", s.id or "", s.outputcondition or "", s.info or ""
if name == "" or id == "" then
- report_backends("error in output intent specification: %s",serialize(s,false))
+ report_backend("error in output intent specification: %s",serialize(s,false))
elseif not loadedintents[name] then
local tag = profilename(filename)
local internal, external = internalprofiles[tag], externalprofiles[tag]
@@ -549,18 +549,18 @@ local function handleoutputintent(s,spec)
elseif external and external ~= true then
d.DestOutputProfileRef = pdfreference(external)
else
- report_backends("omitting reference to profile for intent '%s'",name)
+ report_backend("omitting reference to profile for intent '%s'",name)
end
intents[#intents+1] = pdfreference(pdfflushobject(pdfdictionary(d)))
if trace_format then
- report_backends("setting output intent to '%s' with id '%s' (entry %s)",name,id,#intents)
+ report_backend("setting output intent to '%s' with id '%s' (entry %s)",name,id,#intents)
end
else
- report_backends("invalid output intent '%s'",name)
+ report_backend("invalid output intent '%s'",name)
end
loadedintents[name] = true
elseif trace_format then
- report_backends("an output intent with name '%s' is already in use",name)
+ report_backend("an output intent with name '%s' is already in use",name)
end
end
@@ -571,7 +571,7 @@ local function handleiccprofile(message,spec,name,filename,how,options,alwaysinc
local name = list[i]
local profile = loadprofile(name,filename)
if trace_format then
- report_backends("handling %s '%s'",message,name)
+ report_backend("handling %s '%s'",message,name)
end
if profile then
if formatspecification.cmyk_colors then
@@ -585,34 +585,34 @@ local function handleiccprofile(message,spec,name,filename,how,options,alwaysinc
local always, never = options[variables.always], options[variables.never]
if always or alwaysinclude then
if trace_format then
- report_backends("forcing internal profiles") -- can make preflight unhappy
+ report_backend("forcing internal profiles") -- can make preflight unhappy
end
-- internal, external = true, false
internal, external = not never, false
elseif never then
if trace_format then
- report_backends("forcing external profiles") -- can make preflight unhappy
+ report_backend("forcing external profiles") -- can make preflight unhappy
end
internal, external = false, true
end
if external then
if trace_format then
- report_backends("handling external profiles cf. '%s'",name)
+ report_backend("handling external profiles cf. '%s'",name)
end
handleexternalprofile(profile,false)
else
if trace_format then
- report_backends("handling internal profiles cf. '%s'",name)
+ report_backend("handling internal profiles cf. '%s'",name)
end
if internal then
handleinternalprofile(profile,always or include)
else
- report_backends("no profile inclusion for '%s'",formatname)
+ report_backend("no profile inclusion for '%s'",formatname)
end
end
how(profile,spec)
elseif trace_format then
- report_backends("unknown profile '%s'",name)
+ report_backend("unknown profile '%s'",name)
end
end
end
@@ -640,7 +640,7 @@ function codeinjections.setformat(s)
if spec then
formatspecification, formatname = spec, spec.format_name
level = level and tonumber(level)
- report_backends("setting format to '%s'",formatname)
+ report_backend("setting format to '%s'",formatname)
local xmp_file = formatspecification.xmp_file or ""
if xmp_file == "" then
-- weird error
@@ -655,13 +655,13 @@ function codeinjections.setformat(s)
tex.pdfcompresslevel, tex.pdfobjcompresslevel = compresslevel, objectcompresslevel
tex.pdfmajorversion, tex.pdfminorversion = majorversion, minorversion
if objectcompression then
- report_backends("forcing pdf version %s.%s, compression level %s, object compression level %s",
+ report_backend("forcing pdf version %s.%s, compression level %s, object compression level %s",
majorversion,minorversion,compresslevel,objectcompresslevel)
elseif compresslevel > 0 then
- report_backends("forcing pdf version %s.%s, compression level %s, object compression disabled",
+ report_backend("forcing pdf version %s.%s, compression level %s, object compression disabled",
majorversion,minorversion,compresslevel)
else
- report_backends("forcing pdf version %s.%s, compression disabled",
+ report_backend("forcing pdf version %s.%s, compression disabled",
majorversion,minorversion)
end
--
@@ -700,15 +700,15 @@ function codeinjections.setformat(s)
for k, v in table.sortedhash(formats.default) do
local v = formatspecification[k]
if type(v) ~= "function" then
- report_backends("%s = %s",k,tostring(v or false))
+ report_backend("%s = %s",k,tostring(v or false))
end
end
end
function codeinjections.setformat(noname)
- report_backends("error, format is already set to '%s', ignoring '%s'",formatname,noname.format)
+ report_backend("error, format is already set to '%s', ignoring '%s'",formatname,noname.format)
end
else
- report_backends("error, format '%s' is not supported",format)
+ report_backend("error, format '%s' is not supported",format)
end
end
end
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index 2defa3f2e..044ff5c68 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -26,7 +26,8 @@ local trace_resources = false trackers.register("backend.resources", function
local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end)
local trace_detail = false trackers.register("backend.detail", function(v) trace_detail = v end)
-local report_backends = logs.new("backends")
+local report_objects = logs.new("backend","objects")
+local report_finalizing = logs.new("backend","finalizing")
local backends, context = backends, context
@@ -360,10 +361,10 @@ function lpdf.reserveobject(name)
if name then
names[name] = r
if trace_objects then
- report_backends("reserving object number %s under name '%s'",r,name)
+ report_objects("reserving number %s under name '%s'",r,name)
end
elseif trace_objects then
- report_backends("reserving object number %s",r)
+ report_objects("reserving number %s",r)
end
return r
end
@@ -392,25 +393,25 @@ function lpdf.flushobject(name,data)
if name then
if trace_objects then
if trace_detail then
- report_backends("flushing object data to reserved object with name '%s' -> %s",name,tostring(data))
+ report_objects("flushing data to reserved object with name '%s' -> %s",name,tostring(data))
else
- report_backends("flushing object data to reserved object with name '%s'",name)
+ report_objects("flushing data to reserved object with name '%s'",name)
end
end
return pdfimmediateobject(name,tostring(data))
else
if trace_objects then
if trace_detail then
- report_backends("flushing object data to reserved object with number %s -> %s",name,tostring(data))
+ report_objects("flushing data to reserved object with number %s -> %s",name,tostring(data))
else
- report_backends("flushing object data to reserved object with number %s",name)
+ report_objects("flushing data to reserved object with number %s",name)
end
end
return pdfimmediateobject(tostring(data))
end
else
if trace_objects and trace_detail then
- report_backends("flushing object data -> %s",tostring(name))
+ report_objects("flushing data -> %s",tostring(name))
end
return pdfimmediateobject(tostring(name))
end
@@ -534,26 +535,26 @@ local function set(where,what,f,when,comment)
local w = where[when]
w[#w+1] = { f, comment }
if trace_finalizers then
- report_backends("%s set: [%s,%s]",what,when,#w)
+ report_finalizing("%s set: [%s,%s]",what,when,#w)
end
end
local function run(where,what)
if trace_finalizers then
- report_backends("start backend: category=%s, n=%s",what,#where)
+ report_finalizing("start backend: category=%s, n=%s",what,#where)
end
for i=1,#where do
local w = where[i]
for j=1,#w do
local wj = w[j]
if trace_finalizers then
- report_backends("%s finalizer: [%s,%s] %s",what,i,j,wj[2] or "")
+ report_finalizing("%s finalizer: [%s,%s] %s",what,i,j,wj[2] or "")
end
wj[1]()
end
end
if trace_finalizers then
- report_backends("stop finalizing")
+ report_finalizing("stop finalizing")
end
end
@@ -581,7 +582,7 @@ function lpdf.finalizedocument()
if not environment.initex then
run(documentfinalizers,"document")
function lpdf.finalizedocument()
- report_backends("serious error: the document is finalized multiple times")
+ report_finalizing("serious error: the document is finalized multiple times")
function lpdf.finalizedocument() end
end
end
@@ -596,22 +597,24 @@ callbacks.register("finish_pdffile", lpdf.finalizedocument)
local function trace_set(what,key)
if trace_resources then
- report_backends("setting key '%s' in '%s'",key,what)
+ report_finalizing("setting key '%s' in '%s'",key,what)
end
end
local function trace_flush(what)
if trace_resources then
- report_backends("flushing '%s'",what)
+ report_finalizing("flushing '%s'",what)
end
end
lpdf.protectresources = true
-local catalog, info, names = pdfdictionary(), pdfdictionary(), pdfdictionary()
+local catalog = pdfdictionary { Type = "Catalog" } -- nicer, but when we assign we nil the Type
+local info = pdfdictionary { Type = "Info" } -- nicer, but when we assign we nil the Type
+local names = pdfdictionary { Type = "Names" } -- nicer, but when we assign we nil the Type
-local function flushcatalog() if not environment.initex then trace_flush("catalog") pdf.catalog = catalog() end end
-local function flushinfo () if not environment.initex then trace_flush("info") pdf.info = info () end end
-local function flushnames () if not environment.initex then trace_flush("names") pdf.names = names () end end
+local function flushcatalog() if not environment.initex then trace_flush("catalog") catalog.Catalog = nil pdf.catalog = catalog() end end
+local function flushinfo () if not environment.initex then trace_flush("info") info .Info = nil pdf.info = info () end end
+local function flushnames () if not environment.initex then trace_flush("names") names .Names = nil pdf.names = names () end end
function lpdf.addtocatalog(k,v) if not (lpdf.protectresources and catalog[k]) then trace_set("catalog",k) catalog[k] = v end end
function lpdf.addtoinfo (k,v) if not (lpdf.protectresources and info [k]) then trace_set("info", k) info [k] = v end end
@@ -657,7 +660,7 @@ registerdocumentfinalizer(flushshades,3,"shades")
registerdocumentfinalizer(flushcatalog,3,"catalog")
registerdocumentfinalizer(flushinfo,3,"info")
-registerdocumentfinalizer(flushnames,3,"names")
+registerdocumentfinalizer(flushnames,3,"names") -- before catalog
registerpagefinalizer(checkextgstates,3,"extended graphic states")
registerpagefinalizer(checkcolorspaces,3,"color spaces")
@@ -756,7 +759,7 @@ if not pdfreferenceobject then
n = n + 1
end
if trace_objects then
- report_backends("%s objects flushed",n)
+ report_objects("%s objects flushed",n)
end
delayed = { }
end
diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua
index 00ddef025..e2afddc51 100644
--- a/tex/context/base/lpdf-tag.lua
+++ b/tex/context/base/lpdf-tag.lua
@@ -12,7 +12,7 @@ local utfchar = utf.char
local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end)
-local report_tags = logs.new("tags")
+local report_tags = logs.new("backend","tags")
local backends, lpdf, nodes = backends, lpdf, nodes
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua
index 1ca41ed7c..a9e9db2f0 100644
--- a/tex/context/base/lpdf-wid.lua
+++ b/tex/context/base/lpdf-wid.lua
@@ -11,7 +11,7 @@ local texbox, texcount = tex.box, tex.count
local settings_to_array = utilities.parsers.settings_to_array
local settings_to_hash = utilities.parsers.settings_to_hash
-local report_media = logs.new("media")
+local report_media = logs.new("backend","media")
local backends, lpdf, nodes = backends, lpdf, nodes
diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua
index 490eacbda..e216b5e01 100644
--- a/tex/context/base/lpdf-xmp.lua
+++ b/tex/context/base/lpdf-xmp.lua
@@ -12,7 +12,7 @@ local xmlfillin = xml.fillin
local trace_xmp = false trackers.register("backend.xmp", function(v) trace_xmp = v end)
-local report_xmp = logs.new("backends")
+local report_xmp = logs.new("backend","xmp")
local lpdf = lpdf
@@ -83,7 +83,7 @@ function lpdf.setxmpfile(name)
-- xmpfile = nil
-- end
if xmp then
- report_xmp("discarding loaded xmp file '%s'",xmpfile)
+ report_xmp("discarding loaded file '%s'",xmpfile)
xmp = nil
end
xmpfile = name ~= "" and name
@@ -99,7 +99,7 @@ local function valid_xmp()
xmpfile = resolvers.findfile(xmpname) or ""
end
if xmpfile ~= "" then
- report_xmp("using xmp file '%s'",xmpfile)
+ report_xmp("using file '%s'",xmpfile)
end
local xmpdata = (xmpfile ~= "" and io.loaddata(xmpfile)) or ""
xmp = xml.convert(xmpdata)
@@ -143,22 +143,37 @@ local function flushxmpinfo()
local t = { } for i=1,24 do t[i] = char(96 + random(26)) end
local packetid = concat(t)
- local time = lpdf.timestamp()
- addxmpinfo("Producer",format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision))
- addxmpinfo("DocumentID",format("uuid:%s",os.uuid()))
- addxmpinfo("InstanceID",format("uuid:%s",os.uuid()))
- addxmpinfo("CreatorTool","LuaTeX + ConTeXt MkIV")
- addxmpinfo("CreateDate",time)
- addxmpinfo("ModifyDate",time)
- addxmpinfo("MetadataDate",time)
- addxmpinfo("PTEX.Fullbanner", tex.pdftexbanner)
+
+ local documentid = format("uuid:%s",os.uuid())
+ local instanceid = format("uuid:%s",os.uuid())
+ local producer = format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision)
+ local creator = "LuaTeX + ConTeXt MkIV"
+ local time = lpdf.timestamp()
+ local fullbanner = tex.pdftexbanner
+ -- local fullbanner = gsub(tex.pdftexbanner,"kpse.*","")
+
+ addxmpinfo("DocumentID", documentid)
+ addxmpinfo("InstanceID", instanceid)
+ addxmpinfo("Producer", producer)
+ addxmpinfo("CreatorTool", creator)
+ addxmpinfo("CreateDate", time)
+ addxmpinfo("ModifyDate", time)
+ addxmpinfo("MetadataDate", time)
+ addxmpinfo("PTEX.Fullbanner", fullbanner)
+
+ addtoinfo("Producer", producer)
+ addtoinfo("Creator", creator)
+ addtoinfo("CreationDate", time)
+ addtoinfo("ModDate", time)
+-- addtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence
+
local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta"))
local md = pdfdictionary {
Subtype = pdfconstant("XML"),
Type = pdfconstant("Metadata"),
}
if trace_xmp then
- commands.writestatus("system","xmp data flushed (see log file)")
+ report_xmp("data flushed (see log file)")
texio.write_nl("log","")
texio.write("log","\n% ",(gsub(blob,"[\r\n]","\n%% ")),"\n")
end
diff --git a/tex/context/base/luat-cbk.lua b/tex/context/base/luat-cbk.lua
index 93538c6bb..ef2a8502f 100644
--- a/tex/context/base/luat-cbk.lua
+++ b/tex/context/base/luat-cbk.lua
@@ -12,8 +12,8 @@ local round = math.round
local trace_checking = false trackers.register("memory.checking", function(v) trace_checking = v end)
-local report_callbacks = logs.new("callbacks")
-local report_memory = logs.new("memory")
+local report_callbacks = logs.new("system","callbacks")
+local report_memory = logs.new("system","memory")
--[[ldx--
Callbacks are the real asset of We've now arrived at an interesting part: accessing the tree using a subset
@@ -962,9 +962,9 @@ local function traced_apply(list,parsed,nofparsed,order)
if trace_lparse then
lshow(parsed)
end
- report_lpath("collecting : %s",parsed.pattern)
- report_lpath(" root tags : %s",tagstostring(list))
- report_lpath(" order : %s",order or "unset")
+ report_lpath("collecting: %s",parsed.pattern)
+ report_lpath("root tags : %s",tagstostring(list))
+ report_lpath("order : %s",order or "unset")
local collected = list
for i=1,nofparsed do
local pi = parsed[i]
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index 19bc14464..422fb14bf 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -12,7 +12,7 @@ if not modules then modules = { } end modules ['lxml-tab'] = {
local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
-local report_xml = logs.new("xml")
+local report_xml = logs and logs.new("xml","core") or function(...) print(format(...)) end
--[[ldx--
The parser used here is inspired by the variant discussed in the lua book, but
@@ -687,7 +687,7 @@ function xml.is_valid(root)
return root and not root.error
end
-xml.errorhandler = (logs and logs.report) or (input and logs.report) or print
+xml.errorhandler = report
--[[ldx--
We cannot load an %s %s
",n,messages[n],n,messages[n])
- logs.simple("handling error %s: %s",n,messages[n])
+ report("handling error %s: %s",n,messages[n])
handlers.generic(client,configuration,data,nil,true)
end
@@ -136,7 +153,7 @@ local validpaths, registered = { }, { }
function scripts.webserver.registerpath(name)
if not registered[name] then
local cleanname = string.gsub(name,"%.%.","deleted-parent")
- logs.simple("registering path '%s'",cleanname)
+ report("registering path '%s'",cleanname)
validpaths[#validpaths+1] = cleanname
registered[name] = true
end
@@ -145,7 +162,7 @@ end
function handlers.generic(client,configuration,data,suffix,iscontent)
if not iscontent then
local name = data
- logs.simple("requested file '%s'",name)
+ report("requested file '%s'",name)
local fullname = file.join(configuration.root,name)
data = io.loaddata(fullname) or ""
if data == "" then
@@ -153,12 +170,12 @@ function handlers.generic(client,configuration,data,suffix,iscontent)
local fullname = file.join(validpaths[n],name)
data = io.loaddata(fullname) or ""
if data ~= "" then
- logs.simple("sending generic file '%s'",fullname)
+ report("sending generic file '%s'",fullname)
break
end
end
else
- logs.simple("sending generic file '%s'",fullname)
+ report("sending generic file '%s'",fullname)
end
end
if data and data ~= "" then
@@ -192,18 +209,18 @@ function handlers.lua(client,configuration,filename,suffix,iscontent,hashed) --
-- todo: split url in components, see l-url; rather trivial
local result, keep = loaded[filename], false
if result then
- logs.simple("reusing script: %s",filename)
+ report("reusing script: %s",filename)
else
- logs.simple("locating script: %s",filename)
+ report("locating script: %s",filename)
if lfs.isfile(filename) then
- logs.simple("loading script: %s",filename)
+ report("loading script: %s",filename)
result = loadfile(filename)
- logs.simple("return type: %s",type(result))
+ report("return type: %s",type(result))
if result and type(result) == "function" then
-- result() should return a table { [type=,] [length=,] content= }, function or string
result, keep = result()
if keep then
- logs.simple("saving script: %s",type(result))
+ report("saving script: %s",type(result))
loaded[filename] = result
end
end
@@ -277,11 +294,11 @@ function scripts.webserver.run(configuration)
configuration.scripts = dir.expandname(file.join(configuration.root or ".",configuration.scripts or "."))
end
-- so far for checks
- logs.simple("running at port: %s",configuration.port)
- logs.simple("document root: %s",configuration.root or resolvers.ownpath)
- logs.simple("main index file: %s",configuration.index)
- logs.simple("scripts subpath: %s",configuration.scripts)
- logs.simple("context services: http://localhost:%s/mtx-server-ctx-startup.lua",configuration.port)
+ report("running at port: %s",configuration.port)
+ report("document root: %s",configuration.root or resolvers.ownpath)
+ report("main index file: %s",configuration.index)
+ report("scripts subpath: %s",configuration.scripts)
+ report("context services: http://localhost:%s/mtx-server-ctx-startup.lua",configuration.port)
local server = assert(socket.bind("*", configuration.port))
--~ local reading = { server }
while true do -- no multiple clients
@@ -295,7 +312,7 @@ function scripts.webserver.run(configuration)
errormessage(client,configuration,404)
else
local from = client:getpeername()
- logs.simple("request from: %s",tostring(from))
+ report("request from: %s",tostring(from))
local fullurl = request:match("GET (.+) HTTP/.*$") -- todo: more clever
fullurl = socket.url.unescape(fullurl)
local hashed = url.hashed(fullurl)
@@ -304,18 +321,18 @@ function scripts.webserver.run(configuration)
--~ table.print(hashed)
if filename then
filename = socket.url.unescape(filename)
- logs.simple("requested action: %s",filename)
+ report("requested action: %s",filename)
if filename:find("%.%.") then
filename = nil -- invalid path
end
if filename == nil or filename == "" or filename == "/" then
filename = configuration.index
- logs.simple("invalid filename, forcing: %s",filename)
+ report("invalid filename, forcing: %s",filename)
end
local suffix = file.extname(filename)
local action = handlers[suffix] or handlers.generic
if action then
- logs.simple("performing action: %s",filename)
+ report("performing action: %s",filename)
action(client,configuration,filename,suffix,false,hashed) -- filename and no content
else
errormessage(client,configuration,404)
@@ -325,21 +342,10 @@ function scripts.webserver.run(configuration)
end
end
client:close()
- logs.simple("time spent with client: %0.03f seconds",os.clock()-start)
+ report("time spent with client: %0.03f seconds",os.clock()-start)
end
end
-logs.extendbanner("Simple Webserver For Helpers 0.10")
-
-messages.help = [[
---start start server
---port port to listen to
---root server root
---scripts scripts sub path
---index index file
---auto start on own path
-]]
-
if environment.argument("auto") then
local path = resolvers.findfile("mtx-server.lua") or "."
scripts.webserver.run {
@@ -355,7 +361,7 @@ elseif environment.argument("start") then
scripts = environment.argument("scripts"),
}
else
- logs.help(messages.help)
+ application.help()
end
diff --git a/scripts/context/lua/mtx-texworks.lua b/scripts/context/lua/mtx-texworks.lua
index 38a162c0e..33e56df46 100644
--- a/scripts/context/lua/mtx-texworks.lua
+++ b/scripts/context/lua/mtx-texworks.lua
@@ -6,6 +6,19 @@ if not modules then modules = { } end modules ['mtx-texworks'] = {
license = "see context related readme files"
}
+local helpinfo = [[
+--start [--verbose] start texworks
+--test report what will happen
+]]
+
+local application = logs.application {
+ name = "mtx-texworks",
+ banner = "TeXworks Startup Script 1.00",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
scripts = scripts or { }
scripts.texworks = scripts.texworks or { }
@@ -49,11 +62,11 @@ function scripts.texworks.start(indeed)
end
end
if datapath == "" then
- logs.simple("invalid datapath, maybe you need to regenerate the file database")
+ report("invalid datapath, maybe you need to regenerate the file database")
return false
end
if not binpaths or #binpaths == 0 then
- logs.simple("invalid binpath")
+ report("invalid binpath")
return false
end
for i=1,#binpaths do
@@ -64,7 +77,7 @@ function scripts.texworks.start(indeed)
end
end
if not fullname then
- logs.simple("unable to locate %s",workname)
+ report("unable to locate %s",workname)
return false
end
for i=1,#texworkspaths do
@@ -73,27 +86,20 @@ function scripts.texworks.start(indeed)
os.setenv("TW_INIPATH",datapath)
os.setenv("TW_LIBPATH",datapath)
if not indeed or environment.argument("verbose") then
- logs.simple("used signal: %s", usedsignal)
- logs.simple("data path : %s", datapath)
- logs.simple("full name : %s", fullname)
- logs.simple("set paths : TW_INIPATH TW_LIBPATH")
+ report("used signal: %s", usedsignal)
+ report("data path : %s", datapath)
+ report("full name : %s", fullname)
+ report("set paths : TW_INIPATH TW_LIBPATH")
end
if indeed then
os.launch(fullname)
end
end
-logs.extendbanner("TeXworks Startup Script 1.00")
-
-messages.help = [[
---start [--verbose] start texworks
---test report what will happen
-]]
-
if environment.argument("start") then
scripts.texworks.start(true)
elseif environment.argument("test") then
scripts.texworks.start()
else
- logs.help(messages.help)
+ application.help()
end
diff --git a/scripts/context/lua/mtx-timing.lua b/scripts/context/lua/mtx-timing.lua
index ee658f461..03100e991 100644
--- a/scripts/context/lua/mtx-timing.lua
+++ b/scripts/context/lua/mtx-timing.lua
@@ -8,6 +8,20 @@ if not modules then modules = { } end modules ['mtx-timing'] = {
local format, gsub, concat = string.format, string.gsub, table.concat
+local helpinfo = [[
+--xhtml make xhtml file
+--launch launch after conversion
+--remove remove after launching
+]]
+
+local application = logs.application {
+ name = "mtx-timing",
+ banner = "ConTeXt Timing Tools 0.10",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
dofile(resolvers.findfile("trac-tim.lua","tex"))
dofile(resolvers.findfile("trac-lmx.lua","tex"))
@@ -57,6 +71,8 @@ local directrun = true
local what = { "parameters", "nodes" }
+plugins = plugins or { } -- brrr, will become moduledata as well
+
function plugins.progress.make_svg(filename,other)
local metadata, menudata, c = { }, { }, 0
metadata[#metadata+1] = 'outputformat := "svg" ;'
@@ -76,7 +92,7 @@ function plugins.progress.make_svg(filename,other)
if directrun then
dofile(resolvers.findfile("mlib-run.lua","tex"))
commands = commands or { }
- commands.writestatus = logs.report
+ commands.writestatus = report
local result = metapost.directrun("metafun","timing data","svg",true,metadata)
return menudata, result
else
@@ -167,9 +183,9 @@ scripts.timings = scripts.timings or { }
function scripts.timings.xhtml(filename)
if filename == "" then
- logs.simple("provide filename")
+ report("provide filename")
elseif not plugins.progress.valid_file(filename) then
- logs.simple("first run context again with the --timing option")
+ report("first run context again with the --timing option")
else
local basename = file.removesuffix(filename)
local launch = environment.argument("launch")
@@ -178,16 +194,8 @@ function scripts.timings.xhtml(filename)
end
end
-logs.extendbanner("ConTeXt Timing Tools 0.10",true)
-
-messages.help = [[
---xhtml make xhtml file
---launch launch after conversion
---remove remove after launching
-]]
-
if environment.argument("xhtml") then
scripts.timings.xhtml(environment.files[1] or "")
else
- logs.help(messages.help)
+ application.help()
end
diff --git a/scripts/context/lua/mtx-tools.lua b/scripts/context/lua/mtx-tools.lua
index 92c13886a..905b3aa85 100644
--- a/scripts/context/lua/mtx-tools.lua
+++ b/scripts/context/lua/mtx-tools.lua
@@ -8,6 +8,33 @@ if not modules then modules = { } end modules ['mtx-tools'] = {
local find, format, sub, rep, gsub, lower = string.find, string.format, string.sub, string.rep, string.gsub, string.lower
+local helpinfo = [[
+--disarmutfbomb remove utf bomb if present
+ --force remove indeed
+
+--dirtoxml glob directory into xml
+ --pattern glob pattern (default: *)
+ --url url attribute (no processing)
+ --root the root of the globbed path (default: .)
+ --output output filename (console by default)
+ --recurse recurse into subdirecories
+ --stripname take pathpart of given pattern
+ --longname set name attributes to full path name
+
+--downcase
+ --pattern glob pattern (default: *)
+ --recurse recurse into subdirecories
+ --force downcase indeed
+]]
+
+local application = logs.application {
+ name = "mtx-tools",
+ banner = "Some File Related Goodies 1.01",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
scripts = scripts or { }
scripts.tools = scripts.tools or { }
@@ -23,24 +50,24 @@ function scripts.tools.disarmutfbomb()
if not data then
-- just skip
elseif find(data,bomb_1) then
- logs.simple("file '%s' has a 2 character utf bomb",name)
+ report("file '%s' has a 2 character utf bomb",name)
if force then
io.savedata(name,(gsub(data,bomb_1,"")))
end
done = true
elseif find(data,bomb_2) then
- logs.simple("file '%s' has a 3 character utf bomb",name)
+ report("file '%s' has a 3 character utf bomb",name)
if force then
io.savedata(name,(gsub(data,bomb_2,"")))
end
done = true
else
- -- logs.simple("file '%s' has no utf bomb",name)
+ -- report("file '%s' has no utf bomb",name)
end
end
end
if done and not force then
- logs.simple("use --force to do a real disarming")
+ report("use --force to do a real disarming")
end
end
@@ -63,12 +90,12 @@ function scripts.tools.downcase()
end)
if n > 0 then
if force then
- logs.simple("%s files renamed",n)
+ report("%s files renamed",n)
else
- logs.simple("use --force to do a real rename (%s files involved)",n)
+ report("use --force to do a real rename (%s files involved)",n)
end
else
- logs.simple("nothing to do")
+ report("nothing to do")
end
end
@@ -111,7 +138,7 @@ function scripts.tools.dirtoxml()
end
if not pattern or pattern == "" then
- logs.report('provide --pattern=')
+ report('provide --pattern=')
return
end
@@ -144,27 +171,6 @@ function scripts.tools.dirtoxml()
end
-logs.extendbanner("Some File Related Goodies 1.01")
-
-messages.help = [[
---disarmutfbomb remove utf bomb if present
- --force remove indeed
-
---dirtoxml glob directory into xml
- --pattern glob pattern (default: *)
- --url url attribute (no processing)
- --root the root of the globbed path (default: .)
- --output output filename (console by default)
- --recurse recurse into subdirecories
- --stripname take pathpart of given pattern
- --longname set name attributes to full path name
-
---downcase
- --pattern glob pattern (default: *)
- --recurse recurse into subdirecories
- --force downcase indeed
-]]
-
if environment.argument("disarmutfbomb") then
scripts.tools.disarmutfbomb()
elseif environment.argument("dirtoxml") then
@@ -172,5 +178,5 @@ elseif environment.argument("dirtoxml") then
elseif environment.argument("downcase") then
scripts.tools.downcase()
else
- logs.help(messages.help)
+ application.help()
end
diff --git a/scripts/context/lua/mtx-unzip.lua b/scripts/context/lua/mtx-unzip.lua
index 85a4b9e7b..645863426 100644
--- a/scripts/context/lua/mtx-unzip.lua
+++ b/scripts/context/lua/mtx-unzip.lua
@@ -10,21 +10,23 @@ if not modules then modules = { } end modules ['mtx-unzip'] = {
local format = string.format
-logs.extendbanner("Simple Unzipper 0.10")
-
-messages.help = [[
+local helpinfo = [[
--list list files in archive
--junk flatten unzipped directory structure
--extract extract files
]]
+local application = logs.application {
+ name = "mtx-unzip",
+ banner = "Simple Unzipper 0.10",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
scripts = scripts or { }
scripts.unzipper = scripts.unzipper or { }
-function scripts.unzipper.help()
- logs.help(messages.help)
-end
-
function scripts.unzipper.opened()
local filename = environment.files[1]
if filename and filename ~= "" then
@@ -34,7 +36,7 @@ function scripts.unzipper.opened()
return zipfile
end
end
- logs.report("unzip", "no zip file: " .. filename)
+ report("no zip file: %s",filename)
return false
end
@@ -104,11 +106,11 @@ function scripts.unzipper.extract()
end
if environment.arguments["h"] or environment.arguments["help"] then
- scripts.unzipper.help()
+ application.help()
elseif environment.arguments["l"] or environment.arguments["list"] then
scripts.unzipper.list(zipfile)
elseif environment.files[1] then -- implicit --extract
scripts.unzipper.extract(zipfile)
else
- scripts.unzipper.help()
+ application.help()
end
diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua
index 708565910..750c74886 100644
--- a/scripts/context/lua/mtx-update.lua
+++ b/scripts/context/lua/mtx-update.lua
@@ -11,6 +11,32 @@ if not modules then modules = { } end modules ['mtx-update'] = {
-- Together with Arthur Reutenauer she made sure that it worked well on all
-- platforms that matter.
+local helpinfo = [[
+--platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)
+--server=string repository url (rsync://contextgarden.net)
+--module=string repository url (minimals)
+--repository=string specify version (current, experimental)
+--context=string specify version (current, latest, beta, yyyy.mm.dd)
+--rsync=string rsync binary (rsync)
+--texroot=string installation directory (not guessed for the moment)
+--engine=string tex engine (luatex, pdftex, xetex)
+--extras=string extra modules (can be list or 'all')
+--goodies=string extra binaries (like scite and texworks)
+--force instead of a dryrun, do the real thing
+--update update minimal tree
+--make also make formats and generate file databases
+--keep don't delete unused or obsolete files
+--state update tree using saved state
+]]
+
+local application = logs.application {
+ name = "mtx-update",
+ banner = "ConTeXt Minimals Updater 0.22",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
local format, concat, gmatch, gsub = string.format, table.concat, string.gmatch, string.gsub
scripts = scripts or { }
@@ -159,10 +185,10 @@ function scripts.update.run(str)
-- (texlua sets luatex as the engine, we need to reset that or to fix texexec :)
os.setenv("engine",nil)
if environment.argument("force") then
- logs.report("run", str)
+ report("run, %s",str)
os.execute(str)
else
- logs.report("dry run", str)
+ report("dry run, %s",str)
end
end
@@ -176,7 +202,7 @@ end
function scripts.update.synchronize()
- logs.report("update","start")
+ report("update, start")
local texroot = scripts.update.fullpath(states.get("paths.root"))
local engines = states.get('engines') or { }
@@ -350,7 +376,7 @@ function scripts.update.synchronize()
deleteflags = states.get("rsync.flags.delete")
end
command = format("%s %s %s %s %s'%s' '%s'", bin, normalflags, deleteflags, dryrunflags, url, archives, destination)
- --logs.report("mtx update", format("running command: %s",command))
+ -- report("running command: %s",command)
if not fetched[command] then
scripts.update.run(command,true)
fetched[command] = command
@@ -370,7 +396,7 @@ function scripts.update.synchronize()
else
command = format("%s -tgo --chmod=a+x %s/texmf-context/scripts/context/lua/%s.lua %s/texmf-%s/bin/%s", bin, texroot, script, texroot, platform, script)
end
- logs.report("mtx update", format("updating %s for %s: %s", script, platform, command))
+ report("updating %s for %s: %s", script, platform, command)
scripts.update.run(command)
end
end
@@ -382,10 +408,10 @@ function scripts.update.synchronize()
end
else
- logs.report("mtx update", format("no valid texroot: %s",texroot))
+ report("no valid texroot: %s",texroot)
end
if not force then
- logs.report("update", "use --force to really update files")
+ report("use --force to really update files")
end
resolvers.load_tree(texroot) -- else we operate in the wrong tree
@@ -395,7 +421,7 @@ function scripts.update.synchronize()
-- update filename database for luatex
scripts.update.run(format('mtxrun --tree="%s" --generate',texroot))
- logs.report("update","done")
+ report("update, done")
end
function table.fromhash(t)
@@ -409,7 +435,7 @@ end
-- make the ConTeXt formats
function scripts.update.make()
- logs.report("make","start")
+ report("make, start")
local force = environment.argument("force")
local texroot = scripts.update.fullpath(states.get("paths.root"))
@@ -451,33 +477,13 @@ function scripts.update.make()
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")
+ report("make, use --force to really make formats")
end
scripts.update.run(format('mtxrun --tree="%s" --direct mktexlsr',texroot))
scripts.update.run(format('mtxrun --tree="%s" --generate',texroot))
- logs.report("make","done")
+ report("make, done")
end
-logs.extendbanner("ConTeXt Minimals Updater 0.21")
-
-messages.help = [[
---platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)
---server=string repository url (rsync://contextgarden.net)
---module=string repository url (minimals)
---repository=string specify version (current, experimental)
---context=string specify version (current, latest, beta, yyyy.mm.dd)
---rsync=string rsync binary (rsync)
---texroot=string installation directory (not guessed for the moment)
---engine=string tex engine (luatex, pdftex, xetex)
---extras=string extra modules (can be list or 'all')
---goodies=string extra binaries (like scite and texworks)
---force instead of a dryrun, do the real thing
---update update minimal tree
---make also make formats and generate file databases
---keep don't delete unused or obsolete files
---state update tree using saved state
-]]
-
scripts.savestate = true
if scripts.savestate then
@@ -544,7 +550,8 @@ if scripts.savestate then
states.set("goodies." .. r, true)
end
- logs.report("state","loaded")
+ report("state, loaded")
+ report()
end
@@ -562,7 +569,7 @@ if environment.argument("update") then
elseif environment.argument("make") then
scripts.update.make()
else
- logs.help(messages.help)
+ application.help()
end
if scripts.savestate then
@@ -570,6 +577,6 @@ if scripts.savestate then
states.set("info.runtime",tonumber(statistics.elapsedtime(states)))
if environment.argument("force") then
states.save()
- logs.report("state","saved")
+ report("state","saved")
end
end
diff --git a/scripts/context/lua/mtx-watch.lua b/scripts/context/lua/mtx-watch.lua
index 617d73f90..5bd0ad5f4 100644
--- a/scripts/context/lua/mtx-watch.lua
+++ b/scripts/context/lua/mtx-watch.lua
@@ -6,6 +6,25 @@ if not modules then modules = { } end modules ['mtx-watch'] = {
license = "see context related readme files"
}
+local helpinfo = [[
+--logpath optional path for log files
+--watch watch given path [--delay]
+--pipe use pipe instead of execute
+--delay delay between sweeps
+--automachine replace /machine/ in path /%s",category,format(fmt,s,...)))
- elseif fmt then
- write_nl(format("")
- write_nl("")
-end
+-- there may be scripts out there using this:
-function xmllog.report_output_pages(p,b)
- write_nl(format("%s",category,fmt))
- else
- write_nl(format("",category))
+function logs.show_close(name)
+ if verbose then
+ report_files("level %s, closing %s",nesting,name)
+ nesting = nesting - 1
end
end
-function xmllog.line(fmt,...) -- new
- if fmt then
- write_nl(format("%s",category,format(fmt,s,...)))
- elseif fmt then
- write_nl(format("")
- write_nl("")
-end
+-- there may be scripts out there using this:
-function xmllog.report_output_pages(p,b)
- write_nl(format("%s",category,fmt))
- else
- write_nl(format("",category))
+function logs.show_close(name)
+ if verbose then
+ report_files("level %s, closing %s",nesting,name)
+ nesting = nesting - 1
end
end
-function xmllog.line(fmt,...) -- new
- if fmt then
- write_nl(format("%s",category,format(fmt,s,...)))
- elseif fmt then
- write_nl(format("")
- write_nl("")
-end
+-- there may be scripts out there using this:
-function xmllog.report_output_pages(p,b)
- write_nl(format("%s",category,fmt))
- else
- write_nl(format("",category))
+function logs.show_close(name)
+ if verbose then
+ report_files("level %s, closing %s",nesting,name)
+ nesting = nesting - 1
end
end
-function xmllog.line(fmt,...) -- new
- if fmt then
- write_nl(format("
Regimes take care of converting the input characters into
We will hook regime handling code into the input methods.
+--ldx]]-- --- regimes.synonyms = regimes.synonyms or { } --- local synonyms = regimes.synonyms --- --- if storage then --- storage.register("regimes/synonyms", synonyms, "regimes.synonyms") --- else --- regimes.synonyms = { } --- end +local trace_translating = false trackers.register("regimes.translating", function(v) trace_translating = v end) + +local report_loading = logs.new("regimes","loading") +local report_translating = logs.new("regimes","translating") -local synonyms = { - - ["windows-1250"] = "cp1250", - ["windows-1251"] = "cp1251", - ["windows-1252"] = "cp1252", - ["windows-1253"] = "cp1253", - ["windows-1254"] = "cp1254", - ["windows-1255"] = "cp1255", - ["windows-1256"] = "cp1256", - ["windows-1257"] = "cp1257", - ["windows-1258"] = "cp1258", - - ["il1"] = "8859-1", - ["il2"] = "8859-2", - ["il3"] = "8859-3", - ["il4"] = "8859-4", - ["il5"] = "8859-9", - ["il6"] = "8859-10", - ["il7"] = "8859-13", - ["il8"] = "8859-14", - ["il9"] = "8859-15", - ["il10"] = "8859-16", - - ["iso-8859-1"] = "8859-1", - ["iso-8859-2"] = "8859-2", - ["iso-8859-3"] = "8859-3", - ["iso-8859-4"] = "8859-4", - ["iso-8859-9"] = "8859-9", - ["iso-8859-10"] = "8859-10", - ["iso-8859-13"] = "8859-13", - ["iso-8859-14"] = "8859-14", - ["iso-8859-15"] = "8859-15", - ["iso-8859-16"] = "8859-16", - - ["latin1"] = "8859-1", - ["latin2"] = "8859-2", - ["latin3"] = "8859-3", - ["latin4"] = "8859-4", - ["latin5"] = "8859-9", - ["latin6"] = "8859-10", - ["latin7"] = "8859-13", - ["latin8"] = "8859-14", - ["latin9"] = "8859-15", - ["latin10"] = "8859-16", - - ["utf-8"] = "utf", - ["utf8"] = "utf", - - ["windows"] = "cp1252", +regimes = regimes or { } +local regimes = regimes +local mapping = { + utf = false } -regimes.currentregime = "utf" +local synonyms = { -- backward compatibility list + + ["windows-1250"] = "cp1250", + ["windows-1251"] = "cp1251", + ["windows-1252"] = "cp1252", + ["windows-1253"] = "cp1253", + ["windows-1254"] = "cp1254", + ["windows-1255"] = "cp1255", + ["windows-1256"] = "cp1256", + ["windows-1257"] = "cp1257", + ["windows-1258"] = "cp1258", + + ["il1"] = "8859-1", + ["il2"] = "8859-2", + ["il3"] = "8859-3", + ["il4"] = "8859-4", + ["il5"] = "8859-9", + ["il6"] = "8859-10", + ["il7"] = "8859-13", + ["il8"] = "8859-14", + ["il9"] = "8859-15", + ["il10"] = "8859-16", + + ["iso-8859-1"] = "8859-1", + ["iso-8859-2"] = "8859-2", + ["iso-8859-3"] = "8859-3", + ["iso-8859-4"] = "8859-4", + ["iso-8859-9"] = "8859-9", + ["iso-8859-10"] = "8859-10", + ["iso-8859-13"] = "8859-13", + ["iso-8859-14"] = "8859-14", + ["iso-8859-15"] = "8859-15", + ["iso-8859-16"] = "8859-16", + + ["latin1"] = "8859-1", + ["latin2"] = "8859-2", + ["latin3"] = "8859-3", + ["latin4"] = "8859-4", + ["latin5"] = "8859-9", + ["latin6"] = "8859-10", + ["latin7"] = "8859-13", + ["latin8"] = "8859-14", + ["latin9"] = "8859-15", + ["latin10"] = "8859-16", + + ["utf-8"] = "utf", + ["utf8"] = "utf", + [""] = "utf", + + ["windows"] = "cp1252", ---[[ldx-- -We will hook regime handling code into the input methods.
---ldx]]-- +} + +local currentregime = "utf" -function regimes.number(n) - if type(n) == "string" then return tonumber(n,16) else return n end +local function loadregime(mapping,regime) + local name = resolvers.findfile(format("regi-%s.lua",regime)) or "" + local data = name ~= "" and dofile(name) + if data then + vector = { } + for eightbit, unicode in next, data do + vector[char(eightbit)] = utfchar(unicode) + end + report_loading("vector '%s' is loaded",regime) + else + vector = false + report_loading("vector '%s' is unknown",regime) + end + mapping[regime] = vector + return vector end -function regimes.setsynonym(synonym,target) -- more or less obsolete - synonyms[synonym] = target +setmetatable(mapping, { __index = loadregime }) + +local function translate(line,regime) + if line and #line > 0 then + local map = mapping[regime and synonyms[regime] or regime or currentregime] + if map then + line = gsub(line,".",map) + end + end + return line end -function regimes.truename(regime) - context((regime and synonyms[synonym] or regime) or regimes.currentregime) +local function disable() + currentregime = "utf" + sequencers.disableaction(textlineactions,"regimes.process") end -function regimes.load(regime) +local function enable(regime) regime = synonyms[regime] or regime - if not data[regime] then - environment.loadluafile("regi-"..regime, 1.001) - if data[regime] then - regimes.utf[regime] = { } - for k,v in next, data[regime] do - regimes.utf[regime][char(k)] = utfchar(v) - end + if mapping[regime] == false then + disable() + else + currentregime = regime + sequencers.enableaction(textlineactions,"regimes.process") + end +end + +regimes.translate = translate +regimes.enable = enable +regimes.disable = disable + +-- The following function can be used when we want to make sure that +-- utf gets passed unharmed. This is needed for modules. + +local level = 0 + +function regimes.process(str) + if level == 0 then + str = translate(str,currentregime) + if trace_translating then + report_translating("utf: %s",str) end end + return str end -function regimes.translate(line,regime) - regime = synonyms[regime] or regime - if regime and line then - local rur = regimes.utf[regime] - if rur then - return (gsub(line,"(.)",rur)) -- () redundant +function regimes.push() + level = level + 1 + if trace_translating then + report_translating("pushing level %s",level) + end +end + +function regimes.pop() + if level > 0 then + if trace_translating then + report_translating("popping level %s",level) end + level = level - 1 end - return line end -local sequencers = utilities.sequencers -local textlineactions = resolvers.openers.helpers.textlineactions +sequencers.prependaction(textlineactions,"system","regimes.process") +sequencers.disableaction(textlineactions,"regimes.process") + +-- interface: -function regimes.process(s) - return regimes.translate(s,regimes.currentregime) +commands.enableregime = enable +commands.disableregime = disable + +function commands.currentregime() + context(currentregime) end -function regimes.enable(regime) - regime = synonyms[regime] or regime - if data[regime] then - regimes.currentregime = regime - sequencers.enableaction(textlineactions,"regimes.process") - else - sequencers.disableaction(textlineactions,"regimes.process") +local stack = { } + +function commands.startregime(regime) + insert(stack,currentregime) + if trace_translating then + report_translating("start '%s'",regime) end + enable(regime) end -function regimes.disable() - regimes.currentregime = "utf" - sequencers.disableaction(textlineactions,"regimes.process") +function commands.stopregime() + if #stack > 0 then + local regime = remove(stack) + if trace_translating then + report_translating("stop '%s'",regime) + end + enable(regime) + end end -utilities.sequencers.prependaction(textlineactions,"system","regimes.process") -utilities.sequencers.disableaction(textlineactions,"regimes.process") +-- obsolete: +-- +-- function regimes.setsynonym(synonym,target) +-- synonyms[synonym] = target +-- end +-- +-- function regimes.truename(regime) +-- return regime and synonyms[regime] or regime or currentregime +-- end +-- +-- function commands.trueregimename(regime) +-- context(regimes.truename(regime)) +-- end +-- +-- function regimes.load(regime) +-- return mapping[synonyms[regime] or regime] +-- end diff --git a/tex/context/base/regi-ini.mkiv b/tex/context/base/regi-ini.mkiv index b306d87f4..41f001426 100644 --- a/tex/context/base/regi-ini.mkiv +++ b/tex/context/base/regi-ini.mkiv @@ -11,45 +11,39 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - -%D First some initialization code: - \registerctxluafile{regi-ini}{1.001} -%D \macros -%D {currentregime} - -\def\currentregime{utf} - -%D \macros -%D {defineregimesynonym,trueregimename} - -\unexpanded\def\defineregimesynonym % more or less obsolete - {\dodoubleargument\dodefineregimesynonym} - -\def\dodefineregimesynonym[#1][#2]% - {\ctxlua{regimes.setsynonym("#1","#2")}} - -\def\trueregimename#1% - {\ctxlua{regimes.truename("#1")}} - -%D \macros -%D {useregime} - -\def\useregime[#1]% - {\processcommalist[#1]\douseregime} - -\def\douseregime#1% - {\ctxlua{regimes.load("#1")}} +\unprotect %D \macros -%D {enableregime,disableregime} - -\def\enableregime[#1]% - {\edef\currentregime{\ctxlua{regimes.load("#1") regimes.enable("#1") regimes.truename()}}} - -\def\disableregime - {\edef\currentregime{\ctxlua{regimes.disable()}}} +%D {enableregime,disableregime,currentregime} +%D +%D Beware, the enable and disable commands are global switches, so +%D best use the start|/|stop commands. + +\unexpanded\def\enableregime[#1]{\ctxcommand{enableregime("#1")}} +\unexpanded\def\disableregime {\ctxcommand{disableregime()}} +\unexpanded\def\startregime [#1]{\ctxcommand{startregime("#1")}} +\unexpanded\def\stopregime {\ctxcommand{stopregime()}} + \def\currentregime {\ctxcommand{currentregime()}} + +% D \macros +% D {defineregimesynonym,trueregimename} +% +% \unexpanded\def\defineregimesynonym % more or less obsolete +% {\dodoubleargument\dodefineregimesynonym} +% +% \def\dodefineregimesynonym[#1][#2]% +% {\ctxlua{regimes.setsynonym("#1","#2")}} +% +% \def\trueregimename#1% +% {\ctxcommand{trueregimename("#1")}} + +% D \macros +% D {useregime} +% D +% D This one is sort of obsolete but we keep them around. + +\unexpanded\def\useregime[#1]{} \protect \endinput diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index 5b012890d..2d36fd973 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -13,7 +13,7 @@ local texwrite = tex.write local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end) local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end) -local report_preprocessing = logs.new("preprocessing") +local report_preprocessing = logs.new("scripts","preprocessing") local allocate = utilities.storage.allocate diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 2cf92bf67..793022e52 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -50,7 +50,7 @@ local allocate = utilities.storage.allocate local trace_tests = false trackers.register("sorters.tests", function(v) trace_tests = v end) -local report_sorters = logs.new("sorters") +local report_sorters = logs.new("languages","sorters") local comparers = { } local splitters = { } diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 958d1ad7a..c10ff18fd 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -46,9 +46,9 @@ local trace_vspacing = false trackers.register("builders.vspacing", local trace_vsnapping = false trackers.register("builders.vsnapping", function(v) trace_vsnapping = v end) local trace_vpacking = false trackers.register("builders.vpacking", function(v) trace_vpacking = v end) -local report_vspacing = logs.new("vspacing") -local report_collapser = logs.new("collapser") -local report_snapper = logs.new("snapper") +local report_vspacing = logs.new("vspacing","spacing") +local report_collapser = logs.new("vspacing","collapsing") +local report_snapper = logs.new("vspacing","snapping") local a_skipcategory = attributes.private('skipcategory') local a_skippenalty = attributes.private('skippenalty') diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index fa408ec38..1da6d6d7c 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1854,13 +1854,13 @@ % \def\disablevspacing{\the\everydisablevspacing} % % \appendtoks -% \writestatus\m!systems{! ! enabling vspacing ! !}% +% \writestatus\m!system{! ! enabling vspacing ! !}% % \settrue\vspacingenabled % \ctxlua{builders.vspacing.enable()}% % \to \everyenablevspacing % % \appendtoks -% \writestatus\m!systems{! ! disabling vspacing ! !}% +% \writestatus\m!system{! ! disabling vspacing ! !}% % \setfalse\vspacingenabled % \ctxlua{builders.vspacing.disable()}% % \to \everydisablevspacing diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index c9b8be6bd..139a75836 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/strc-bkm.lua b/tex/context/base/strc-bkm.lua index 08f26c88f..84bb73e80 100644 --- a/tex/context/base/strc-bkm.lua +++ b/tex/context/base/strc-bkm.lua @@ -21,7 +21,7 @@ local codeinjections = backends.codeinjections local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end) -local report_bookmarks = logs.new("bookmarks") +local report_bookmarks = logs.new("structure","bookmarks") local structures = structures diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index 7e95fb563..8195bdecf 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -25,7 +25,7 @@ local variables = interfaces.variables local trace_sectioning = false trackers.register("structures.sectioning", function(v) trace_sectioning = v end) local trace_detail = false trackers.register("structures.detail", function(v) trace_detail = v end) -local report_structure = logs.new("structure") +local report_structure = logs.new("structure","sectioning") local structures, context = structures, context @@ -322,7 +322,7 @@ function sections.somelevel(given) -- given.numberdata = nil end -function sections.writestatus() +function sections.reportstructure() if sections.verbose then local numbers, ownnumbers, status, depth = data.numbers, data.ownnumbers, data.status, data.depth local d = status[depth] @@ -332,11 +332,11 @@ function sections.writestatus() local t = (l ~= "" and l) or d.titledata.title or "[no title]" local m = d.metadata.name if o and not find(o,"^%.*$") then - commands.writestatus("structure","%s @ level %i : (%s) %s -> %s",m,depth,n,o,t) + report_structure("%s @ level %i : (%s) %s -> %s",m,depth,n,o,t) elseif d.directives and d.directives.hidenumber then - commands.writestatus("structure","%s @ level %i : (%s) -> %s",m,depth,n,t) + report_structure("%s @ level %i : (%s) -> %s",m,depth,n,t) else - commands.writestatus("structure","%s @ level %i : %s -> %s",m,depth,n,t) + report_structure("%s @ level %i : %s -> %s",m,depth,n,t) end end end diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv index 972e50f78..2d05bf04d 100644 --- a/tex/context/base/strc-doc.mkiv +++ b/tex/context/base/strc-doc.mkiv @@ -178,7 +178,7 @@ {\xdef\currentstructureattribute {\ctxlua {tex.write(structures.references.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\@@iafocus"))}}% \xdef\currentstructuresynchronize{\ctxlatelua{structures.lists.enhance(#1)}}} -\def\reportcurrentstructure{\ctxlua{structures.sections.writestatus()}} +\def\reportcurrentstructure{\ctxlua{structures.sections.reportstructure()}} % Beware: we need to flush the data to the list explicitly. This is because % node in inserted and we may want control over when that happens. diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua index 88c1d344d..69d7528dd 100644 --- a/tex/context/base/strc-ini.lua +++ b/tex/context/base/strc-ini.lua @@ -31,7 +31,7 @@ local ctxcatcodes, xmlcatcodes, notcatcodes = tex.ctxcatcodes, tex.xmlcatcodes, local trace_processors = false trackers.register("structures.processors", function(v) trace_processors = v end) -local report_processors = logs.new("processors") +local report_processors = logs.new("structure","processors") -- move this diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 8278a66d9..fca7f56e3 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -21,7 +21,7 @@ local allocate, mark, checked = utilities.storage.allocate, utilities.storage.ma local trace_lists = false trackers.register("structures.lists", function(v) trace_lists = v end) -local report_lists = logs.new("lists") +local report_lists = logs.new("structure","lists") local ctxcatcodes = tex.ctxcatcodes diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index eb876452c..50458c4d5 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -211,7 +211,7 @@ \definelistextra [\v!page] - [\c!before={\showmessage\m!systems{14}{\currentlist/\currentlistindex}\page}] + [\c!before={\showmessage\m!system{14}{\currentlist/\currentlistindex}\page}] \def\processlistextrabefore{\executeifdefined{\??li:\c!extras:\currentlistextra:\c!before}\relax} \def\processlistextraafter {\executeifdefined{\??li:\c!extras:\currentlistextra:\c!after }\relax} @@ -639,7 +639,7 @@ % \begingroup % \edef\listelements{\listparameter\c!pageboundaries}% % \normalexpanded{\noexpand\doifinset{#3}{\listelements}} -% {\showmessage\m!systems{14}{#3}% +% {\showmessage\m!system{14}{#3}% % \page}% % \endgroup \dontcomplain diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index d990b4fff..c14d93a43 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -22,13 +22,13 @@ local traversenodes = node.traverse local texsetattribute = tex.setattribute local texbox = tex.box -local a_marks = attributes.private('marks') +local a_marks = attributes.private("structure","marks") local trace_marks_set = false trackers.register("marks.set", function(v) trace_marks_set = v end) local trace_marks_get = false trackers.register("marks.get", function(v) trace_marks_get = v end) local trace_marks_all = false trackers.register("marks.detail", function(v) trace_marks_all = v end) -local report_marks = logs.new("marks") +local report_marks = logs.new("structure","marks") local variables = interfaces.variables diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua index 222623a59..ebc25dd5d 100644 --- a/tex/context/base/strc-not.lua +++ b/tex/context/base/strc-not.lua @@ -12,7 +12,7 @@ local texcount = tex.count local trace_notes = false trackers.register("structures.notes", function(v) trace_notes = v end) -local report_notes = logs.new("notes") +local report_notes = logs.new("structure","notes") local structures = structures local helpers = structures.helpers diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua index 1fefd864c..8f4f0e245 100644 --- a/tex/context/base/strc-num.lua +++ b/tex/context/base/strc-num.lua @@ -14,7 +14,7 @@ local allocate, mark = utilities.storage.allocate, utilities.storage.mark local trace_counters = false trackers.register("structures.counters", function(v) trace_counters = v end) -local report_counters = logs.new("counters") +local report_counters = logs.new("structure","counters") local structures = structures diff --git a/tex/context/base/strc-pag.lua b/tex/context/base/strc-pag.lua index 3dc70b6a3..19af8cbc4 100644 --- a/tex/context/base/strc-pag.lua +++ b/tex/context/base/strc-pag.lua @@ -13,7 +13,7 @@ local allocate, mark = utilities.storage.allocate, utilities.storage.mark local trace_pages = false trackers.register("structures.pages", function(v) trace_pages = v end) -local report_pages = logs.new("pages") +local report_pages = logs.new("structure","pages") local structures = structures diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index ff773e9a0..522442982 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -16,7 +16,7 @@ local allocate = utilities.storage.allocate local trace_referencing = false trackers.register("structures.referencing", function(v) trace_referencing = v end) -local report_references = logs.new("references") +local report_references = logs.new("structure","references") local variables = interfaces.variables local constants = interfaces.constants diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index a9a19515c..b91940523 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -258,7 +258,7 @@ %D \stoptabulate \def\usereferences[#1]% not yet - {\writestatus\m!systems{references from other files are handled automatically}} + {\writestatus\m!system{references from other files are handled automatically}} %D As mentioned we will also use the cross reference mechanism %D for navigational purposes. The main reason for this is that diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index 7e392ba72..3220b3f61 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -16,7 +16,7 @@ local allocate, mark = utilities.storage.allocate, utilities.storage.mark local trace_registers = false trackers.register("structures.registers", function(v) trace_registers = v end) -local report_registers = logs.new("registers") +local report_registers = logs.new("structure","registers") local structures = structures local registers = structures.registers diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 94e97ea24..c9a5f870f 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -531,7 +531,7 @@ \xdef\currentstructureheadcoupling{\structuresectionheadcoupling\currentstructurehead}% \xdef\currentstructureheadsection {\structuresectionheadsection \currentstructureheadcoupling}% \xdef\currentstructureheadlevel {\structuresectionlevel \currentstructureheadsection}% - %writestatus\m!systems{setup: \currentstructurehead,\currentstructureheadcoupling,\currentstructureheadsection,\currentstructureheadlevel}% + %writestatus\m!system{setup: \currentstructurehead,\currentstructureheadcoupling,\currentstructureheadsection,\currentstructureheadlevel}% % \setstructureheadreference % does not do much currently \setstructureheadincrement diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index f853cdd85..5563cd834 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -17,7 +17,7 @@ local settings_to_hash = utilities.parsers.settings_to_hash local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) -local report_tags = logs.new("tags") +local report_tags = logs.new("structure","tags") local attributes, structures = attributes, structures diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua index c40995562..be5bc2864 100644 --- a/tex/context/base/supp-box.lua +++ b/tex/context/base/supp-box.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['supp-box'] = { -- this is preliminary code +local report_hyphenation = logs.new("languages","hyphenation") + local nodecodes = nodes.nodecodes local disc_code = nodecodes.disc @@ -45,7 +47,7 @@ end commands.hyphenatedlist = hyphenatedlist function commands.showhyphenatedinlist(list) - commands.writestatus("show hyphens",nodes.listtoutf(list)) + report_hyphenation("show: %s",nodes.listtoutf(list)) end function checkedlist(list) diff --git a/tex/context/base/supp-fil.lua b/tex/context/base/supp-fil.lua index acc3bbe66..357de5eca 100644 --- a/tex/context/base/supp-fil.lua +++ b/tex/context/base/supp-fil.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['supp-fil'] = { -- This module will be redone ! -- context is not defined yet! todo! (we need to load tupp-fil after cld) +-- todo: move startreadingfile to lua and push regime there --[[ldx--It's more convenient to manipulate filenames (paths) in
@@ -23,8 +24,8 @@ local isfile = lfs.isfile
local trace_modules = false trackers.register("modules.loading", function(v) trace_modules = v end)
local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end)
-local report_modules = logs.new("modules")
-local report_files = logs.new("resolvers")
+local report_modules = logs.new("resolvers","modules")
+local report_files = logs.new("resolvers","files")
commands = commands or { }
local commands = commands
@@ -305,17 +306,17 @@ function commands.usemodules(prefix,askedname,truename)
if trace_modules then
report_modules("skipping '%s' (not found)",truename)
else
- interfaces.showmessage("systems",6,askedname)
+ interfaces.showmessage("system",6,askedname)
end
elseif status == 1 then
if not trace_modules then
- interfaces.showmessage("systems",5,askedname)
+ interfaces.showmessage("system",5,askedname)
end
else
if trace_modules then
report_modules("skipping '%s' (already loaded)",truename)
else
- interfaces.showmessage("systems",7,askedname)
+ interfaces.showmessage("system",7,askedname)
end
end
modstatus[hashname] = status
diff --git a/tex/context/base/supp-fil.mkiv b/tex/context/base/supp-fil.mkiv
index 555d1240a..6b9af21ce 100644
--- a/tex/context/base/supp-fil.mkiv
+++ b/tex/context/base/supp-fil.mkiv
@@ -412,10 +412,12 @@
{\global\advance\readingfilelevel\plusone
\the\everystartreadingfile
\pushcatcodetable % saveguard
+ \ctxlua{regimes.push()}% temporarily this way
}% \setcatcodetable\prtcatcodes % no longer in mkiv, has to be done explictly
\unexpanded\def\stopreadingfile
{\popcatcodetable % saveguard
+ \ctxlua{regimes.pop()}% temporarily this way
\the\everystopreadingfile
\global\advance\readingfilelevel\minusone}
diff --git a/tex/context/base/supp-ran.lua b/tex/context/base/supp-ran.lua
index 5263208eb..0be9f66fd 100644
--- a/tex/context/base/supp-ran.lua
+++ b/tex/context/base/supp-ran.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['supp-ran'] = {
-- We cannot ask for the current seed, so we need some messy hack
-- here.
-local report_system = logs.new("system")
+local report_system = logs.new("system","randomizer")
commands = commands or { }
local commands = commands
@@ -19,12 +19,15 @@ local random, randomseed, round, seed, last = math.random, math.randomseed, math
local texwrite = tex.write
function math.setrandomseedi(n,comment)
+ if not n then
+--~ n = 0.5 -- hack
+ end
if n <= 1 then
n = n*1073741823 -- maxcount
end
n = round(n)
if false then
- report_system("setting random seed to %s (%s)",n,comment or "normal")
+ report_system("setting seed to %s (%s)",n,comment or "normal")
end
randomseed(n)
last = random(0,1073741823) -- we need an initial value
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 461c84117..17169acbf 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -2091,7 +2091,7 @@
\setnewconstant\expectedarguments \zerocount
\def\showargumenterror#1#2%
- {\writestatus{systems}{\number#1 argument(s) expected in line #2}}
+ {\writestatus{system}{\number#1 argument(s) expected in line #2}}
\def\doshowargumenterror
{\ifnum\expectedarguments>\noexpectedarguments
@@ -4534,7 +4534,7 @@
%D \CONTEXT only defines lowcased macros.
\def\showdefinederror#1#2%
- {\writestatus\m!systems{#1 #2 replaces a macro, use CAPITALS!}}
+ {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}}
\def\checkdefined#1#2#3%
{\doifdefined{#3}{\showdefinederror{#2}{#3}}}
@@ -6945,10 +6945,10 @@
\def\retestfeature % timer support is new per 10/5/2005
{\bgroup
\ifcase\interactionmode\let\wait\relax\fi
- \writestatus\m!systems{starting feature test}\wait
+ \writestatus\m!system{starting feature test}\wait
\resettimer
\featuretest\zerocount \dotestfeature
- \writestatus\m!systems{feature test done (\elapsedseconds s)}%
+ \writestatus\m!system{feature test done (\elapsedseconds s)}%
\wait
\egroup}
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index 293ce4258..63cf65f35 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -257,7 +257,9 @@
%D evolved from code that dealt with older engines but as all engines
%D now provide many registers we removed all traces.
-\def\writestatus#1#2{\immediate\write16{#1: #2}} \def\space { }
+\ifdefined\writestatus \else
+ \def\writestatus#1#2{\immediate\write16{#1: #2}}
+\fi
\def\allocateregisteryes#1#2#3#4#5% last class method max name
{\ifnum#1<#4\relax
diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua
index da9269ac3..fefe415cf 100644
--- a/tex/context/base/syst-lua.lua
+++ b/tex/context/base/syst-lua.lua
@@ -14,8 +14,9 @@ local ctxcatcodes = tex.ctxcatcodes
commands = commands or { } -- cs = commands -- shorter, maybe some day, not used now
-function commands.writereport(...) logs.report(...) end -- not that efficient
-function commands.writestatus(...) logs.status(...) end
+function commands.writestatus(...) logs.status(...) end -- overloaded later
+
+-- todo: use shorter names i.e. less tokenization
local function testcase(b)
if b then -- looks faster with if than with expression
diff --git a/tex/context/base/syst-mes.mkiv b/tex/context/base/syst-mes.mkiv
index af792aba9..070c7af72 100644
--- a/tex/context/base/syst-mes.mkiv
+++ b/tex/context/base/syst-mes.mkiv
@@ -11,9 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\setnewconstant\statuswidth 15
-\setnewconstant\statuswrite 16
-
\newtoks\everywritestring
\def\writedirect {\immediate\write\statuswrite}
@@ -22,17 +19,4 @@
\let\writebanner \writestring
\let\message \normalmessage
-\ifx\normalwritestatus\undefined \def\normalwritestatus#1#2{\writedirect{#1 : #2}} \fi
-
-% no xml logging in format generation
-
-\everyjob {% we can redefine at the lua end !
- \doif {\ctxlua{tex.sprint(logs.getmethod())}} {xml} {%
- \long\def\writebanner #1{\writestring {
This is a prelude to a more extensive logging module. For the sake
-of parsing log files, in addition to the standard logging we will
-provide an
This is a prelude to a more extensive logging module. We no longer
+provide
Eventually this code will disappear because map files are kind @@ -5638,7 +5630,7 @@ local trace_sequences = false trackers.register("otf.sequences", function(v) local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) -local report_otf = logs.new("load otf") +local report_otf = logs.new("fonts","otf loading") local starttiming, stoptiming, elapsedtime = statistics.starttiming, statistics.stoptiming, statistics.elapsedtime @@ -5658,6 +5650,7 @@ otf.features.default = otf.features.default or { } otf.enhancers = allocate() local enhancers = otf.enhancers enhancers.patches = { } +local patches = enhancers.patches local definers = fonts.definers @@ -5870,11 +5863,11 @@ local ordered_enhancers = { local actions = { } -enhancers.patches.before = allocate() -enhancers.patches.after = allocate() +patches.before = allocate() +patches.after = allocate() -local before = enhancers.patches.before -local after = enhancers.patches.after +local before = patches.before +local after = patches.after local function enhance(name,data,filename,raw,verbose) local enhancer = actions[name] @@ -5918,9 +5911,9 @@ function enhancers.apply(data,filename,raw,verbose) ioflush() -- we want instant messages end --- enhancers.patches.register("before","migrate metadata","cambria",function() end) +-- patches.register("before","migrate metadata","cambria",function() end) -function enhancers.patches.register(what,where,pattern,action) +function patches.register(what,where,pattern,action) local ww = what[where] if ww then ww[pattern] = action @@ -5929,6 +5922,12 @@ function enhancers.patches.register(what,where,pattern,action) end end +function patches.report(fmt,...) + if trace_loading then + report_otf("patching: " ..fmt,...) + end +end + function enhancers.register(what,action) -- only already registered can be overloaded actions[what] = action end @@ -7531,7 +7530,7 @@ if not modules then modules = { } end modules ['font-otd'] = { local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) -local report_otf = logs.new("load otf") +local report_otf = logs.new("fonts","otf loading") local fonts = fonts local otf = fonts.otf @@ -7705,7 +7704,7 @@ local trace_ligatures = false trackers.register("otf.ligatures", function local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end) local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end) -local report_prepare = logs.new("otf prepare") +local report_prepare = logs.new("fonts","otf prepare") local wildcard = "*" local default = "dflt" @@ -8223,11 +8222,11 @@ local trace_steps = false trackers.register("otf.steps", function local trace_skips = false trackers.register("otf.skips", function(v) trace_skips = v end) local trace_directions = false trackers.register("otf.directions", function(v) trace_directions = v end) -local report_direct = logs.new("otf direct") -local report_subchain = logs.new("otf subchain") -local report_chain = logs.new("otf chain") -local report_process = logs.new("otf process") -local report_prepare = logs.new("otf prepare") +local report_direct = logs.new("fonts","otf direct") +local report_subchain = logs.new("fonts","otf subchain") +local report_chain = logs.new("fonts","otf chain") +local report_process = logs.new("fonts","otf process") +local report_prepare = logs.new("fonts","otf prepare") trackers.register("otf.verbose_chain", function(v) otf.setcontextchain(v and "verbose") end) trackers.register("otf.normal_chain", function(v) otf.setcontextchain(v and "normal") end) @@ -11096,7 +11095,7 @@ local trace_loading = false trackers.register("otf.loading", function(v) trace_ local fonts = fonts local otf = fonts.otf -local report_otf = logs.new("load otf") +local report_otf = logs.new("fonts","otf loading") -- instead of "script = "DFLT", langs = { 'dflt' }" we now use wildcards (we used to -- have always); some day we can write a "force always when true" trick for other @@ -15303,8 +15302,8 @@ local directive_embedall = false directives.register("fonts.embedall", function trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading", "tfm.loading") trackers.register("fonts.all", "fonts.*", "otf.*", "afm.*", "tfm.*") -local report_define = logs.new("define fonts") -local report_afm = logs.new("load afm") +local report_defining = logs.new("fonts","defining") +local report_afm = logs.new("fonts","afm loading") --[[ldx--
Here we deal with defining fonts. We do so by intercepting the @@ -15419,7 +15418,7 @@ end function definers.makespecification(specification, lookup, name, sub, method, detail, size) size = size or 655360 if trace_defining then - report_define("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", + report_defining("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", specification, (lookup ~= "" and lookup) or "[file]", (name ~= "" and name) or "-", (sub ~= "" and sub) or "-", (method ~= "" and method) or "-", (detail ~= "" and detail) or "-") end @@ -15627,14 +15626,14 @@ function tfm.read(specification) local reader = readers[lower(forced)] tfmtable = reader and reader(specification) if not tfmtable then - report_define("forced type %s of %s not found",forced,specification.name) + report_defining("forced type %s of %s not found",forced,specification.name) end else for s=1,#sequence do -- reader sequence local reader = sequence[s] if readers[reader] then -- not really needed if trace_defining then - report_define("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") + report_defining("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") end tfmtable = readers[reader](specification) if tfmtable then @@ -15659,7 +15658,7 @@ function tfm.read(specification) end end if not tfmtable then - report_define("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup) + report_defining("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup) end return tfmtable end @@ -15877,7 +15876,7 @@ function definers.register(tfmdata,id) -- will be overloaded local hash = tfmdata.hash if not internalized[hash] then if trace_defining then - report_define("registering font, id: %s, hash: %s",id or "?",hash or "?") + report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?") end fonts.identifiers[id] = tfmdata internalized[hash] = id @@ -15945,9 +15944,9 @@ function definers.read(specification,size,id) -- id can be optional, name can al end lastdefined = tfmdata or id -- todo ! ! ! ! ! if not tfmdata then -- or id? - report_define( "unknown font %s, loading aborted",specification.name) + report_defining( "unknown font %s, loading aborted",specification.name) elseif trace_defining and type(tfmdata) == "table" then - report_define("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", + report_defining("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", tfmdata.type or "unknown", id or "?", tfmdata.name or "?", @@ -15967,18 +15966,18 @@ function vf.find(name) local format = fonts.logger.format(name) if format == 'tfm' or format == 'ofm' then if trace_defining then - report_define("locating vf for %s",name) + report_defining("locating vf for %s",name) end return findbinfile(name,"ovf") else if trace_defining then - report_define("vf for %s is already taken care of",name) + report_defining("vf for %s is already taken care of",name) end return nil -- "" end else if trace_defining then - report_define("locating vf for %s",name) + report_defining("locating vf for %s",name) end return findbinfile(name,"ovf") end -- cgit v1.2.3