Attempt better maxdeadcycles handling

This commit is contained in:
Marcel Fabian Krüger 2021-11-21 16:11:49 +01:00
parent 8494bde0a5
commit fc21983b16

View File

@ -124,8 +124,9 @@ local do_terminal_input do
end end
end end
local errorvalues = tex.geterrorvalues() do
function callbacks.intercept_tex_error(mode, errortype) local errorvalues = tex.geterrorvalues()
local function intercept(mode, errortype)
errortype = errorvalues[errortype] errortype = errorvalues[errortype]
if errortype == "eof" then if errortype == "eof" then
-- print('EOF', token.peek_next()) -- print('EOF', token.peek_next())
@ -168,5 +169,15 @@ function callbacks.intercept_tex_error(mode, errortype)
end end
until false until false
return 3 return 3
end
function callbacks.intercept_tex_error(mode, errortype)
local ret = intercept(mode, errortype)
if tex.deadcycles >= tex.maxdeadcycles then
tex.runtoks(function()
tex.sprint(1, '\\shipout\\box255')
end)
end
return ret
end
end end
callbacks.__freeze'intercept_tex_error' callbacks.__freeze'intercept_tex_error'