diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/data-aux.lua | 18 | ||||
-rw-r--r-- | tex/context/base/data-con.lua | 2 | ||||
-rw-r--r-- | tex/context/base/data-res.lua | 229 | ||||
-rw-r--r-- | tex/context/base/data-tex.lua | 25 | ||||
-rw-r--r-- | tex/context/base/data-use.lua | 3 | ||||
-rw-r--r-- | tex/context/base/data-zip.lua | 71 | ||||
-rw-r--r-- | tex/context/base/font-ext.lua | 26 | ||||
-rw-r--r-- | tex/context/base/luat-env.lua | 15 | ||||
-rw-r--r-- | tex/context/base/mult-sys.tex | 1 | ||||
-rw-r--r-- | tex/context/base/spac-ver.mkiv | 36 | ||||
-rw-r--r-- | tex/context/base/trac-log.lua | 6 | ||||
-rw-r--r-- | tex/context/base/trac-tra.lua | 86 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 4 |
15 files changed, 254 insertions, 272 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 25a5b19c0..3aafa79e0 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2009.11.21 11:45} +\newcontextversion{2009.11.23 11:49} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 3d25b095d..7e19ccd06 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.11.21 11:45} +\edef\contextversion{2009.11.23 11:49} %D For those who want to use this: diff --git a/tex/context/base/data-aux.lua b/tex/context/base/data-aux.lua index 923c6bb91..26e1f551c 100644 --- a/tex/context/base/data-aux.lua +++ b/tex/context/base/data-aux.lua @@ -8,47 +8,47 @@ if not modules then modules = { } end modules ['data-aux'] = { local find = string.find -local trace_verbose = false trackers.register("resolvers.verbose", function(v) trace_verbose = v end) +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") local oldscript = resolvers.clean_path(oldname) - if trace_verbose then + if trace_locating then logs.report("fileio","to be replaced old script %s", oldscript) end local newscripts = resolvers.find_files(newname) or { } if #newscripts == 0 then - if trace_verbose then + if trace_locating then logs.report("fileio","unable to locate new script") end else for i=1,#newscripts do local newscript = resolvers.clean_path(newscripts[i]) - if trace_verbose then + if trace_locating then logs.report("fileio","checking new script %s", newscript) end if oldscript == newscript then - if trace_verbose then + if trace_locating then logs.report("fileio","old and new script are the same") end elseif not find(newscript,scriptpath) then - if trace_verbose then + if trace_locating then logs.report("fileio","new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then - if trace_verbose then + if trace_locating then logs.report("fileio","invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then - if trace_verbose then + if trace_locating then logs.report("fileio","old script content replaced by new content") end io.savedata(oldscript,newdata) break - elseif trace_verbose then + elseif trace_locating then logs.report("fileio","unable to load new script") end end diff --git a/tex/context/base/data-con.lua b/tex/context/base/data-con.lua index d35bc7ab1..f06dba5b5 100644 --- a/tex/context/base/data-con.lua +++ b/tex/context/base/data-con.lua @@ -11,8 +11,6 @@ local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) local trace_containers = false trackers.register("resolvers.containers", function(v) trace_containers = v end) local trace_storage = false trackers.register("resolvers.storage", function(v) trace_storage = v end) -local trace_verbose = false trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v trackers.enable("resolvers.verbose") end) --[[ldx-- <p>Once we found ourselves defining similar cache constructs diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 1cb0b2dd9..3fc36dab2 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -37,11 +37,11 @@ local format, gsub, find, lower, upper, match, gmatch = string.format, string.gs local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys local next, type = next, type -local trace_locating, trace_detail, trace_verbose = false, false, false +local trace_locating, trace_detail, trace_expansions = false, false, false -trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -trackers.register("resolvers.locating", function(v) trace_locating = v trackers.enable("resolvers.verbose") end) -trackers.register("resolvers.detail", function(v) trace_detail = v trackers.enable("resolvers.verbose,resolvers.detail") end) +trackers.register("resolvers.locating", function(v) trace_locating = v end) +trackers.register("resolvers.details", function(v) trace_detail = v end) +trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo if not resolvers then resolvers = { @@ -350,37 +350,43 @@ end -- work that well; the parsing is ok, but dealing with the resulting -- table is a pain because we need to work inside-out recursively +local function do_first(a,b) + local t = { } + for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end + return "{" .. concat(t,",") .. "}" +end + +local function do_second(a,b) + local t = { } + for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end + return "{" .. concat(t,",") .. "}" +end + +local function do_both(a,b) + local t = { } + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + t[#t+1] = sa .. sb + end + end + return "{" .. concat(t,",") .. "}" +end + +local function do_three(a,b,c) + return a .. b.. c +end + local function splitpathexpr(str, t, validate) -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub; we could move - -- the local functions outside the body + -- few times, we can use lpeg for the sub + if trace_expansion then + logs.report("fileio","expanding variable '%s'",str) + end t = t or { } str = gsub(str,",}",",@}") str = gsub(str,"{,","{@,") -- str = "@" .. str .. "@" local ok, done - local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" - end - local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" - end - local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" - end - local function do_three(a,b,c) - return a .. b.. c - end while true do done = false while true do @@ -411,6 +417,11 @@ local function splitpathexpr(str, t, validate) t[#t+1] = s end end + if trace_expansions then + for k,v in ipairs(t) do + logs.report("fileio","% 4i: %s",k,v) + end + end return t end @@ -473,14 +484,14 @@ function resolvers.getownpath() local olddir = lfs.currentdir() if lfs.chdir(p) then local pp = lfs.currentdir() - if trace_verbose and p ~= pp then - logs.report("fileio","following symlink %s to %s",p,pp) + if trace_locating and p ~= pp then + logs.report("fileio","following symlink '%s' to '%s'",p,pp) end resolvers.ownpath = pp lfs.chdir(olddir) else - if trace_verbose then - logs.report("fileio","unable to check path %s",p) + if trace_locating then + logs.report("fileio","unable to check path '%s'",p) end resolvers.ownpath = p end @@ -509,10 +520,10 @@ local function identify_own() if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_verbose then + if trace_locating then for i=1,#own_places do local v = own_places[i] - logs.report("fileio","variable %s set to %s",v,resolvers.env(v) or "unknown") + logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") end end identify_own = function() end @@ -544,10 +555,8 @@ end local function load_cnf_file(fname) fname = resolvers.clean_path(fname) local lname = file.replacesuffix(fname,'lua') - local f = io.open(lname) - if f then -- this will go - f:close() - local dname = file.dirname(fname) + if lfs.isfile(lname) then + local dname = file.dirname(fname) -- fname ? if not instance.configuration[dname] then resolvers.load_data(dname,'configuration',lname and file.basename(lname)) instance.order[#instance.order+1] = instance.configuration[dname] @@ -555,8 +564,8 @@ local function load_cnf_file(fname) else f = io.open(fname) if f then - if trace_verbose then - logs.report("fileio","loading %s", fname) + if trace_locating then + logs.report("fileio","loading configuration file %s", fname) end local line, data, n, k, v local dname = file.dirname(fname) @@ -590,8 +599,8 @@ local function load_cnf_file(fname) end end f:close() - elseif trace_verbose then - logs.report("fileio","skipping %s", fname) + elseif trace_locating then + logs.report("fileio","skipping configuration file '%s'", fname) end end end @@ -618,8 +627,11 @@ function resolvers.load_cnf() end end -- instance.cnffiles contain complete names now ! + -- we still use a funny mix of cnf and new but soon + -- we will switch to lua exclusively as we only use + -- the file to collect the tree roots if #instance.cnffiles == 0 then - if trace_verbose then + if trace_locating then logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") end else @@ -686,14 +698,14 @@ end function resolvers.append_hash(type,tag,name) if trace_locating then - logs.report("fileio","= hash append: %s",tag) + logs.report("fileio","hash '%s' appended",tag) end insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) end function resolvers.prepend_hash(type,tag,name) if trace_locating then - logs.report("fileio","= hash prepend: %s",tag) + logs.report("fileio","hash '%s' prepended",tag) end insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) end @@ -718,8 +730,8 @@ end function resolvers.locatelists() for _, path in ipairs(resolvers.clean_path_list('TEXMF')) do - if trace_verbose then - logs.report("fileio","locating list of %s",path) + if trace_locating then + logs.report("fileio","locating list of '%s'",path) end resolvers.locatedatabase(file.collapse_path(path)) end @@ -732,11 +744,11 @@ end function resolvers.locators.tex(specification) if specification and specification ~= '' and lfs.isdir(specification) then if trace_locating then - logs.report("fileio",'! tex locator found: %s',specification) + logs.report("fileio","tex locator '%s' found",specification) end resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio",'? tex locator not found: %s',specification) + logs.report("fileio","tex locator '%s' not found",specification) end end @@ -779,8 +791,8 @@ local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,? function resolvers.generators.tex(specification) local tag = specification - if trace_verbose then - logs.report("fileio","scanning path %s",specification) + if trace_locating then + logs.report("fileio","scanning path '%s'",specification) end instance.files[tag] = { } local files = instance.files[tag] @@ -829,7 +841,7 @@ function resolvers.generators.tex(specification) end end action() - if trace_verbose then + if trace_locating then logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) end end @@ -859,7 +871,12 @@ local function split_kpse_path(str) -- beware, this can be either a path or a {s else found = checkedsplit(str,io.pathseparator) end - -- print(table.serialize(found)) + if trace_expansions then + logs.report("fileio","splitting path specification '%s'",str) + for k,v in ipairs(found) do + logs.report("fileio","% 4i: %s",k,v) + end + end cache[str] = found end return found @@ -889,6 +906,7 @@ function resolvers.joinconfig() end end end + function resolvers.split_path(str) if type(str) == 'table' then return str @@ -896,6 +914,7 @@ function resolvers.split_path(str) return split_kpse_path(str) end end + function resolvers.join_path(str) if type(str) == 'table' then return file.join_path(str) @@ -984,12 +1003,18 @@ function resolvers.serialize(files) return concat(t,"\n") end +local data_state = { } + +function resolvers.data_state() + return data_state or { } +end + function resolvers.save_data(dataname, makename) -- untested without cache overload for cachename, files in next, instance[dataname] do local name = (makename or file.join)(cachename,dataname) local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_verbose then - logs.report("fileio","preparing %s for %s",dataname,cachename) + if trace_locating then + logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) end for k, v in next, files do if type(v) == "table" and #v == 1 then @@ -1003,24 +1028,25 @@ function resolvers.save_data(dataname, makename) -- untested without cache overl date = os.date("%Y-%m-%d"), time = os.date("%H:%M:%S"), content = files, + uuid = os.uuid(), } local ok = io.savedata(luaname,resolvers.serialize(data)) if ok then - if trace_verbose then - logs.report("fileio","%s saved in %s",dataname,luaname) + if trace_locating then + logs.report("fileio","'%s' saved in '%s'",dataname,luaname) end if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_verbose then - logs.report("fileio","%s compiled to %s",dataname,lucname) + if trace_locating then + logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) end else - if trace_verbose then - logs.report("fileio","compiling failed for %s, deleting file %s",dataname,lucname) + if trace_locating then + logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) end os.remove(lucname) end - elseif trace_verbose then - logs.report("fileio","unable to save %s in %s (access error)",dataname,luaname) + elseif trace_locating then + logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) end end end @@ -1032,19 +1058,20 @@ function resolvers.load_data(pathname,dataname,filename,makename) -- untested wi if blob then local data = blob() if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - if trace_verbose then - logs.report("fileio","loading %s for %s from %s",dataname,pathname,filename) + data_state[#data_state+1] = data.uuid + if trace_locating then + logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) end instance[dataname][pathname] = data.content else - if trace_verbose then - logs.report("fileio","skipping %s for %s from %s",dataname,pathname,filename) + if trace_locating then + logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) end instance[dataname][pathname] = { } instance.loaderror = true end - elseif trace_verbose then - logs.report("fileio","skipping %s for %s from %s",dataname,pathname,filename) + elseif trace_locating then + logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) end end @@ -1070,8 +1097,8 @@ function resolvers.loadnewconfig() if blob then local data = blob() if data then - if trace_verbose then - logs.report("fileio","loading configuration file %s",filename) + if trace_locating then + logs.report("fileio","loading configuration file '%s'",filename) end if true then -- flatten to variable.progname @@ -1092,14 +1119,14 @@ function resolvers.loadnewconfig() instance['setup'][pathname] = data end else - if trace_verbose then - logs.report("fileio","skipping configuration file %s",filename) + if trace_locating then + logs.report("fileio","skipping configuration file '%s'",filename) end instance['setup'][pathname] = { } instance.loaderror = true end - elseif trace_verbose then - logs.report("fileio","skipping configuration file %s",filename) + elseif trace_locating then + logs.report("fileio","skipping configuration file '%s'",filename) end instance.order[#instance.order+1] = instance.setup[pathname] if instance.loaderror then break end @@ -1365,9 +1392,9 @@ function resolvers.isreadable.file(name) local readable = lfs.isfile(name) -- brrr if trace_detail then if readable then - logs.report("fileio","+ readable: %s",name) + logs.report("fileio","file '%s' is readable",name) else - logs.report("fileio","- readable: %s", name) + logs.report("fileio","file '%s' is not readable", name) end end return readable @@ -1383,7 +1410,7 @@ local function collect_files(names) for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","? blobpath asked: %s",fname) + logs.report("fileio","using blobpath '%s'",fname) end local bname = file.basename(fname) local dname = file.dirname(fname) @@ -1399,7 +1426,7 @@ local function collect_files(names) local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio",'? blobpath do: %s (%s)',blobpath,bname) + logs.report("fileio","processing blobpath '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -1433,7 +1460,7 @@ local function collect_files(names) end end elseif trace_locating then - logs.report("fileio",'! blobpath no: %s (%s)',blobpath,bname) + logs.report("fileio","no blobpath '%s' (%s)",blobpath,bname) end end end @@ -1490,7 +1517,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format if instance.found[stamp] then if trace_locating then - logs.report("fileio",'! remembered: %s',filename) + logs.report("fileio","remembering file '%s'",filename) end return instance.found[stamp] end @@ -1498,7 +1525,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not dangerous[instance.format or "?"] then if resolvers.isreadable.file(filename) then if trace_detail then - logs.report("fileio",'= found directly: %s',filename) + logs.report("fileio","file '%s' found directly",filename) end instance.found[stamp] = { filename } return { filename } @@ -1506,13 +1533,13 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end if find(filename,'%*') then if trace_locating then - logs.report("fileio",'! wildcard: %s', filename) + logs.report("fileio","checking wildcard '%s'", filename) end result = resolvers.find_wildcard_files(filename) elseif file.is_qualified_path(filename) then if resolvers.isreadable.file(filename) then if trace_locating then - logs.report("fileio",'! qualified: %s', filename) + logs.report("fileio","qualified name '%s'", filename) end result = { filename } else @@ -1522,7 +1549,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan forcedname = filename .. ".tex" if resolvers.isreadable.file(forcedname) then if trace_locating then - logs.report("fileio",'! no suffix, forcing standard filetype: tex') + logs.report("fileio","no suffix, forcing standard filetype 'tex'") end result, ok = { forcedname }, true end @@ -1532,7 +1559,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan forcedname = filename .. "." .. s if resolvers.isreadable.file(forcedname) then if trace_locating then - logs.report("fileio",'! no suffix, forcing format filetype: %s', s) + logs.report("fileio","no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -1582,7 +1609,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio",'? qualified: %s', filename) + logs.report("fileio","qualified name '%s'", filename) end end else @@ -1601,12 +1628,12 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan wantedfiles[#wantedfiles+1] = forcedname filetype = resolvers.format_of_suffix(forcedname) if trace_locating then - logs.report("fileio",'! forcing filetype: %s',filetype) + logs.report("fileio","forcing filetype '%s'",filetype) end else filetype = resolvers.format_of_suffix(filename) if trace_locating then - logs.report("fileio",'! using suffix based filetype: %s',filetype) + logs.report("fileio","using suffix based filetype '%s'",filetype) end end else @@ -1618,7 +1645,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end filetype = instance.format if trace_locating then - logs.report("fileio",'! using given filetype: %s',filetype) + logs.report("fileio","using given filetype '%s'",filetype) end end local typespec = resolvers.variable_of_format(filetype) @@ -1626,9 +1653,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio",'? filename: %s',filename) - logs.report("fileio",'? filetype: %s',filetype or '?') - logs.report("fileio",'? wanted files: %s',concat(wantedfiles," | ")) + logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] @@ -1651,7 +1676,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local doscan, recurse if trace_detail then - logs.report("fileio",'? filename: %s',filename) + logs.report("fileio","checking filename '%s'",filename) end -- a bit messy ... esp the doscan setting here for k=1,#pathlist do @@ -1672,7 +1697,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local f = fl[2] if find(f,expr) then if trace_detail then - logs.report("fileio",'= found in hash: %s',f) + logs.report("fileio","file '%s' found in hash",f) end --- todo, test for readable result[#result+1] = fl[3] @@ -1694,7 +1719,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local fname = file.join(ppname,w) if resolvers.isreadable.file(fname) then if trace_detail then - logs.report("fileio",'= found by scanning: %s',fname) + logs.report("fileio","found '%s' by scanning",fname) end result[#result+1] = fname done = true @@ -1867,9 +1892,9 @@ function resolvers.load(option) statistics.starttiming(instance) resolvers.resetconfig() resolvers.identify_cnf() - resolvers.load_lua() + resolvers.load_lua() -- will become the new method resolvers.expand_variables() - resolvers.load_cnf() + resolvers.load_cnf() -- will be skipped when we have a lua file resolvers.expand_variables() if option ~= "nofiles" then resolvers.load_hash() @@ -1881,14 +1906,14 @@ end function resolvers.for_files(command, files, filetype, mustexist) if files and #files > 0 then local function report(str) - if trace_verbose then + if trace_locating then logs.report("fileio",str) -- has already verbose else print(str) end end - if trace_verbose then - report('') + if trace_locating then + report('') -- ? end for _, file in ipairs(files) do local result = command(file,filetype,mustexist) @@ -1954,7 +1979,7 @@ function resolvers.methodhandler(what, filename, filetype) -- ... local scheme = specification.scheme if resolvers[what][scheme] then if trace_locating then - logs.report("fileio",'= handler: %s -> %s -> %s',specification.original,what,table.sequenced(specification)) + logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) end return resolvers[what][scheme](filename,filetype) -- todo: specification else diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 6407fea49..e0f6c8019 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -21,12 +21,12 @@ function finders.generic(tag,filename,filetype) local foundname = resolvers.find_file(filename,filetype) if foundname and foundname ~= "" then if trace_locating then - logs.report("fileio",'+ finder: %s, file: %s', tag,filename) + logs.report("fileio","%s finder: file '%s' found",tag,filename) end return foundname else if trace_locating then - logs.report("fileio",'- finder: %s, file: %s', tag,filename) + logs.report("fileio","%s finder: unknown file '%s'",tag,filename) end return unpack(finders.notfound) end @@ -47,7 +47,7 @@ function openers.text_opener(filename,file_handle,tag) local t = { } if u > 0 then if trace_locating then - logs.report("fileio",'+ opener: %s (%s), file: %s',tag,unicode.utfname[u],filename) + logs.report("fileio","%s opener, file '%s' opened using method '%s'",tag,filename,unicode.utfname[u]) end local l if u > 2 then @@ -64,7 +64,7 @@ function openers.text_opener(filename,file_handle,tag) noflines = #l, close = function() if trace_locating then - logs.report("fileio",'= closer: %s (%s), file: %s',tag,unicode.utfname[u],filename) + logs.report("fileio","%s closer, file '%s' closed",tag,filename) end logs.show_close(filename) t = nil @@ -99,7 +99,7 @@ function openers.text_opener(filename,file_handle,tag) } else if trace_locating then - logs.report("fileio",'+ opener: %s, file: %s',tag,filename) + logs.report("fileio","%s opener, file '%s' opened",tag,filename) end -- todo: file;name -> freeze / eerste regel scannen -> freeze --~ local data = getlines:match(file_handle:read("*a")) @@ -129,12 +129,12 @@ function openers.text_opener(filename,file_handle,tag) end, close = function() if trace_locating then - logs.report("fileio",'= closer: %s, file: %s',tag,filename) + logs.report("fileio","%s closer, file '%s' closed",tag,filename) end logs.show_close(filename) file_handle:close() t = nil -collectgarbage("step") + collectgarbage("step") -- saves some memory end, handle = function() return file_handle @@ -152,12 +152,15 @@ function openers.generic(tag,filename) if filename and filename ~= "" then local f = io.open(filename,"r") if f then - logs.show_open(filename) + logs.show_open(filename) -- todo + if trace_locating then + logs.report("fileio","%s opener, file '%s' opened",tag,filename) + end return openers.text_opener(filename,f,tag) end end if trace_locating then - logs.report("fileio",'- opener: %s, file: %s',tag,filename) + logs.report("fileio","%s opener, file '%s' not found",tag,filename) end return unpack(openers.notfound) end @@ -168,7 +171,7 @@ function loaders.generic(tag,filename) if f then logs.show_load(filename) if trace_locating then - logs.report("fileio",'+ loader: %s, file: %s',tag,filename) + logs.report("fileio","%s loader, file '%s' loaded",tag,filename) end local s = f:read("*a") if garbagecollector and garbagecollector.check then garbagecollector.check(#s) end @@ -179,7 +182,7 @@ function loaders.generic(tag,filename) end end if trace_locating then - logs.report("fileio",'- loader: %s, file: %s',tag,filename) + logs.report("fileio","%s loader, file '%s' not found",tag,filename) end return unpack(loaders.notfound) end diff --git a/tex/context/base/data-use.lua b/tex/context/base/data-use.lua index a88f55c18..4e5aa553c 100644 --- a/tex/context/base/data-use.lua +++ b/tex/context/base/data-use.lua @@ -8,8 +8,7 @@ if not modules then modules = { } end modules ['data-use'] = { local format, lower, gsub = string.format, string.lower, string.gsub -local trace_verbose = false trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v trackers.enable("resolvers.verbose") end) +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -- since we want to use the cache instead of the tree, we will now -- reimplement the saver. diff --git a/tex/context/base/data-zip.lua b/tex/context/base/data-zip.lua index 97022c7d8..16d56ce8b 100644 --- a/tex/context/base/data-zip.lua +++ b/tex/context/base/data-zip.lua @@ -8,10 +8,13 @@ if not modules then modules = { } end modules ['data-zip'] = { local format, find = string.format, string.find -local trace_locating, trace_verbose = false, false +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -trackers.register("resolvers.locating", function(v) trace_locating = v trace_verbose = v end) +-- zip:///oeps.zip?name=bla/bla.tex +-- zip:///oeps.zip?tree=tex/texmf-local +-- zip:///texmf.zip?tree=/tex/texmf +-- zip:///texmf.zip?tree=/tex/texmf-local +-- zip:///texmf-mine.zip?tree=/tex/texmf-projects zip = zip or { } zip.archives = zip.archives or { } @@ -22,9 +25,6 @@ local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, local archives = zip.archives --- zip:///oeps.zip?name=bla/bla.tex --- zip:///oeps.zip?tree=tex/texmf-local - local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then return "zip:///" .. str @@ -54,26 +54,22 @@ function zip.closearchive(name) end end --- zip:///texmf.zip?tree=/tex/texmf --- zip:///texmf.zip?tree=/tex/texmf-local --- zip:///texmf-mine.zip?tree=/tex/texmf-projects - function locators.zip(specification) -- where is this used? startup zips (untested) specification = resolvers.splitmethod(specification) local zipfile = specification.path local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree if trace_locating then if zfile then - logs.report("fileio",'! zip locator, found: %s',specification.original) + logs.report("fileio","zip locator, archive '%s' found",specification.original) else - logs.report("fileio",'? zip locator, not found: %s',specification.original) + logs.report("fileio","zip locator, archive '%s' not found",specification.original) end end end function hashers.zip(tag,name) - if trace_verbose then - logs.report("fileio","loading zip file %s as %s",name,tag) + if trace_locating then + logs.report("fileio","loading zip file '%s' as '%s'",name,tag) end resolvers.usezipfile(format("%s?tree=%s",tag,name)) end @@ -98,23 +94,25 @@ function finders.zip(specification,filetype) local zfile = zip.openarchive(specification.path) if zfile then if trace_locating then - logs.report("fileio",'! zip finder, path: %s',specification.path) + logs.report("fileio","zip finder, archive '%s' found",specification.path) end local dfile = zfile:open(q.name) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio",'+ zip finder, name: %s',q.name) + logs.report("fileio","zip finder, file '%s' found",q.name) end return specification.original + elseif trace_locating then + logs.report("fileio","zip finder, file '%s' not found",q.name) end elseif trace_locating then - logs.report("fileio",'? zip finder, path %s',specification.path) + logs.report("fileio","zip finder, unknown archive '%s'",specification.path) end end end if trace_locating then - logs.report("fileio",'- zip finder, name: %s',filename) + logs.report("fileio","zip finder, '%s' not found",filename) end return unpack(finders.notfound) end @@ -127,20 +125,25 @@ function openers.zip(specification) local zfile = zip.openarchive(zipspecification.path) if zfile then if trace_locating then - logs.report("fileio",'+ zip starter, path: %s',zipspecification.path) + logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) end local dfile = zfile:open(q.name) if dfile then logs.show_open(specification) + if trace_locating then + logs.report("fileio","zip opener, file '%s' found",q.name) + end return openers.text_opener(specification,dfile,'zip') + elseif trace_locating then + logs.report("fileio","zip opener, file '%s' not found",q.name) end elseif trace_locating then - logs.report("fileio",'- zip starter, path %s',zipspecification.path) + logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) end end end if trace_locating then - logs.report("fileio",'- zip opener, name: %s',filename) + logs.report("fileio","zip opener, '%s' not found",filename) end return unpack(openers.notfound) end @@ -153,25 +156,27 @@ function loaders.zip(specification) local zfile = zip.openarchive(specification.path) if zfile then if trace_locating then - logs.report("fileio",'+ zip starter, path: %s',specification.path) + logs.report("fileio","zip loader, archive '%s' opened",specification.path) end local dfile = zfile:open(q.name) if dfile then logs.show_load(filename) if trace_locating then - logs.report("fileio",'+ zip loader, name: %s',filename) + logs.report("fileio","zip loader, file '%s' loaded",filename) end local s = dfile:read("*all") dfile:close() return true, s, #s + elseif trace_locating then + logs.report("fileio","zip loader, file '%s' not found",q.name) end elseif trace_locating then - logs.report("fileio",'- zip starter, path: %s',specification.path) + logs.report("fileio","zip loader, unknown archive '%s'",specification.path) end end end if trace_locating then - logs.report("fileio",'- zip loader, name: %s',filename) + logs.report("fileio","zip loader, '%s' not found",filename) end return unpack(openers.notfound) end @@ -181,21 +186,15 @@ end function resolvers.usezipfile(zipname) zipname = validzip(zipname) - if trace_locating then - logs.report("fileio",'! zip use, file: %s',zipname) - end local specification = resolvers.splitmethod(zipname) local zipfile = specification.path if zipfile and not zip.registeredfiles[zipname] then local tree = url.query(specification.query).tree or "" - if trace_locating then - logs.report("fileio",'! zip register, file: %s',zipname) - end local z = zip.openarchive(zipfile) if z then local instance = resolvers.instance if trace_locating then - logs.report("fileio","= zipfile, registering: %s",zipname) + logs.report("fileio","zip registering, registering archive '%s'",zipname) end statistics.starttiming(instance) resolvers.prepend_hash('zip',zipname,zipfile) @@ -204,10 +203,10 @@ function resolvers.usezipfile(zipname) instance.files[zipname] = resolvers.register_zip_file(z,tree or "") statistics.stoptiming(instance) elseif trace_locating then - logs.report("fileio","? zipfile, unknown: %s",zipname) + logs.report("fileio","zip registering, unknown archive '%s'",zipname) end elseif trace_locating then - logs.report("fileio",'! zip register, no file: %s',zipname) + logs.report("fileio","zip registering, '%s' not found",zipname) end end @@ -219,7 +218,7 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio",'= zip filter: %s',filter) + logs.report("fileio","zip registering, using filter '%s'",filter) end local register, n = resolvers.register_file, 0 for i in z:files() do @@ -236,6 +235,6 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio",'= zip entries: %s',n) + logs.report("fileio","zip registering, %s files registered",n) return files end diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index c6168e030..66d3b8e78 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -9,6 +9,9 @@ if not modules then modules = { } end modules ['font-ext'] = { local next, type, byte = next, type, string.byte local gmatch = string.gmatch +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) + --[[ldx-- <p>When we implement functions that deal with features, most of them will depend of the font format. Here we define the few that are kind @@ -237,12 +240,11 @@ function initializers.common.expansion(tfmdata,value) if class then local vector = vectors[class.vector] if vector then - tfmdata.stretch = (class.stretch or 0) * 10 - tfmdata.shrink = (class.shrink or 0) * 10 - tfmdata.step = (class.step or 0) * 10 - local factor = class.factor or 1 ---~ logs.report("fonts","define expansion %s, vector: %s, stretch: %s, shrink: %s, step: %s, factor: %s",value,class.vector,tfmdata.stretch,tfmdata.shrink,tfmdata.step,factor) - tfmdata.auto_expand = true + 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 + logs.report("fonts","set expansion 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 local data = characters.data for i, chr in next, tfmdata.characters do local v = vector[i] @@ -265,7 +267,11 @@ function initializers.common.expansion(tfmdata,value) chr.expansion_factor = factor end end + elseif trace_expansion then + logs.report("fonts","unknown expansion vector '%s' in class '%s",class.vector,value) end + elseif trace_expansion then + logs.report("fonts","unknown expansion class '%s'",value) end end end @@ -399,13 +405,15 @@ vectors['quality'] = table.merge( {}, function initializers.common.protrusion(tfmdata,value) if value then local class = classes[value] ---~ logs.report("fonts","define protrusion %s",table.serialize(class)) if class then local vector = vectors[class.vector] if vector then local factor = class.factor or 1 local left = class.left or 1 local right = class.right or 1 + if trace_protrusion then + logs.report("fonts","set protrusion class %s, vector: %s, factor: %s, left: %s, right: %s",value,class.vector,factor.left,right) + end local data = characters.data local emwidth = tfmdata.parameters.quad tfmdata.auto_protrude = true @@ -434,7 +442,11 @@ function initializers.common.protrusion(tfmdata,value) if pl and pl ~= 0 then chr.left_protruding = left *pl*factor end if pr and pr ~= 0 then chr.right_protruding = right*pr*factor end end + elseif trace_protrusion then + logs.report("fonts","unknown protrusion vector '%s' in class '%s",class.vector,value) end + elseif trace_protrusion then + logs.report("fonts","unknown protrusion class '%s'",value) end end end diff --git a/tex/context/base/luat-env.lua b/tex/context/base/luat-env.lua index 9f395e862..43e3c272e 100644 --- a/tex/context/base/luat-env.lua +++ b/tex/context/base/luat-env.lua @@ -12,8 +12,7 @@ if not modules then modules = { } end modules ['luat-env'] = { -- evolved before bytecode arrays were available and so a lot of -- code has disappeared already. -local trace_verbose = false trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v trackers.enable("resolvers.verbose") end) +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) local format = string.format @@ -204,12 +203,12 @@ function environment.luafilechunk(filename) -- used for loading lua bytecode in filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then - if trace_verbose then + if trace_locating then logs.report("fileio","loading file %s", fullname) end return environment.loadedluacode(fullname) else - if trace_verbose then + if trace_locating then logs.report("fileio","unknown file %s", filename) end return nil @@ -229,7 +228,7 @@ function environment.loadluafile(filename, version) -- when not overloaded by explicit suffix we look for a luc file first local fullname = (lucname and environment.luafile(lucname)) or "" if fullname ~= "" then - if trace_verbose then + if trace_locating then logs.report("fileio","loading %s", fullname) end chunk = loadfile(fullname) -- this way we don't need a file exists check @@ -247,7 +246,7 @@ function environment.loadluafile(filename, version) if v == version then return true else - if trace_verbose then + if trace_locating then logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) end environment.loadluafile(filename) @@ -258,12 +257,12 @@ function environment.loadluafile(filename, version) end fullname = (luaname and environment.luafile(luaname)) or "" if fullname ~= "" then - if trace_verbose then + if trace_locating then logs.report("fileio","loading %s", fullname) end chunk = loadfile(fullname) -- this way we don't need a file exists check if not chunk then - if verbose then + if trace_locating then logs.report("fileio","unknown file %s", filename) end else diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 8600fd8f3..9105ce00a 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -610,6 +610,7 @@ \definesystemvariable {ui} % UItvoer \definesystemvariable {ur} % URl \definesystemvariable {up} % Utility Program +\definesystemvariable {va} % VspAce \definesystemvariable {ve} % VErsie \definesystemvariable {vn} % VoetNoten \definesystemvariable {vs} % VSpacing diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 5aca501be..b6594476a 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1731,7 +1731,41 @@ \let\defineblank \definevspacing \let\defineblankmethod\definevspacingamount -% moved from page-lin +%D The following command is for Wolfgang. It has to be used with +%D care as it does {\em not} work in tandem with the other spacing +%D commands. + +\def\definevspace + {\dotripleempty\dodefinevspace} + +\def\dodefinevspace[#1][#2][#3]% + {\ifthirdargument + \setvalue{\??va#1:#2}{#3}% + \else + \setvalue{\??va:#1}{#2}% + \fi} + +\unexpanded\def\vspace + {\dodoubleempty\dovspace} + +\def\dovspace[#1][#2]% + {\ifsecondargument + \dodovspace[#1][#2]% + \else\iffirstargument + \vspace[][#1]% + \else + \vspace[][\s!default]% + \fi\fi} + +\def\dodovspace[#1][#2]% + {\par + \ifvmode + \removelastskip + \vskip\vspaceamount{#1}{#2}\relax + \fi} + +\def\vspaceamount#1#2% + {\executeifdefined{\??va#1:#2}{\executeifdefined{\??va:#2}\zeropoint}} %D When spacing is active we need to handle commands in %D a special way: diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index ddcea55ef..2db6278ec 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -207,7 +207,7 @@ end function logs.setprogram(_name_,_banner_,_verbose_) name, banner = _name_, _banner_ if _verbose_ then - trackers.enable("resolvers.verbose") + trackers.enable("resolvers.locating") end logs.set_method("tex") logs.report = report -- also used in libraries @@ -220,9 +220,9 @@ end function logs.setverbose(what) if what then - trackers.enable("resolvers.verbose") + trackers.enable("resolvers.locating") else - trackers.disable("resolvers.verbose") + trackers.disable("resolvers.locating") end logs.verbose = what or false end diff --git a/tex/context/base/trac-tra.lua b/tex/context/base/trac-tra.lua index 3a8f14074..e4cbd1e01 100644 --- a/tex/context/base/trac-tra.lua +++ b/tex/context/base/trac-tra.lua @@ -288,89 +288,3 @@ function directives.disable(...) commands.writestatus("directives","disabling: %s",concat({...}," ")) d(...) end - ---~ -- old code: --- ---~ trackers = trackers or { } ---~ local data, done = { }, { } ---~ local function set(what,value) ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end ---~ local function reset() ---~ for d, f in next, data do ---~ for i=1,#f do ---~ f[i](false) ---~ end ---~ end ---~ end ---~ local function enable(what) ---~ set(what,true) ---~ end ---~ local function disable(what) ---~ if not what or what == "" then ---~ done = { } ---~ reset() ---~ else ---~ set(what,false) ---~ end ---~ end ---~ function trackers.register(what,...) ---~ what = lower(what) ---~ local w = data[what] ---~ if not w then ---~ w = { } ---~ data[what] = w ---~ end ---~ for _, fnc in next, { ... } do ---~ local typ = type(fnc) ---~ if typ == "function" then ---~ w[#w+1] = fnc ---~ elseif typ == "string" then ---~ w[#w+1] = function(value) set(fnc,value,nesting) end ---~ end ---~ end ---~ end ---~ function trackers.enable(what) ---~ local e = trackers.enable ---~ trackers.enable, done = enable, { } ---~ enable(string.simpleesc(what)) ---~ trackers.enable, done = e, { } ---~ end ---~ function trackers.disable(what) ---~ local e = trackers.disable ---~ trackers.disable, done = disable, { } ---~ disable(string.simpleesc(what)) ---~ trackers.disable, done = e, { } ---~ end ---~ function trackers.reset() ---~ done = { } ---~ reset() ---~ end ---~ function trackers.list() -- pattern ---~ local list = table.sortedkeys(data) ---~ local user, system = { }, { } ---~ for l=1,#list do ---~ local what = list[l] ---~ if find(what,"^%*") then ---~ system[#system+1] = what ---~ else ---~ user[#user+1] = what ---~ end ---~ end ---~ return user, system ---~ end diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index f18b9f83d..d982247eb 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 11/21/09 11:50:03 +-- merge date : 11/23/09 11:55:47 do -- begin closure to overcome local limits and interference @@ -1948,8 +1948,6 @@ local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) local trace_containers = false trackers.register("resolvers.containers", function(v) trace_containers = v end) local trace_storage = false trackers.register("resolvers.storage", function(v) trace_storage = v end) -local trace_verbose = false trackers.register("resolvers.verbose", function(v) trace_verbose = v end) -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v trackers.enable("resolvers.verbose") end) --[[ldx-- <p>Once we found ourselves defining similar cache constructs |