Drop useless test

This commit is contained in:
Marcel Krüger 2020-07-10 20:46:08 +02:00
parent c5efb3e0c2
commit 5b1497034d
2 changed files with 16 additions and 34 deletions

View File

@ -1,31 +1,18 @@
do do
local ourpath = lua.startupfile:match('(.*[/\\])[^/\\]*%.lua$') local ourpath
ourpath, texconfig.formatname = lua.startupfile:match('(.*[/\\])([^/\\]*)%-init%.lua$')
kpse = assert(package.loadlib(ourpath .. 'kpse.' .. (os.type == 'windows' and 'dll' or 'so'), 'luaopen_kpse'))() kpse = assert(package.loadlib(ourpath .. 'kpse.' .. (os.type == 'windows' and 'dll' or 'so'), 'luaopen_kpse'))()
end end
local interaction
do do
local arg0, progname local arg_pattern = '-' * lpeg.P'-'^-1 * lpeg.C((1-lpeg.P'=')^1) * ('=' * lpeg.C(lpeg.P(1)^0) + lpeg.Cc(true))
for _, a in ipairs(arg) do for _, a in ipairs(arg) do
if a:sub(1,11) == "--progname=" then local name, value = arg_pattern:match(a)
progname = a:sub(12) if name then
elseif a:sub(1,7) == "--arg0=" then arg[name] = value
arg0 = a:sub(8)
elseif a:match'^%-%-?interaction=' then
local interaction_name = a:sub(a:find'='+1)
interaction = ({
batchmode=0,
nonstopmode=1,
scrollmode=2,
errorstopmode=3,
})[interaction_name]
if not interaction then
texio.write('term', string.format('Unknown interaction mode %q ignored.\n', interaction_name))
end
end end
end end
os.arg0 = arg0
kpse.set_program_name(arg0, progname)
end end
kpse.set_program_name(arg.arg0 or arg[arg[0]], arg.progname)
package.searchers[2] = function(modname) package.searchers[2] = function(modname)
local filename = kpse.find_file(modname, "lua", true) local filename = kpse.find_file(modname, "lua", true)
if not filename then if not filename then
@ -59,8 +46,16 @@ end
callback_register('find_format_file', function(name) return kpse.find_file(name, 'fmt', true) end) callback_register('find_format_file', function(name) return kpse.find_file(name, 'fmt', true) end)
function texconfig.init() function texconfig.init()
local interaction = ({ [true] = 3, [false] = false,
batchmode=0,
nonstopmode=1,
scrollmode=2,
errorstopmode=3,
})[arg.interaction or false]
if interaction then if interaction then
tex.setinteraction(interaction) tex.setinteraction(interaction)
elseif interaction == nil then
texio.write('term', string.format('Unknown interaction mode %q ignored.\n', arg.interaction))
end end
if build_bytecode then -- Effectivly if status.ini_version if build_bytecode then -- Effectivly if status.ini_version
require'luametalatex-lateinit'(build_bytecode) require'luametalatex-lateinit'(build_bytecode)

View File

@ -75,8 +75,6 @@ for i, a in ipairs(os.selfarg) do
os.selfarg[i] = a os.selfarg[i] = a
if a:sub(1, 11) == "--progname=" then if a:sub(1, 11) == "--progname=" then
format = a:sub(12) format = a:sub(12)
elseif a == '--ini' then
is_initex = true
end end
end end
local dir = absdir(os.selfdir) local dir = absdir(os.selfdir)
@ -106,17 +104,6 @@ for i = #dirseparators, 1, -1 do
end end
error[[CRITICAL: Initialization script not found]] error[[CRITICAL: Initialization script not found]]
::FOUND:: ::FOUND::
-- table.insert(arg, 1, "--lua=" .. dir)
-- table.insert(arg, 1, "luametatex")
-- arg[0] = nil
-- local _, msg = os.exec(arg)
-- error(msg)
os.setenv("engine", status.luatex_engine) os.setenv("engine", status.luatex_engine)
local ret_value
local args = os.selfarg[1] and " \"" .. table.concat(os.selfarg, "\" \"") .. "\"" or "" local args = os.selfarg[1] and " \"" .. table.concat(os.selfarg, "\" \"") .. "\"" or ""
if is_initex then os.exit(os.execute(string.format("luametatex \"--lua=%s\" --arg0=\"%s\"%s", dir, os.selfarg[0], args)))
ret_value = os.execute(string.format("luametatex \"--lua=%s\" --arg0=\"%s\"%s", dir, os.selfarg[0], args))
else
ret_value = os.execute(string.format("luametatex \"--fmt=%s\" \"--lua=%s\" --arg0=\"%s\"%s", format, dir, os.selfarg[0], args))
end
os.exit(x)