summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/oberdiek
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-12-15 00:23:34 +0000
committerKarl Berry <karl@freefriends.org>2007-12-15 00:23:34 +0000
commit116405a01899ba783a14653896d02888e298fbb1 (patch)
treea18817a449117e864d52b1cf21f5be0eac3ed7cb /Master/texmf-dist/scripts/oberdiek
parent61cc3ba9dfd27cde051a486dad06940dfff0e699 (diff)
oberdiek: luacolor1.0 luatex1.0 ... (14dec07)
git-svn-id: svn://tug.org/texlive/trunk@5785 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/oberdiek')
-rw-r--r--Master/texmf-dist/scripts/oberdiek/luacolor.lua169
-rw-r--r--Master/texmf-dist/scripts/oberdiek/magicnum.lua227
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua169
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua48
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua227
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua295
-rw-r--r--Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua295
7 files changed, 1430 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor.lua b/Master/texmf-dist/scripts/oberdiek/luacolor.lua
new file mode 100644
index 00000000000..332a78a8299
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/luacolor.lua
@@ -0,0 +1,169 @@
+--
+-- 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.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- 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,
+-- oberdiek.luacolor.lua, luacolor.lua.
+--
+module("oberdiek.luacolor", package.seeall)
+local ifpdf
+if tonumber(tex.pdfoutput) > 0 then
+ ifpdf = true
+else
+ ifpdf = false
+end
+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 dvidetect()
+ local v = tex.box[0]
+ assert(v.id == node.id("hlist"))
+ for v in node.traverse_id(node.id("whatsit"), v.list) do
+ if v and v.subtype == 3 then -- special
+ 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 get(color)
+ local n = map[color]
+ if not n then
+ n = map.n + 1
+ map.n = n
+ map[n] = color
+ map[color] = n
+ end
+ tex.write("" .. n)
+end
+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 = {
+ [node.id("hlist")] = LIST,
+ [node.id("vlist")] = LIST,
+ [node.id("rule")] = COLOR,
+ [node.id("glyph")] = COLOR,
+ [node.id("disc")] = COLOR,
+}
+local subtype = {
+ [3] = COLOR, -- special
+ [8] = COLOR, -- pdf_literal
+}
+local mode = 2 -- luatex.pdfliteral.direct
+local WHATSIT = node.id("whatsit")
+local SPECIAL = 3
+local PDFLITERAL = 8
+function traverse(list, color)
+ if not list then
+ return color
+ end
+ if type[list.id] ~= 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 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)
+ end
+ end
+ end
+ end
+ end
+ list.list = head
+ return color
+end
+--
+-- End of File `luacolor.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/magicnum.lua b/Master/texmf-dist/scripts/oberdiek/magicnum.lua
new file mode 100644
index 00000000000..87f9ee1f22f
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/magicnum.lua
@@ -0,0 +1,227 @@
+--
+-- 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.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- 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.lua, oberdiek.magicnum.lua.
+--
+module("oberdiek.magicnum", package.seeall)
+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 get(name, catcodetable)
+ 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.print(catcodetable, value)
+end
+--
+-- End of File `magicnum.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua
new file mode 100644
index 00000000000..1d6bcda1acb
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua
@@ -0,0 +1,169 @@
+--
+-- This is file `oberdiek.luacolor.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luacolor.dtx (with options: `lua')
+--
+-- This is a generated file.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- 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,
+-- oberdiek.luacolor.lua, luacolor.lua.
+--
+module("oberdiek.luacolor", package.seeall)
+local ifpdf
+if tonumber(tex.pdfoutput) > 0 then
+ ifpdf = true
+else
+ ifpdf = false
+end
+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 dvidetect()
+ local v = tex.box[0]
+ assert(v.id == node.id("hlist"))
+ for v in node.traverse_id(node.id("whatsit"), v.list) do
+ if v and v.subtype == 3 then -- special
+ 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 get(color)
+ local n = map[color]
+ if not n then
+ n = map.n + 1
+ map.n = n
+ map[n] = color
+ map[color] = n
+ end
+ tex.write("" .. n)
+end
+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 = {
+ [node.id("hlist")] = LIST,
+ [node.id("vlist")] = LIST,
+ [node.id("rule")] = COLOR,
+ [node.id("glyph")] = COLOR,
+ [node.id("disc")] = COLOR,
+}
+local subtype = {
+ [3] = COLOR, -- special
+ [8] = COLOR, -- pdf_literal
+}
+local mode = 2 -- luatex.pdfliteral.direct
+local WHATSIT = node.id("whatsit")
+local SPECIAL = 3
+local PDFLITERAL = 8
+function traverse(list, color)
+ if not list then
+ return color
+ end
+ if type[list.id] ~= 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 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)
+ end
+ end
+ end
+ end
+ end
+ list.list = head
+ return color
+end
+--
+-- End of File `oberdiek.luacolor.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua
new file mode 100644
index 00000000000..6044e22bbe6
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua
@@ -0,0 +1,48 @@
+--
+-- This is file `oberdiek.luatex.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatex.dtx (with options: `lua')
+--
+-- This is a generated file.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- This work consists of the main source file luatex.dtx
+-- and the derived files
+-- luatex.sty, luatex.pdf, luatex.ins, luatex.drv, luatex-loader.sty,
+-- luatex-test1.tex, luatex-test2.tex, luatex-test3.tex,
+-- luatex-test4.tex, luatex-test5.tex, oberdiek.luatex.lua.
+--
+module("oberdiek.luatex", package.seeall)
+function kpse_module_loader(module)
+ local script = module .. ".lua"
+ local file = kpse.find_file(script, "texmfscripts")
+ if file then
+ local loader, error = loadfile(file)
+ if loader then
+ texio.write_nl("(" .. file .. ")")
+ return loader
+ end
+ return "\n\t[oberdiek.luatex.kpse_module_loader] Loading error:\n\t"
+ .. error
+ end
+ return "\n\t[oberdiek.luatex.kpse_module_loader] Search failed"
+end
+table.insert(package.loaders, kpse_module_loader)
+--
+-- End of File `oberdiek.luatex.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua
new file mode 100644
index 00000000000..130538094a0
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua
@@ -0,0 +1,227 @@
+--
+-- 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.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- 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.lua, oberdiek.magicnum.lua.
+--
+module("oberdiek.magicnum", package.seeall)
+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 get(name, catcodetable)
+ 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.print(catcodetable, value)
+end
+--
+-- End of File `oberdiek.magicnum.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
new file mode 100644
index 00000000000..00e488fcd24
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
@@ -0,0 +1,295 @@
+--
+-- This is file `oberdiek.pdftexcmds.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- pdftexcmds.dtx (with options: `lua')
+--
+-- This is a generated file.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- This work consists of the main source file pdftexcmds.dtx
+-- and the derived files
+-- pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv,
+-- oberdiek.pdftexcmds.lua, pdftexcmds.lua.
+--
+module("oberdiek.pdftexcmds", package.seeall)
+local systemexitstatus
+function strcmp(A, B)
+ if A == B then
+ tex.write("0")
+ elseif A < B then
+ tex.write("-1")
+ else
+ tex.write("1")
+ end
+end
+local function utf8_to_byte(str)
+ local i = 0
+ local n = string.len(str)
+ local t = {}
+ while i < n do
+ i = i + 1
+ local a = string.byte(str, i)
+ if a < 128 then
+ table.insert(t, string.char(a))
+ else
+ if a >= 192 and i < n then
+ i = i + 1
+ local b = string.byte(str, i)
+ if b < 128 or b >= 192 then
+ i = i - 1
+ elseif a == 194 then
+ table.insert(t, string.char(b))
+ elseif a == 195 then
+ table.insert(t, string.char(b + 64))
+ end
+ end
+ end
+ end
+ return table.concat(t)
+end
+function escapehex(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ return string.format("%02X", string.byte(ch))
+ end
+ )))
+end
+function unescapehex(str, mode)
+ local a = 0
+ local first = true
+ local result = {}
+ for i = 1, string.len(str), 1 do
+ local ch = string.byte(str, i)
+ if ch >= 48 and ch <= 57 then
+ ch = ch - 48
+ elseif ch >= 65 and ch <= 70 then
+ ch = ch - 55
+ elseif ch >= 97 and ch <= 102 then
+ ch = ch - 87
+ else
+ ch = nil
+ end
+ if ch then
+ if first then
+ a = ch * 16
+ first = false
+ else
+ table.insert(result, a + ch)
+ first = true
+ end
+ end
+ end
+ if not first then
+ table.insert(result, a)
+ end
+ if mode == "byte" then
+ local utf8 = {}
+ for i, a in ipairs(result) do
+ if a < 128 then
+ table.insert(utf8, a)
+ else
+ if a < 192 then
+ table.insert(utf8, 194)
+ a = a - 128
+ else
+ table.insert(utf8, 195)
+ a = a - 192
+ end
+ table.insert(utf8, a + 128)
+ end
+ end
+ result = utf8
+ end
+ tex.settoks(toks, string.char(unpack(result)))
+end
+function escapestring(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ local b = string.byte(ch)
+ if b < 33 or b > 126 then
+ return string.format("\\%.3o", b)
+ end
+ if b == 40 or b == 41 or b == 92 then
+ return "\\" .. ch
+ end
+ return nil
+ end
+ )))
+end
+function escapename(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ local b = string.byte(ch)
+ if b == 0 then
+ return ""
+ end
+ if b <= 32 or b >= 127
+ or b == 35 or b == 37 or b == 40 or b == 41
+ or b == 47 or b == 60 or b == 62 or b == 91
+ or b == 93 or b == 123 or b == 125 then
+ return string.format("#%.2X", b)
+ else
+ return nil
+ end
+ end
+ )))
+end
+function filesize(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local size = lfs.attributes(foundfile, "size")
+ if size then
+ tex.write(size)
+ end
+ end
+end
+function filemoddate(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local date = lfs.attributes(foundfile, "modification")
+ if date then
+ local d = os.date("*t", date)
+ if d.sec >= 60 then
+ d.sec = 59
+ end
+ local u = os.date("!*t", date)
+ local off = 60 * (d.hour - u.hour) + d.min - u.min
+ if d.year ~= u.year then
+ if d.year > u.year then
+ off = off + 1440
+ else
+ off = off - 1440
+ end
+ elseif d.yday ~= u.yday then
+ if d.yday > u.yday then
+ off = off + 1440
+ else
+ off = off - 1440
+ end
+ end
+ local timezone
+ if off == 0 then
+ timezone = "Z"
+ else
+ local hours = math.floor(off / 60)
+ local mins = math.abs(off - hours * 60)
+ timezone = string.format("%+03d'%02d'", hours, mins)
+ end
+ tex.write(string.format("D:%04d%02d%02d%02d%02d%02d%s",
+ d.year, d.month, d.day, d.hour, d.min, d.sec, timezone))
+ end
+ end
+end
+function filedump(offset, length, filename)
+ length = tonumber(length)
+ if length and length > 0 then
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ offset = tonumber(offset)
+ if not offset then
+ offset = 0
+ end
+ local filehandle = io.open(foundfile, "r")
+ if filehandle then
+ if offset > 0 then
+ filehandle:seek("set", offset)
+ end
+ local dump = filehandle:read(length)
+ escapehex(dump)
+ end
+ end
+ end
+end
+function mdfivesum(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ escapehex(md5.sum(str))
+end
+function filemdfivesum(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local filehandle = io.open(foundfile, "r")
+ if filehandle then
+ local contents = filehandle:read("*a")
+ escapehex(md5.sum(contents))
+ end
+ end
+end
+function shellescape()
+ if os.execute then
+ tex.write("1")
+ else
+ tex.write("0")
+ end
+end
+function system(cmdline)
+ systemexitstatus = nil
+ texio.write_nl("log", "system(" .. cmdline .. ") ")
+ if os.execute then
+ texio.write("log", "executed.")
+ systemexitstatus = os.execute(cmdline)
+ else
+ texio.write("log", "disabled.")
+ end
+end
+function lastsystemstatus()
+ local result = tonumber(systemexitstatus)
+ if result then
+ local x = math.floor(result / 256)
+ tex.write(result - 256 * math.floor(result / 256))
+ end
+end
+function lastsystemexit()
+ local result = tonumber(systemexitstatus)
+ if result then
+ tex.write(math.floor(result / 256))
+ end
+end
+function pipe(cmdline)
+ local result
+ systemexitstatus = nil
+ texio.write_nl("log", "pipe(" .. cmdline ..") ")
+ if io.popen then
+ texio.write("log", "executed.")
+ local handle = io.popen(cmdline, "r")
+ if handle then
+ result = handle:read("*a")
+ handle:close()
+ end
+ else
+ texio.write("log", "disabled.")
+ end
+ if result then
+ tex.settoks(toks, result)
+ else
+ tex.settoks(toks, "")
+ end
+end
+--
+-- End of File `oberdiek.pdftexcmds.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
new file mode 100644
index 00000000000..0c4c1475e8b
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
@@ -0,0 +1,295 @@
+--
+-- This is file `pdftexcmds.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- pdftexcmds.dtx (with options: `lua')
+--
+-- This is a generated file.
+--
+-- Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3 of this license or (at your option) any later
+-- version. The latest version of this license is in
+-- http://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".
+--
+-- This Current Maintainer of this work is Heiko Oberdiek.
+--
+-- This work consists of the main source file pdftexcmds.dtx
+-- and the derived files
+-- pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv,
+-- oberdiek.pdftexcmds.lua, pdftexcmds.lua.
+--
+module("oberdiek.pdftexcmds", package.seeall)
+local systemexitstatus
+function strcmp(A, B)
+ if A == B then
+ tex.write("0")
+ elseif A < B then
+ tex.write("-1")
+ else
+ tex.write("1")
+ end
+end
+local function utf8_to_byte(str)
+ local i = 0
+ local n = string.len(str)
+ local t = {}
+ while i < n do
+ i = i + 1
+ local a = string.byte(str, i)
+ if a < 128 then
+ table.insert(t, string.char(a))
+ else
+ if a >= 192 and i < n then
+ i = i + 1
+ local b = string.byte(str, i)
+ if b < 128 or b >= 192 then
+ i = i - 1
+ elseif a == 194 then
+ table.insert(t, string.char(b))
+ elseif a == 195 then
+ table.insert(t, string.char(b + 64))
+ end
+ end
+ end
+ end
+ return table.concat(t)
+end
+function escapehex(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ return string.format("%02X", string.byte(ch))
+ end
+ )))
+end
+function unescapehex(str, mode)
+ local a = 0
+ local first = true
+ local result = {}
+ for i = 1, string.len(str), 1 do
+ local ch = string.byte(str, i)
+ if ch >= 48 and ch <= 57 then
+ ch = ch - 48
+ elseif ch >= 65 and ch <= 70 then
+ ch = ch - 55
+ elseif ch >= 97 and ch <= 102 then
+ ch = ch - 87
+ else
+ ch = nil
+ end
+ if ch then
+ if first then
+ a = ch * 16
+ first = false
+ else
+ table.insert(result, a + ch)
+ first = true
+ end
+ end
+ end
+ if not first then
+ table.insert(result, a)
+ end
+ if mode == "byte" then
+ local utf8 = {}
+ for i, a in ipairs(result) do
+ if a < 128 then
+ table.insert(utf8, a)
+ else
+ if a < 192 then
+ table.insert(utf8, 194)
+ a = a - 128
+ else
+ table.insert(utf8, 195)
+ a = a - 192
+ end
+ table.insert(utf8, a + 128)
+ end
+ end
+ result = utf8
+ end
+ tex.settoks(toks, string.char(unpack(result)))
+end
+function escapestring(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ local b = string.byte(ch)
+ if b < 33 or b > 126 then
+ return string.format("\\%.3o", b)
+ end
+ if b == 40 or b == 41 or b == 92 then
+ return "\\" .. ch
+ end
+ return nil
+ end
+ )))
+end
+function escapename(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ tex.write((string.gsub(str, ".",
+ function (ch)
+ local b = string.byte(ch)
+ if b == 0 then
+ return ""
+ end
+ if b <= 32 or b >= 127
+ or b == 35 or b == 37 or b == 40 or b == 41
+ or b == 47 or b == 60 or b == 62 or b == 91
+ or b == 93 or b == 123 or b == 125 then
+ return string.format("#%.2X", b)
+ else
+ return nil
+ end
+ end
+ )))
+end
+function filesize(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local size = lfs.attributes(foundfile, "size")
+ if size then
+ tex.write(size)
+ end
+ end
+end
+function filemoddate(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local date = lfs.attributes(foundfile, "modification")
+ if date then
+ local d = os.date("*t", date)
+ if d.sec >= 60 then
+ d.sec = 59
+ end
+ local u = os.date("!*t", date)
+ local off = 60 * (d.hour - u.hour) + d.min - u.min
+ if d.year ~= u.year then
+ if d.year > u.year then
+ off = off + 1440
+ else
+ off = off - 1440
+ end
+ elseif d.yday ~= u.yday then
+ if d.yday > u.yday then
+ off = off + 1440
+ else
+ off = off - 1440
+ end
+ end
+ local timezone
+ if off == 0 then
+ timezone = "Z"
+ else
+ local hours = math.floor(off / 60)
+ local mins = math.abs(off - hours * 60)
+ timezone = string.format("%+03d'%02d'", hours, mins)
+ end
+ tex.write(string.format("D:%04d%02d%02d%02d%02d%02d%s",
+ d.year, d.month, d.day, d.hour, d.min, d.sec, timezone))
+ end
+ end
+end
+function filedump(offset, length, filename)
+ length = tonumber(length)
+ if length and length > 0 then
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ offset = tonumber(offset)
+ if not offset then
+ offset = 0
+ end
+ local filehandle = io.open(foundfile, "r")
+ if filehandle then
+ if offset > 0 then
+ filehandle:seek("set", offset)
+ end
+ local dump = filehandle:read(length)
+ escapehex(dump)
+ end
+ end
+ end
+end
+function mdfivesum(str, mode)
+ if mode == "byte" then
+ str = utf8_to_byte(str)
+ end
+ escapehex(md5.sum(str))
+end
+function filemdfivesum(filename)
+ local foundfile = kpse.find_file(filename, "tex", true)
+ if foundfile then
+ local filehandle = io.open(foundfile, "r")
+ if filehandle then
+ local contents = filehandle:read("*a")
+ escapehex(md5.sum(contents))
+ end
+ end
+end
+function shellescape()
+ if os.execute then
+ tex.write("1")
+ else
+ tex.write("0")
+ end
+end
+function system(cmdline)
+ systemexitstatus = nil
+ texio.write_nl("log", "system(" .. cmdline .. ") ")
+ if os.execute then
+ texio.write("log", "executed.")
+ systemexitstatus = os.execute(cmdline)
+ else
+ texio.write("log", "disabled.")
+ end
+end
+function lastsystemstatus()
+ local result = tonumber(systemexitstatus)
+ if result then
+ local x = math.floor(result / 256)
+ tex.write(result - 256 * math.floor(result / 256))
+ end
+end
+function lastsystemexit()
+ local result = tonumber(systemexitstatus)
+ if result then
+ tex.write(math.floor(result / 256))
+ end
+end
+function pipe(cmdline)
+ local result
+ systemexitstatus = nil
+ texio.write_nl("log", "pipe(" .. cmdline ..") ")
+ if io.popen then
+ texio.write("log", "executed.")
+ local handle = io.popen(cmdline, "r")
+ if handle then
+ result = handle:read("*a")
+ handle:close()
+ end
+ else
+ texio.write("log", "disabled.")
+ end
+ if result then
+ tex.settoks(toks, result)
+ else
+ tex.settoks(toks, "")
+ end
+end
+--
+-- End of File `pdftexcmds.lua'.