diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-30 22:20:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-30 22:20:44 +0000 |
commit | 31c4ed490cc529727c6f14a87e143092c63d7e6f (patch) | |
tree | a7738aa71faebdf5258ca651136dbf449b0fca5f /Master/texmf-dist/scripts | |
parent | a9e7b81367e5bdca5b67c393a7b1c16afd2ba2d9 (diff) |
oberdiek (30nov19)
git-svn-id: svn://tug.org/texlive/trunk@52987 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r-- | Master/texmf-dist/scripts/oberdiek/luacolor.lua | 220 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/oberdiek/magicnum.lua | 245 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua | 245 |
3 files changed, 0 insertions, 710 deletions
diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor.lua b/Master/texmf-dist/scripts/oberdiek/luacolor.lua deleted file mode 100644 index dbc7ae89808..00000000000 --- a/Master/texmf-dist/scripts/oberdiek/luacolor.lua +++ /dev/null @@ -1,220 +0,0 @@ --- --- This is file `luacolor.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luacolor.dtx (with options: `lua') --- --- This is a generated file. --- --- Project: luacolor --- Version: 2019/07/25 v1.12 --- --- Copyright (C) 2007, 2009-2011 by --- Heiko Oberdiek <heiko.oberdiek at googlemail.com> --- --- This work may be distributed and/or modified under the --- conditions of the LaTeX Project Public License, either --- version 1.3c of this license or (at your option) any later --- version. This version of this license is in --- https://www.latex-project.org/lppl/lppl-1-3c.txt --- and the latest version of this license is in --- https://www.latex-project.org/lppl.txt --- and version 1.3 or later is part of all distributions of --- LaTeX version 2005/12/01 or later. --- --- This work has the LPPL maintenance status "maintained". --- --- The Current Maintainers of this work are --- Heiko Oberdiek and the Oberdiek Package Support Group --- https://github.com/ho-tex/oberdiek/issues --- --- --- This work consists of the main source file luacolor.dtx --- and the derived files --- luacolor.sty, luacolor.pdf, luacolor.ins, luacolor.drv, --- luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex, --- luacolor.lua, --- -oberdiek = oberdiek or {} -local luacolor = oberdiek.luacolor or {} -oberdiek.luacolor = luacolor -function luacolor.getversion() - tex.write("2019/07/25 v1.12") -end -local ifpdf = tonumber(tex.outputmode or tex.pdfoutput) > 0 -local prefix -local prefixes = { - dvips = "color ", - dvipdfm = "pdf:sc ", - truetex = "textcolor:", - pctexps = "ps::", -} -local patterns = { - ["^color "] = "dvips", - ["^pdf: *begincolor "] = "dvipdfm", - ["^pdf: *bcolor "] = "dvipdfm", - ["^pdf: *bc "] = "dvipdfm", - ["^pdf: *setcolor "] = "dvipdfm", - ["^pdf: *scolor "] = "dvipdfm", - ["^pdf: *sc "] = "dvipdfm", - ["^textcolor:"] = "truetex", - ["^ps::"] = "pctexps", -} -local function info(msg, term) - local target = "log" - if term then - target = "term and log" - end - texio.write_nl(target, "Package luacolor info: " .. msg .. ".") - texio.write_nl(target, "") -end -function luacolor.dvidetect() - local v = tex.box[0] - assert(v.id == node.id("hlist")) - for v in node.traverse_id(node.id("whatsit"), v.head) do - if v and v.subtype == node.subtype("special") then - local data = v.data - for pattern, driver in pairs(patterns) do - if string.find(data, pattern) then - prefix = prefixes[driver] - tex.write(driver) - return - end - end - info("\\special{" .. data .. "}", true) - return - end - end - info("Missing \\special", true) -end -local map = { - n = 0, -} -function luacolor.get(color) - tex.write("" .. luacolor.getvalue(color)) -end -function luacolor.getvalue(color) - local n = map[color] - if not n then - n = map.n + 1 - map.n = n - map[n] = color - map[color] = n - end - return n -end -local attribute -function luacolor.setattribute(attr) - attribute = attr -end -function luacolor.getattribute() - return attribute -end -local LIST = 1 -local LIST_LEADERS = 2 -local LIST_DISC = 3 -local COLOR = 4 -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")] = LIST_DISC, - [node.id("whatsit")] = { - [node.subtype("special")] = COLOR, - [node.subtype("pdf_literal")] = COLOR, - [node.subtype("pdf_save")] = COLOR, - [node.subtype("pdf_restore")] = COLOR, -- probably not needed --- TODO (DPC) [node.subtype("pdf_refximage")] = COLOR, - }, - [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 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 = node.subtype("special") -local PDFLITERAL = node.subtype("pdf_literal") -local DRY_FALSE = false -local DRY_TRUE = true -local function traverse(list, color, dry) - if not list then - return color - end - local head - if get_type(list) == LIST then - head = list.head - elseif get_type(list) == LIST_DISC then - head = list.replace - else - texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) - return color - end - for n in node.traverse(head) do - local t = get_type(n) - if t == LIST or t == LIST_DISC then - color = traverse(n, color, dry) - 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 or dry) - else - traverse(n.leader, '', DRY_FALSE or dry) - color = '' - 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 - 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 - end - end - end - if get_type(list) == LIST then - list.head = head - else - list.replace = head - end - return color -end -function luacolor.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/magicnum.lua b/Master/texmf-dist/scripts/oberdiek/magicnum.lua deleted file mode 100644 index 7fdbb4efc37..00000000000 --- a/Master/texmf-dist/scripts/oberdiek/magicnum.lua +++ /dev/null @@ -1,245 +0,0 @@ --- --- This is file `magicnum.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- magicnum.dtx (with options: `lua') --- --- This is a generated file. --- --- Project: magicnum --- Version: 2019/07/25 v1.6 --- --- Copyright (C) 2007, 2009-2011 by --- Heiko Oberdiek <heiko.oberdiek at googlemail.com> --- --- This work may be distributed and/or modified under the --- conditions of the LaTeX Project Public License, either --- version 1.3c of this license or (at your option) any later --- version. This version of this license is in --- https://www.latex-project.org/lppl/lppl-1-3c.txt --- and the latest version of this license is in --- https://www.latex-project.org/lppl.txt --- and version 1.3 or later is part of all distributions of --- LaTeX version 2005/12/01 or later. --- --- This work has the LPPL maintenance status "maintained". --- --- The Current Maintainers of this work are --- Heiko Oberdiek and the Oberdiek Package Support Group --- https://github.com/ho-tex/oberdiek/issues --- --- --- The Base Interpreter refers to any `TeX-Format', --- because some files are installed in TDS:tex/generic//. --- --- This work consists of the main source file magicnum.dtx --- and the derived files --- magicnum.sty, magicnum.pdf, magicnum.ins, magicnum.drv, magicnum.txt, --- magicnum-test1.tex, magicnum-test2.tex, magicnum-test3.tex, --- magicnum-test4.tex, magicnum.lua, oberdiek.magicnum.lua. --- -oberdiek = oberdiek or {} -local magicnum = oberdiek.magicnum or {} -oberdiek.magicnum = magicnum -function magicnum.getversion() - tex.write("2019/07/25 v1.6") -end -local data = { - ["tex.catcode"] = { - [0] = "escape", - [1] = "begingroup", - [2] = "endgroup", - [3] = "math", - [4] = "align", - [5] = "eol", - [6] = "parameter", - [7] = "superscript", - [8] = "subscript", - [9] = "ignore", - [10] = "space", - [11] = "letter", - [12] = "other", - [13] = "active", - [14] = "comment", - [15] = "invalid", - ["active"] = 13, - ["align"] = 4, - ["begingroup"] = 1, - ["comment"] = 14, - ["endgroup"] = 2, - ["eol"] = 5, - ["escape"] = 0, - ["ignore"] = 9, - ["invalid"] = 15, - ["letter"] = 11, - ["math"] = 3, - ["other"] = 12, - ["parameter"] = 6, - ["space"] = 10, - ["subscript"] = 8, - ["superscript"] = 7 - }, - ["etex.grouptype"] = { - [0] = "bottomlevel", - [1] = "simple", - [2] = "hbox", - [3] = "adjustedhbox", - [4] = "vbox", - [5] = "align", - [6] = "noalign", - [8] = "output", - [9] = "math", - [10] = "disc", - [11] = "insert", - [12] = "vcenter", - [13] = "mathchoice", - [14] = "semisimple", - [15] = "mathshift", - [16] = "mathleft", - ["adjustedhbox"] = 3, - ["align"] = 5, - ["bottomlevel"] = 0, - ["disc"] = 10, - ["hbox"] = 2, - ["insert"] = 11, - ["math"] = 9, - ["mathchoice"] = 13, - ["mathleft"] = 16, - ["mathshift"] = 15, - ["noalign"] = 6, - ["output"] = 8, - ["semisimple"] = 14, - ["simple"] = 1, - ["vbox"] = 4, - ["vcenter"] = 12 - }, - ["etex.iftype"] = { - [0] = "none", - [1] = "char", - [2] = "cat", - [3] = "num", - [4] = "dim", - [5] = "odd", - [6] = "vmode", - [7] = "hmode", - [8] = "mmode", - [9] = "inner", - [10] = "void", - [11] = "hbox", - [12] = "vbox", - [13] = "x", - [14] = "eof", - [15] = "true", - [16] = "false", - [17] = "case", - [18] = "defined", - [19] = "csname", - [20] = "fontchar", - ["case"] = 17, - ["cat"] = 2, - ["char"] = 1, - ["csname"] = 19, - ["defined"] = 18, - ["dim"] = 4, - ["eof"] = 14, - ["false"] = 16, - ["fontchar"] = 20, - ["hbox"] = 11, - ["hmode"] = 7, - ["inner"] = 9, - ["mmode"] = 8, - ["none"] = 0, - ["num"] = 3, - ["odd"] = 5, - ["true"] = 15, - ["vbox"] = 12, - ["vmode"] = 6, - ["void"] = 10, - ["x"] = 13 - }, - ["etex.nodetype"] = { - [-1] = "none", - [0] = "char", - [1] = "hlist", - [2] = "vlist", - [3] = "rule", - [4] = "ins", - [5] = "mark", - [6] = "adjust", - [7] = "ligature", - [8] = "disc", - [9] = "whatsit", - [10] = "math", - [11] = "glue", - [12] = "kern", - [13] = "penalty", - [14] = "unset", - [15] = "maths", - ["adjust"] = 6, - ["char"] = 0, - ["disc"] = 8, - ["glue"] = 11, - ["hlist"] = 1, - ["ins"] = 4, - ["kern"] = 12, - ["ligature"] = 7, - ["mark"] = 5, - ["math"] = 10, - ["maths"] = 15, - ["none"] = -1, - ["penalty"] = 13, - ["rule"] = 3, - ["unset"] = 14, - ["vlist"] = 2, - ["whatsit"] = 9 - }, - ["etex.interactionmode"] = { - [0] = "batch", - [1] = "nonstop", - [2] = "scroll", - [3] = "errorstop", - ["batch"] = 0, - ["errorstop"] = 3, - ["nonstop"] = 1, - ["scroll"] = 2 - }, - ["luatex.pdfliteral.mode"] = { - [0] = "setorigin", - [1] = "page", - [2] = "direct", - ["direct"] = 2, - ["page"] = 1, - ["setorigin"] = 0 - } -} -function magicnum.get(name) - local startpos, endpos, category, entry = - string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$") - if not entry then - return - end - local node = data[category] - if not node then - return - end - local num = tonumber(entry) - local value - if num then - value = node[num] - if not value then - return - end - else - value = node[entry] - if not value then - return - end - value = "" .. value - end - tex.write(value) -end - --- --- End of File `magicnum.lua'. diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua deleted file mode 100644 index b74508a3608..00000000000 --- a/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua +++ /dev/null @@ -1,245 +0,0 @@ --- --- This is file `oberdiek.magicnum.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- magicnum.dtx (with options: `lua') --- --- This is a generated file. --- --- Project: magicnum --- Version: 2019/07/25 v1.6 --- --- Copyright (C) 2007, 2009-2011 by --- Heiko Oberdiek <heiko.oberdiek at googlemail.com> --- --- This work may be distributed and/or modified under the --- conditions of the LaTeX Project Public License, either --- version 1.3c of this license or (at your option) any later --- version. This version of this license is in --- https://www.latex-project.org/lppl/lppl-1-3c.txt --- and the latest version of this license is in --- https://www.latex-project.org/lppl.txt --- and version 1.3 or later is part of all distributions of --- LaTeX version 2005/12/01 or later. --- --- This work has the LPPL maintenance status "maintained". --- --- The Current Maintainers of this work are --- Heiko Oberdiek and the Oberdiek Package Support Group --- https://github.com/ho-tex/oberdiek/issues --- --- --- The Base Interpreter refers to any `TeX-Format', --- because some files are installed in TDS:tex/generic//. --- --- This work consists of the main source file magicnum.dtx --- and the derived files --- magicnum.sty, magicnum.pdf, magicnum.ins, magicnum.drv, magicnum.txt, --- magicnum-test1.tex, magicnum-test2.tex, magicnum-test3.tex, --- magicnum-test4.tex, magicnum.lua, oberdiek.magicnum.lua. --- -oberdiek = oberdiek or {} -local magicnum = oberdiek.magicnum or {} -oberdiek.magicnum = magicnum -function magicnum.getversion() - tex.write("2019/07/25 v1.6") -end -local data = { - ["tex.catcode"] = { - [0] = "escape", - [1] = "begingroup", - [2] = "endgroup", - [3] = "math", - [4] = "align", - [5] = "eol", - [6] = "parameter", - [7] = "superscript", - [8] = "subscript", - [9] = "ignore", - [10] = "space", - [11] = "letter", - [12] = "other", - [13] = "active", - [14] = "comment", - [15] = "invalid", - ["active"] = 13, - ["align"] = 4, - ["begingroup"] = 1, - ["comment"] = 14, - ["endgroup"] = 2, - ["eol"] = 5, - ["escape"] = 0, - ["ignore"] = 9, - ["invalid"] = 15, - ["letter"] = 11, - ["math"] = 3, - ["other"] = 12, - ["parameter"] = 6, - ["space"] = 10, - ["subscript"] = 8, - ["superscript"] = 7 - }, - ["etex.grouptype"] = { - [0] = "bottomlevel", - [1] = "simple", - [2] = "hbox", - [3] = "adjustedhbox", - [4] = "vbox", - [5] = "align", - [6] = "noalign", - [8] = "output", - [9] = "math", - [10] = "disc", - [11] = "insert", - [12] = "vcenter", - [13] = "mathchoice", - [14] = "semisimple", - [15] = "mathshift", - [16] = "mathleft", - ["adjustedhbox"] = 3, - ["align"] = 5, - ["bottomlevel"] = 0, - ["disc"] = 10, - ["hbox"] = 2, - ["insert"] = 11, - ["math"] = 9, - ["mathchoice"] = 13, - ["mathleft"] = 16, - ["mathshift"] = 15, - ["noalign"] = 6, - ["output"] = 8, - ["semisimple"] = 14, - ["simple"] = 1, - ["vbox"] = 4, - ["vcenter"] = 12 - }, - ["etex.iftype"] = { - [0] = "none", - [1] = "char", - [2] = "cat", - [3] = "num", - [4] = "dim", - [5] = "odd", - [6] = "vmode", - [7] = "hmode", - [8] = "mmode", - [9] = "inner", - [10] = "void", - [11] = "hbox", - [12] = "vbox", - [13] = "x", - [14] = "eof", - [15] = "true", - [16] = "false", - [17] = "case", - [18] = "defined", - [19] = "csname", - [20] = "fontchar", - ["case"] = 17, - ["cat"] = 2, - ["char"] = 1, - ["csname"] = 19, - ["defined"] = 18, - ["dim"] = 4, - ["eof"] = 14, - ["false"] = 16, - ["fontchar"] = 20, - ["hbox"] = 11, - ["hmode"] = 7, - ["inner"] = 9, - ["mmode"] = 8, - ["none"] = 0, - ["num"] = 3, - ["odd"] = 5, - ["true"] = 15, - ["vbox"] = 12, - ["vmode"] = 6, - ["void"] = 10, - ["x"] = 13 - }, - ["etex.nodetype"] = { - [-1] = "none", - [0] = "char", - [1] = "hlist", - [2] = "vlist", - [3] = "rule", - [4] = "ins", - [5] = "mark", - [6] = "adjust", - [7] = "ligature", - [8] = "disc", - [9] = "whatsit", - [10] = "math", - [11] = "glue", - [12] = "kern", - [13] = "penalty", - [14] = "unset", - [15] = "maths", - ["adjust"] = 6, - ["char"] = 0, - ["disc"] = 8, - ["glue"] = 11, - ["hlist"] = 1, - ["ins"] = 4, - ["kern"] = 12, - ["ligature"] = 7, - ["mark"] = 5, - ["math"] = 10, - ["maths"] = 15, - ["none"] = -1, - ["penalty"] = 13, - ["rule"] = 3, - ["unset"] = 14, - ["vlist"] = 2, - ["whatsit"] = 9 - }, - ["etex.interactionmode"] = { - [0] = "batch", - [1] = "nonstop", - [2] = "scroll", - [3] = "errorstop", - ["batch"] = 0, - ["errorstop"] = 3, - ["nonstop"] = 1, - ["scroll"] = 2 - }, - ["luatex.pdfliteral.mode"] = { - [0] = "setorigin", - [1] = "page", - [2] = "direct", - ["direct"] = 2, - ["page"] = 1, - ["setorigin"] = 0 - } -} -function magicnum.get(name) - local startpos, endpos, category, entry = - string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$") - if not entry then - return - end - local node = data[category] - if not node then - return - end - local num = tonumber(entry) - local value - if num then - value = node[num] - if not value then - return - end - else - value = node[entry] - if not value then - return - end - value = "" .. value - end - tex.write(value) -end - --- --- End of File `oberdiek.magicnum.lua'. |