summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-02-05 13:35:00 +0100
committerHans Hagen <pragma@wxs.nl>2013-02-05 13:35:00 +0100
commitbaae751ef69bcc2c205ec969dbd5788fe0ac26e8 (patch)
tree48d78cbe66786b60e549f4e21be3bcf2b47262aa /scripts
parente2f3737b9e45d1cf4d553b3f6cce71d5428bfe51 (diff)
downloadcontext-baae751ef69bcc2c205ec969dbd5788fe0ac26e8.tar.gz
beta 2013.02.05 13:35
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-package.lua22
-rw-r--r--scripts/context/lua/mtxrun.lua132
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua132
-rwxr-xr-xscripts/context/stubs/unix/mtxrun132
4 files changed, 260 insertions, 158 deletions
diff --git a/scripts/context/lua/mtx-package.lua b/scripts/context/lua/mtx-package.lua
index 294ef4f28..879dd5e3a 100644
--- a/scripts/context/lua/mtx-package.lua
+++ b/scripts/context/lua/mtx-package.lua
@@ -24,18 +24,18 @@ scripts = scripts or { }
messages = messages or { }
scripts.package = scripts.package or { }
-function scripts.package.merge_luatex_files(name,strip)
+function scripts.package.merge_luatex_files(name)
local oldname = resolvers.findfile(name) or ""
oldname = file.replacesuffix(oldname,"lua")
if oldname == "" then
- report("missing '%s'",name)
+ report("missing %q",name)
else
local newname = file.removesuffix(oldname) .. "-merged.lua"
local data = io.loaddata(oldname) or ""
if data == "" then
- report("missing '%s'",newname)
+ report("missing %q",newname)
else
- report("loading '%s'",oldname)
+ report("loading %q",oldname)
local collected = { }
collected[#collected+1] = format("-- merged file : %s\n",newname)
collected[#collected+1] = format("-- parent file : %s\n",oldname)
@@ -45,23 +45,17 @@ function scripts.package.merge_luatex_files(name,strip)
if file.basename(lib) ~= file.basename(newname) then
local fullname = resolvers.findfile(lib) or ""
if fullname == "" then
- report("missing '%s'",lib)
+ report("missing %q",lib)
else
- report("fetching '%s'",fullname)
+ report("fetching %q",fullname)
local data = io.loaddata(fullname)
- if strip then
- data = gsub(data,"%-%-%[%[ldx%-%-.-%-%-%ldx%]%]%-%-[\n\r]*","")
- data = gsub(data,"%-%-%~[^\n\r]*[\n\r]*","\n")
- data = gsub(data,"%s+%-%-[^\n\r]*[\n\r]*","\n")
- data = gsub(data,"[\n\r]+","\n")
- end
collected[#collected+1] = "\ndo -- begin closure to overcome local limits and interference\n\n"
- collected[#collected+1] = data
+ collected[#collected+1] = utilities.merger.compact(data)
collected[#collected+1] = "\nend -- closure\n"
end
end
end
- report("saving '%s'",newname)
+ report("saving %q",newname)
io.savedata(newname,table.concat(collected))
end
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 66b6f5466..6a894df01 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -2197,7 +2197,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 13731, stripped down to: 8450
+-- original size: 13891, stripped down to: 8591
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -2319,7 +2319,13 @@ function os.runtime()
end
os.resolvers=os.resolvers or {}
local resolvers=os.resolvers
-local osmt=getmetatable(os) or { __index=function(t,k) t[k]="unset" return "unset" end }
+local osmt=getmetatable(os) or { __index=function(t,k)
+ local v=function()
+ print(format("function os.%s in namespace is undefined"))
+ end
+ t[k]=v
+ return v
+end }
local osix=osmt.__index
osmt.__index=function(t,k)
return (resolvers[k] or osix)(t,k)
@@ -2510,6 +2516,9 @@ end
function os.now()
return date("!%Y-%m-%d %H:%M:%S")
end
+if not os.sleep and socket then
+ os.sleep=socket.sleep
+end
end -- of closure
@@ -4817,7 +4826,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 7158, stripped down to: 5738
+-- original size: 7245, stripped down to: 5822
if not modules then modules={} end modules ['util-mrg']={
version=1.001,
@@ -4890,6 +4899,9 @@ local compact=Cs ((
)^1 )
local strip=Cs((emptyline^2/"\n"+1)^0)
local stripreturn=Cs((1-P("return")*space^1*P(1-space-eol)^1*(space+eol)^0*P(-1))^1)
+function merger.compact(data)
+ return lpegmatch(strip,lpegmatch(compact,data))
+end
local function self_compact(data)
local delta=0
if merger.strip_comment then
@@ -7051,23 +7063,19 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 12282, stripped down to: 8098
+-- original size: 7702, stripped down to: 4701
-if not modules then modules={} end modules ['luat-env']={
+if not modules then modules={} end modules ['util-env']={
version=1.001,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_lua=logs.reporter("resolvers","lua")
local allocate,mark=utilities.storage.allocate,utilities.storage.mark
local format,sub,match,gsub,find=string.format,string.sub,string.match,string.gsub,string.find
local unquoted,quoted=string.unquoted,string.quoted
local concat,insert,remove=table.concat,table.insert,table.remove
-local luautilities=utilities.lua
-local luasuffixes=luautilities.suffixes
environment=environment or {}
local environment=environment
os.setlocale(nil,nil)
@@ -7084,18 +7092,25 @@ local basicengines=allocate {
["luajittex"]="luajittex",
["texluajit"]="luajittex",
}
+local luaengines=allocate {
+ ["lua"]=true,
+ ["luajit"]=true,
+}
environment.validengines=validengines
environment.basicengines=basicengines
-if arg and validengines[file.removesuffix(arg[0])] and arg[1]=="--luaonly" then
- arg[-1]=arg[0]
- arg[ 0]=arg[2]
- for k=3,#arg do
- arg[k-2]=arg[k]
+if not arg then
+elseif luaengines[file.removesuffix(arg[-1])] then
+elseif validengines[file.removesuffix(arg[0])] then
+ if arg[1]=="--luaonly" then
+ arg[-1]=arg[0]
+ arg[ 0]=arg[2]
+ for k=3,#arg do
+ arg[k-2]=arg[k]
+ end
+ remove(arg)
+ remove(arg)
+ else
end
- remove(arg)
- remove(arg)
-end
-do
local originalzero=file.basename(arg[0])
local specialmapping={ luatools=="base" }
if originalzero~="mtxrun" and originalzero~="mtxrun.lua" then
@@ -7107,32 +7122,6 @@ end
environment.arguments=allocate()
environment.files=allocate()
environment.sortedflags=nil
-local mt={
- __index=function(_,k)
- if k=="version" then
- local version=tex.toks and tex.toks.contextversiontoks
- if version and version~="" then
- rawset(environment,"version",version)
- return version
- else
- return "unknown"
- end
- elseif k=="jobname" or k=="formatname" then
- local name=tex and tex[k]
- if name or name=="" then
- rawset(environment,k,name)
- return name
- else
- return "unknown"
- end
- elseif k=="outputfilename" then
- local name=environment.jobname
- rawset(environment,k,name)
- return name
- end
- end
-}
-setmetatable(environment,mt)
function environment.initializearguments(arg)
local arguments,files={},{}
environment.arguments,environment.files,environment.sortedflags=arguments,files,nil
@@ -7247,6 +7236,53 @@ if arg then
environment.rawarguments=mark(arg)
arg={}
end
+
+
+end -- of closure
+
+do -- create closure to overcome 200 locals limit
+
+-- original size: 5441, stripped down to: 3874
+
+ if not modules then modules={} end modules ['luat-env']={
+ version=1.001,
+ comment="companion to luat-lib.mkiv",
+ author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright="PRAGMA ADE / ConTeXt Development Team",
+ license="see context related readme files"
+}
+local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
+local report_lua=logs.reporter("resolvers","lua")
+local luautilities=utilities.lua
+local luasuffixes=luautilities.suffixes
+environment=environment or {}
+local environment=environment
+local mt={
+ __index=function(_,k)
+ if k=="version" then
+ local version=tex.toks and tex.toks.contextversiontoks
+ if version and version~="" then
+ rawset(environment,"version",version)
+ return version
+ else
+ return "unknown"
+ end
+ elseif k=="jobname" or k=="formatname" then
+ local name=tex and tex[k]
+ if name or name=="" then
+ rawset(environment,k,name)
+ return name
+ else
+ return "unknown"
+ end
+ elseif k=="outputfilename" then
+ local name=environment.jobname
+ rawset(environment,k,name)
+ return name
+ end
+ end
+}
+setmetatable(environment,mt)
function environment.texfile(filename)
return resolvers.findfile(filename,'tex')
end
@@ -14763,10 +14799,10 @@ end
end -- of closure
--- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-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 luat-sta.lua luat-fmt.lua
+-- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua 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 luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 593245
--- stripped bytes : 199776
+-- original bytes : 594353
+-- stripped bytes : 200182
-- end library merge
@@ -14822,6 +14858,7 @@ local ownlibs = { -- order can be made better
'util-tpl.lua',
+ 'util-env.lua',
'luat-env.lua', -- can come before inf (as in mkiv)
'lxml-tab.lua',
@@ -16019,7 +16056,6 @@ elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to l
resolvers.listers.configurations()
else
-
runners.loadbase()
runners.execute_ctx_script("mtx-base",filename)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 66b6f5466..6a894df01 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -2197,7 +2197,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 13731, stripped down to: 8450
+-- original size: 13891, stripped down to: 8591
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -2319,7 +2319,13 @@ function os.runtime()
end
os.resolvers=os.resolvers or {}
local resolvers=os.resolvers
-local osmt=getmetatable(os) or { __index=function(t,k) t[k]="unset" return "unset" end }
+local osmt=getmetatable(os) or { __index=function(t,k)
+ local v=function()
+ print(format("function os.%s in namespace is undefined"))
+ end
+ t[k]=v
+ return v
+end }
local osix=osmt.__index
osmt.__index=function(t,k)
return (resolvers[k] or osix)(t,k)
@@ -2510,6 +2516,9 @@ end
function os.now()
return date("!%Y-%m-%d %H:%M:%S")
end
+if not os.sleep and socket then
+ os.sleep=socket.sleep
+end
end -- of closure
@@ -4817,7 +4826,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 7158, stripped down to: 5738
+-- original size: 7245, stripped down to: 5822
if not modules then modules={} end modules ['util-mrg']={
version=1.001,
@@ -4890,6 +4899,9 @@ local compact=Cs ((
)^1 )
local strip=Cs((emptyline^2/"\n"+1)^0)
local stripreturn=Cs((1-P("return")*space^1*P(1-space-eol)^1*(space+eol)^0*P(-1))^1)
+function merger.compact(data)
+ return lpegmatch(strip,lpegmatch(compact,data))
+end
local function self_compact(data)
local delta=0
if merger.strip_comment then
@@ -7051,23 +7063,19 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 12282, stripped down to: 8098
+-- original size: 7702, stripped down to: 4701
-if not modules then modules={} end modules ['luat-env']={
+if not modules then modules={} end modules ['util-env']={
version=1.001,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_lua=logs.reporter("resolvers","lua")
local allocate,mark=utilities.storage.allocate,utilities.storage.mark
local format,sub,match,gsub,find=string.format,string.sub,string.match,string.gsub,string.find
local unquoted,quoted=string.unquoted,string.quoted
local concat,insert,remove=table.concat,table.insert,table.remove
-local luautilities=utilities.lua
-local luasuffixes=luautilities.suffixes
environment=environment or {}
local environment=environment
os.setlocale(nil,nil)
@@ -7084,18 +7092,25 @@ local basicengines=allocate {
["luajittex"]="luajittex",
["texluajit"]="luajittex",
}
+local luaengines=allocate {
+ ["lua"]=true,
+ ["luajit"]=true,
+}
environment.validengines=validengines
environment.basicengines=basicengines
-if arg and validengines[file.removesuffix(arg[0])] and arg[1]=="--luaonly" then
- arg[-1]=arg[0]
- arg[ 0]=arg[2]
- for k=3,#arg do
- arg[k-2]=arg[k]
+if not arg then
+elseif luaengines[file.removesuffix(arg[-1])] then
+elseif validengines[file.removesuffix(arg[0])] then
+ if arg[1]=="--luaonly" then
+ arg[-1]=arg[0]
+ arg[ 0]=arg[2]
+ for k=3,#arg do
+ arg[k-2]=arg[k]
+ end
+ remove(arg)
+ remove(arg)
+ else
end
- remove(arg)
- remove(arg)
-end
-do
local originalzero=file.basename(arg[0])
local specialmapping={ luatools=="base" }
if originalzero~="mtxrun" and originalzero~="mtxrun.lua" then
@@ -7107,32 +7122,6 @@ end
environment.arguments=allocate()
environment.files=allocate()
environment.sortedflags=nil
-local mt={
- __index=function(_,k)
- if k=="version" then
- local version=tex.toks and tex.toks.contextversiontoks
- if version and version~="" then
- rawset(environment,"version",version)
- return version
- else
- return "unknown"
- end
- elseif k=="jobname" or k=="formatname" then
- local name=tex and tex[k]
- if name or name=="" then
- rawset(environment,k,name)
- return name
- else
- return "unknown"
- end
- elseif k=="outputfilename" then
- local name=environment.jobname
- rawset(environment,k,name)
- return name
- end
- end
-}
-setmetatable(environment,mt)
function environment.initializearguments(arg)
local arguments,files={},{}
environment.arguments,environment.files,environment.sortedflags=arguments,files,nil
@@ -7247,6 +7236,53 @@ if arg then
environment.rawarguments=mark(arg)
arg={}
end
+
+
+end -- of closure
+
+do -- create closure to overcome 200 locals limit
+
+-- original size: 5441, stripped down to: 3874
+
+ if not modules then modules={} end modules ['luat-env']={
+ version=1.001,
+ comment="companion to luat-lib.mkiv",
+ author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright="PRAGMA ADE / ConTeXt Development Team",
+ license="see context related readme files"
+}
+local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
+local report_lua=logs.reporter("resolvers","lua")
+local luautilities=utilities.lua
+local luasuffixes=luautilities.suffixes
+environment=environment or {}
+local environment=environment
+local mt={
+ __index=function(_,k)
+ if k=="version" then
+ local version=tex.toks and tex.toks.contextversiontoks
+ if version and version~="" then
+ rawset(environment,"version",version)
+ return version
+ else
+ return "unknown"
+ end
+ elseif k=="jobname" or k=="formatname" then
+ local name=tex and tex[k]
+ if name or name=="" then
+ rawset(environment,k,name)
+ return name
+ else
+ return "unknown"
+ end
+ elseif k=="outputfilename" then
+ local name=environment.jobname
+ rawset(environment,k,name)
+ return name
+ end
+ end
+}
+setmetatable(environment,mt)
function environment.texfile(filename)
return resolvers.findfile(filename,'tex')
end
@@ -14763,10 +14799,10 @@ end
end -- of closure
--- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-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 luat-sta.lua luat-fmt.lua
+-- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua 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 luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 593245
--- stripped bytes : 199776
+-- original bytes : 594353
+-- stripped bytes : 200182
-- end library merge
@@ -14822,6 +14858,7 @@ local ownlibs = { -- order can be made better
'util-tpl.lua',
+ 'util-env.lua',
'luat-env.lua', -- can come before inf (as in mkiv)
'lxml-tab.lua',
@@ -16019,7 +16056,6 @@ elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to l
resolvers.listers.configurations()
else
-
runners.loadbase()
runners.execute_ctx_script("mtx-base",filename)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 66b6f5466..6a894df01 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -2197,7 +2197,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 13731, stripped down to: 8450
+-- original size: 13891, stripped down to: 8591
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -2319,7 +2319,13 @@ function os.runtime()
end
os.resolvers=os.resolvers or {}
local resolvers=os.resolvers
-local osmt=getmetatable(os) or { __index=function(t,k) t[k]="unset" return "unset" end }
+local osmt=getmetatable(os) or { __index=function(t,k)
+ local v=function()
+ print(format("function os.%s in namespace is undefined"))
+ end
+ t[k]=v
+ return v
+end }
local osix=osmt.__index
osmt.__index=function(t,k)
return (resolvers[k] or osix)(t,k)
@@ -2510,6 +2516,9 @@ end
function os.now()
return date("!%Y-%m-%d %H:%M:%S")
end
+if not os.sleep and socket then
+ os.sleep=socket.sleep
+end
end -- of closure
@@ -4817,7 +4826,7 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 7158, stripped down to: 5738
+-- original size: 7245, stripped down to: 5822
if not modules then modules={} end modules ['util-mrg']={
version=1.001,
@@ -4890,6 +4899,9 @@ local compact=Cs ((
)^1 )
local strip=Cs((emptyline^2/"\n"+1)^0)
local stripreturn=Cs((1-P("return")*space^1*P(1-space-eol)^1*(space+eol)^0*P(-1))^1)
+function merger.compact(data)
+ return lpegmatch(strip,lpegmatch(compact,data))
+end
local function self_compact(data)
local delta=0
if merger.strip_comment then
@@ -7051,23 +7063,19 @@ end -- of closure
do -- create closure to overcome 200 locals limit
--- original size: 12282, stripped down to: 8098
+-- original size: 7702, stripped down to: 4701
-if not modules then modules={} end modules ['luat-env']={
+if not modules then modules={} end modules ['util-env']={
version=1.001,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
-local report_lua=logs.reporter("resolvers","lua")
local allocate,mark=utilities.storage.allocate,utilities.storage.mark
local format,sub,match,gsub,find=string.format,string.sub,string.match,string.gsub,string.find
local unquoted,quoted=string.unquoted,string.quoted
local concat,insert,remove=table.concat,table.insert,table.remove
-local luautilities=utilities.lua
-local luasuffixes=luautilities.suffixes
environment=environment or {}
local environment=environment
os.setlocale(nil,nil)
@@ -7084,18 +7092,25 @@ local basicengines=allocate {
["luajittex"]="luajittex",
["texluajit"]="luajittex",
}
+local luaengines=allocate {
+ ["lua"]=true,
+ ["luajit"]=true,
+}
environment.validengines=validengines
environment.basicengines=basicengines
-if arg and validengines[file.removesuffix(arg[0])] and arg[1]=="--luaonly" then
- arg[-1]=arg[0]
- arg[ 0]=arg[2]
- for k=3,#arg do
- arg[k-2]=arg[k]
+if not arg then
+elseif luaengines[file.removesuffix(arg[-1])] then
+elseif validengines[file.removesuffix(arg[0])] then
+ if arg[1]=="--luaonly" then
+ arg[-1]=arg[0]
+ arg[ 0]=arg[2]
+ for k=3,#arg do
+ arg[k-2]=arg[k]
+ end
+ remove(arg)
+ remove(arg)
+ else
end
- remove(arg)
- remove(arg)
-end
-do
local originalzero=file.basename(arg[0])
local specialmapping={ luatools=="base" }
if originalzero~="mtxrun" and originalzero~="mtxrun.lua" then
@@ -7107,32 +7122,6 @@ end
environment.arguments=allocate()
environment.files=allocate()
environment.sortedflags=nil
-local mt={
- __index=function(_,k)
- if k=="version" then
- local version=tex.toks and tex.toks.contextversiontoks
- if version and version~="" then
- rawset(environment,"version",version)
- return version
- else
- return "unknown"
- end
- elseif k=="jobname" or k=="formatname" then
- local name=tex and tex[k]
- if name or name=="" then
- rawset(environment,k,name)
- return name
- else
- return "unknown"
- end
- elseif k=="outputfilename" then
- local name=environment.jobname
- rawset(environment,k,name)
- return name
- end
- end
-}
-setmetatable(environment,mt)
function environment.initializearguments(arg)
local arguments,files={},{}
environment.arguments,environment.files,environment.sortedflags=arguments,files,nil
@@ -7247,6 +7236,53 @@ if arg then
environment.rawarguments=mark(arg)
arg={}
end
+
+
+end -- of closure
+
+do -- create closure to overcome 200 locals limit
+
+-- original size: 5441, stripped down to: 3874
+
+ if not modules then modules={} end modules ['luat-env']={
+ version=1.001,
+ comment="companion to luat-lib.mkiv",
+ author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright="PRAGMA ADE / ConTeXt Development Team",
+ license="see context related readme files"
+}
+local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
+local report_lua=logs.reporter("resolvers","lua")
+local luautilities=utilities.lua
+local luasuffixes=luautilities.suffixes
+environment=environment or {}
+local environment=environment
+local mt={
+ __index=function(_,k)
+ if k=="version" then
+ local version=tex.toks and tex.toks.contextversiontoks
+ if version and version~="" then
+ rawset(environment,"version",version)
+ return version
+ else
+ return "unknown"
+ end
+ elseif k=="jobname" or k=="formatname" then
+ local name=tex and tex[k]
+ if name or name=="" then
+ rawset(environment,k,name)
+ return name
+ else
+ return "unknown"
+ end
+ elseif k=="outputfilename" then
+ local name=environment.jobname
+ rawset(environment,k,name)
+ return name
+ end
+ end
+}
+setmetatable(environment,mt)
function environment.texfile(filename)
return resolvers.findfile(filename,'tex')
end
@@ -14763,10 +14799,10 @@ end
end -- of closure
--- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-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 luat-sta.lua luat-fmt.lua
+-- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-tab.lua util-sto.lua util-str.lua util-mrg.lua util-lua.lua util-prs.lua util-fmt.lua util-deb.lua trac-inf.lua trac-set.lua trac-log.lua trac-pro.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua 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 luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 593245
--- stripped bytes : 199776
+-- original bytes : 594353
+-- stripped bytes : 200182
-- end library merge
@@ -14822,6 +14858,7 @@ local ownlibs = { -- order can be made better
'util-tpl.lua',
+ 'util-env.lua',
'luat-env.lua', -- can come before inf (as in mkiv)
'lxml-tab.lua',
@@ -16019,7 +16056,6 @@ elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to l
resolvers.listers.configurations()
else
-
runners.loadbase()
runners.execute_ctx_script("mtx-base",filename)