summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-11-12 19:54:50 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-11-12 19:54:50 +0100
commit0c75a2acf592eb4360685375904440f5e6b8125a (patch)
tree0a23a35bf947d13b3975bacdc27ad1d7edc9454c /scripts
parent5c195236a1a69b23762df71a791e6b4e2c671892 (diff)
downloadcontext-0c75a2acf592eb4360685375904440f5e6b8125a.tar.gz
2019-11-12 18:53:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-base.lua8
-rw-r--r--scripts/context/lua/mtx-context.lua123
-rw-r--r--scripts/context/lua/mtx-context.xml5
-rw-r--r--scripts/context/lua/mtx-patterns.lua1
-rw-r--r--scripts/context/lua/mtx-plain.lua6
-rw-r--r--scripts/context/lua/mtxrun.lua397
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua397
-rw-r--r--scripts/context/stubs/unix/mtxrun397
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua397
9 files changed, 1091 insertions, 640 deletions
diff --git a/scripts/context/lua/mtx-base.lua b/scripts/context/lua/mtx-base.lua
index bcc9aeb60..eab82c900 100644
--- a/scripts/context/lua/mtx-base.lua
+++ b/scripts/context/lua/mtx-base.lua
@@ -76,14 +76,6 @@ elseif environment.arguments["find-path"] then
resolvers.load()
local path = resolvers.findpath(environment.files[1], fileformat)
print(path) -- quite basic, wil become function in logs
-elseif environment.arguments["run"] then
- resolvers.load("nofiles") -- ! no need for loading databases
- trackers.enable("resolvers.locating")
- environment.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "")
-elseif environment.arguments["fmt"] then
- resolvers.load("nofiles") -- ! no need for loading databases
- trackers.enable("resolvers.locating")
- environment.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "")
elseif environment.arguments["expand-braces"] then
resolvers.load("nofiles")
resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files)
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index f987416ec..0a72522e5 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -518,36 +518,6 @@ local function result_save_keep(oldbase,newbase)
end
end
--- executing luatex
-
-local function flags_to_string(flags,prefix) -- context flags get prepended by c:
- local t = { }
- for k, v in table.sortedhash(flags) do
- if prefix then
- k = format("c:%s",k)
- end
- if not v or v == "" or v == '""' then
- -- no need to flag false
- elseif v == true then
- t[#t+1] = format('--%s',k)
- elseif type(v) == "string" then
- t[#t+1] = format('--%s=%s',k,quote(v))
- else
- t[#t+1] = format('--%s=%s',k,tostring(v))
- end
- end
- return concat(t," ")
-end
-
-local function luatex_command(l_flags,c_flags,filename,engine)
- return format('%s %s %s "%s"',
- engine or (status and status.luatex_engine) or "luatex",
- flags_to_string(l_flags),
- flags_to_string(c_flags,true),
- filename
- )
-end
-
-- use mtx-plain instead
local plain_formats = {
@@ -569,10 +539,10 @@ local function run_plain(plainformat,filename)
local pdfview = getargument("autopdf") or getargument("closepdf")
if pdfview then
pdf_close(resultname,pdfview)
- os.execute(command)
+ os.execute(command) -- maybe also a proper runner
pdf_open(resultname,pdfview)
else
- os.execute(command)
+ os.execute(command) -- maybe also a proper runner
end
end
end
@@ -605,8 +575,32 @@ local function run_texexec(filename,a_purge,a_purgeall)
end
end
+-- executing luatex
+
+local function flags_to_string(flags,prefix)
+ -- context flags get prepended by c: ... this will move to the sbx module
+ local t = { }
+ for k, v in table.sortedhash(flags) do
+ if prefix then
+ k = format("c:%s",k)
+ end
+ if not v or v == "" or v == '""' then
+ -- no need to flag false
+ elseif v == true then
+ t[#t+1] = format('--%s',k)
+ elseif type(v) == "string" then
+ t[#t+1] = format('--%s=%s',k,quote(v))
+ else
+ t[#t+1] = format('--%s=%s',k,tostring(v))
+ end
+ end
+ return concat(t," ")
+end
+
function scripts.context.run(ctxdata,filename)
--
+ local verbose = false
+ --
local a_nofile = getargument("nofile")
local a_engine = getargument("engine")
--
@@ -633,9 +627,10 @@ function scripts.context.run(ctxdata,filename)
return
end
--
- local interface = validstring(getargument("interface")) or "en"
+ local interface = validstring(getargument("interface")) or "en"
local formatname = formatofinterface[interface] or "cont-en"
- local formatfile, scriptfile = resolvers.locateformat(formatname) -- regular engine !
+ local formatfile,
+ scriptfile = resolvers.locateformat(formatname) -- regular engine !
if not formatfile or not scriptfile then
report("warning: no format found, forcing remake (commandline driven)")
scripts.context.make(formatname)
@@ -673,17 +668,6 @@ function scripts.context.run(ctxdata,filename)
local a_nodates = getargument("nodates")
local a_trailerid = getargument("trailerid")
local a_nocompression = getargument("nocompression")
-
- -- the following flag is not officially supported because i cannot forsee
- -- side effects (so no bug reports please) .. we provide --sandbox that
- -- does similar things but tries to ensure that context works as expected
-
- -- local a_safer = getargument("safer")
- --
- -- if a_safer then
- -- report("warning: using the luatex safer options, processing is not guaranteed")
- -- end
-
--
a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil
--
@@ -826,8 +810,8 @@ function scripts.context.run(ctxdata,filename)
-- ["safer"] = a_safer, -- better use --sandbox
-- ["no-mktex"] = true,
-- ["file-line-error-style"] = true,
- ["fmt"] = formatfile,
- ["lua"] = scriptfile,
+-- ["fmt"] = formatfile,
+-- ["lua"] = scriptfile,
["jobname"] = jobname,
["jithash"] = a_jithash,
}
@@ -874,11 +858,15 @@ function scripts.context.run(ctxdata,filename)
c_flags.noarrange = a_noarrange or a_arrange or nil
c_flags.profile = a_profile and (tonumber(a_profile) or 0) or nil
--
- local command = luatex_command(l_flags,c_flags,mainfile,a_engine)
- --
- report("run %s: %s",currentrun,command)
print("") -- cleaner, else continuation on same line
- local returncode = os.execute(command)
+ local returncode = environment.run_format(
+ formatfile,
+ scriptfile,
+ mainfile,
+ flags_to_string(l_flags),
+ flags_to_string(c_flags,true),
+ verbose
+ )
-- todo: remake format when no proper format is found
if not returncode then
report("fatal error: no return code")
@@ -935,10 +923,17 @@ function scripts.context.run(ctxdata,filename)
c_flags.currentrun = c_flags.currentrun + 1
c_flags.noarrange = nil
--
- local command = luatex_command(l_flags,c_flags,mainfile,a_engine)
- --
report("arrange run: %s",command)
- local returncode, errorstring = os.execute(command)
+ --
+ local returncode = environment.run_format(
+ formatfile,
+ scriptfile,
+ mainfile,
+ flags_to_string(l_flags),
+ flags_to_string(c_flags,true),
+ verbose
+ )
+ --
if not returncode then
report("fatal error: no return code, message: %s",errorstring or "?")
os.exit(1)
@@ -998,7 +993,7 @@ function scripts.context.run(ctxdata,filename)
report()
report("making epub file: ",command)
report()
- os.execute(command)
+ os.execute(command) -- todo: also a runner
end
--
if a_timing then
@@ -1060,20 +1055,24 @@ function scripts.context.pipe() -- still used?
io.savedata(filename,"\\relax")
report("entering scrollmode using '%s' with optionfile, end job with \\end",filename)
end
- local command = luatex_command(l_flags,c_flags,filename)
- os.execute(command)
+ local returncode = environment.run_format(
+ formatfile,
+ scriptfile,
+ filename,
+ flags_to_string(l_flags),
+ flags_to_string(c_flags,true),
+ verbose
+ )
if getargument("purge") then
scripts.context.purge_job(filename)
elseif getargument("purgeall") then
scripts.context.purge_job(filename,true)
removefile(filename)
end
+ elseif formatname then
+ report("error, no format found with name: %s, aborting",formatname)
else
- if formatname then
- report("error, no format found with name: %s, aborting",formatname)
- else
- report("error, no format found (provide formatname or interface)")
- end
+ report("error, no format found (provide formatname or interface)")
end
end
diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml
index 916dad377..b0566517d 100644
--- a/scripts/context/lua/mtx-context.xml
+++ b/scripts/context/lua/mtx-context.xml
@@ -225,6 +225,11 @@
<short>process file in a limited environment</short>
</flag>
</subcategory>
+ <subcategory>
+ <flag name="addbinarypath">
+ <short>prepend the (found) binarypath to runners</short>
+ </flag>
+ </subcategory>
</category>
</flags>
</application>
diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua
index aeaae0875..37843a6b6 100644
--- a/scripts/context/lua/mtx-patterns.lua
+++ b/scripts/context/lua/mtx-patterns.lua
@@ -133,6 +133,7 @@ scripts.patterns.list = {
-- { "lo", "hyph-lo", "lao" },
{ "lt", "hyph-lt", "lithuanian" },
{ "lv", "hyph-lv", "latvian" },
+ { "mk", "hyph-mk", "macedonian" },
{ "ml", "hyph-ml", "malayalam" },
{ "mn", "hyph-mn-cyrl", "mongolian, cyrillic script" },
-- { "mr", "hyph-mr", "..." },
diff --git a/scripts/context/lua/mtx-plain.lua b/scripts/context/lua/mtx-plain.lua
index 72cc48f92..e6c790f7c 100644
--- a/scripts/context/lua/mtx-plain.lua
+++ b/scripts/context/lua/mtx-plain.lua
@@ -6,11 +6,13 @@ if not modules then modules = { } end modules ['mtx-plain'] = {
license = "see context related readme files"
}
--- future version will use the texmf-cache/generic/formats/<engine> path
+-- Future version will use the texmf-cache/generic/formats/<engine> path
-- instead because then we can use some more of the generic context
-- initializers ... in that case we will also use the regular database
-- instead of kpse here, just like with the font database code (as that
--- one also works with kpse runtime)
+-- one also works with kpse runtime).
+
+-- Maybe I have to update this one to use more recent ways to run programs.
local format = string.format
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index cdc396edc..fbbf3d2a2 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6520, stripped down to: 2988
+-- original size: 6529, stripped down to: 2933
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -212,9 +212,6 @@ if LUAVERSION<5.2 and jit then
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -12953,7 +12950,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32900, stripped down to: 21131
+-- original size: 33803, stripped down to: 21818
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12998,17 +12995,30 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
+local function ansisupported(specification)
+ if specification~="ansi" and specification~="ansilog" then
+ return false
+ elseif os and os.enableansi then
+ return os.enableansi()
+ else
+ return false
+ end
+end
if runningtex and texio then
if texio.setescape then
texio.setescape(0)
end
- if arg then
+ if arg and ansisupported then
for k,v in next,arg do
if v=="--ansi" or v=="--c:ansi" then
- variant="ansi"
+ if ansisupported("ansi") then
+ variant="ansi"
+ end
break
elseif v=="--ansilog" or v=="--c:ansilog" then
- variant="ansilog"
+ if ansisupported("ansilog") then
+ variant="ansilog"
+ end
break
end
end
@@ -13223,6 +13233,9 @@ if runningtex and texio then
t=specification.targets
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
t=v.targets
@@ -13342,6 +13355,9 @@ else
if type(specification)=="table" then
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
f=v.formats
@@ -13669,6 +13685,13 @@ local exporters={
logs.reporters=reporters
logs.exporters=exporters
function logs.application(t)
+ local arguments=environment and environment.arguments
+ if arguments then
+ local ansi=arguments.ansi or arguments.ansilog
+ if ansi then
+ logs.setformatters(arguments.ansi and "ansi" or "ansilog")
+ end
+ end
t.name=t.name or "unknown"
t.banner=t.banner
t.moreinfo=moreinfo
@@ -14861,7 +14884,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 20184, stripped down to: 12874
+-- original size: 21058, stripped down to: 13199
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15109,36 +15132,48 @@ local function validcommand(name,program,template,checkers,defaults,variables,re
if validbinaries~=false and (validbinaries==true or validbinaries[program]) then
if variables then
for variable,value in next,variables do
- local checker=validators[checkers[variable]]
- if checker then
- value=checker(unquoted(value),strict)
- if value then
- variables[variable]=optionalquoted(value)
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ value=checker(unquoted(value),strict)
+ if value then
+ variables[variable]=optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
else
- report("variable %a with value %a fails the check",variable,value)
+ report("variable %a has no checker",variable)
return
end
- else
- report("variable %a has no checker",variable)
- return
end
end
for variable,default in next,defaults do
local value=variables[variable]
if not value or value=="" then
- local checker=validators[checkers[variable]]
- if checker then
- default=checker(unquoted(default),strict)
- if default then
- variables[variable]=optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ default=checker(unquoted(default),strict)
+ if default then
+ variables[variable]=optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
end
end
end
end
end
+ local binpath=variables.binarypath
+ if type(binpath)=="string" and binpath~="" then
+ program=binpath.."/"..program
+ end
local command=program.." "..replace(template,variables)
if reporter then
reporter("executing runner %a: %s",name,command)
@@ -15172,7 +15207,8 @@ local runners={
if trace then
report("execute: %s",command)
end
- return osexecute(command)
+ local okay=osexecute(command)
+ return okay
end
end,
pipeto=function(...)
@@ -15206,7 +15242,7 @@ function sandbox.registerrunner(specification)
return
end
if validrunners[name] then
- report("invalid name, runner %a already defined")
+ report("invalid name, runner %a already defined",name)
return
end
local program=specification.program
@@ -22087,7 +22123,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 68194, stripped down to: 43699
+-- original size: 68209, stripped down to: 43711
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -23601,7 +23637,7 @@ function resolvers.dowithvariable(name,func)
end
function resolvers.locateformat(name)
local engine=environment.ownmain or "luatex"
- local barename=removesuffix(name)
+ local barename=removesuffix(file.basename(name))
local fullname=addsuffix(barename,"fmt")
local fmtname=caches.getfirstreadablefile(fullname,"formats",engine) or ""
if fmtname=="" then
@@ -23614,11 +23650,11 @@ function resolvers.locateformat(name)
local lucname=addsuffix(barename,luasuffixes.luc)
local luiname=addsuffix(barename,luasuffixes.lui)
if isfile(luiname) then
- return barename,luiname
+ return fmtname,luiname
elseif isfile(lucname) then
- return barename,lucname
+ return fmtname,lucname
elseif isfile(luaname) then
- return barename,luaname
+ return fmtname,luaname
end
end
return nil,nil
@@ -24702,7 +24738,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-sch"] = package.loaded["data-sch"] or true
--- original size: 6753, stripped down to: 5268
+-- original size: 6757, stripped down to: 5272
if not modules then modules={} end modules ['data-sch']={
version=1.001,
@@ -24758,7 +24794,7 @@ local runner=sandbox.registerrunner {
name="curl resolver",
method="execute",
program="curl",
- template="--silent --insecure --create-dirs --output %cachename% %original%",
+ template='--silent --insecure --create-dirs --output "%cachename%" "%original%"',
checkers={
cachename="cache",
original="url",
@@ -25609,7 +25645,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9998, stripped down to: 7540
+-- original size: 13894, stripped down to: 10006
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25623,16 +25659,14 @@ local concat=table.concat
local quoted=string.quoted
local luasuffixes=utilities.lua.suffixes
local report_format=logs.reporter("resolvers","formats")
-local function primaryflags()
- local arguments=environment.arguments
+local function primaryflags(arguments)
local flags={}
if arguments.silent then
flags[#flags+1]="--interaction=batchmode"
end
return concat(flags," ")
end
-local function secondaryflags()
- local arguments=environment.arguments
+local function secondaryflags(arguments)
local trackers=arguments.trackers
local directives=arguments.directives
local flags={}
@@ -25667,12 +25701,13 @@ local function secondaryflags()
end
local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
local checkers={
- primaryflags="string",
- secondaryflags="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
dump="string",
+ binarypath="string",
}
local runners={
luatex=sandbox.registerrunner {
@@ -25697,54 +25732,88 @@ local runners={
reporter=report_format,
},
}
-function environment.make_format(name,arguments)
+local function validbinarypath()
+ if environment.arguments.addbinarypath then
+ local binarypath=environment.ownpath or ""
+ if binarypath~="" then
+ binarypath=dir.expandname(binarypath)
+ if lfs.isdir(binarypath) then
+ return binarypath
+ end
+ end
+ end
+end
+function environment.make_format(formatname)
+ local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
- local silent=environment.arguments.silent
- local errors=environment.arguments.errors
- local olddir=dir.current()
- local path=caches.getwritablepath("formats",engine) or ""
- if path~="" then
- lfs.chdir(path)
- end
- report_format("using format path %a",dir.current())
+ local silent=arguments.silent
+ local errors=arguments.errors
local texsourcename=""
+ local texsourcepath=""
local fulltexsourcename=""
if engine=="luametatex" then
- texsourcename=file.addsuffix(name,"mkxl")
+ texsourcename=file.addsuffix(formatname,"mkxl")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"mkiv")
+ texsourcename=file.addsuffix(formatname,"mkiv")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"tex")
+ texsourcename=file.addsuffix(formatname,"tex")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",name)
- lfs.chdir(olddir)
+ report_format("no tex source file with name %a (mkiv or tex)",formatname)
return
- else
- report_format("using tex source file %a",fulltexsourcename)
end
- local texsourcepath=dir.expandname(file.dirname(fulltexsourcename))
- local specificationname=file.replacesuffix(fulltexsourcename,"lus")
- local fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
- if fullspecificationname=="" then
- specificationname=file.join(texsourcepath,"context.lus")
- fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
+ report_format("using tex source file %a",fulltexsourcename)
+ fulltexsourcename=dir.expandname(fulltexsourcename)
+ texsourcepath=file.dirname(fulltexsourcename)
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
end
+ local specificationname="context.lus"
+ local specificationpath=""
+ local fullspecificationname=resolvers.findfile(specificationname) or ""
if fullspecificationname=="" then
- report_format("unknown stub specification %a",specificationname)
- lfs.chdir(olddir)
+ report_format("unable to locate specification file %a",specificationname)
+ return
+ end
+ report_format("using specification file %a",fullspecificationname)
+ fullspecificationname=dir.expandname(fullspecificationname)
+ specificationpath=file.dirname(fullspecificationname)
+ if texsourcepath~=specificationpath then
+ report_format("tex source file and specification file are on different paths")
+ return
+ end
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
+ end
+ if not lfs.isfile(fullspecificationname) then
+ report_format("no accessible specification file with name %a",fulltexsourcename)
+ return
+ end
+ report_format("using tex source path %a",texsourcepath)
+ local validformatpath=caches.getwritablepath("formats",engine) or ""
+ local startupdir=dir.current()
+ if validformatpath=="" then
+ report_format("invalid format path, insufficient write access")
+ return
+ end
+ local binarypath=validbinarypath()
+ report_format("changing to format path %a",validformatpath)
+ lfs.chdir(validformatpath)
+ if dir.current()~=validformatpath then
+ report_format("unable to change to format path %a",validformatpath)
return
end
- local specificationpath=file.dirname(fullspecificationname)
local usedluastub=nil
local usedlualibs=dofile(fullspecificationname)
if type(usedlualibs)=="string" then
- usedluastub=file.join(file.dirname(fullspecificationname),usedlualibs)
+ usedluastub=file.join(specificationpath,usedlualibs)
elseif type(usedlualibs)=="table" then
report_format("using stub specification %a",fullspecificationname)
local texbasename=file.basename(name)
@@ -25761,48 +25830,57 @@ function environment.make_format(name,arguments)
end
else
report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(olddir)
+ lfs.chdir(startupdir)
return
end
+ local runner=runners[engine]
+ if not runner then
+ report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
+ lfs.chdir(startupdir)
+ return
+ end
+ local primaryflags=primaryflags(arguments)
+ local secondaryflags=secondaryflags(arguments)
local specification={
- primaryflags=primaryflags(),
- secondaryflags=secondaryflags(),
+ binarypath=binarypath,
+ primaryflags=primaryflags,
+ secondaryflags=secondaryflags,
luafile=quoted(usedluastub),
texfile=quoted(fulltexsourcename),
dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be generated, no runner available for engine %a",name,engine)
- elseif silent then
- statistics.starttiming()
+ if silent then
specification.redirect="> temp.log"
- local result=runner(specification)
- local runtime=statistics.stoptiming()
- if result~=0 then
- print(format("%s silent make > fatal error when making format %q",engine,name))
- else
- print(format("%s silent make > format %q made in %.3f seconds",engine,name,runtime))
- end
+ end
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if silent then
os.remove("temp.log")
- else
- runner(specification)
end
- local pattern=file.removesuffix(file.basename(usedluastub)).."-*.mem"
- local mp=dir.glob(pattern)
- if mp then
- for i=1,#mp do
- local name=mp[i]
- report_format("removing related mplib format %a",file.basename(name))
- os.remove(name)
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath or "?")
end
- end
- lfs.chdir(olddir)
+ report_format("format path : %s",validformatpath)
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",usedluastub)
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("context file : %s",fulltexsourcename)
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
+ lfs.chdir(startupdir)
end
-local template=[[%flags% --fmt=%fmtfile% --lua=%luafile% %texfile% %more%]]
+local template=[[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
local checkers={
- flags="string",
- more="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
fmtfile="readable",
luafile="readable",
texfile="readable",
@@ -25815,6 +25893,13 @@ local runners={
checkers=checkers,
reporter=report_format,
},
+ luametatex=sandbox.registerrunner {
+ name="run luametatex format",
+ program="luametatex",
+ template=template,
+ checkers=checkers,
+ reporter=report_format,
+ },
luajittex=sandbox.registerrunner {
name="run luajittex format",
program="luajittex",
@@ -25823,42 +25908,69 @@ local runners={
reporter=report_format,
},
}
-function environment.run_format(name,data,more)
- if name and name~="" then
- local engine=environment.ownmain or "luatex"
- local barename=file.removesuffix(name)
- local fmtname=caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats",engine)
- if fmtname=="" then
- fmtname=resolvers.findfile(file.addsuffix(barename,"fmt")) or ""
- end
- fmtname=resolvers.cleanpath(fmtname)
- if fmtname=="" then
- report_format("no format with name %a",name)
- else
- local barename=file.removesuffix(name)
- local luaname=file.addsuffix(barename,"luc")
- if not lfs.isfile(luaname) then
- luaname=file.addsuffix(barename,"lua")
- end
- if not lfs.isfile(luaname) then
- report_format("using format name %a",fmtname)
- report_format("no luc/lua file with name %a",barename)
- else
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be run, no runner available for engine %a",name,engine)
- else
- runner {
- flags=primaryflags(),
- fmtfile=quoted(barename),
- luafile=quoted(luaname),
- texfile=quoted(data),
- more=more,
- }
- end
- end
- end
+function environment.run_format(formatname,scriptname,filename,primaryflags,secondaryflags,verbose)
+ local engine=environment.ownmain or "luatex"
+ if not formatname or formatname=="" then
+ report_format("missing format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("missing script name")
+ return
+ end
+ if not lfs.isfile(formatname) or not lfs.isfile(scriptname) then
+ formatname,scriptname=resolvers.locateformat(formatname)
+ end
+ if not formatname or formatname=="" then
+ report_format("invalid format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("invalid script name")
+ return
+ end
+ local runner=runners[engine]
+ if not runner then
+ report_format("format %a cannot be run, no runner available for engine %a",file.nameonly(name),engine)
+ return
+ end
+ if not filename then
+ filename ""
+ end
+ local binarypath=validbinarypath()
+ local specification={
+ binarypath=binarypath,
+ primaryflags=primaryflags or "",
+ secondaryflags=secondaryflags or "",
+ fmtfile=quoted(formatname),
+ luafile=quoted(scriptname),
+ texfile=filename~="" and quoted(filename) or "",
+ }
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if verbose then
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath)
+ end
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",scriptname)
+ report_format("tex format file : %s",formatname)
+ if filename~="" then
+ report_format("tex input file : %s",filename)
+ end
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
end
+ return result
end
@@ -25866,8 +25978,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 util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1030892
--- stripped bytes : 407938
+-- original bytes : 1036593
+-- stripped bytes : 410200
-- end library merge
@@ -26149,6 +26261,7 @@ local helpinfo = [[
<flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag>
<flag name="windows"><short>create windows (mswin) stubs</short></flag>
<flag name="unix"><short>create unix (linux) stubs</short></flag>
+ <flag name="addbinarypath"><short>prepend the (found) binarypath to runners</short></flag>
</subcategory>
<subcategory>
<flag name="verbose"><short>give a bit more info</short></flag>
@@ -27008,17 +27121,17 @@ do
end
-if e_argument("ansi") or e_argument("ansilog") then
+-- if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
+-- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
- local script = e_argument("script") or e_argument("scripts")
+-- -- local script = e_argument("script") or e_argument("scripts")
+-- --
+-- -- if type(script) == "string" then
+-- -- logs.writer("]0;"..script.."") -- for Alan to test
+-- -- end
- if type(script) == "string" then
- logs.writer("]0;"..script.."") -- for Alan to test
- end
-
-end
+-- end
if e_argument("script") or e_argument("scripts") then
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index cdc396edc..fbbf3d2a2 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6520, stripped down to: 2988
+-- original size: 6529, stripped down to: 2933
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -212,9 +212,6 @@ if LUAVERSION<5.2 and jit then
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -12953,7 +12950,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32900, stripped down to: 21131
+-- original size: 33803, stripped down to: 21818
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12998,17 +12995,30 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
+local function ansisupported(specification)
+ if specification~="ansi" and specification~="ansilog" then
+ return false
+ elseif os and os.enableansi then
+ return os.enableansi()
+ else
+ return false
+ end
+end
if runningtex and texio then
if texio.setescape then
texio.setescape(0)
end
- if arg then
+ if arg and ansisupported then
for k,v in next,arg do
if v=="--ansi" or v=="--c:ansi" then
- variant="ansi"
+ if ansisupported("ansi") then
+ variant="ansi"
+ end
break
elseif v=="--ansilog" or v=="--c:ansilog" then
- variant="ansilog"
+ if ansisupported("ansilog") then
+ variant="ansilog"
+ end
break
end
end
@@ -13223,6 +13233,9 @@ if runningtex and texio then
t=specification.targets
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
t=v.targets
@@ -13342,6 +13355,9 @@ else
if type(specification)=="table" then
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
f=v.formats
@@ -13669,6 +13685,13 @@ local exporters={
logs.reporters=reporters
logs.exporters=exporters
function logs.application(t)
+ local arguments=environment and environment.arguments
+ if arguments then
+ local ansi=arguments.ansi or arguments.ansilog
+ if ansi then
+ logs.setformatters(arguments.ansi and "ansi" or "ansilog")
+ end
+ end
t.name=t.name or "unknown"
t.banner=t.banner
t.moreinfo=moreinfo
@@ -14861,7 +14884,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 20184, stripped down to: 12874
+-- original size: 21058, stripped down to: 13199
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15109,36 +15132,48 @@ local function validcommand(name,program,template,checkers,defaults,variables,re
if validbinaries~=false and (validbinaries==true or validbinaries[program]) then
if variables then
for variable,value in next,variables do
- local checker=validators[checkers[variable]]
- if checker then
- value=checker(unquoted(value),strict)
- if value then
- variables[variable]=optionalquoted(value)
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ value=checker(unquoted(value),strict)
+ if value then
+ variables[variable]=optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
else
- report("variable %a with value %a fails the check",variable,value)
+ report("variable %a has no checker",variable)
return
end
- else
- report("variable %a has no checker",variable)
- return
end
end
for variable,default in next,defaults do
local value=variables[variable]
if not value or value=="" then
- local checker=validators[checkers[variable]]
- if checker then
- default=checker(unquoted(default),strict)
- if default then
- variables[variable]=optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ default=checker(unquoted(default),strict)
+ if default then
+ variables[variable]=optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
end
end
end
end
end
+ local binpath=variables.binarypath
+ if type(binpath)=="string" and binpath~="" then
+ program=binpath.."/"..program
+ end
local command=program.." "..replace(template,variables)
if reporter then
reporter("executing runner %a: %s",name,command)
@@ -15172,7 +15207,8 @@ local runners={
if trace then
report("execute: %s",command)
end
- return osexecute(command)
+ local okay=osexecute(command)
+ return okay
end
end,
pipeto=function(...)
@@ -15206,7 +15242,7 @@ function sandbox.registerrunner(specification)
return
end
if validrunners[name] then
- report("invalid name, runner %a already defined")
+ report("invalid name, runner %a already defined",name)
return
end
local program=specification.program
@@ -22087,7 +22123,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 68194, stripped down to: 43699
+-- original size: 68209, stripped down to: 43711
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -23601,7 +23637,7 @@ function resolvers.dowithvariable(name,func)
end
function resolvers.locateformat(name)
local engine=environment.ownmain or "luatex"
- local barename=removesuffix(name)
+ local barename=removesuffix(file.basename(name))
local fullname=addsuffix(barename,"fmt")
local fmtname=caches.getfirstreadablefile(fullname,"formats",engine) or ""
if fmtname=="" then
@@ -23614,11 +23650,11 @@ function resolvers.locateformat(name)
local lucname=addsuffix(barename,luasuffixes.luc)
local luiname=addsuffix(barename,luasuffixes.lui)
if isfile(luiname) then
- return barename,luiname
+ return fmtname,luiname
elseif isfile(lucname) then
- return barename,lucname
+ return fmtname,lucname
elseif isfile(luaname) then
- return barename,luaname
+ return fmtname,luaname
end
end
return nil,nil
@@ -24702,7 +24738,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-sch"] = package.loaded["data-sch"] or true
--- original size: 6753, stripped down to: 5268
+-- original size: 6757, stripped down to: 5272
if not modules then modules={} end modules ['data-sch']={
version=1.001,
@@ -24758,7 +24794,7 @@ local runner=sandbox.registerrunner {
name="curl resolver",
method="execute",
program="curl",
- template="--silent --insecure --create-dirs --output %cachename% %original%",
+ template='--silent --insecure --create-dirs --output "%cachename%" "%original%"',
checkers={
cachename="cache",
original="url",
@@ -25609,7 +25645,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9998, stripped down to: 7540
+-- original size: 13894, stripped down to: 10006
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25623,16 +25659,14 @@ local concat=table.concat
local quoted=string.quoted
local luasuffixes=utilities.lua.suffixes
local report_format=logs.reporter("resolvers","formats")
-local function primaryflags()
- local arguments=environment.arguments
+local function primaryflags(arguments)
local flags={}
if arguments.silent then
flags[#flags+1]="--interaction=batchmode"
end
return concat(flags," ")
end
-local function secondaryflags()
- local arguments=environment.arguments
+local function secondaryflags(arguments)
local trackers=arguments.trackers
local directives=arguments.directives
local flags={}
@@ -25667,12 +25701,13 @@ local function secondaryflags()
end
local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
local checkers={
- primaryflags="string",
- secondaryflags="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
dump="string",
+ binarypath="string",
}
local runners={
luatex=sandbox.registerrunner {
@@ -25697,54 +25732,88 @@ local runners={
reporter=report_format,
},
}
-function environment.make_format(name,arguments)
+local function validbinarypath()
+ if environment.arguments.addbinarypath then
+ local binarypath=environment.ownpath or ""
+ if binarypath~="" then
+ binarypath=dir.expandname(binarypath)
+ if lfs.isdir(binarypath) then
+ return binarypath
+ end
+ end
+ end
+end
+function environment.make_format(formatname)
+ local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
- local silent=environment.arguments.silent
- local errors=environment.arguments.errors
- local olddir=dir.current()
- local path=caches.getwritablepath("formats",engine) or ""
- if path~="" then
- lfs.chdir(path)
- end
- report_format("using format path %a",dir.current())
+ local silent=arguments.silent
+ local errors=arguments.errors
local texsourcename=""
+ local texsourcepath=""
local fulltexsourcename=""
if engine=="luametatex" then
- texsourcename=file.addsuffix(name,"mkxl")
+ texsourcename=file.addsuffix(formatname,"mkxl")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"mkiv")
+ texsourcename=file.addsuffix(formatname,"mkiv")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"tex")
+ texsourcename=file.addsuffix(formatname,"tex")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",name)
- lfs.chdir(olddir)
+ report_format("no tex source file with name %a (mkiv or tex)",formatname)
return
- else
- report_format("using tex source file %a",fulltexsourcename)
end
- local texsourcepath=dir.expandname(file.dirname(fulltexsourcename))
- local specificationname=file.replacesuffix(fulltexsourcename,"lus")
- local fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
- if fullspecificationname=="" then
- specificationname=file.join(texsourcepath,"context.lus")
- fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
+ report_format("using tex source file %a",fulltexsourcename)
+ fulltexsourcename=dir.expandname(fulltexsourcename)
+ texsourcepath=file.dirname(fulltexsourcename)
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
end
+ local specificationname="context.lus"
+ local specificationpath=""
+ local fullspecificationname=resolvers.findfile(specificationname) or ""
if fullspecificationname=="" then
- report_format("unknown stub specification %a",specificationname)
- lfs.chdir(olddir)
+ report_format("unable to locate specification file %a",specificationname)
+ return
+ end
+ report_format("using specification file %a",fullspecificationname)
+ fullspecificationname=dir.expandname(fullspecificationname)
+ specificationpath=file.dirname(fullspecificationname)
+ if texsourcepath~=specificationpath then
+ report_format("tex source file and specification file are on different paths")
+ return
+ end
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
+ end
+ if not lfs.isfile(fullspecificationname) then
+ report_format("no accessible specification file with name %a",fulltexsourcename)
+ return
+ end
+ report_format("using tex source path %a",texsourcepath)
+ local validformatpath=caches.getwritablepath("formats",engine) or ""
+ local startupdir=dir.current()
+ if validformatpath=="" then
+ report_format("invalid format path, insufficient write access")
+ return
+ end
+ local binarypath=validbinarypath()
+ report_format("changing to format path %a",validformatpath)
+ lfs.chdir(validformatpath)
+ if dir.current()~=validformatpath then
+ report_format("unable to change to format path %a",validformatpath)
return
end
- local specificationpath=file.dirname(fullspecificationname)
local usedluastub=nil
local usedlualibs=dofile(fullspecificationname)
if type(usedlualibs)=="string" then
- usedluastub=file.join(file.dirname(fullspecificationname),usedlualibs)
+ usedluastub=file.join(specificationpath,usedlualibs)
elseif type(usedlualibs)=="table" then
report_format("using stub specification %a",fullspecificationname)
local texbasename=file.basename(name)
@@ -25761,48 +25830,57 @@ function environment.make_format(name,arguments)
end
else
report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(olddir)
+ lfs.chdir(startupdir)
return
end
+ local runner=runners[engine]
+ if not runner then
+ report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
+ lfs.chdir(startupdir)
+ return
+ end
+ local primaryflags=primaryflags(arguments)
+ local secondaryflags=secondaryflags(arguments)
local specification={
- primaryflags=primaryflags(),
- secondaryflags=secondaryflags(),
+ binarypath=binarypath,
+ primaryflags=primaryflags,
+ secondaryflags=secondaryflags,
luafile=quoted(usedluastub),
texfile=quoted(fulltexsourcename),
dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be generated, no runner available for engine %a",name,engine)
- elseif silent then
- statistics.starttiming()
+ if silent then
specification.redirect="> temp.log"
- local result=runner(specification)
- local runtime=statistics.stoptiming()
- if result~=0 then
- print(format("%s silent make > fatal error when making format %q",engine,name))
- else
- print(format("%s silent make > format %q made in %.3f seconds",engine,name,runtime))
- end
+ end
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if silent then
os.remove("temp.log")
- else
- runner(specification)
end
- local pattern=file.removesuffix(file.basename(usedluastub)).."-*.mem"
- local mp=dir.glob(pattern)
- if mp then
- for i=1,#mp do
- local name=mp[i]
- report_format("removing related mplib format %a",file.basename(name))
- os.remove(name)
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath or "?")
end
- end
- lfs.chdir(olddir)
+ report_format("format path : %s",validformatpath)
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",usedluastub)
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("context file : %s",fulltexsourcename)
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
+ lfs.chdir(startupdir)
end
-local template=[[%flags% --fmt=%fmtfile% --lua=%luafile% %texfile% %more%]]
+local template=[[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
local checkers={
- flags="string",
- more="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
fmtfile="readable",
luafile="readable",
texfile="readable",
@@ -25815,6 +25893,13 @@ local runners={
checkers=checkers,
reporter=report_format,
},
+ luametatex=sandbox.registerrunner {
+ name="run luametatex format",
+ program="luametatex",
+ template=template,
+ checkers=checkers,
+ reporter=report_format,
+ },
luajittex=sandbox.registerrunner {
name="run luajittex format",
program="luajittex",
@@ -25823,42 +25908,69 @@ local runners={
reporter=report_format,
},
}
-function environment.run_format(name,data,more)
- if name and name~="" then
- local engine=environment.ownmain or "luatex"
- local barename=file.removesuffix(name)
- local fmtname=caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats",engine)
- if fmtname=="" then
- fmtname=resolvers.findfile(file.addsuffix(barename,"fmt")) or ""
- end
- fmtname=resolvers.cleanpath(fmtname)
- if fmtname=="" then
- report_format("no format with name %a",name)
- else
- local barename=file.removesuffix(name)
- local luaname=file.addsuffix(barename,"luc")
- if not lfs.isfile(luaname) then
- luaname=file.addsuffix(barename,"lua")
- end
- if not lfs.isfile(luaname) then
- report_format("using format name %a",fmtname)
- report_format("no luc/lua file with name %a",barename)
- else
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be run, no runner available for engine %a",name,engine)
- else
- runner {
- flags=primaryflags(),
- fmtfile=quoted(barename),
- luafile=quoted(luaname),
- texfile=quoted(data),
- more=more,
- }
- end
- end
- end
+function environment.run_format(formatname,scriptname,filename,primaryflags,secondaryflags,verbose)
+ local engine=environment.ownmain or "luatex"
+ if not formatname or formatname=="" then
+ report_format("missing format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("missing script name")
+ return
+ end
+ if not lfs.isfile(formatname) or not lfs.isfile(scriptname) then
+ formatname,scriptname=resolvers.locateformat(formatname)
+ end
+ if not formatname or formatname=="" then
+ report_format("invalid format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("invalid script name")
+ return
+ end
+ local runner=runners[engine]
+ if not runner then
+ report_format("format %a cannot be run, no runner available for engine %a",file.nameonly(name),engine)
+ return
+ end
+ if not filename then
+ filename ""
+ end
+ local binarypath=validbinarypath()
+ local specification={
+ binarypath=binarypath,
+ primaryflags=primaryflags or "",
+ secondaryflags=secondaryflags or "",
+ fmtfile=quoted(formatname),
+ luafile=quoted(scriptname),
+ texfile=filename~="" and quoted(filename) or "",
+ }
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if verbose then
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath)
+ end
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",scriptname)
+ report_format("tex format file : %s",formatname)
+ if filename~="" then
+ report_format("tex input file : %s",filename)
+ end
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
end
+ return result
end
@@ -25866,8 +25978,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 util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1030892
--- stripped bytes : 407938
+-- original bytes : 1036593
+-- stripped bytes : 410200
-- end library merge
@@ -26149,6 +26261,7 @@ local helpinfo = [[
<flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag>
<flag name="windows"><short>create windows (mswin) stubs</short></flag>
<flag name="unix"><short>create unix (linux) stubs</short></flag>
+ <flag name="addbinarypath"><short>prepend the (found) binarypath to runners</short></flag>
</subcategory>
<subcategory>
<flag name="verbose"><short>give a bit more info</short></flag>
@@ -27008,17 +27121,17 @@ do
end
-if e_argument("ansi") or e_argument("ansilog") then
+-- if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
+-- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
- local script = e_argument("script") or e_argument("scripts")
+-- -- local script = e_argument("script") or e_argument("scripts")
+-- --
+-- -- if type(script) == "string" then
+-- -- logs.writer("]0;"..script.."") -- for Alan to test
+-- -- end
- if type(script) == "string" then
- logs.writer("]0;"..script.."") -- for Alan to test
- end
-
-end
+-- end
if e_argument("script") or e_argument("scripts") then
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index cdc396edc..fbbf3d2a2 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6520, stripped down to: 2988
+-- original size: 6529, stripped down to: 2933
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -212,9 +212,6 @@ if LUAVERSION<5.2 and jit then
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -12953,7 +12950,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32900, stripped down to: 21131
+-- original size: 33803, stripped down to: 21818
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12998,17 +12995,30 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
+local function ansisupported(specification)
+ if specification~="ansi" and specification~="ansilog" then
+ return false
+ elseif os and os.enableansi then
+ return os.enableansi()
+ else
+ return false
+ end
+end
if runningtex and texio then
if texio.setescape then
texio.setescape(0)
end
- if arg then
+ if arg and ansisupported then
for k,v in next,arg do
if v=="--ansi" or v=="--c:ansi" then
- variant="ansi"
+ if ansisupported("ansi") then
+ variant="ansi"
+ end
break
elseif v=="--ansilog" or v=="--c:ansilog" then
- variant="ansilog"
+ if ansisupported("ansilog") then
+ variant="ansilog"
+ end
break
end
end
@@ -13223,6 +13233,9 @@ if runningtex and texio then
t=specification.targets
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
t=v.targets
@@ -13342,6 +13355,9 @@ else
if type(specification)=="table" then
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
f=v.formats
@@ -13669,6 +13685,13 @@ local exporters={
logs.reporters=reporters
logs.exporters=exporters
function logs.application(t)
+ local arguments=environment and environment.arguments
+ if arguments then
+ local ansi=arguments.ansi or arguments.ansilog
+ if ansi then
+ logs.setformatters(arguments.ansi and "ansi" or "ansilog")
+ end
+ end
t.name=t.name or "unknown"
t.banner=t.banner
t.moreinfo=moreinfo
@@ -14861,7 +14884,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 20184, stripped down to: 12874
+-- original size: 21058, stripped down to: 13199
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15109,36 +15132,48 @@ local function validcommand(name,program,template,checkers,defaults,variables,re
if validbinaries~=false and (validbinaries==true or validbinaries[program]) then
if variables then
for variable,value in next,variables do
- local checker=validators[checkers[variable]]
- if checker then
- value=checker(unquoted(value),strict)
- if value then
- variables[variable]=optionalquoted(value)
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ value=checker(unquoted(value),strict)
+ if value then
+ variables[variable]=optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
else
- report("variable %a with value %a fails the check",variable,value)
+ report("variable %a has no checker",variable)
return
end
- else
- report("variable %a has no checker",variable)
- return
end
end
for variable,default in next,defaults do
local value=variables[variable]
if not value or value=="" then
- local checker=validators[checkers[variable]]
- if checker then
- default=checker(unquoted(default),strict)
- if default then
- variables[variable]=optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ default=checker(unquoted(default),strict)
+ if default then
+ variables[variable]=optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
end
end
end
end
end
+ local binpath=variables.binarypath
+ if type(binpath)=="string" and binpath~="" then
+ program=binpath.."/"..program
+ end
local command=program.." "..replace(template,variables)
if reporter then
reporter("executing runner %a: %s",name,command)
@@ -15172,7 +15207,8 @@ local runners={
if trace then
report("execute: %s",command)
end
- return osexecute(command)
+ local okay=osexecute(command)
+ return okay
end
end,
pipeto=function(...)
@@ -15206,7 +15242,7 @@ function sandbox.registerrunner(specification)
return
end
if validrunners[name] then
- report("invalid name, runner %a already defined")
+ report("invalid name, runner %a already defined",name)
return
end
local program=specification.program
@@ -22087,7 +22123,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 68194, stripped down to: 43699
+-- original size: 68209, stripped down to: 43711
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -23601,7 +23637,7 @@ function resolvers.dowithvariable(name,func)
end
function resolvers.locateformat(name)
local engine=environment.ownmain or "luatex"
- local barename=removesuffix(name)
+ local barename=removesuffix(file.basename(name))
local fullname=addsuffix(barename,"fmt")
local fmtname=caches.getfirstreadablefile(fullname,"formats",engine) or ""
if fmtname=="" then
@@ -23614,11 +23650,11 @@ function resolvers.locateformat(name)
local lucname=addsuffix(barename,luasuffixes.luc)
local luiname=addsuffix(barename,luasuffixes.lui)
if isfile(luiname) then
- return barename,luiname
+ return fmtname,luiname
elseif isfile(lucname) then
- return barename,lucname
+ return fmtname,lucname
elseif isfile(luaname) then
- return barename,luaname
+ return fmtname,luaname
end
end
return nil,nil
@@ -24702,7 +24738,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-sch"] = package.loaded["data-sch"] or true
--- original size: 6753, stripped down to: 5268
+-- original size: 6757, stripped down to: 5272
if not modules then modules={} end modules ['data-sch']={
version=1.001,
@@ -24758,7 +24794,7 @@ local runner=sandbox.registerrunner {
name="curl resolver",
method="execute",
program="curl",
- template="--silent --insecure --create-dirs --output %cachename% %original%",
+ template='--silent --insecure --create-dirs --output "%cachename%" "%original%"',
checkers={
cachename="cache",
original="url",
@@ -25609,7 +25645,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9998, stripped down to: 7540
+-- original size: 13894, stripped down to: 10006
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25623,16 +25659,14 @@ local concat=table.concat
local quoted=string.quoted
local luasuffixes=utilities.lua.suffixes
local report_format=logs.reporter("resolvers","formats")
-local function primaryflags()
- local arguments=environment.arguments
+local function primaryflags(arguments)
local flags={}
if arguments.silent then
flags[#flags+1]="--interaction=batchmode"
end
return concat(flags," ")
end
-local function secondaryflags()
- local arguments=environment.arguments
+local function secondaryflags(arguments)
local trackers=arguments.trackers
local directives=arguments.directives
local flags={}
@@ -25667,12 +25701,13 @@ local function secondaryflags()
end
local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
local checkers={
- primaryflags="string",
- secondaryflags="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
dump="string",
+ binarypath="string",
}
local runners={
luatex=sandbox.registerrunner {
@@ -25697,54 +25732,88 @@ local runners={
reporter=report_format,
},
}
-function environment.make_format(name,arguments)
+local function validbinarypath()
+ if environment.arguments.addbinarypath then
+ local binarypath=environment.ownpath or ""
+ if binarypath~="" then
+ binarypath=dir.expandname(binarypath)
+ if lfs.isdir(binarypath) then
+ return binarypath
+ end
+ end
+ end
+end
+function environment.make_format(formatname)
+ local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
- local silent=environment.arguments.silent
- local errors=environment.arguments.errors
- local olddir=dir.current()
- local path=caches.getwritablepath("formats",engine) or ""
- if path~="" then
- lfs.chdir(path)
- end
- report_format("using format path %a",dir.current())
+ local silent=arguments.silent
+ local errors=arguments.errors
local texsourcename=""
+ local texsourcepath=""
local fulltexsourcename=""
if engine=="luametatex" then
- texsourcename=file.addsuffix(name,"mkxl")
+ texsourcename=file.addsuffix(formatname,"mkxl")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"mkiv")
+ texsourcename=file.addsuffix(formatname,"mkiv")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"tex")
+ texsourcename=file.addsuffix(formatname,"tex")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",name)
- lfs.chdir(olddir)
+ report_format("no tex source file with name %a (mkiv or tex)",formatname)
return
- else
- report_format("using tex source file %a",fulltexsourcename)
end
- local texsourcepath=dir.expandname(file.dirname(fulltexsourcename))
- local specificationname=file.replacesuffix(fulltexsourcename,"lus")
- local fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
- if fullspecificationname=="" then
- specificationname=file.join(texsourcepath,"context.lus")
- fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
+ report_format("using tex source file %a",fulltexsourcename)
+ fulltexsourcename=dir.expandname(fulltexsourcename)
+ texsourcepath=file.dirname(fulltexsourcename)
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
end
+ local specificationname="context.lus"
+ local specificationpath=""
+ local fullspecificationname=resolvers.findfile(specificationname) or ""
if fullspecificationname=="" then
- report_format("unknown stub specification %a",specificationname)
- lfs.chdir(olddir)
+ report_format("unable to locate specification file %a",specificationname)
+ return
+ end
+ report_format("using specification file %a",fullspecificationname)
+ fullspecificationname=dir.expandname(fullspecificationname)
+ specificationpath=file.dirname(fullspecificationname)
+ if texsourcepath~=specificationpath then
+ report_format("tex source file and specification file are on different paths")
+ return
+ end
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
+ end
+ if not lfs.isfile(fullspecificationname) then
+ report_format("no accessible specification file with name %a",fulltexsourcename)
+ return
+ end
+ report_format("using tex source path %a",texsourcepath)
+ local validformatpath=caches.getwritablepath("formats",engine) or ""
+ local startupdir=dir.current()
+ if validformatpath=="" then
+ report_format("invalid format path, insufficient write access")
+ return
+ end
+ local binarypath=validbinarypath()
+ report_format("changing to format path %a",validformatpath)
+ lfs.chdir(validformatpath)
+ if dir.current()~=validformatpath then
+ report_format("unable to change to format path %a",validformatpath)
return
end
- local specificationpath=file.dirname(fullspecificationname)
local usedluastub=nil
local usedlualibs=dofile(fullspecificationname)
if type(usedlualibs)=="string" then
- usedluastub=file.join(file.dirname(fullspecificationname),usedlualibs)
+ usedluastub=file.join(specificationpath,usedlualibs)
elseif type(usedlualibs)=="table" then
report_format("using stub specification %a",fullspecificationname)
local texbasename=file.basename(name)
@@ -25761,48 +25830,57 @@ function environment.make_format(name,arguments)
end
else
report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(olddir)
+ lfs.chdir(startupdir)
return
end
+ local runner=runners[engine]
+ if not runner then
+ report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
+ lfs.chdir(startupdir)
+ return
+ end
+ local primaryflags=primaryflags(arguments)
+ local secondaryflags=secondaryflags(arguments)
local specification={
- primaryflags=primaryflags(),
- secondaryflags=secondaryflags(),
+ binarypath=binarypath,
+ primaryflags=primaryflags,
+ secondaryflags=secondaryflags,
luafile=quoted(usedluastub),
texfile=quoted(fulltexsourcename),
dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be generated, no runner available for engine %a",name,engine)
- elseif silent then
- statistics.starttiming()
+ if silent then
specification.redirect="> temp.log"
- local result=runner(specification)
- local runtime=statistics.stoptiming()
- if result~=0 then
- print(format("%s silent make > fatal error when making format %q",engine,name))
- else
- print(format("%s silent make > format %q made in %.3f seconds",engine,name,runtime))
- end
+ end
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if silent then
os.remove("temp.log")
- else
- runner(specification)
end
- local pattern=file.removesuffix(file.basename(usedluastub)).."-*.mem"
- local mp=dir.glob(pattern)
- if mp then
- for i=1,#mp do
- local name=mp[i]
- report_format("removing related mplib format %a",file.basename(name))
- os.remove(name)
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath or "?")
end
- end
- lfs.chdir(olddir)
+ report_format("format path : %s",validformatpath)
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",usedluastub)
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("context file : %s",fulltexsourcename)
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
+ lfs.chdir(startupdir)
end
-local template=[[%flags% --fmt=%fmtfile% --lua=%luafile% %texfile% %more%]]
+local template=[[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
local checkers={
- flags="string",
- more="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
fmtfile="readable",
luafile="readable",
texfile="readable",
@@ -25815,6 +25893,13 @@ local runners={
checkers=checkers,
reporter=report_format,
},
+ luametatex=sandbox.registerrunner {
+ name="run luametatex format",
+ program="luametatex",
+ template=template,
+ checkers=checkers,
+ reporter=report_format,
+ },
luajittex=sandbox.registerrunner {
name="run luajittex format",
program="luajittex",
@@ -25823,42 +25908,69 @@ local runners={
reporter=report_format,
},
}
-function environment.run_format(name,data,more)
- if name and name~="" then
- local engine=environment.ownmain or "luatex"
- local barename=file.removesuffix(name)
- local fmtname=caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats",engine)
- if fmtname=="" then
- fmtname=resolvers.findfile(file.addsuffix(barename,"fmt")) or ""
- end
- fmtname=resolvers.cleanpath(fmtname)
- if fmtname=="" then
- report_format("no format with name %a",name)
- else
- local barename=file.removesuffix(name)
- local luaname=file.addsuffix(barename,"luc")
- if not lfs.isfile(luaname) then
- luaname=file.addsuffix(barename,"lua")
- end
- if not lfs.isfile(luaname) then
- report_format("using format name %a",fmtname)
- report_format("no luc/lua file with name %a",barename)
- else
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be run, no runner available for engine %a",name,engine)
- else
- runner {
- flags=primaryflags(),
- fmtfile=quoted(barename),
- luafile=quoted(luaname),
- texfile=quoted(data),
- more=more,
- }
- end
- end
- end
+function environment.run_format(formatname,scriptname,filename,primaryflags,secondaryflags,verbose)
+ local engine=environment.ownmain or "luatex"
+ if not formatname or formatname=="" then
+ report_format("missing format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("missing script name")
+ return
+ end
+ if not lfs.isfile(formatname) or not lfs.isfile(scriptname) then
+ formatname,scriptname=resolvers.locateformat(formatname)
+ end
+ if not formatname or formatname=="" then
+ report_format("invalid format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("invalid script name")
+ return
+ end
+ local runner=runners[engine]
+ if not runner then
+ report_format("format %a cannot be run, no runner available for engine %a",file.nameonly(name),engine)
+ return
+ end
+ if not filename then
+ filename ""
+ end
+ local binarypath=validbinarypath()
+ local specification={
+ binarypath=binarypath,
+ primaryflags=primaryflags or "",
+ secondaryflags=secondaryflags or "",
+ fmtfile=quoted(formatname),
+ luafile=quoted(scriptname),
+ texfile=filename~="" and quoted(filename) or "",
+ }
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if verbose then
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath)
+ end
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",scriptname)
+ report_format("tex format file : %s",formatname)
+ if filename~="" then
+ report_format("tex input file : %s",filename)
+ end
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
end
+ return result
end
@@ -25866,8 +25978,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 util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1030892
--- stripped bytes : 407938
+-- original bytes : 1036593
+-- stripped bytes : 410200
-- end library merge
@@ -26149,6 +26261,7 @@ local helpinfo = [[
<flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag>
<flag name="windows"><short>create windows (mswin) stubs</short></flag>
<flag name="unix"><short>create unix (linux) stubs</short></flag>
+ <flag name="addbinarypath"><short>prepend the (found) binarypath to runners</short></flag>
</subcategory>
<subcategory>
<flag name="verbose"><short>give a bit more info</short></flag>
@@ -27008,17 +27121,17 @@ do
end
-if e_argument("ansi") or e_argument("ansilog") then
+-- if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
+-- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
- local script = e_argument("script") or e_argument("scripts")
+-- -- local script = e_argument("script") or e_argument("scripts")
+-- --
+-- -- if type(script) == "string" then
+-- -- logs.writer("]0;"..script.."") -- for Alan to test
+-- -- end
- if type(script) == "string" then
- logs.writer("]0;"..script.."") -- for Alan to test
- end
-
-end
+-- end
if e_argument("script") or e_argument("scripts") then
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index cdc396edc..fbbf3d2a2 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6520, stripped down to: 2988
+-- original size: 6529, stripped down to: 2933
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -212,9 +212,6 @@ if LUAVERSION<5.2 and jit then
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -12953,7 +12950,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 32900, stripped down to: 21131
+-- original size: 33803, stripped down to: 21818
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -12998,17 +12995,30 @@ local function ignore() end
setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters,newline
+local function ansisupported(specification)
+ if specification~="ansi" and specification~="ansilog" then
+ return false
+ elseif os and os.enableansi then
+ return os.enableansi()
+ else
+ return false
+ end
+end
if runningtex and texio then
if texio.setescape then
texio.setescape(0)
end
- if arg then
+ if arg and ansisupported then
for k,v in next,arg do
if v=="--ansi" or v=="--c:ansi" then
- variant="ansi"
+ if ansisupported("ansi") then
+ variant="ansi"
+ end
break
elseif v=="--ansilog" or v=="--c:ansilog" then
- variant="ansilog"
+ if ansisupported("ansilog") then
+ variant="ansilog"
+ end
break
end
end
@@ -13223,6 +13233,9 @@ if runningtex and texio then
t=specification.targets
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
t=v.targets
@@ -13342,6 +13355,9 @@ else
if type(specification)=="table" then
f=specification.formats or specification
else
+ if not ansisupported(specification) then
+ specification="default"
+ end
local v=variants[specification]
if v then
f=v.formats
@@ -13669,6 +13685,13 @@ local exporters={
logs.reporters=reporters
logs.exporters=exporters
function logs.application(t)
+ local arguments=environment and environment.arguments
+ if arguments then
+ local ansi=arguments.ansi or arguments.ansilog
+ if ansi then
+ logs.setformatters(arguments.ansi and "ansi" or "ansilog")
+ end
+ end
t.name=t.name or "unknown"
t.banner=t.banner
t.moreinfo=moreinfo
@@ -14861,7 +14884,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sbx"] = package.loaded["util-sbx"] or true
--- original size: 20184, stripped down to: 12874
+-- original size: 21058, stripped down to: 13199
if not modules then modules={} end modules ['util-sbx']={
version=1.001,
@@ -15109,36 +15132,48 @@ local function validcommand(name,program,template,checkers,defaults,variables,re
if validbinaries~=false and (validbinaries==true or validbinaries[program]) then
if variables then
for variable,value in next,variables do
- local checker=validators[checkers[variable]]
- if checker then
- value=checker(unquoted(value),strict)
- if value then
- variables[variable]=optionalquoted(value)
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ value=checker(unquoted(value),strict)
+ if value then
+ variables[variable]=optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
else
- report("variable %a with value %a fails the check",variable,value)
+ report("variable %a has no checker",variable)
return
end
- else
- report("variable %a has no checker",variable)
- return
end
end
for variable,default in next,defaults do
local value=variables[variable]
if not value or value=="" then
- local checker=validators[checkers[variable]]
- if checker then
- default=checker(unquoted(default),strict)
- if default then
- variables[variable]=optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
+ local chktype=checkers[variable]
+ if chktype=="verbose" then
+ else
+ local checker=validators[chktype]
+ if checker then
+ default=checker(unquoted(default),strict)
+ if default then
+ variables[variable]=optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
end
end
end
end
end
+ local binpath=variables.binarypath
+ if type(binpath)=="string" and binpath~="" then
+ program=binpath.."/"..program
+ end
local command=program.." "..replace(template,variables)
if reporter then
reporter("executing runner %a: %s",name,command)
@@ -15172,7 +15207,8 @@ local runners={
if trace then
report("execute: %s",command)
end
- return osexecute(command)
+ local okay=osexecute(command)
+ return okay
end
end,
pipeto=function(...)
@@ -15206,7 +15242,7 @@ function sandbox.registerrunner(specification)
return
end
if validrunners[name] then
- report("invalid name, runner %a already defined")
+ report("invalid name, runner %a already defined",name)
return
end
local program=specification.program
@@ -22087,7 +22123,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-res"] = package.loaded["data-res"] or true
--- original size: 68194, stripped down to: 43699
+-- original size: 68209, stripped down to: 43711
if not modules then modules={} end modules ['data-res']={
version=1.001,
@@ -23601,7 +23637,7 @@ function resolvers.dowithvariable(name,func)
end
function resolvers.locateformat(name)
local engine=environment.ownmain or "luatex"
- local barename=removesuffix(name)
+ local barename=removesuffix(file.basename(name))
local fullname=addsuffix(barename,"fmt")
local fmtname=caches.getfirstreadablefile(fullname,"formats",engine) or ""
if fmtname=="" then
@@ -23614,11 +23650,11 @@ function resolvers.locateformat(name)
local lucname=addsuffix(barename,luasuffixes.luc)
local luiname=addsuffix(barename,luasuffixes.lui)
if isfile(luiname) then
- return barename,luiname
+ return fmtname,luiname
elseif isfile(lucname) then
- return barename,lucname
+ return fmtname,lucname
elseif isfile(luaname) then
- return barename,luaname
+ return fmtname,luaname
end
end
return nil,nil
@@ -24702,7 +24738,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-sch"] = package.loaded["data-sch"] or true
--- original size: 6753, stripped down to: 5268
+-- original size: 6757, stripped down to: 5272
if not modules then modules={} end modules ['data-sch']={
version=1.001,
@@ -24758,7 +24794,7 @@ local runner=sandbox.registerrunner {
name="curl resolver",
method="execute",
program="curl",
- template="--silent --insecure --create-dirs --output %cachename% %original%",
+ template='--silent --insecure --create-dirs --output "%cachename%" "%original%"',
checkers={
cachename="cache",
original="url",
@@ -25609,7 +25645,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 9998, stripped down to: 7540
+-- original size: 13894, stripped down to: 10006
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25623,16 +25659,14 @@ local concat=table.concat
local quoted=string.quoted
local luasuffixes=utilities.lua.suffixes
local report_format=logs.reporter("resolvers","formats")
-local function primaryflags()
- local arguments=environment.arguments
+local function primaryflags(arguments)
local flags={}
if arguments.silent then
flags[#flags+1]="--interaction=batchmode"
end
return concat(flags," ")
end
-local function secondaryflags()
- local arguments=environment.arguments
+local function secondaryflags(arguments)
local trackers=arguments.trackers
local directives=arguments.directives
local flags={}
@@ -25667,12 +25701,13 @@ local function secondaryflags()
end
local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
local checkers={
- primaryflags="string",
- secondaryflags="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
dump="string",
+ binarypath="string",
}
local runners={
luatex=sandbox.registerrunner {
@@ -25697,54 +25732,88 @@ local runners={
reporter=report_format,
},
}
-function environment.make_format(name,arguments)
+local function validbinarypath()
+ if environment.arguments.addbinarypath then
+ local binarypath=environment.ownpath or ""
+ if binarypath~="" then
+ binarypath=dir.expandname(binarypath)
+ if lfs.isdir(binarypath) then
+ return binarypath
+ end
+ end
+ end
+end
+function environment.make_format(formatname)
+ local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
- local silent=environment.arguments.silent
- local errors=environment.arguments.errors
- local olddir=dir.current()
- local path=caches.getwritablepath("formats",engine) or ""
- if path~="" then
- lfs.chdir(path)
- end
- report_format("using format path %a",dir.current())
+ local silent=arguments.silent
+ local errors=arguments.errors
local texsourcename=""
+ local texsourcepath=""
local fulltexsourcename=""
if engine=="luametatex" then
- texsourcename=file.addsuffix(name,"mkxl")
+ texsourcename=file.addsuffix(formatname,"mkxl")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"mkiv")
+ texsourcename=file.addsuffix(formatname,"mkiv")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(name,"tex")
+ texsourcename=file.addsuffix(formatname,"tex")
fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
end
if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",name)
- lfs.chdir(olddir)
+ report_format("no tex source file with name %a (mkiv or tex)",formatname)
return
- else
- report_format("using tex source file %a",fulltexsourcename)
end
- local texsourcepath=dir.expandname(file.dirname(fulltexsourcename))
- local specificationname=file.replacesuffix(fulltexsourcename,"lus")
- local fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
- if fullspecificationname=="" then
- specificationname=file.join(texsourcepath,"context.lus")
- fullspecificationname=resolvers.findfile(specificationname,"tex") or ""
+ report_format("using tex source file %a",fulltexsourcename)
+ fulltexsourcename=dir.expandname(fulltexsourcename)
+ texsourcepath=file.dirname(fulltexsourcename)
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
end
+ local specificationname="context.lus"
+ local specificationpath=""
+ local fullspecificationname=resolvers.findfile(specificationname) or ""
if fullspecificationname=="" then
- report_format("unknown stub specification %a",specificationname)
- lfs.chdir(olddir)
+ report_format("unable to locate specification file %a",specificationname)
+ return
+ end
+ report_format("using specification file %a",fullspecificationname)
+ fullspecificationname=dir.expandname(fullspecificationname)
+ specificationpath=file.dirname(fullspecificationname)
+ if texsourcepath~=specificationpath then
+ report_format("tex source file and specification file are on different paths")
+ return
+ end
+ if not lfs.isfile(fulltexsourcename) then
+ report_format("no accessible tex source file with name %a",fulltexsourcename)
+ return
+ end
+ if not lfs.isfile(fullspecificationname) then
+ report_format("no accessible specification file with name %a",fulltexsourcename)
+ return
+ end
+ report_format("using tex source path %a",texsourcepath)
+ local validformatpath=caches.getwritablepath("formats",engine) or ""
+ local startupdir=dir.current()
+ if validformatpath=="" then
+ report_format("invalid format path, insufficient write access")
+ return
+ end
+ local binarypath=validbinarypath()
+ report_format("changing to format path %a",validformatpath)
+ lfs.chdir(validformatpath)
+ if dir.current()~=validformatpath then
+ report_format("unable to change to format path %a",validformatpath)
return
end
- local specificationpath=file.dirname(fullspecificationname)
local usedluastub=nil
local usedlualibs=dofile(fullspecificationname)
if type(usedlualibs)=="string" then
- usedluastub=file.join(file.dirname(fullspecificationname),usedlualibs)
+ usedluastub=file.join(specificationpath,usedlualibs)
elseif type(usedlualibs)=="table" then
report_format("using stub specification %a",fullspecificationname)
local texbasename=file.basename(name)
@@ -25761,48 +25830,57 @@ function environment.make_format(name,arguments)
end
else
report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(olddir)
+ lfs.chdir(startupdir)
return
end
+ local runner=runners[engine]
+ if not runner then
+ report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
+ lfs.chdir(startupdir)
+ return
+ end
+ local primaryflags=primaryflags(arguments)
+ local secondaryflags=secondaryflags(arguments)
local specification={
- primaryflags=primaryflags(),
- secondaryflags=secondaryflags(),
+ binarypath=binarypath,
+ primaryflags=primaryflags,
+ secondaryflags=secondaryflags,
luafile=quoted(usedluastub),
texfile=quoted(fulltexsourcename),
dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be generated, no runner available for engine %a",name,engine)
- elseif silent then
- statistics.starttiming()
+ if silent then
specification.redirect="> temp.log"
- local result=runner(specification)
- local runtime=statistics.stoptiming()
- if result~=0 then
- print(format("%s silent make > fatal error when making format %q",engine,name))
- else
- print(format("%s silent make > format %q made in %.3f seconds",engine,name,runtime))
- end
+ end
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if silent then
os.remove("temp.log")
- else
- runner(specification)
end
- local pattern=file.removesuffix(file.basename(usedluastub)).."-*.mem"
- local mp=dir.glob(pattern)
- if mp then
- for i=1,#mp do
- local name=mp[i]
- report_format("removing related mplib format %a",file.basename(name))
- os.remove(name)
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath or "?")
end
- end
- lfs.chdir(olddir)
+ report_format("format path : %s",validformatpath)
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",usedluastub)
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("context file : %s",fulltexsourcename)
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
+ lfs.chdir(startupdir)
end
-local template=[[%flags% --fmt=%fmtfile% --lua=%luafile% %texfile% %more%]]
+local template=[[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]]
local checkers={
- flags="string",
- more="string",
+ primaryflags="verbose",
+ secondaryflags="verbose",
fmtfile="readable",
luafile="readable",
texfile="readable",
@@ -25815,6 +25893,13 @@ local runners={
checkers=checkers,
reporter=report_format,
},
+ luametatex=sandbox.registerrunner {
+ name="run luametatex format",
+ program="luametatex",
+ template=template,
+ checkers=checkers,
+ reporter=report_format,
+ },
luajittex=sandbox.registerrunner {
name="run luajittex format",
program="luajittex",
@@ -25823,42 +25908,69 @@ local runners={
reporter=report_format,
},
}
-function environment.run_format(name,data,more)
- if name and name~="" then
- local engine=environment.ownmain or "luatex"
- local barename=file.removesuffix(name)
- local fmtname=caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats",engine)
- if fmtname=="" then
- fmtname=resolvers.findfile(file.addsuffix(barename,"fmt")) or ""
- end
- fmtname=resolvers.cleanpath(fmtname)
- if fmtname=="" then
- report_format("no format with name %a",name)
- else
- local barename=file.removesuffix(name)
- local luaname=file.addsuffix(barename,"luc")
- if not lfs.isfile(luaname) then
- luaname=file.addsuffix(barename,"lua")
- end
- if not lfs.isfile(luaname) then
- report_format("using format name %a",fmtname)
- report_format("no luc/lua file with name %a",barename)
- else
- local runner=runners[engine]
- if not runner then
- report_format("format %a cannot be run, no runner available for engine %a",name,engine)
- else
- runner {
- flags=primaryflags(),
- fmtfile=quoted(barename),
- luafile=quoted(luaname),
- texfile=quoted(data),
- more=more,
- }
- end
- end
- end
+function environment.run_format(formatname,scriptname,filename,primaryflags,secondaryflags,verbose)
+ local engine=environment.ownmain or "luatex"
+ if not formatname or formatname=="" then
+ report_format("missing format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("missing script name")
+ return
+ end
+ if not lfs.isfile(formatname) or not lfs.isfile(scriptname) then
+ formatname,scriptname=resolvers.locateformat(formatname)
+ end
+ if not formatname or formatname=="" then
+ report_format("invalid format name")
+ return
+ end
+ if not scriptname or scriptname=="" then
+ report_format("invalid script name")
+ return
+ end
+ local runner=runners[engine]
+ if not runner then
+ report_format("format %a cannot be run, no runner available for engine %a",file.nameonly(name),engine)
+ return
+ end
+ if not filename then
+ filename ""
+ end
+ local binarypath=validbinarypath()
+ local specification={
+ binarypath=binarypath,
+ primaryflags=primaryflags or "",
+ secondaryflags=secondaryflags or "",
+ fmtfile=quoted(formatname),
+ luafile=quoted(scriptname),
+ texfile=filename~="" and quoted(filename) or "",
+ }
+ statistics.starttiming()
+ local result=runner(specification)
+ local runtime=statistics.stoptiming()
+ if verbose then
+ report_format()
+ if binarypath and binarypath~="" then
+ report_format("binary path : %s",binarypath)
+ end
+ report_format("luatex engine : %s",engine)
+ report_format("lua startup file : %s",scriptname)
+ report_format("tex format file : %s",formatname)
+ if filename~="" then
+ report_format("tex input file : %s",filename)
+ end
+ if primaryflags~="" then
+ report_format("primary flags : %s",primaryflags)
+ end
+ if secondaryflags~="" then
+ report_format("secondary flags : %s",secondaryflags)
+ end
+ report_format("run time : %.3f seconds",runtime)
+ report_format("return value : %s",result==0 and "okay" or "error")
+ report_format()
end
+ return result
end
@@ -25866,8 +25978,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 util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1030892
--- stripped bytes : 407938
+-- original bytes : 1036593
+-- stripped bytes : 410200
-- end library merge
@@ -26149,6 +26261,7 @@ local helpinfo = [[
<flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag>
<flag name="windows"><short>create windows (mswin) stubs</short></flag>
<flag name="unix"><short>create unix (linux) stubs</short></flag>
+ <flag name="addbinarypath"><short>prepend the (found) binarypath to runners</short></flag>
</subcategory>
<subcategory>
<flag name="verbose"><short>give a bit more info</short></flag>
@@ -27008,17 +27121,17 @@ do
end
-if e_argument("ansi") or e_argument("ansilog") then
+-- if e_argument("ansi") or e_argument("ansilog") then
- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
+-- logs.setformatters(e_argument("ansi") and "ansi" or "ansilog")
- local script = e_argument("script") or e_argument("scripts")
+-- -- local script = e_argument("script") or e_argument("scripts")
+-- --
+-- -- if type(script) == "string" then
+-- -- logs.writer("]0;"..script.."") -- for Alan to test
+-- -- end
- if type(script) == "string" then
- logs.writer("]0;"..script.."") -- for Alan to test
- end
-
-end
+-- end
if e_argument("script") or e_argument("scripts") then