summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-07-09 11:15:05 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-07-09 11:15:05 +0200
commit3ce833aa5de4b2955ef00422bc3d1d77735116d5 (patch)
treeaf6f7a125090e3c9a1802c7fa69215da21cec587 /scripts
parent32a229eb318e40b0fc6368e270b2cf21b8d59549 (diff)
downloadcontext-3ce833aa5de4b2955ef00422bc3d1d77735116d5.tar.gz
2014-07-09 10:28:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-context.lua67
-rw-r--r--scripts/context/lua/mtx-context.xml13
-rw-r--r--scripts/context/lua/mtxrun.lua163
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua163
-rw-r--r--scripts/context/stubs/unix/mtxrun163
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua163
6 files changed, 480 insertions, 252 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 9de6717bf..83030e2e7 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -28,10 +28,12 @@ local fileaddsuffix = file.addsuffix
local filenewsuffix = file.replacesuffix
local removesuffix = file.removesuffix
local validfile = lfs.isfile
+local removefile = os.remove
+local renamefile = os.rename
local application = logs.application {
name = "mtx-context",
- banner = "ConTeXt Process Management 0.60",
+ banner = "ConTeXt Process Management 0.61",
-- helpinfo = helpinfo, -- table with { category_a = text_1, category_b = text_2 } or helpstring or xml_blob
helpinfo = "mtx-context.xml",
}
@@ -279,11 +281,29 @@ local function multipass_changed(oldhash, newhash)
return false
end
-local function multipass_copyluafile(jobname)
+local function multipass_copyluafile(jobname,run)
local tuaname, tucname = jobname..".tua", jobname..".tuc"
if validfile(tuaname) then
- os.remove(tucname)
- os.rename(tuaname,tucname)
+ if run then
+ for i=1,10 do
+ local tmpname = format("%s-tuc-%02d.tmp",jobname,i)
+ if validfile(tmpname) then
+ removefile(tmpname)
+ report("removing %a",tmpname)
+ end
+ end
+ if validfile(tucname) then
+ local tmpname = format("%s-tuc-%02d.tmp",jobname,run or 1)
+ report("copying %a into %a",tucname,tmpname)
+ file.copy(tucname,tmpname)
+ else
+ report("no file %a, nothing kept",filename)
+ end
+ report("copying %a into %a",tuaname,tucname)
+ report()
+ end
+ removefile(tucname)
+ renamefile(tuaname,tucname)
end
end
@@ -348,8 +368,8 @@ local function result_push_purge(oldbase,newbase)
for _, suffix in next, usedsuffixes.after do
local oldname = fileaddsuffix(oldbase,suffix)
local newname = fileaddsuffix(newbase,suffix)
- os.remove(newname)
- os.remove(oldname)
+ removefile(newname)
+ removefile(oldname)
end
end
@@ -358,10 +378,10 @@ local function result_push_keep(oldbase,newbase)
local oldname = fileaddsuffix(oldbase,suffix)
local newname = fileaddsuffix(newbase,suffix)
local tmpname = "keep-"..oldname
- os.remove(tmpname)
- os.rename(oldname,tmpname)
- os.remove(oldname)
- os.rename(newname,oldname)
+ removefile(tmpname)
+ renamefile(oldname,tmpname)
+ removefile(oldname)
+ renamefile(newname,oldname)
end
end
@@ -369,8 +389,8 @@ local function result_save_error(oldbase,newbase)
for _, suffix in next, usedsuffixes.keep do
local oldname = fileaddsuffix(oldbase,suffix)
local newname = fileaddsuffix(newbase,suffix)
- os.remove(newname) -- to be sure
- os.rename(oldname,newname)
+ removefile(newname) -- to be sure
+ renamefile(oldname,newname)
end
end
@@ -378,8 +398,8 @@ local function result_save_purge(oldbase,newbase)
for _, suffix in next, usedsuffixes.after do
local oldname = fileaddsuffix(oldbase,suffix)
local newname = fileaddsuffix(newbase,suffix)
- os.remove(newname) -- to be sure
- os.rename(oldname,newname)
+ removefile(newname) -- to be sure
+ renamefile(oldname,newname)
end
end
@@ -388,9 +408,9 @@ local function result_save_keep(oldbase,newbase)
local oldname = fileaddsuffix(oldbase,suffix)
local newname = fileaddsuffix(newbase,suffix)
local tmpname = "keep-"..oldname
- os.remove(newname)
- os.rename(oldname,newname)
- os.rename(tmpname,oldname)
+ removefile(newname)
+ renamefile(oldname,newname)
+ renamefile(tmpname,oldname)
end
end
@@ -549,6 +569,7 @@ function scripts.context.run(ctxdata,filename)
local a_jiton = getargument("jiton")
local a_jithash = getargument("jithash")
local a_texformat = getargument("texformat")
+ local a_keeptuc = getargument("keeptuc")
--
a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil
a_synctex = check_synctex(a_synctex)
@@ -715,7 +736,7 @@ function scripts.context.run(ctxdata,filename)
os.exit(1)
break
elseif returncode == 0 then
- multipass_copyluafile(jobname)
+ multipass_copyluafile(jobname,a_keeptuc and currentrun)
if not multipass_forcedruns then
newhash = multipass_hashfiles(jobname)
if multipass_changed(oldhash,newhash) then
@@ -852,7 +873,7 @@ function scripts.context.pipe() -- still used?
scripts.context.purge_job(filename)
elseif getargument("purgeall") then
scripts.context.purge_job(filename,true)
- os.remove(filename)
+ removefile(filename)
end
else
if formatname then
@@ -1046,11 +1067,11 @@ local special_runfiles = {
local function purge_file(dfile,cfile)
if cfile and validfile(cfile) then
- if os.remove(dfile) then
+ if removefile(dfile) then
return filebasename(dfile)
end
elseif dfile then
- if os.remove(dfile) then
+ if removefile(dfile) then
return filebasename(dfile)
end
end
@@ -1144,8 +1165,8 @@ local function touch(path,name,versionpattern,kind,kindpattern)
end
if newdata ~= "" and (oldversion ~= newversion or oldkind ~= newkind or newdata ~= olddata) then
local backup = filenewsuffix(name,"tmp")
- os.remove(backup)
- os.rename(name,backup)
+ removefile(backup)
+ renamefile(name,backup)
io.savedata(name,newdata)
return name, oldversion, newversion, oldkind, newkind
end
diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml
index af8d5cc20..009a87740 100644
--- a/scripts/context/lua/mtx-context.xml
+++ b/scripts/context/lua/mtx-context.xml
@@ -152,16 +152,19 @@
<short>update context version number (also provide <ref name="expert"/>, optionally provide <ref name="basepath"/>)</short>
</flag>
<flag name="nostatistics">
- <short>omit runtime statistics at the end of the run</short>
+ <short>omit runtime statistics at the end of the run</short>
</flag>
<flag name="update">
<short>update context from website (not to be confused with contextgarden)</short>
</flag>
- <flag name="profile">
- <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short>
+ <flag name="profile">
+ <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short>
</flag>
- <flag name="timing">
- <short>generate timing and statistics overview</short>
+ <flag name="timing">
+ <short>generate timing and statistics overview</short>
+ </flag>
+ <flag name="keeptuc">
+ <short>keep previous tuc files (numbered by run)</short>
</flag>
</subcategory>
<subcategory>
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 7cf93ce4c..a6353dc67 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -437,7 +437,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 32062, stripped down to: 16772
+-- original size: 32003, stripped down to: 16772
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -4359,7 +4359,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 33706, stripped down to: 14938
+-- original size: 34171, stripped down to: 15086
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
@@ -4375,7 +4375,9 @@ local type=type
local char,byte,format,sub,gmatch=string.char,string.byte,string.format,string.sub,string.gmatch
local concat=table.concat
local P,C,R,Cs,Ct,Cmt,Cc,Carg,Cp=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Ct,lpeg.Cmt,lpeg.Cc,lpeg.Carg,lpeg.Cp
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
+local lpegmatch=lpeg.match
+local patterns=lpeg.patterns
+local tabletopattern=lpeg.utfchartabletopattern
local bytepairs=string.bytepairs
local finder=lpeg.finder
local replacer=lpeg.replacer
@@ -4384,7 +4386,7 @@ local utfgmatch=utf.gmatch
local p_utftype=patterns.utftype
local p_utfstricttype=patterns.utfstricttype
local p_utfoffset=patterns.utfoffset
-local p_utf8char=patterns.utf8char
+local p_utf8char=patterns.utf8character
local p_utf8byte=patterns.utf8byte
local p_utfbom=patterns.utfbom
local p_newline=patterns.newline
@@ -4584,7 +4586,8 @@ if not utf.sub then
end
end
function utf.remapper(mapping)
- local pattern=Cs((p_utf8char/mapping)^0)
+ local pattern=type(mapping)=="table" and tabletopattern(mapping) or p_utf8char
+ local pattern=Cs((pattern/mapping+p_utf8char)^0)
return function(str)
if not str or str=="" then
return ""
@@ -11318,7 +11321,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 25374, stripped down to: 17841
+-- original size: 25139, stripped down to: 17839
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -11655,7 +11658,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
if name then break end
end
end
- local data=(name and name~="" and loaddata(name)) or ""
+ local data=name and name~="" and loaddata(name) or ""
if data=="" then
epdt[ek.ni]=""
elseif ekat["parse"]=="text" then
@@ -13207,7 +13210,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 8841, stripped down to: 6546
+-- original size: 8898, stripped down to: 6564
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -13300,7 +13303,7 @@ local relations=allocate {
tex={
names={ "tex" },
variable='TEXINPUTS',
- suffixes={ 'tex',"mkvi","mkiv","mkii" },
+ suffixes={ "tex","mkvi","mkiv","mkii","cld","lfg","xml" },
},
icc={
names={ "icc","icc profile","icc profiles" },
@@ -13976,7 +13979,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 61031, stripped down to: 42613
+-- original size: 61614, stripped down to: 42970
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -14562,42 +14565,44 @@ function resolvers.registerextrapath(paths,subpaths)
instance.lists={}
end
end
-local function made_list(instance,list)
+local function made_list(instance,list,extra_too)
+ if not extra_too then
+ return list
+ end
local ep=instance.extra_paths
if not ep or #ep==0 then
return list
- else
- local done,new,newn={},{},0
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- if find(v,"^[%.%/]$") then
- done[v]=true
- newn=newn+1
- new[newn]=v
- else
- break
- end
- end
- end
- for k=1,#ep do
- local v=ep[k]
- if not done[v] then
+ end
+ local done,new,newn={},{},0
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ if find(v,"^[%.%/]$") then
done[v]=true
newn=newn+1
new[newn]=v
+ else
+ break
end
end
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- done[v]=true
- newn=newn+1
- new[newn]=v
- end
+ end
+ for k=1,#ep do
+ local v=ep[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
+ end
+ end
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
end
- return new
end
+ return new
end
function resolvers.cleanpathlist(str)
local t=resolvers.expandedpathlist(str)
@@ -14611,7 +14616,7 @@ end
function resolvers.expandpath(str)
return joinpath(resolvers.expandedpathlist(str))
end
-function resolvers.expandedpathlist(str)
+function resolvers.expandedpathlist(str,extra_too)
if not str then
return {}
elseif instance.savelists then
@@ -14619,14 +14624,14 @@ function resolvers.expandedpathlist(str)
local lists=instance.lists
local lst=lists[str]
if not lst then
- local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)))
+ local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)),extra_too)
lst=expandedpathfromlist(l)
lists[str]=lst
end
return lst
else
local lst=resolvers.splitpath(resolvers.expansion(str))
- return made_list(instance,expandedpathfromlist(lst))
+ return made_list(instance,expandedpathfromlist(lst),extra_too)
end
end
function resolvers.expandedpathlistfromvariable(str)
@@ -14881,7 +14886,7 @@ local function check_subpath(fname)
end
local function find_intree(filename,filetype,wantedfiles,allresults)
local typespec=resolvers.variableofformat(filetype)
- local pathlist=resolvers.expandedpathlist(typespec)
+ local pathlist=resolvers.expandedpathlist(typespec,filetype=="tex")
local method="intree"
if pathlist and #pathlist>0 then
local filelist=collect_files(wantedfiles)
@@ -14991,6 +14996,17 @@ local function find_intree(filename,filetype,wantedfiles,allresults)
end
else
end
+ else
+ for k=1,#wantedfiles do
+ local fname=methodhandler('finders',pathname.."/"..wantedfiles[k])
+ if fname then
+ result[#result+1]=fname
+ doen=true
+ if not allresults then
+ break
+ end
+ end
+ end
end
end
if done and not allresults then
@@ -16118,7 +16134,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tre"] = package.loaded["data-tre"] or true
--- original size: 6609, stripped down to: 4280
+-- original size: 7874, stripped down to: 5289
if not modules then modules={} end modules ['data-tre']={
version=1.001,
@@ -16129,7 +16145,7 @@ if not modules then modules={} end modules ['data-tre']={
}
local find,gsub,lower=string.find,string.gsub,string.lower
local basename,dirname,joinname=file.basename,file.dirname,file .join
-local globdir,isdir=dir.glob,lfs.isdir
+local globdir,isdir,isfile=dir.glob,lfs.isdir,lfs.isfile
local P,lpegmatch=lpeg.P,lpeg.match
local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
local report_trees=logs.reporter("resolvers","trees")
@@ -16203,7 +16219,25 @@ table.setmetatableindex(collectors,function(t,k)
t[k]=content
return content
end)
-function resolvers.finders.dirlist(specification)
+local function checked(root,p,n)
+ if p then
+ if type(p)=="table" then
+ for i=1,#p do
+ local fullname=joinname(root,p[i],n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ else
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ end
+ return notfound()
+end
+local function resolve(specification)
local filename=specification.filename
if filename~="" then
local root,rest=lpegmatch(splitter,filename)
@@ -16221,39 +16255,56 @@ function resolvers.finders.dirlist(specification)
for i=1,#p do
local pi=p[i]
if pi==path or find(pi,pattern) then
- return joinname(root,pi,n)
+ local fullname=joinname(root,pi,n)
+ if isfile(fullname) then
+ return fullname
+ end
end
end
- else
- if p==path or find(p,pattern) then
- return joinname(root,p,n)
+ elseif p==path or find(p,pattern) then
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
end
end
local queries=specification.queries
if queries and queries.option=="fileonly" then
- return joinname(root,istable and p[1] or p,n)
+ return checked(root,p,n)
+ else
+ return notfound()
end
- return notfound()
end
end
local path,name=dirname(filename),basename(filename)
local root=lpegmatch(stripper,path)
local content=collectors[path]
local p,n=lookup(content,name)
- if not p then
- return notfound()
- elseif type(p)=="table" then
- p=p[1]
+ if p then
+ return checked(root,p,n)
end
- return joinname(root,p,n)
end
return notfound()
end
+resolvers.finders .dirlist=resolve
resolvers.locators .dirlist=resolvers.locators .tree
resolvers.hashers .dirlist=resolvers.hashers .tree
resolvers.generators.dirlist=resolvers.generators.file
resolvers.openers .dirlist=resolvers.openers .file
resolvers.loaders .dirlist=resolvers.loaders .file
+function resolvers.finders.dirfile(specification)
+ local queries=specification.queries
+ if queries then
+ queries.option="fileonly"
+ else
+ specification.queries={ option="fileonly" }
+ end
+ return resolve(specification)
+end
+resolvers.locators .dirfile=resolvers.locators .dirlist
+resolvers.hashers .dirfile=resolvers.hashers .dirlist
+resolvers.generators.dirfile=resolvers.generators.dirlist
+resolvers.openers .dirfile=resolvers.openers .dirlist
+resolvers.loaders .dirfile=resolvers.loaders .dirlist
end -- of closure
@@ -17173,8 +17224,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 706951
--- stripped bytes : 251233
+-- original bytes : 709027
+-- stripped bytes : 251779
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 7cf93ce4c..a6353dc67 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -437,7 +437,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 32062, stripped down to: 16772
+-- original size: 32003, stripped down to: 16772
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -4359,7 +4359,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 33706, stripped down to: 14938
+-- original size: 34171, stripped down to: 15086
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
@@ -4375,7 +4375,9 @@ local type=type
local char,byte,format,sub,gmatch=string.char,string.byte,string.format,string.sub,string.gmatch
local concat=table.concat
local P,C,R,Cs,Ct,Cmt,Cc,Carg,Cp=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Ct,lpeg.Cmt,lpeg.Cc,lpeg.Carg,lpeg.Cp
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
+local lpegmatch=lpeg.match
+local patterns=lpeg.patterns
+local tabletopattern=lpeg.utfchartabletopattern
local bytepairs=string.bytepairs
local finder=lpeg.finder
local replacer=lpeg.replacer
@@ -4384,7 +4386,7 @@ local utfgmatch=utf.gmatch
local p_utftype=patterns.utftype
local p_utfstricttype=patterns.utfstricttype
local p_utfoffset=patterns.utfoffset
-local p_utf8char=patterns.utf8char
+local p_utf8char=patterns.utf8character
local p_utf8byte=patterns.utf8byte
local p_utfbom=patterns.utfbom
local p_newline=patterns.newline
@@ -4584,7 +4586,8 @@ if not utf.sub then
end
end
function utf.remapper(mapping)
- local pattern=Cs((p_utf8char/mapping)^0)
+ local pattern=type(mapping)=="table" and tabletopattern(mapping) or p_utf8char
+ local pattern=Cs((pattern/mapping+p_utf8char)^0)
return function(str)
if not str or str=="" then
return ""
@@ -11318,7 +11321,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 25374, stripped down to: 17841
+-- original size: 25139, stripped down to: 17839
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -11655,7 +11658,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
if name then break end
end
end
- local data=(name and name~="" and loaddata(name)) or ""
+ local data=name and name~="" and loaddata(name) or ""
if data=="" then
epdt[ek.ni]=""
elseif ekat["parse"]=="text" then
@@ -13207,7 +13210,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 8841, stripped down to: 6546
+-- original size: 8898, stripped down to: 6564
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -13300,7 +13303,7 @@ local relations=allocate {
tex={
names={ "tex" },
variable='TEXINPUTS',
- suffixes={ 'tex',"mkvi","mkiv","mkii" },
+ suffixes={ "tex","mkvi","mkiv","mkii","cld","lfg","xml" },
},
icc={
names={ "icc","icc profile","icc profiles" },
@@ -13976,7 +13979,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 61031, stripped down to: 42613
+-- original size: 61614, stripped down to: 42970
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -14562,42 +14565,44 @@ function resolvers.registerextrapath(paths,subpaths)
instance.lists={}
end
end
-local function made_list(instance,list)
+local function made_list(instance,list,extra_too)
+ if not extra_too then
+ return list
+ end
local ep=instance.extra_paths
if not ep or #ep==0 then
return list
- else
- local done,new,newn={},{},0
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- if find(v,"^[%.%/]$") then
- done[v]=true
- newn=newn+1
- new[newn]=v
- else
- break
- end
- end
- end
- for k=1,#ep do
- local v=ep[k]
- if not done[v] then
+ end
+ local done,new,newn={},{},0
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ if find(v,"^[%.%/]$") then
done[v]=true
newn=newn+1
new[newn]=v
+ else
+ break
end
end
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- done[v]=true
- newn=newn+1
- new[newn]=v
- end
+ end
+ for k=1,#ep do
+ local v=ep[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
+ end
+ end
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
end
- return new
end
+ return new
end
function resolvers.cleanpathlist(str)
local t=resolvers.expandedpathlist(str)
@@ -14611,7 +14616,7 @@ end
function resolvers.expandpath(str)
return joinpath(resolvers.expandedpathlist(str))
end
-function resolvers.expandedpathlist(str)
+function resolvers.expandedpathlist(str,extra_too)
if not str then
return {}
elseif instance.savelists then
@@ -14619,14 +14624,14 @@ function resolvers.expandedpathlist(str)
local lists=instance.lists
local lst=lists[str]
if not lst then
- local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)))
+ local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)),extra_too)
lst=expandedpathfromlist(l)
lists[str]=lst
end
return lst
else
local lst=resolvers.splitpath(resolvers.expansion(str))
- return made_list(instance,expandedpathfromlist(lst))
+ return made_list(instance,expandedpathfromlist(lst),extra_too)
end
end
function resolvers.expandedpathlistfromvariable(str)
@@ -14881,7 +14886,7 @@ local function check_subpath(fname)
end
local function find_intree(filename,filetype,wantedfiles,allresults)
local typespec=resolvers.variableofformat(filetype)
- local pathlist=resolvers.expandedpathlist(typespec)
+ local pathlist=resolvers.expandedpathlist(typespec,filetype=="tex")
local method="intree"
if pathlist and #pathlist>0 then
local filelist=collect_files(wantedfiles)
@@ -14991,6 +14996,17 @@ local function find_intree(filename,filetype,wantedfiles,allresults)
end
else
end
+ else
+ for k=1,#wantedfiles do
+ local fname=methodhandler('finders',pathname.."/"..wantedfiles[k])
+ if fname then
+ result[#result+1]=fname
+ doen=true
+ if not allresults then
+ break
+ end
+ end
+ end
end
end
if done and not allresults then
@@ -16118,7 +16134,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tre"] = package.loaded["data-tre"] or true
--- original size: 6609, stripped down to: 4280
+-- original size: 7874, stripped down to: 5289
if not modules then modules={} end modules ['data-tre']={
version=1.001,
@@ -16129,7 +16145,7 @@ if not modules then modules={} end modules ['data-tre']={
}
local find,gsub,lower=string.find,string.gsub,string.lower
local basename,dirname,joinname=file.basename,file.dirname,file .join
-local globdir,isdir=dir.glob,lfs.isdir
+local globdir,isdir,isfile=dir.glob,lfs.isdir,lfs.isfile
local P,lpegmatch=lpeg.P,lpeg.match
local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
local report_trees=logs.reporter("resolvers","trees")
@@ -16203,7 +16219,25 @@ table.setmetatableindex(collectors,function(t,k)
t[k]=content
return content
end)
-function resolvers.finders.dirlist(specification)
+local function checked(root,p,n)
+ if p then
+ if type(p)=="table" then
+ for i=1,#p do
+ local fullname=joinname(root,p[i],n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ else
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ end
+ return notfound()
+end
+local function resolve(specification)
local filename=specification.filename
if filename~="" then
local root,rest=lpegmatch(splitter,filename)
@@ -16221,39 +16255,56 @@ function resolvers.finders.dirlist(specification)
for i=1,#p do
local pi=p[i]
if pi==path or find(pi,pattern) then
- return joinname(root,pi,n)
+ local fullname=joinname(root,pi,n)
+ if isfile(fullname) then
+ return fullname
+ end
end
end
- else
- if p==path or find(p,pattern) then
- return joinname(root,p,n)
+ elseif p==path or find(p,pattern) then
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
end
end
local queries=specification.queries
if queries and queries.option=="fileonly" then
- return joinname(root,istable and p[1] or p,n)
+ return checked(root,p,n)
+ else
+ return notfound()
end
- return notfound()
end
end
local path,name=dirname(filename),basename(filename)
local root=lpegmatch(stripper,path)
local content=collectors[path]
local p,n=lookup(content,name)
- if not p then
- return notfound()
- elseif type(p)=="table" then
- p=p[1]
+ if p then
+ return checked(root,p,n)
end
- return joinname(root,p,n)
end
return notfound()
end
+resolvers.finders .dirlist=resolve
resolvers.locators .dirlist=resolvers.locators .tree
resolvers.hashers .dirlist=resolvers.hashers .tree
resolvers.generators.dirlist=resolvers.generators.file
resolvers.openers .dirlist=resolvers.openers .file
resolvers.loaders .dirlist=resolvers.loaders .file
+function resolvers.finders.dirfile(specification)
+ local queries=specification.queries
+ if queries then
+ queries.option="fileonly"
+ else
+ specification.queries={ option="fileonly" }
+ end
+ return resolve(specification)
+end
+resolvers.locators .dirfile=resolvers.locators .dirlist
+resolvers.hashers .dirfile=resolvers.hashers .dirlist
+resolvers.generators.dirfile=resolvers.generators.dirlist
+resolvers.openers .dirfile=resolvers.openers .dirlist
+resolvers.loaders .dirfile=resolvers.loaders .dirlist
end -- of closure
@@ -17173,8 +17224,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 706951
--- stripped bytes : 251233
+-- original bytes : 709027
+-- stripped bytes : 251779
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 7cf93ce4c..a6353dc67 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -437,7 +437,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 32062, stripped down to: 16772
+-- original size: 32003, stripped down to: 16772
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -4359,7 +4359,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 33706, stripped down to: 14938
+-- original size: 34171, stripped down to: 15086
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
@@ -4375,7 +4375,9 @@ local type=type
local char,byte,format,sub,gmatch=string.char,string.byte,string.format,string.sub,string.gmatch
local concat=table.concat
local P,C,R,Cs,Ct,Cmt,Cc,Carg,Cp=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Ct,lpeg.Cmt,lpeg.Cc,lpeg.Carg,lpeg.Cp
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
+local lpegmatch=lpeg.match
+local patterns=lpeg.patterns
+local tabletopattern=lpeg.utfchartabletopattern
local bytepairs=string.bytepairs
local finder=lpeg.finder
local replacer=lpeg.replacer
@@ -4384,7 +4386,7 @@ local utfgmatch=utf.gmatch
local p_utftype=patterns.utftype
local p_utfstricttype=patterns.utfstricttype
local p_utfoffset=patterns.utfoffset
-local p_utf8char=patterns.utf8char
+local p_utf8char=patterns.utf8character
local p_utf8byte=patterns.utf8byte
local p_utfbom=patterns.utfbom
local p_newline=patterns.newline
@@ -4584,7 +4586,8 @@ if not utf.sub then
end
end
function utf.remapper(mapping)
- local pattern=Cs((p_utf8char/mapping)^0)
+ local pattern=type(mapping)=="table" and tabletopattern(mapping) or p_utf8char
+ local pattern=Cs((pattern/mapping+p_utf8char)^0)
return function(str)
if not str or str=="" then
return ""
@@ -11318,7 +11321,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 25374, stripped down to: 17841
+-- original size: 25139, stripped down to: 17839
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -11655,7 +11658,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
if name then break end
end
end
- local data=(name and name~="" and loaddata(name)) or ""
+ local data=name and name~="" and loaddata(name) or ""
if data=="" then
epdt[ek.ni]=""
elseif ekat["parse"]=="text" then
@@ -13207,7 +13210,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 8841, stripped down to: 6546
+-- original size: 8898, stripped down to: 6564
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -13300,7 +13303,7 @@ local relations=allocate {
tex={
names={ "tex" },
variable='TEXINPUTS',
- suffixes={ 'tex',"mkvi","mkiv","mkii" },
+ suffixes={ "tex","mkvi","mkiv","mkii","cld","lfg","xml" },
},
icc={
names={ "icc","icc profile","icc profiles" },
@@ -13976,7 +13979,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 61031, stripped down to: 42613
+-- original size: 61614, stripped down to: 42970
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -14562,42 +14565,44 @@ function resolvers.registerextrapath(paths,subpaths)
instance.lists={}
end
end
-local function made_list(instance,list)
+local function made_list(instance,list,extra_too)
+ if not extra_too then
+ return list
+ end
local ep=instance.extra_paths
if not ep or #ep==0 then
return list
- else
- local done,new,newn={},{},0
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- if find(v,"^[%.%/]$") then
- done[v]=true
- newn=newn+1
- new[newn]=v
- else
- break
- end
- end
- end
- for k=1,#ep do
- local v=ep[k]
- if not done[v] then
+ end
+ local done,new,newn={},{},0
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ if find(v,"^[%.%/]$") then
done[v]=true
newn=newn+1
new[newn]=v
+ else
+ break
end
end
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- done[v]=true
- newn=newn+1
- new[newn]=v
- end
+ end
+ for k=1,#ep do
+ local v=ep[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
+ end
+ end
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
end
- return new
end
+ return new
end
function resolvers.cleanpathlist(str)
local t=resolvers.expandedpathlist(str)
@@ -14611,7 +14616,7 @@ end
function resolvers.expandpath(str)
return joinpath(resolvers.expandedpathlist(str))
end
-function resolvers.expandedpathlist(str)
+function resolvers.expandedpathlist(str,extra_too)
if not str then
return {}
elseif instance.savelists then
@@ -14619,14 +14624,14 @@ function resolvers.expandedpathlist(str)
local lists=instance.lists
local lst=lists[str]
if not lst then
- local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)))
+ local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)),extra_too)
lst=expandedpathfromlist(l)
lists[str]=lst
end
return lst
else
local lst=resolvers.splitpath(resolvers.expansion(str))
- return made_list(instance,expandedpathfromlist(lst))
+ return made_list(instance,expandedpathfromlist(lst),extra_too)
end
end
function resolvers.expandedpathlistfromvariable(str)
@@ -14881,7 +14886,7 @@ local function check_subpath(fname)
end
local function find_intree(filename,filetype,wantedfiles,allresults)
local typespec=resolvers.variableofformat(filetype)
- local pathlist=resolvers.expandedpathlist(typespec)
+ local pathlist=resolvers.expandedpathlist(typespec,filetype=="tex")
local method="intree"
if pathlist and #pathlist>0 then
local filelist=collect_files(wantedfiles)
@@ -14991,6 +14996,17 @@ local function find_intree(filename,filetype,wantedfiles,allresults)
end
else
end
+ else
+ for k=1,#wantedfiles do
+ local fname=methodhandler('finders',pathname.."/"..wantedfiles[k])
+ if fname then
+ result[#result+1]=fname
+ doen=true
+ if not allresults then
+ break
+ end
+ end
+ end
end
end
if done and not allresults then
@@ -16118,7 +16134,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tre"] = package.loaded["data-tre"] or true
--- original size: 6609, stripped down to: 4280
+-- original size: 7874, stripped down to: 5289
if not modules then modules={} end modules ['data-tre']={
version=1.001,
@@ -16129,7 +16145,7 @@ if not modules then modules={} end modules ['data-tre']={
}
local find,gsub,lower=string.find,string.gsub,string.lower
local basename,dirname,joinname=file.basename,file.dirname,file .join
-local globdir,isdir=dir.glob,lfs.isdir
+local globdir,isdir,isfile=dir.glob,lfs.isdir,lfs.isfile
local P,lpegmatch=lpeg.P,lpeg.match
local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
local report_trees=logs.reporter("resolvers","trees")
@@ -16203,7 +16219,25 @@ table.setmetatableindex(collectors,function(t,k)
t[k]=content
return content
end)
-function resolvers.finders.dirlist(specification)
+local function checked(root,p,n)
+ if p then
+ if type(p)=="table" then
+ for i=1,#p do
+ local fullname=joinname(root,p[i],n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ else
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ end
+ return notfound()
+end
+local function resolve(specification)
local filename=specification.filename
if filename~="" then
local root,rest=lpegmatch(splitter,filename)
@@ -16221,39 +16255,56 @@ function resolvers.finders.dirlist(specification)
for i=1,#p do
local pi=p[i]
if pi==path or find(pi,pattern) then
- return joinname(root,pi,n)
+ local fullname=joinname(root,pi,n)
+ if isfile(fullname) then
+ return fullname
+ end
end
end
- else
- if p==path or find(p,pattern) then
- return joinname(root,p,n)
+ elseif p==path or find(p,pattern) then
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
end
end
local queries=specification.queries
if queries and queries.option=="fileonly" then
- return joinname(root,istable and p[1] or p,n)
+ return checked(root,p,n)
+ else
+ return notfound()
end
- return notfound()
end
end
local path,name=dirname(filename),basename(filename)
local root=lpegmatch(stripper,path)
local content=collectors[path]
local p,n=lookup(content,name)
- if not p then
- return notfound()
- elseif type(p)=="table" then
- p=p[1]
+ if p then
+ return checked(root,p,n)
end
- return joinname(root,p,n)
end
return notfound()
end
+resolvers.finders .dirlist=resolve
resolvers.locators .dirlist=resolvers.locators .tree
resolvers.hashers .dirlist=resolvers.hashers .tree
resolvers.generators.dirlist=resolvers.generators.file
resolvers.openers .dirlist=resolvers.openers .file
resolvers.loaders .dirlist=resolvers.loaders .file
+function resolvers.finders.dirfile(specification)
+ local queries=specification.queries
+ if queries then
+ queries.option="fileonly"
+ else
+ specification.queries={ option="fileonly" }
+ end
+ return resolve(specification)
+end
+resolvers.locators .dirfile=resolvers.locators .dirlist
+resolvers.hashers .dirfile=resolvers.hashers .dirlist
+resolvers.generators.dirfile=resolvers.generators.dirlist
+resolvers.openers .dirfile=resolvers.openers .dirlist
+resolvers.loaders .dirfile=resolvers.loaders .dirlist
end -- of closure
@@ -17173,8 +17224,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 706951
--- stripped bytes : 251233
+-- original bytes : 709027
+-- stripped bytes : 251779
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 7cf93ce4c..a6353dc67 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -437,7 +437,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 32062, stripped down to: 16772
+-- original size: 32003, stripped down to: 16772
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -4359,7 +4359,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 33706, stripped down to: 14938
+-- original size: 34171, stripped down to: 15086
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
@@ -4375,7 +4375,9 @@ local type=type
local char,byte,format,sub,gmatch=string.char,string.byte,string.format,string.sub,string.gmatch
local concat=table.concat
local P,C,R,Cs,Ct,Cmt,Cc,Carg,Cp=lpeg.P,lpeg.C,lpeg.R,lpeg.Cs,lpeg.Ct,lpeg.Cmt,lpeg.Cc,lpeg.Carg,lpeg.Cp
-local lpegmatch,patterns=lpeg.match,lpeg.patterns
+local lpegmatch=lpeg.match
+local patterns=lpeg.patterns
+local tabletopattern=lpeg.utfchartabletopattern
local bytepairs=string.bytepairs
local finder=lpeg.finder
local replacer=lpeg.replacer
@@ -4384,7 +4386,7 @@ local utfgmatch=utf.gmatch
local p_utftype=patterns.utftype
local p_utfstricttype=patterns.utfstricttype
local p_utfoffset=patterns.utfoffset
-local p_utf8char=patterns.utf8char
+local p_utf8char=patterns.utf8character
local p_utf8byte=patterns.utf8byte
local p_utfbom=patterns.utfbom
local p_newline=patterns.newline
@@ -4584,7 +4586,8 @@ if not utf.sub then
end
end
function utf.remapper(mapping)
- local pattern=Cs((p_utf8char/mapping)^0)
+ local pattern=type(mapping)=="table" and tabletopattern(mapping) or p_utf8char
+ local pattern=Cs((pattern/mapping+p_utf8char)^0)
return function(str)
if not str or str=="" then
return ""
@@ -11318,7 +11321,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 25374, stripped down to: 17841
+-- original size: 25139, stripped down to: 17839
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -11655,7 +11658,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
if name then break end
end
end
- local data=(name and name~="" and loaddata(name)) or ""
+ local data=name and name~="" and loaddata(name) or ""
if data=="" then
epdt[ek.ni]=""
elseif ekat["parse"]=="text" then
@@ -13207,7 +13210,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 8841, stripped down to: 6546
+-- original size: 8898, stripped down to: 6564
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -13300,7 +13303,7 @@ local relations=allocate {
tex={
names={ "tex" },
variable='TEXINPUTS',
- suffixes={ 'tex',"mkvi","mkiv","mkii" },
+ suffixes={ "tex","mkvi","mkiv","mkii","cld","lfg","xml" },
},
icc={
names={ "icc","icc profile","icc profiles" },
@@ -13976,7 +13979,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 61031, stripped down to: 42613
+-- original size: 61614, stripped down to: 42970
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -14562,42 +14565,44 @@ function resolvers.registerextrapath(paths,subpaths)
instance.lists={}
end
end
-local function made_list(instance,list)
+local function made_list(instance,list,extra_too)
+ if not extra_too then
+ return list
+ end
local ep=instance.extra_paths
if not ep or #ep==0 then
return list
- else
- local done,new,newn={},{},0
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- if find(v,"^[%.%/]$") then
- done[v]=true
- newn=newn+1
- new[newn]=v
- else
- break
- end
- end
- end
- for k=1,#ep do
- local v=ep[k]
- if not done[v] then
+ end
+ local done,new,newn={},{},0
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ if find(v,"^[%.%/]$") then
done[v]=true
newn=newn+1
new[newn]=v
+ else
+ break
end
end
- for k=1,#list do
- local v=list[k]
- if not done[v] then
- done[v]=true
- newn=newn+1
- new[newn]=v
- end
+ end
+ for k=1,#ep do
+ local v=ep[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
+ end
+ end
+ for k=1,#list do
+ local v=list[k]
+ if not done[v] then
+ done[v]=true
+ newn=newn+1
+ new[newn]=v
end
- return new
end
+ return new
end
function resolvers.cleanpathlist(str)
local t=resolvers.expandedpathlist(str)
@@ -14611,7 +14616,7 @@ end
function resolvers.expandpath(str)
return joinpath(resolvers.expandedpathlist(str))
end
-function resolvers.expandedpathlist(str)
+function resolvers.expandedpathlist(str,extra_too)
if not str then
return {}
elseif instance.savelists then
@@ -14619,14 +14624,14 @@ function resolvers.expandedpathlist(str)
local lists=instance.lists
local lst=lists[str]
if not lst then
- local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)))
+ local l=made_list(instance,resolvers.splitpath(resolvers.expansion(str)),extra_too)
lst=expandedpathfromlist(l)
lists[str]=lst
end
return lst
else
local lst=resolvers.splitpath(resolvers.expansion(str))
- return made_list(instance,expandedpathfromlist(lst))
+ return made_list(instance,expandedpathfromlist(lst),extra_too)
end
end
function resolvers.expandedpathlistfromvariable(str)
@@ -14881,7 +14886,7 @@ local function check_subpath(fname)
end
local function find_intree(filename,filetype,wantedfiles,allresults)
local typespec=resolvers.variableofformat(filetype)
- local pathlist=resolvers.expandedpathlist(typespec)
+ local pathlist=resolvers.expandedpathlist(typespec,filetype=="tex")
local method="intree"
if pathlist and #pathlist>0 then
local filelist=collect_files(wantedfiles)
@@ -14991,6 +14996,17 @@ local function find_intree(filename,filetype,wantedfiles,allresults)
end
else
end
+ else
+ for k=1,#wantedfiles do
+ local fname=methodhandler('finders',pathname.."/"..wantedfiles[k])
+ if fname then
+ result[#result+1]=fname
+ doen=true
+ if not allresults then
+ break
+ end
+ end
+ end
end
end
if done and not allresults then
@@ -16118,7 +16134,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tre"] = package.loaded["data-tre"] or true
--- original size: 6609, stripped down to: 4280
+-- original size: 7874, stripped down to: 5289
if not modules then modules={} end modules ['data-tre']={
version=1.001,
@@ -16129,7 +16145,7 @@ if not modules then modules={} end modules ['data-tre']={
}
local find,gsub,lower=string.find,string.gsub,string.lower
local basename,dirname,joinname=file.basename,file.dirname,file .join
-local globdir,isdir=dir.glob,lfs.isdir
+local globdir,isdir,isfile=dir.glob,lfs.isdir,lfs.isfile
local P,lpegmatch=lpeg.P,lpeg.match
local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
local report_trees=logs.reporter("resolvers","trees")
@@ -16203,7 +16219,25 @@ table.setmetatableindex(collectors,function(t,k)
t[k]=content
return content
end)
-function resolvers.finders.dirlist(specification)
+local function checked(root,p,n)
+ if p then
+ if type(p)=="table" then
+ for i=1,#p do
+ local fullname=joinname(root,p[i],n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ else
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
+ end
+ end
+ end
+ return notfound()
+end
+local function resolve(specification)
local filename=specification.filename
if filename~="" then
local root,rest=lpegmatch(splitter,filename)
@@ -16221,39 +16255,56 @@ function resolvers.finders.dirlist(specification)
for i=1,#p do
local pi=p[i]
if pi==path or find(pi,pattern) then
- return joinname(root,pi,n)
+ local fullname=joinname(root,pi,n)
+ if isfile(fullname) then
+ return fullname
+ end
end
end
- else
- if p==path or find(p,pattern) then
- return joinname(root,p,n)
+ elseif p==path or find(p,pattern) then
+ local fullname=joinname(root,p,n)
+ if isfile(fullname) then
+ return fullname
end
end
local queries=specification.queries
if queries and queries.option=="fileonly" then
- return joinname(root,istable and p[1] or p,n)
+ return checked(root,p,n)
+ else
+ return notfound()
end
- return notfound()
end
end
local path,name=dirname(filename),basename(filename)
local root=lpegmatch(stripper,path)
local content=collectors[path]
local p,n=lookup(content,name)
- if not p then
- return notfound()
- elseif type(p)=="table" then
- p=p[1]
+ if p then
+ return checked(root,p,n)
end
- return joinname(root,p,n)
end
return notfound()
end
+resolvers.finders .dirlist=resolve
resolvers.locators .dirlist=resolvers.locators .tree
resolvers.hashers .dirlist=resolvers.hashers .tree
resolvers.generators.dirlist=resolvers.generators.file
resolvers.openers .dirlist=resolvers.openers .file
resolvers.loaders .dirlist=resolvers.loaders .file
+function resolvers.finders.dirfile(specification)
+ local queries=specification.queries
+ if queries then
+ queries.option="fileonly"
+ else
+ specification.queries={ option="fileonly" }
+ end
+ return resolve(specification)
+end
+resolvers.locators .dirfile=resolvers.locators .dirlist
+resolvers.hashers .dirfile=resolvers.hashers .dirlist
+resolvers.generators.dirfile=resolvers.generators.dirlist
+resolvers.openers .dirfile=resolvers.openers .dirlist
+resolvers.loaders .dirfile=resolvers.loaders .dirlist
end -- of closure
@@ -17173,8 +17224,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 706951
--- stripped bytes : 251233
+-- original bytes : 709027
+-- stripped bytes : 251779
-- end library merge