From ff391d3816591b47893a12b8ccc0eb90f4b70333 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 1 Feb 2011 14:24:00 +0100 Subject: beta 2011.02.01 14:24 --- tex/context/base/core-con.lua | 2 +- tex/context/base/data-res.lua | 45 ++++++++++++++++++-------------------- tex/context/base/l-dir.lua | 28 +++++++++++++----------- tex/context/base/s-inf-01.mkvi | 2 +- tex/context/base/status-files.pdf | Bin 23919 -> 8943 bytes 5 files changed, 38 insertions(+), 39 deletions(-) (limited to 'tex') diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index 318616db4..f6dfad9c9 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -548,7 +548,7 @@ local function convert(method,n) -- todo: language elseif sequence then return do_alphabetic(n,sequence,false,true) else - return context(n) + return n end end end diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 4231997ab..679135c48 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -53,6 +53,8 @@ resolvers.luacnfstate = "unknown" -- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' +--~ -- not yet, some reporters expect strings + --~ resolvers.luacnfspec = { --~ "selfautoparent:/texmf-local", --~ "selfautoparent:/texmf-local/web2c", @@ -146,12 +148,6 @@ end resolvers.getenv = getenv resolvers.env = getenv ---~ local function resolve(key) ---~ local value = instance.variables[key] or "" ---~ return (value ~= "" and value) or getenv(key) or "" ---~ end ---~ - local dollarstripper = lpeg.stripper("$") local inhibitstripper = P("!")^0 * Cs(P(1)^0) local backslashswapper = lpeg.replacer("\\","/") @@ -162,6 +158,11 @@ local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + P(";") * (P(";") / "") + P(1) +--~ local function resolve(key) +--~ local value = instance.variables[key] or "" +--~ return (value ~= "" and value) or getenv(key) or "" +--~ end +--~ --~ local pattern = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) --~ --~ local function expandvars(lst) -- simple vars @@ -350,7 +351,7 @@ local function load_configuration_files() -- we push the value into the main environment (osenv) so -- that it takes precedence over the default one and therefore -- also over following definitions - resolvers.setenv('TEXMFCNF',cnfspec) + resolvers.setenv('TEXMFCNF',resolvers.resolve(cnfspec)) -- we now identify and load the specified configuration files instance.specification = { } identify_configuration_files() @@ -855,8 +856,8 @@ local function collect_files(names) if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then local kind = hash.type ---~ local search = filejoin(blobpath,blobfile,bname) -local search = filejoin(blobroot,blobfile,bname) + -- local search = filejoin(blobpath,blobfile,bname) + 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) @@ -869,8 +870,8 @@ local search = filejoin(blobroot,blobfile,bname) local vv = blobfile[kk] if not dname or find(vv,dname) then local kind = hash.type ---~ local search = filejoin(blobpath,vv,bname) -local search = filejoin(blobroot,vv,bname) + -- local search = filejoin(blobpath,vv,bname) + 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) @@ -895,7 +896,7 @@ function resolvers.registerintrees(name) end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -911,11 +912,11 @@ end local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) +-- this one will be split in smalle functions + local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) local result = { } local stamp = nil ---~ local trace_locating = true ---~ local trace_detail= true askedformat = askedformat or "" filename = collapsepath(filename) -- speed up / beware: format problem @@ -923,7 +924,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - report_resolvers("remembering file '%s'",filename) + report_resolvers("remembered file '%s'",filename) end resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] @@ -986,7 +987,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : -- if basename ~= filename then local resolved = collect_instance_files(basename,askedformat,allresults) - if #result == 0 then + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then resolved = collect_instance_files(lowered,askedformat,allresults) @@ -1019,7 +1020,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, fileextname(filename) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) -- tricky as filename can be bla.1.2.3 --~ if not suffixmap[ext] then --- probably needs to be done elsewhere too --~ wantedfiles[#wantedfiles+1] = filename @@ -1027,11 +1028,7 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : -- to be checked - if ext == "" then - wantedfiles[#wantedfiles+1] = filename - else - wantedfiles[#wantedfiles+1] = filename - end + wantedfiles[#wantedfiles+1] = filename if askedformat == "" then if ext == "" or not suffixmap[ext] then local defaultsuffixes = resolvers.defaultsuffixes @@ -1337,7 +1334,7 @@ local function report(str) end end -function resolvers.dowithfilesandreport(command, files, ...) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then if trace_locating then report('') -- ? @@ -1419,7 +1416,7 @@ function resolvers.booleanvariable(str,default) end end -function resolvers.dowithfilesintree(pattern,handle,before,after) -- can be a nice iterator instead +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead local instance = resolvers.instance local hashes = instance.hashes for i=1,#hashes do diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 2c4ff999b..878698b16 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -59,20 +59,22 @@ end --~ end local function globpattern(path,patt,recurse,action) - if path == "/" then - path = path .. "." - elseif not find(path,"/$") then - path = path .. '/' - end - for name in walkdir(path) do - local full = path .. name - local mode = attributes(full,'mode') - if mode == 'file' then - if find(full,patt) then - action(full) + if isdir(path) then + if path == "/" then + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' + end + for name in walkdir(path) do + local full = path .. name + local mode = attributes(full,'mode') + if mode == 'file' then + if find(full,patt) then + action(full) + end + elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then + globpattern(full,patt,recurse,action) end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - globpattern(full,patt,recurse,action) end end end diff --git a/tex/context/base/s-inf-01.mkvi b/tex/context/base/s-inf-01.mkvi index d32356d69..6a031a2ca 100644 --- a/tex/context/base/s-inf-01.mkvi +++ b/tex/context/base/s-inf-01.mkvi @@ -115,7 +115,7 @@ for k, v in table.sortedpairs(what) do for i=1,5 do if v[i] > max then max = v[i] end end end - return max, what, function(n) return max == 0 and 0 or n/max end + return max, what, function(n) return (max == 0 and 0) or (n == 0 and 0) or n/max end end function document.context_state_1(what) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 9d5df81af..4d63389e4 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ -- cgit v1.2.3