From cd62c624e149e4c29e0e7aa29c016ae8b45cf086 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 22 Apr 2011 23:36:31 +0000 Subject: oberdiek (22apr11) git-svn-id: svn://tug.org/texlive/trunk@22162 c570f23f-e606-0410-a88d-b1316a301751 --- .../scripts/oberdiek/luacolor-pre065.lua | 106 ++++++++++++++------- Master/texmf-dist/scripts/oberdiek/luacolor.lua | 96 ++++++++++++------- .../scripts/oberdiek/oberdiek.luacolor-pre065.lua | 106 ++++++++++++++------- .../scripts/oberdiek/oberdiek.luacolor.lua | 96 ++++++++++++------- .../scripts/oberdiek/oberdiek.pdftexcmds.lua | 6 +- Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua | 6 +- 6 files changed, 264 insertions(+), 152 deletions(-) (limited to 'Master/texmf-dist/scripts/oberdiek') diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua b/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua index 35da6ea8468..65daa18fedd 100644 --- a/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua +++ b/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2011/03/29 v1.4 +-- Version: 2011/04/22 v1.5 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -104,66 +104,93 @@ local attribute function setattribute(attr) attribute = attr end -function process(box) - local color = "" - local list = tex.getbox(box) - traverse(list, color) -end local LIST = 1 -local COLOR = 2 -local type = { +local LIST_LEADERS = 2 +local COLOR = 3 +local RULE = node.id("rule") +local node_types = { [node.id("hlist")] = LIST, [node.id("vlist")] = LIST, [node.id("rule")] = COLOR, [node.id("glyph")] = COLOR, [node.id("disc")] = COLOR, + [node.id("whatsit")] = { + [3] = COLOR, -- special + [8] = COLOR, -- pdf_literal + [14] = COLOR, -- pdf_refximage + }, + [node.id("glue")] = + function(n) + if n.subtype >= 100 then -- leaders + if n.leader.id == RULE then + return COLOR + else + return LIST_LEADERS + end + end + end, } -local subtype = { - [3] = COLOR, -- special - [8] = COLOR, -- pdf_literal -} +local function get_type(n) + local ret = node_types[n.id] + if type(ret) == 'table' then + ret = ret[n.subtype] + end + if type(ret) == 'function' then + ret = ret(n) + end + return ret +end local mode = 2 -- luatex.pdfliteral.direct local WHATSIT = node.id("whatsit") local SPECIAL = 3 local PDFLITERAL = 8 -function traverse(list, color) +local DRY_FALSE = 0 +local DRY_TRUE = 1 +local function traverse(list, color, dry) if not list then return color end - if type[list.id] ~= LIST then + if get_type(list) ~= LIST then texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) return color end local head = list.list for n in node.traverse(head) do - local type = type[n.id] - if type == LIST then - color = traverse(n, color) - elseif type == COLOR - or (type == WHATSIT - and subtype[n.subtype]) then + local t = get_type(n) + if t == LIST then + color = traverse(n, color, DRY_FALSE) + elseif t == LIST_LEADERS then + local color_after = traverse(n.leader, color, DRY_TRUE) + if color == color_after then + traverse(n.leader, color, DRY_FALSE) + else + traverse(n.leader, '', DRY_FALSE) + end + elseif t == COLOR then local v = node.has_attribute(n, attribute) if v then local newColor = map[v] if newColor ~= color then color = newColor - local newNode - if ifpdf then - newNode = node.new(WHATSIT, PDFLITERAL) - newNode.mode = mode - newNode.data = color - else - newNode = node.new(WHATSIT, SPECIAL) - newNode.data = prefix .. color - end - if head == n then - newNode.next = head - local old_prev = head.prev - head.prev = newNode - head = newNode - head.prev = old_prev - else - head = node.insert_before(head, n, newNode) + if dry == DRY_FALSE then + local newNode + if ifpdf then + newNode = node.new(WHATSIT, PDFLITERAL) + newNode.mode = mode + newNode.data = color + else + newNode = node.new(WHATSIT, SPECIAL) + newNode.data = prefix .. color + end + if head == n then + newNode.next = head + local old_prev = head.prev + head.prev = newNode + head = newNode + head.prev = old_prev + else + head = node.insert_before(head, n, newNode) + end end end end @@ -172,5 +199,10 @@ function traverse(list, color) list.list = head return color end +function process(box) + local color = "" + local list = tex.getbox(box) + traverse(list, color, DRY_FALSE) +end -- -- End of File `luacolor-pre065.lua'. diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor.lua b/Master/texmf-dist/scripts/oberdiek/luacolor.lua index 23450f44a69..33d3b2b02a4 100644 --- a/Master/texmf-dist/scripts/oberdiek/luacolor.lua +++ b/Master/texmf-dist/scripts/oberdiek/luacolor.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2011/03/29 v1.4 +-- Version: 2011/04/22 v1.5 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -104,65 +104,84 @@ local attribute function setattribute(attr) attribute = attr end -function process(box) - local color = "" - local list = tex.getbox(box) - traverse(list, color) -end local LIST = 1 -local COLOR = 2 -local type = { +local LIST_LEADERS = 2 +local COLOR = 3 +local RULE = node.id("rule") +local node_types = { [node.id("hlist")] = LIST, [node.id("vlist")] = LIST, [node.id("rule")] = COLOR, [node.id("glyph")] = COLOR, [node.id("disc")] = COLOR, + [node.id("whatsit")] = { + [3] = COLOR, -- special + [8] = COLOR, -- pdf_literal + [14] = COLOR, -- pdf_refximage + }, + [node.id("glue")] = + function(n) + if n.subtype >= 100 then -- leaders + if n.leader.id == RULE then + return COLOR + else + return LIST_LEADERS + end + end + end, } -local subtype = { - [3] = COLOR, -- special - [8] = COLOR, -- pdf_literal -} +local function get_type(n) + local ret = node_types[n.id] + if type(ret) == 'table' then + ret = ret[n.subtype] + end + if type(ret) == 'function' then + ret = ret(n) + end + return ret +end local mode = 2 -- luatex.pdfliteral.direct local WHATSIT = node.id("whatsit") local SPECIAL = 3 local PDFLITERAL = 8 -function traverse(list, color) +local DRY_FALSE = 0 +local DRY_TRUE = 1 +local function traverse(list, color, dry) if not list then return color end - if type[list.id] ~= LIST then + if get_type(list) ~= LIST then texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) return color end local head = list.head for n in node.traverse(head) do - local type = type[n.id] - if type == LIST then - color = traverse(n, color) - elseif type == COLOR - or (type == WHATSIT - and subtype[n.subtype]) then + local t = get_type(n) + if t == LIST then + color = traverse(n, color, DRY_FALSE) + elseif t == LIST_LEADERS then + local color_after = traverse(n.leader, color, DRY_TRUE) + if color == color_after then + traverse(n.leader, color, DRY_FALSE) + else + traverse(n.leader, '', DRY_FALSE) + end + elseif t == COLOR then local v = node.has_attribute(n, attribute) if v then local newColor = map[v] if newColor ~= color then color = newColor - local newNode - if ifpdf then - newNode = node.new(WHATSIT, PDFLITERAL) - newNode.mode = mode - newNode.data = color - else - newNode = node.new(WHATSIT, SPECIAL) - newNode.data = prefix .. color - end - if head == n then - newNode.next = head - local old_prev = head.prev - head.prev = newNode - head = newNode - head.prev = old_prev - else + if dry == DRY_FALSE then + local newNode + if ifpdf then + newNode = node.new(WHATSIT, PDFLITERAL) + newNode.mode = mode + newNode.data = color + else + newNode = node.new(WHATSIT, SPECIAL) + newNode.data = prefix .. color + end head = node.insert_before(head, n, newNode) end end @@ -172,5 +191,10 @@ function traverse(list, color) list.head = head return color end +function process(box) + local color = "" + local list = tex.getbox(box) + traverse(list, color, DRY_FALSE) +end -- -- End of File `luacolor.lua'. diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua index 06c2db5170c..51db02959f2 100644 --- a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua +++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2011/03/29 v1.4 +-- Version: 2011/04/22 v1.5 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -104,66 +104,93 @@ local attribute function setattribute(attr) attribute = attr end -function process(box) - local color = "" - local list = tex.getbox(box) - traverse(list, color) -end local LIST = 1 -local COLOR = 2 -local type = { +local LIST_LEADERS = 2 +local COLOR = 3 +local RULE = node.id("rule") +local node_types = { [node.id("hlist")] = LIST, [node.id("vlist")] = LIST, [node.id("rule")] = COLOR, [node.id("glyph")] = COLOR, [node.id("disc")] = COLOR, + [node.id("whatsit")] = { + [3] = COLOR, -- special + [8] = COLOR, -- pdf_literal + [14] = COLOR, -- pdf_refximage + }, + [node.id("glue")] = + function(n) + if n.subtype >= 100 then -- leaders + if n.leader.id == RULE then + return COLOR + else + return LIST_LEADERS + end + end + end, } -local subtype = { - [3] = COLOR, -- special - [8] = COLOR, -- pdf_literal -} +local function get_type(n) + local ret = node_types[n.id] + if type(ret) == 'table' then + ret = ret[n.subtype] + end + if type(ret) == 'function' then + ret = ret(n) + end + return ret +end local mode = 2 -- luatex.pdfliteral.direct local WHATSIT = node.id("whatsit") local SPECIAL = 3 local PDFLITERAL = 8 -function traverse(list, color) +local DRY_FALSE = 0 +local DRY_TRUE = 1 +local function traverse(list, color, dry) if not list then return color end - if type[list.id] ~= LIST then + if get_type(list) ~= LIST then texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) return color end local head = list.list for n in node.traverse(head) do - local type = type[n.id] - if type == LIST then - color = traverse(n, color) - elseif type == COLOR - or (type == WHATSIT - and subtype[n.subtype]) then + local t = get_type(n) + if t == LIST then + color = traverse(n, color, DRY_FALSE) + elseif t == LIST_LEADERS then + local color_after = traverse(n.leader, color, DRY_TRUE) + if color == color_after then + traverse(n.leader, color, DRY_FALSE) + else + traverse(n.leader, '', DRY_FALSE) + end + elseif t == COLOR then local v = node.has_attribute(n, attribute) if v then local newColor = map[v] if newColor ~= color then color = newColor - local newNode - if ifpdf then - newNode = node.new(WHATSIT, PDFLITERAL) - newNode.mode = mode - newNode.data = color - else - newNode = node.new(WHATSIT, SPECIAL) - newNode.data = prefix .. color - end - if head == n then - newNode.next = head - local old_prev = head.prev - head.prev = newNode - head = newNode - head.prev = old_prev - else - head = node.insert_before(head, n, newNode) + if dry == DRY_FALSE then + local newNode + if ifpdf then + newNode = node.new(WHATSIT, PDFLITERAL) + newNode.mode = mode + newNode.data = color + else + newNode = node.new(WHATSIT, SPECIAL) + newNode.data = prefix .. color + end + if head == n then + newNode.next = head + local old_prev = head.prev + head.prev = newNode + head = newNode + head.prev = old_prev + else + head = node.insert_before(head, n, newNode) + end end end end @@ -172,5 +199,10 @@ function traverse(list, color) list.list = head return color end +function process(box) + local color = "" + local list = tex.getbox(box) + traverse(list, color, DRY_FALSE) +end -- -- End of File `oberdiek.luacolor-pre065.lua'. diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua index 5638e8c1974..0f5dafdd80b 100644 --- a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua +++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2011/03/29 v1.4 +-- Version: 2011/04/22 v1.5 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -104,65 +104,84 @@ local attribute function setattribute(attr) attribute = attr end -function process(box) - local color = "" - local list = tex.getbox(box) - traverse(list, color) -end local LIST = 1 -local COLOR = 2 -local type = { +local LIST_LEADERS = 2 +local COLOR = 3 +local RULE = node.id("rule") +local node_types = { [node.id("hlist")] = LIST, [node.id("vlist")] = LIST, [node.id("rule")] = COLOR, [node.id("glyph")] = COLOR, [node.id("disc")] = COLOR, + [node.id("whatsit")] = { + [3] = COLOR, -- special + [8] = COLOR, -- pdf_literal + [14] = COLOR, -- pdf_refximage + }, + [node.id("glue")] = + function(n) + if n.subtype >= 100 then -- leaders + if n.leader.id == RULE then + return COLOR + else + return LIST_LEADERS + end + end + end, } -local subtype = { - [3] = COLOR, -- special - [8] = COLOR, -- pdf_literal -} +local function get_type(n) + local ret = node_types[n.id] + if type(ret) == 'table' then + ret = ret[n.subtype] + end + if type(ret) == 'function' then + ret = ret(n) + end + return ret +end local mode = 2 -- luatex.pdfliteral.direct local WHATSIT = node.id("whatsit") local SPECIAL = 3 local PDFLITERAL = 8 -function traverse(list, color) +local DRY_FALSE = 0 +local DRY_TRUE = 1 +local function traverse(list, color, dry) if not list then return color end - if type[list.id] ~= LIST then + if get_type(list) ~= LIST then texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) return color end local head = list.head for n in node.traverse(head) do - local type = type[n.id] - if type == LIST then - color = traverse(n, color) - elseif type == COLOR - or (type == WHATSIT - and subtype[n.subtype]) then + local t = get_type(n) + if t == LIST then + color = traverse(n, color, DRY_FALSE) + elseif t == LIST_LEADERS then + local color_after = traverse(n.leader, color, DRY_TRUE) + if color == color_after then + traverse(n.leader, color, DRY_FALSE) + else + traverse(n.leader, '', DRY_FALSE) + end + elseif t == COLOR then local v = node.has_attribute(n, attribute) if v then local newColor = map[v] if newColor ~= color then color = newColor - local newNode - if ifpdf then - newNode = node.new(WHATSIT, PDFLITERAL) - newNode.mode = mode - newNode.data = color - else - newNode = node.new(WHATSIT, SPECIAL) - newNode.data = prefix .. color - end - if head == n then - newNode.next = head - local old_prev = head.prev - head.prev = newNode - head = newNode - head.prev = old_prev - else + if dry == DRY_FALSE then + local newNode + if ifpdf then + newNode = node.new(WHATSIT, PDFLITERAL) + newNode.mode = mode + newNode.data = color + else + newNode = node.new(WHATSIT, SPECIAL) + newNode.data = prefix .. color + end head = node.insert_before(head, n, newNode) end end @@ -172,5 +191,10 @@ function traverse(list, color) list.head = head return color end +function process(box) + local color = "" + local list = tex.getbox(box) + traverse(list, color, DRY_FALSE) +end -- -- End of File `oberdiek.luacolor.lua'. diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua index 4a3b9765822..3fb036e8f53 100644 --- a/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua +++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: pdftexcmds --- Version: 2011/04/16 v0.15 +-- Version: 2011/04/22 v0.16 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -41,7 +41,7 @@ module("oberdiek.pdftexcmds", package.seeall) local systemexitstatus function getversion() - tex.write("2011/04/16 v0.15") + tex.write("2011/04/22 v0.16") end function strcmp(A, B) if A == B then @@ -276,7 +276,7 @@ function shellescape() if os.execute then if status and status.luatex_version - and status.luatex_version >= 70 then + and status.luatex_version >= 68 then tex.write(os.execute()) else local result = os.execute() diff --git a/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua index 73cc9e33494..02570a68902 100644 --- a/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua +++ b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: pdftexcmds --- Version: 2011/04/16 v0.15 +-- Version: 2011/04/22 v0.16 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek @@ -41,7 +41,7 @@ module("oberdiek.pdftexcmds", package.seeall) local systemexitstatus function getversion() - tex.write("2011/04/16 v0.15") + tex.write("2011/04/22 v0.16") end function strcmp(A, B) if A == B then @@ -276,7 +276,7 @@ function shellescape() if os.execute then if status and status.luatex_version - and status.luatex_version >= 70 then + and status.luatex_version >= 68 then tex.write(os.execute()) else local result = os.execute() -- cgit v1.2.3