summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-04-01 10:50:35 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-04-01 10:50:35 +0200
commit059fc69b2c7853b937ddb4cfc9d36304dee07893 (patch)
treea58b878377348a05b55bf9b2c6ee44dcd8508c2c /scripts
parent97f560d2993c367fb84ef62eefbe90ca03c19ebc (diff)
downloadcontext-059fc69b2c7853b937ddb4cfc9d36304dee07893.tar.gz
2023-04-01 09:31:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-context.lua22
-rw-r--r--scripts/context/lua/mtx-fonts.lua11
-rw-r--r--scripts/context/lua/mtx-pdf.lua109
-rw-r--r--scripts/context/lua/mtxrun.lua109
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua109
-rw-r--r--scripts/context/stubs/unix/mtxrun109
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua109
7 files changed, 442 insertions, 136 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 014a7d4ef..a5dfd5a7d 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -704,6 +704,8 @@ function scripts.context.run(ctxdata,filename)
--
a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil
--
+ local changed = { }
+ --
for i=1,#filelist do
--
local filename = filelist[i]
@@ -731,6 +733,10 @@ function scripts.context.run(ctxdata,filename)
-- local jobname = removesuffix(filename)
local ctxname = ctxdata and ctxdata.ctxname
--
+ if changed[jobname] == nil then
+ changed[jobname] = false
+ end
+ --
local analysis = preamble_analyze(filename)
--
if a_mkii or analysis.engine == 'pdftex' or analysis.engine == 'xetex' then
@@ -962,6 +968,7 @@ function scripts.context.run(ctxdata,filename)
if not multipass_forcedruns then
newhash = multipass_hashfiles(jobname)
if multipass_changed(oldhash,newhash) then
+ changed[jobname] = true
oldhash = newhash
else
break
@@ -1096,6 +1103,21 @@ function scripts.context.run(ctxdata,filename)
end
end
--
+ if #filelist > 1 then
+ local done = false
+ for k, v in sortedhash(changed) do
+ if v then
+ if not done then
+ report()
+ done = true
+ end
+ report("file %a was changed",k)
+ end
+ end
+ if done then
+ report()
+ end
+ end
end
function scripts.context.pipe() -- still used?
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 37107ea1e..746a010c8 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -358,9 +358,14 @@ local function list_specifications(t,info)
fontweight(entry.fontweight),
}
end
- table.insert(s,1,{"familyname","weight","style","width","variant","fontname","filename","subfont","fontweight"})
- table.insert(s,2,{"","","","","","","","",""})
- utilities.formatters.formatcolumns(s)
+ local h = {
+ {"familyname","weight","style","width","variant","fontname","filename","subfont","fontweight"},
+ {"","","","","","","","",""}
+ }
+ utilities.formatters.formatcolumns(s,false,h)
+ for k=1,#h do
+ write_nl(h[k])
+ end
for k=1,#s do
write_nl(s[k])
end
diff --git a/scripts/context/lua/mtx-pdf.lua b/scripts/context/lua/mtx-pdf.lua
index 0ce17ec5b..a1803a801 100644
--- a/scripts/context/lua/mtx-pdf.lua
+++ b/scripts/context/lua/mtx-pdf.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['mtx-pdf'] = {
local tonumber = tonumber
local format, gmatch, gsub, match, find = string.format, string.gmatch, string.gsub, string.match, string.find
local utfchar = utf.char
-local concat = table.concat
+local concat, insert, swapped = table.concat, table.insert, table.swapped
local setmetatableindex, sortedhash, sortedkeys = table.setmetatableindex, table.sortedhash, table.sortedkeys
local helpinfo = [[
@@ -28,6 +28,7 @@ local helpinfo = [[
<flag name="pretty"><short>replace newlines in metadata</short></flag>
<flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag>
<flag name="object"><short>show object"/></short></flag>
+ <flag name="linkjs"><short>show links"/></short></flag>
</subcategory>
<subcategory>
<example><command>mtxrun --script pdf --info foo.pdf</command></example>
@@ -365,6 +366,110 @@ function scripts.pdf.object(filename,n)
end
end
+function scripts.pdf.links(filename,asked)
+ local pdffile = loadpdffile(filename)
+ if pdffile then
+
+ local pages = pdffile.pages
+ local nofpages = pdffile.nofpages
+
+ if asked and (asked < 1 or asked > nofpages) then
+ report("")
+ report("no page %i, last page %i",asked,nofpages)
+ report("")
+ return
+ end
+
+ local reverse = swapped(pages)
+
+ local function show(pagenumber)
+ local page = pages[pagenumber]
+ local annots = page.Annots
+ if annots then
+ report("")
+ report("annotations @ page %i",pagenumber)
+ report("")
+ for i=1,#annots do
+ local annot = annots[i]
+ if annot.Subtype == "Link" then
+ local A = annot.A
+ if A then
+ local S = A.S
+ local D = A.D
+ if S == "GoTo" then
+ if D then
+ local D1 = D[1]
+ local R1 = reverse[D1]
+ if tonumber(R1) then
+ report("intern, page % 4i",R1 or 0)
+ else
+ report("intern, name %s",tostring(D1))
+ end
+ end
+ elseif S == "GoToR" then
+ if D then
+ local F = A.F
+ if F then
+ local D1 = D[1]
+ if tonumber(D1) then
+ report("extern, page % 4i, file %s",D1 + 1,F)
+ else
+ report("extern, page % 4i, file %s, name %s",0,F,D[1])
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ if asked then
+ show(asked)
+ else
+ for pagenumber=1,nofpages do
+ show(pagenumber)
+ end
+ end
+
+ local destinations = pdffile.destinations
+ if destinations then
+ if asked then
+ report("")
+ report("destinations to page %i",asked)
+ report("")
+ for k, v in sortedhash(destinations) do
+ local D = v.D
+ if D then
+ local p = reverse[D[1]] or 0
+ if p == asked then
+ report(k)
+ end
+ end
+ end
+ else
+ report("")
+ report("destinations")
+ report("")
+ local list = setmetatableindex("table")
+ for k, v in sortedhash(destinations) do
+ local D = v.D
+ if D then
+ local p = reverse[D[1]]
+ report("tag %s, page % 4i",k,p)
+ insert(list[p],k)
+ end
+ end
+ for k, v in sortedhash(list) do
+ report("")
+ report("page %i, names % t",k,v)
+ end
+ end
+ end
+ end
+end
+
-- scripts.pdf.info("e:/tmp/oeps.pdf")
-- scripts.pdf.metadata("e:/tmp/oeps.pdf")
-- scripts.pdf.fonts("e:/tmp/oeps.pdf")
@@ -382,6 +487,8 @@ elseif environment.argument("fonts") then
scripts.pdf.fonts(filename)
elseif environment.argument("object") then
scripts.pdf.object(filename,tonumber(environment.argument("object")))
+elseif environment.argument("links") then
+ scripts.pdf.links(filename,tonumber(environment.argument("page")))
elseif environment.argument("exporthelp") then
application.export(environment.argument("exporthelp"),filename)
else
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 49ae4a1bb..0cb821561 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -9942,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9955,19 +9964,21 @@ utilities=utilities or {}
utilities.formatters=utilities.formatters or {}
local formatters=utilities.formatters
local concat,format=table.concat,string.format
-local tostring,type=tostring,type
+local tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9989,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ end
+ end
+ end
for i=1,n do
local w=widths[i]
if numbers[i] then
if w>80 then
- widths[i]="%s"..between
- else
- widths[i]="%0"..w.."i"..between
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -16397,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17878,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19129,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19198,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21705,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22240,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22308,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24249,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24467,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -26095,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035917
--- stripped bytes : 408296
+-- original bytes : 1037183
+-- stripped bytes : 408369
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 49ae4a1bb..0cb821561 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -9942,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9955,19 +9964,21 @@ utilities=utilities or {}
utilities.formatters=utilities.formatters or {}
local formatters=utilities.formatters
local concat,format=table.concat,string.format
-local tostring,type=tostring,type
+local tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9989,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ end
+ end
+ end
for i=1,n do
local w=widths[i]
if numbers[i] then
if w>80 then
- widths[i]="%s"..between
- else
- widths[i]="%0"..w.."i"..between
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -16397,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17878,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19129,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19198,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21705,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22240,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22308,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24249,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24467,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -26095,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035917
--- stripped bytes : 408296
+-- original bytes : 1037183
+-- stripped bytes : 408369
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 49ae4a1bb..0cb821561 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -9942,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9955,19 +9964,21 @@ utilities=utilities or {}
utilities.formatters=utilities.formatters or {}
local formatters=utilities.formatters
local concat,format=table.concat,string.format
-local tostring,type=tostring,type
+local tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9989,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ end
+ end
+ end
for i=1,n do
local w=widths[i]
if numbers[i] then
if w>80 then
- widths[i]="%s"..between
- else
- widths[i]="%0"..w.."i"..between
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -16397,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17878,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19129,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19198,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21705,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22240,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22308,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24249,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24467,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -26095,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035917
--- stripped bytes : 408296
+-- original bytes : 1037183
+-- stripped bytes : 408369
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 49ae4a1bb..0cb821561 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -5136,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18893, stripped down to: 11170
+-- original size: 19139, stripped down to: 11345
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5154,7 +5154,7 @@ dir=dir or {}
local dir=dir
local lfs=lfs
local attributes=lfs.attributes
-local walkdir=lfs.dir
+local scandir=lfs.dir
local isdir=lfs.isdir
local isfile=lfs.isfile
local currentdir=lfs.currentdir
@@ -5185,6 +5185,15 @@ else
lfs.isdir=isdir
lfs.isfile=isfile
end
+local isreadable=file.isreadable
+local walkdir=function(p,...)
+ if isreadable(p.."/.") then
+ return scandir(p,...)
+ else
+ return function() end
+ end
+end
+lfs.walkdir=walkdir
function dir.current()
return (gsub(currentdir(),"\\","/"))
end
@@ -9942,7 +9951,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fmt"] = package.loaded["util-fmt"] or true
--- original size: 2541, stripped down to: 1624
+-- original size: 3379, stripped down to: 2273
if not modules then modules={} end modules ['util-fmt']={
version=1.001,
@@ -9955,19 +9964,21 @@ utilities=utilities or {}
utilities.formatters=utilities.formatters or {}
local formatters=utilities.formatters
local concat,format=table.concat,string.format
-local tostring,type=tostring,type
+local tostring,type,unpack=tostring,type,unpack
local strip=string.strip
local lpegmatch=lpeg.match
local stripper=lpeg.patterns.stripzeros
function formatters.stripzeros(str)
return lpegmatch(stripper,str)
end
-function formatters.formatcolumns(result,between)
+function formatters.formatcolumns(result,between,header)
if result and #result>0 then
- between=between or " "
- local widths,numbers={},{}
+ local widths={}
+ local numbers={}
+ local templates={}
local first=result[1]
local n=#first
+ between=between or " "
for i=1,n do
widths[i]=0
end
@@ -9989,31 +10000,61 @@ function formatters.formatcolumns(result,between)
end
end
end
+ if header then
+ for i=1,#header do
+ local h=header[i]
+ for j=1,n do
+ local hj=tostring(h[j])
+ h[j]=hj
+ local w=#hj
+ if w>widths[j] then
+ widths[j]=w
+ end
+ end
+ end
+ end
for i=1,n do
local w=widths[i]
if numbers[i] then
if w>80 then
- widths[i]="%s"..between
- else
- widths[i]="%0"..w.."i"..between
+ templates[i]="%s"..between
+ else
+ templates[i]="% "..w.."i"..between
end
else
if w>80 then
- widths[i]="%s"..between
- elseif w>0 then
- widths[i]="%-"..w.."s"..between
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
else
- widths[i]="%s"
+ templates[i]="%s"
end
end
end
- local template=strip(concat(widths))
+ local template=strip(concat(templates))
for i=1,#result do
local str=format(template,unpack(result[i]))
result[i]=strip(str)
end
+ if header then
+ for i=1,n do
+ local w=widths[i]
+ if w>80 then
+ templates[i]="%s"..between
+ elseif w>0 then
+ templates[i]="%-"..w.."s"..between
+ else
+ templates[i]="%s"
+ end
+ end
+ local template=strip(concat(templates))
+ for i=1,#header do
+ local str=format(template,unpack(header[i]))
+ header[i]=strip(str)
+ end
+ end
end
- return result
+ return result,header
end
@@ -16397,7 +16438,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62810, stripped down to: 36225
+-- original size: 62221, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17878,7 +17919,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54733, stripped down to: 31258
+-- original size: 54589, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -19129,7 +19170,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true
--- original size: 3574, stripped down to: 1808
+-- original size: 3542, stripped down to: 1808
if not modules then modules={} end modules ['lxml-mis']={
version=1.001,
@@ -19198,7 +19239,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 34661, stripped down to: 21511
+-- original size: 34522, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -21705,7 +21746,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16456, stripped down to: 11636
+-- original size: 16433, stripped down to: 11636
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -22240,7 +22281,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 69576, stripped down to: 44470
+-- original size: 70711, stripped down to: 44839
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -22308,13 +22349,15 @@ local criticalvars={
if environment.default_texmfcnf then
resolvers.luacnfspec="home:texmf/web2c;"..environment.default_texmfcnf
else
- resolvers.luacnfspec=concat ({
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
- },";")
+ local texroot=environment.texroot
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c"
+ if texroot and isdir(texroot.."/texmf-context") then
+ elseif texroot and isdir(texroot.."/texmf-dist") then
+ resolvers.luacnfspec="home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c"
+ elseif ostype~="windows" and isdir("/etc/texmf/web2c") then
+ resolvers.luacnfspec="home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c"
+ else
+ end
end
local unset_variable="unset"
local formats=resolvers.formats
@@ -24249,7 +24292,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5487, stripped down to: 3757
+-- original size: 5477, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24467,7 +24510,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-zip"] = package.loaded["data-zip"] or true
--- original size: 10805, stripped down to: 7951
+-- original size: 10789, stripped down to: 7951
if not modules then modules={} end modules ['data-zip']={
version=1.001,
@@ -26095,8 +26138,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1035917
--- stripped bytes : 408296
+-- original bytes : 1037183
+-- stripped bytes : 408369
-- end library merge