Some updates
This commit is contained in:
parent
a6d3b3cc0f
commit
7f370bc361
@ -63,18 +63,16 @@ local function get_outline()
|
|||||||
return outline
|
return outline
|
||||||
end
|
end
|
||||||
local properties = node.direct.properties
|
local properties = node.direct.properties
|
||||||
local immediateassignment = token.new(5, token.command_id'convert')
|
local reset_deadcycles do
|
||||||
local global = token.new(0, token.command_id'prefix')
|
local tokens = {
|
||||||
local deadcycles = token.new(8, token.command_id'set_page_property')
|
token.primitive_tokens.global,
|
||||||
local zero_tok = token.create(0x30)
|
token.primitive_tokens.deadcycles,token.create(0x30),
|
||||||
local relax = token.new(0, 0)
|
token.primitive_tokens.relax,
|
||||||
local reset_deadcycles = {
|
}
|
||||||
immediateassignment,
|
function reset_deadcycles()
|
||||||
global,
|
token.put_next(tokens)
|
||||||
deadcycles,
|
end
|
||||||
zero_tok,
|
end
|
||||||
relax,
|
|
||||||
}
|
|
||||||
token.luacmd("shipout", function()
|
token.luacmd("shipout", function()
|
||||||
local pfile = get_pfile()
|
local pfile = get_pfile()
|
||||||
local total_voffset, total_hoffset = tex.voffset + pdfvariable.vorigin, tex.hoffset + pdfvariable.horigin
|
local total_voffset, total_hoffset = tex.voffset + pdfvariable.vorigin, tex.hoffset + pdfvariable.horigin
|
||||||
@ -95,8 +93,7 @@ token.luacmd("shipout", function()
|
|||||||
local content = pfile:stream(nil, '', out)
|
local content = pfile:stream(nil, '', out)
|
||||||
pfile:indirect(page, string.format([[<</Type/Page/Parent %i 0 R/Contents %i 0 R/MediaBox[0 %i %i %i]/Resources%s%s%s%s>>]], parent, content, -math.ceil(to_bp(list.depth)), math.ceil(to_bp(list.width)), math.ceil(to_bp(list.height)), resources(pdfvariable.pageresources .. pdf.pageresources), annots, pdfvariable.pageattr, pdf.pageattributes))
|
pfile:indirect(page, string.format([[<</Type/Page/Parent %i 0 R/Contents %i 0 R/MediaBox[0 %i %i %i]/Resources%s%s%s%s>>]], parent, content, -math.ceil(to_bp(list.depth)), math.ceil(to_bp(list.width)), math.ceil(to_bp(list.height)), resources(pdfvariable.pageresources .. pdf.pageresources), annots, pdfvariable.pageattr, pdf.pageattributes))
|
||||||
node.flush_list(list)
|
node.flush_list(list)
|
||||||
token.put_next(reset_deadcycles)
|
tex.runlocal(reset_deadcycles)
|
||||||
scan_token()
|
|
||||||
end, 'force', 'protected')
|
end, 'force', 'protected')
|
||||||
|
|
||||||
local infodir = ""
|
local infodir = ""
|
||||||
@ -226,7 +223,8 @@ function callbacks.stop_run()
|
|||||||
local size = pfile:close()
|
local size = pfile:close()
|
||||||
texio.write_nl("term", "(see the transcript file for additional information)")
|
texio.write_nl("term", "(see the transcript file for additional information)")
|
||||||
-- TODO: Additional logging, epecially targeting the log file
|
-- TODO: Additional logging, epecially targeting the log file
|
||||||
texio.write_nl("term and log", string.format(" %d words of node memory still in use:", status.nodestate.use))
|
texio.write_nl("term and log", " node memory still in use:")
|
||||||
|
-- texio.write_nl("term and log", string.format(" %d words of node memory still in use:", status.nodestate.use))
|
||||||
local by_type, by_sub = {}, {}
|
local by_type, by_sub = {}, {}
|
||||||
for n, id, sub in node.traverse(node.usedlist()) do
|
for n, id, sub in node.traverse(node.usedlist()) do
|
||||||
if id == whatsit_id then
|
if id == whatsit_id then
|
||||||
|
@ -103,9 +103,8 @@ local errorvalues = tex.geterrorvalues()
|
|||||||
function callbacks.intercept_tex_error(mode, errortype)
|
function callbacks.intercept_tex_error(mode, errortype)
|
||||||
errortype = errorvalues[errortype]
|
errortype = errorvalues[errortype]
|
||||||
if errortype == "eof" then
|
if errortype == "eof" then
|
||||||
tex.runlocal(function()token.put_next(token.create'tracingall')end)
|
-- print('EOF', token.peek_next())
|
||||||
do_terminal_input()
|
token.put_next(token.create'ABD')
|
||||||
tex.runlocal(token.skip_next)
|
|
||||||
return 3
|
return 3
|
||||||
end
|
end
|
||||||
texio.write'.'
|
texio.write'.'
|
||||||
|
@ -121,6 +121,9 @@ tex_variable(count_code, scan_int, 'outputmode', 1) -- The "traditional" default
|
|||||||
tex_variable(dimen_code, scan_dimen, 'pageheight', 0)
|
tex_variable(dimen_code, scan_dimen, 'pageheight', 0)
|
||||||
tex_variable(dimen_code, scan_dimen, 'pagewidth', 0)
|
tex_variable(dimen_code, scan_dimen, 'pagewidth', 0)
|
||||||
|
|
||||||
|
tex_variable(dimen_code, scan_dimen, 'hoffset', 0)
|
||||||
|
tex_variable(dimen_code, scan_dimen, 'voffset', 0)
|
||||||
|
|
||||||
tex_variable(count_code, scan_int, 'bodydirection', 0)
|
tex_variable(count_code, scan_int, 'bodydirection', 0)
|
||||||
tex_variable(count_code, scan_int, 'pagedirection', 0)
|
tex_variable(count_code, scan_int, 'pagedirection', 0)
|
||||||
|
|
||||||
|
@ -190,36 +190,37 @@ token.luacmd("read", function(_, prefix)
|
|||||||
end
|
end
|
||||||
local macro = scan_csname(true)
|
local macro = scan_csname(true)
|
||||||
local file = ifiles[id]
|
local file = ifiles[id]
|
||||||
local line
|
|
||||||
if file then
|
|
||||||
line = file:reader()
|
|
||||||
if not line then
|
|
||||||
file:close()
|
|
||||||
ifiles[id] = nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
error[[FIXME: Ask the user for input]]
|
|
||||||
end
|
|
||||||
local endlocal
|
|
||||||
tex.runlocal(function()
|
|
||||||
endlocal = token.scan_next()
|
|
||||||
tex.sprint(endlocal)
|
|
||||||
tex.print(line and line ~= "" and line or " ")
|
|
||||||
tex.print(endlocal)
|
|
||||||
end)
|
|
||||||
local tokens = {}
|
local tokens = {}
|
||||||
local balance = 0
|
local balance = 0
|
||||||
while true do
|
repeat
|
||||||
local tok = token.scan_next()
|
local line
|
||||||
if tok == endlocal then break end
|
if file then
|
||||||
if tok.command == 1 then
|
line = file:reader()
|
||||||
balance = balance + 1
|
if not line then
|
||||||
elseif tok.command == 2 then
|
file:close()
|
||||||
balance = balance - 1
|
ifiles[id] = nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
line = io.stdin:read()
|
||||||
end
|
end
|
||||||
tokens[#tokens+1] = tok
|
local endlocal
|
||||||
end
|
tex.runlocal(function()
|
||||||
if balance ~= 0 then error[[FIXME: Read additional input lines]] end
|
endlocal = token.scan_next()
|
||||||
|
tex.sprint(endlocal)
|
||||||
|
tex.print(line and line ~= "" and line or " ")
|
||||||
|
tex.print(endlocal)
|
||||||
|
end)
|
||||||
|
while true do
|
||||||
|
local tok = token.scan_next()
|
||||||
|
if tok == endlocal then break end
|
||||||
|
if tok.command == 1 then
|
||||||
|
balance = balance + 1
|
||||||
|
elseif tok.command == 2 then
|
||||||
|
balance = balance - 1
|
||||||
|
end
|
||||||
|
tokens[#tokens+1] = tok
|
||||||
|
end
|
||||||
|
until balance == 0
|
||||||
tex.runlocal(function()
|
tex.runlocal(function()
|
||||||
tokens[#tokens+1] = rbrace
|
tokens[#tokens+1] = rbrace
|
||||||
token.put_next(tokens)
|
token.put_next(tokens)
|
||||||
|
@ -68,7 +68,7 @@ end
|
|||||||
local undefined_cmd = token.command_id'undefined_cs'
|
local undefined_cmd = token.command_id'undefined_cs'
|
||||||
local lua_call_cmd = token.command_id'lua_call'
|
local lua_call_cmd = token.command_id'lua_call'
|
||||||
local lua_value_cmd = token.command_id'lua_value'
|
local lua_value_cmd = token.command_id'lua_value'
|
||||||
local lua_expandable_call_cmd = token.command_id'lua_expandable_call'
|
local lua_protected_call_cmd = token.command_id'lua_protected_call'
|
||||||
local if_test_cmd = token.command_id'if_test'
|
local if_test_cmd = token.command_id'if_test'
|
||||||
function token.luacmd(name, func, ...)
|
function token.luacmd(name, func, ...)
|
||||||
local idx
|
local idx
|
||||||
@ -78,10 +78,10 @@ function token.luacmd(name, func, ...)
|
|||||||
idx = tok.index
|
idx = tok.index
|
||||||
elseif cmd == lua_call_cmd then
|
elseif cmd == lua_call_cmd then
|
||||||
idx = tok.index
|
idx = tok.index
|
||||||
elseif cmd == lua_expandable_call_cmd then
|
elseif cmd == lua_protected_call_cmd then
|
||||||
idx = tok.index
|
idx = tok.index
|
||||||
elseif cmd == if_test_cmd and tok.index > 48 then
|
elseif cmd == if_test_cmd and tok.index > 49 then
|
||||||
idx = tok.index - 48
|
idx = tok.index - 49
|
||||||
elseif ... == 'force' then
|
elseif ... == 'force' then
|
||||||
idx = new_luafunction(name)
|
idx = new_luafunction(name)
|
||||||
set_lua(name, idx, select(2, ...))
|
set_lua(name, idx, select(2, ...))
|
||||||
@ -106,6 +106,7 @@ if initex then
|
|||||||
|
|
||||||
local prepared = lua.prepared_code
|
local prepared = lua.prepared_code
|
||||||
prepared[1] = string.format("fixupluafunctions(%i)", predefined_luafunctions)
|
prepared[1] = string.format("fixupluafunctions(%i)", predefined_luafunctions)
|
||||||
|
--[[
|
||||||
for i=0,0 do -- maybeFIXME: In practise only one language is preloaded in LuaTeX anyway
|
for i=0,0 do -- maybeFIXME: In practise only one language is preloaded in LuaTeX anyway
|
||||||
-- for i=0,tex.count[19] do -- Sometimes catches reserved language ids which are not used yet
|
-- for i=0,tex.count[19] do -- Sometimes catches reserved language ids which are not used yet
|
||||||
-- for i=0,lang.new():id()-1 do -- lang.new():id() is always 0 in luametatex?!?
|
-- for i=0,lang.new():id()-1 do -- lang.new():id() is always 0 in luametatex?!?
|
||||||
@ -136,6 +137,7 @@ if initex then
|
|||||||
end
|
end
|
||||||
prepared[#prepared+1] = str
|
prepared[#prepared+1] = str
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
for i=2,#prepared do
|
for i=2,#prepared do
|
||||||
if type(prepared[i]) ~= 'string' then
|
if type(prepared[i]) ~= 'string' then
|
||||||
prepared[i] = assert(prepared[i]())
|
prepared[i] = assert(prepared[i]())
|
||||||
|
@ -273,7 +273,7 @@ nodehandler.math = ignore_node
|
|||||||
nodehandler.kern = ignore_node
|
nodehandler.kern = ignore_node
|
||||||
-- The following are only for frontend use:
|
-- The following are only for frontend use:
|
||||||
nodehandler.boundary = ignore_node
|
nodehandler.boundary = ignore_node
|
||||||
nodehandler.local_par = ignore_node
|
nodehandler.par = ignore_node
|
||||||
nodehandler.penalty = ignore_node
|
nodehandler.penalty = ignore_node
|
||||||
nodehandler.mark = ignore_node
|
nodehandler.mark = ignore_node
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user