summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/oberdiek
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/oberdiek')
-rw-r--r--Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua173
-rw-r--r--Master/texmf-dist/scripts/oberdiek/luacolor.lua11
-rw-r--r--Master/texmf-dist/scripts/oberdiek/magicnum.lua11
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua173
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua11
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua11
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua55
-rwxr-xr-xMaster/texmf-dist/scripts/oberdiek/pdfatfi.pl70
-rw-r--r--Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua55
9 files changed, 520 insertions, 50 deletions
diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua b/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua
new file mode 100644
index 00000000000..6e5a86aed40
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/luacolor-pre065.lua
@@ -0,0 +1,173 @@
+--
+-- This is file `luacolor-pre065.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luacolor.dtx (with options: `lua,pre065')
+--
+-- This is a generated file.
+--
+-- 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
+-- http://www.latex-project.org/lppl/lppl-1-3c.txt
+-- and 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,
+-- oberdiek.luacolor-pre065.lua, luacolor-pre065.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-pre065.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor.lua b/Master/texmf-dist/scripts/oberdiek/luacolor.lua
index 49f7fcfc097..69040380829 100644
--- a/Master/texmf-dist/scripts/oberdiek/luacolor.lua
+++ b/Master/texmf-dist/scripts/oberdiek/luacolor.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009-2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -29,7 +29,8 @@
-- 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.
+-- oberdiek.luacolor.lua, luacolor.lua,
+-- oberdiek.luacolor-pre065.lua, luacolor-pre065.lua.
--
module("oberdiek.luacolor", package.seeall)
local ifpdf
@@ -67,7 +68,7 @@ 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
+ for v in node.traverse_id(node.id("whatsit"), v.head) do
if v and v.subtype == 3 then -- special
local data = v.data
for pattern, driver in pairs(patterns) do
@@ -130,7 +131,7 @@ function traverse(list, color)
texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id))
return color
end
- local head = list.list
+ local head = list.head
for n in node.traverse(head) do
local type = type[n.id]
if type == LIST then
@@ -165,7 +166,7 @@ function traverse(list, color)
end
end
end
- list.list = head
+ list.head = head
return color
end
--
diff --git a/Master/texmf-dist/scripts/oberdiek/magicnum.lua b/Master/texmf-dist/scripts/oberdiek/magicnum.lua
index e5820b295a4..ed9a9de32c6 100644
--- a/Master/texmf-dist/scripts/oberdiek/magicnum.lua
+++ b/Master/texmf-dist/scripts/oberdiek/magicnum.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009, 2010, 2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -32,9 +32,12 @@
-- 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.
+-- magicnum-test4.tex, magicnum.lua, oberdiek.magicnum.lua.
--
module("oberdiek.magicnum", package.seeall)
+function getversion()
+ tex.write("2011/04/10 v1.4")
+end
local data = {
["tex.catcode"] = {
[0] = "escape",
@@ -203,7 +206,7 @@ local data = {
["setorigin"] = 0
}
}
-function get(name, catcodetable)
+function get(name)
local startpos, endpos, category, entry =
string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$")
if not entry then
@@ -227,7 +230,7 @@ function get(name, catcodetable)
end
value = "" .. value
end
- tex.print(catcodetable, value)
+ tex.write(value)
end
--
-- End of File `magicnum.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua
new file mode 100644
index 00000000000..37e7505a165
--- /dev/null
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor-pre065.lua
@@ -0,0 +1,173 @@
+--
+-- This is file `oberdiek.luacolor-pre065.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luacolor.dtx (with options: `lua,pre065')
+--
+-- This is a generated file.
+--
+-- 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
+-- http://www.latex-project.org/lppl/lppl-1-3c.txt
+-- and 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,
+-- oberdiek.luacolor-pre065.lua, luacolor-pre065.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-pre065.lua'.
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua
index 8c01b8b282e..f1acacbba45 100644
--- a/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.luacolor.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009-2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -29,7 +29,8 @@
-- 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.
+-- oberdiek.luacolor.lua, luacolor.lua,
+-- oberdiek.luacolor-pre065.lua, luacolor-pre065.lua.
--
module("oberdiek.luacolor", package.seeall)
local ifpdf
@@ -67,7 +68,7 @@ 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
+ for v in node.traverse_id(node.id("whatsit"), v.head) do
if v and v.subtype == 3 then -- special
local data = v.data
for pattern, driver in pairs(patterns) do
@@ -130,7 +131,7 @@ function traverse(list, color)
texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id))
return color
end
- local head = list.list
+ local head = list.head
for n in node.traverse(head) do
local type = type[n.id]
if type == LIST then
@@ -165,7 +166,7 @@ function traverse(list, color)
end
end
end
- list.list = head
+ list.head = head
return color
end
--
diff --git a/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua b/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua
index bd5ee8647c3..f4dc63541b1 100644
--- a/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.magicnum.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009, 2010, 2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -32,9 +32,12 @@
-- 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.
+-- magicnum-test4.tex, magicnum.lua, oberdiek.magicnum.lua.
--
module("oberdiek.magicnum", package.seeall)
+function getversion()
+ tex.write("2011/04/10 v1.4")
+end
local data = {
["tex.catcode"] = {
[0] = "escape",
@@ -203,7 +206,7 @@ local data = {
["setorigin"] = 0
}
}
-function get(name, catcodetable)
+function get(name)
local startpos, endpos, category, entry =
string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$")
if not entry then
@@ -227,7 +230,7 @@ function get(name, catcodetable)
end
value = "" .. value
end
- tex.print(catcodetable, value)
+ tex.write(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
index be6f2a7efb3..c54a297c3c1 100644
--- a/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
+++ b/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009-2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -32,10 +32,14 @@
-- and the derived files
-- pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv,
-- pdftexcmds-test1.tex, pdftexcmds-test2.tex,
+-- pdftexcmds-test-shell.tex, pdftexcmds-test-escape.tex,
-- oberdiek.pdftexcmds.lua, pdftexcmds.lua.
--
module("oberdiek.pdftexcmds", package.seeall)
local systemexitstatus
+function getversion()
+ tex.write("2011/04/10 v0.14")
+end
function strcmp(A, B)
if A == B then
tex.write("0")
@@ -80,7 +84,7 @@ function escapehex(str, mode)
end
)))
end
-function unescapehex(str, mode)
+function unescapehex(str, mode, patch)
local a = 0
local first = true
local result = {}
@@ -108,6 +112,23 @@ function unescapehex(str, mode)
if not first then
table.insert(result, a)
end
+ if patch == 1 then
+ local temp = {}
+ for i, a in ipairs(result) do
+ if a == 0 then
+ table.insert(temp, 1)
+ table.insert(temp, 1)
+ else
+ if a == 1 then
+ table.insert(temp, 1)
+ table.insert(temp, 2)
+ else
+ table.insert(temp, a)
+ end
+ end
+ end
+ result = temp
+ end
if mode == "byte" then
local utf8 = {}
for i, a in ipairs(result) do
@@ -250,7 +271,16 @@ function filemdfivesum(filename)
end
function shellescape()
if os.execute then
- tex.write("1")
+ local result = os.execute()
+ if result == 0 then
+ tex.write("0")
+ else
+ if result == nil then
+ tex.write("0")
+ else
+ tex.write("1")
+ end
+ end
else
tex.write("0")
end
@@ -278,7 +308,7 @@ function lastsystemexit()
tex.write(math.floor(result / 256))
end
end
-function pipe(cmdline)
+function pipe(cmdline, patch)
local result
systemexitstatus = nil
texio.write_nl("log", "pipe(" .. cmdline ..") ")
@@ -293,6 +323,23 @@ function pipe(cmdline)
texio.write("log", "disabled.")
end
if result then
+ if patch == 1 then
+ local temp = {}
+ for i, a in ipairs(result) do
+ if a == 0 then
+ table.insert(temp, 1)
+ table.insert(temp, 1)
+ else
+ if a == 1 then
+ table.insert(temp, 1)
+ table.insert(temp, 2)
+ else
+ table.insert(temp, a)
+ end
+ end
+ end
+ result = temp
+ end
tex.settoks(toks, result)
else
tex.settoks(toks, "")
diff --git a/Master/texmf-dist/scripts/oberdiek/pdfatfi.pl b/Master/texmf-dist/scripts/oberdiek/pdfatfi.pl
index e33859ce598..cd93fa66ddb 100755
--- a/Master/texmf-dist/scripts/oberdiek/pdfatfi.pl
+++ b/Master/texmf-dist/scripts/oberdiek/pdfatfi.pl
@@ -1,39 +1,42 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
+#!/usr/bin/env perl
use strict;
$^W=1; # turn warning on
#
# pdfatfi.pl
#
-# Copyright (C) 2005, 2006 Heiko Oberdiek.
+# Copyright (C) 2005-2010 Heiko Oberdiek.
#
# 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.
+# 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
+# http://www.latex-project.org/lppl/lppl-1-3c.txt
+# and 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.
#
-# See file "attachfile2.pdf" for a list of files that belong to this project.
+# See file "attachfile2.pdf" for a list of files that belong to
+# this project.
#
# This file "pdfatfi.pl" may be renamed to "pdfatfi"
# for installation purposes.
#
my $file = "pdfatfi.pl";
my $program = uc($&) if $file =~ /^\w+/;
-my $version = "2.5";
-my $date = "2009/09/25";
+my $version = "2.6";
+my $date = "2010/09/27";
my $author = "Heiko Oberdiek";
-my $copyright = "Copyright (c) 2005, 2006 by $author.";
+my $copyright = "Copyright (c) 2005-2010 by $author.";
#
# History:
# 2005/05/21 v1.0: First release.
# 2006/08/16 v2.2: Included in DTX file of attachfile2.dtx.
+# 2010/09/27 v2.6: Keys ModDateTZ and CreationDateTZ added.
#
use POSIX qw(strftime); # %z is used (GNU)
@@ -58,11 +61,11 @@ $::opt_verbose = 0;
my $usage = <<"END_OF_USAGE";
${title}Syntax: \L$program\E [options] <file[.atfi]>
Function: Help program for LaTeX package "attachfile2".
-Options: (defaults:)
+Options: (defaults:)
--help print usage
- --(no)quiet suppress messages ($bool[$::opt_quiet])
- --(no)verbose verbose printing ($bool[$::opt_verbose])
- --(no)debug debug informations ($bool[$::opt_debug])
+ --(no)quiet suppress messages ($bool[$::opt_quiet])
+ --(no)verbose verbose printing ($bool[$::opt_verbose])
+ --(no)debug debug informations ($bool[$::opt_debug])
END_OF_USAGE
### process options
@@ -101,7 +104,15 @@ END_DEB
my $tmpfile = $atfifile . ".tmp";
my $timezone = strftime "%z", localtime;
-$timezone =~ s/^([+\-]\d\d)(\d\d)$/$1'$2'/;
+
+sub gettz ($) {
+ my $time = shift;
+ my $tz = strftime "%z", localtime($time);
+ return '' unless $tz;
+ return 'Z' if $tz eq '+0000';
+ $tz =~ s/^([+\-]\d\d)(\d\d)$/$1'$2'/;
+ return $tz;
+}
open(IN, $atfifile) or die "$Error Cannot open `$atfifile'!\n";
open(OUT, ">$tmpfile") or die "$Error Cannot write `$tmpfile'!\n";
@@ -125,20 +136,26 @@ while(<IN>) {
my $mtime = @s[9];
my $ctime = @s[10]; # inode change time
- my ($sec, $min, $hour, $mday, $mon, $year) = localtime($mtime);
+ my ($sec, $min, $hour, $mday, $mon, $year) =
+ localtime($mtime);
my $moddate = sprintf("%04d%02d%02d%02d%02d%02d",
$year + 1900, $mon + 1, $mday,
$hour, $min, $sec);
+ my $moddatetz = 'D:' . $moddate . gettz($mtime);
# Manual page "perlport" says that "ctime" is creation
# time instead of inode change time for "Win32" and
# "Mac OS", but it is unsupported for "Mac OS X".
my $creationdate = "";
+ my $creationdatetz = "";
if ($^O eq 'MSWin32') { # cygwin?
- ($sec, $min, $hour, $mday, $mon, $year) = localtime($ctime);
+ ($sec, $min, $hour, $mday, $mon, $year) =
+ localtime($ctime);
$creationdate = sprintf("%04d%02d%02d%02d%02d%02d",
$year + 1900, $mon + 1, $mday,
$hour, $min, $sec);
+ $creationdatetz =
+ 'D:' . $creationdate . gettz($ctime);
}
# md5 checksum
@@ -155,15 +172,20 @@ while(<IN>) {
}
$_ = "\\attachfile\@file["
- . "ModDate=$moddate,Size=$size"
- . (($checksum) ? ",CheckSum=$checksum" : "")
- . (($creationdate) ? ",CreationDate=$creationdate" : "")
+ . "ModDateTZ=$moddatetz"
+ . ",Size=$size"
+ . ($checksum ? ",CheckSum=$checksum" : "")
+ . ($creationdatetz ?
+ ",CreationDateTZ=$creationdatetz" :
+ ($creationdate ?
+ ",CreationDate=$creationdate" : ""))
. "]{$hexfile}\n";
if ($::opt_verbose) {
print "* file entry = $file\n";
print " size = $size\n";
print " moddate = $moddate\n";
- print " creationdate = $creationdate\n" if $creationdate;
+ print " creationdate = $creationdate\n"
+ if $creationdate;
print " checksum = $checksum\n" if $checksum;
}
}
diff --git a/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
index d2e53974544..69b8964e712 100644
--- a/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
+++ b/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
@@ -8,7 +8,7 @@
--
-- This is a generated file.
--
--- Copyright (C) 2007, 2009, 2010 by
+-- Copyright (C) 2007, 2009-2011 by
-- Heiko Oberdiek <heiko.oberdiek at googlemail.com>
--
-- This work may be distributed and/or modified under the
@@ -32,10 +32,14 @@
-- and the derived files
-- pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv,
-- pdftexcmds-test1.tex, pdftexcmds-test2.tex,
+-- pdftexcmds-test-shell.tex, pdftexcmds-test-escape.tex,
-- oberdiek.pdftexcmds.lua, pdftexcmds.lua.
--
module("oberdiek.pdftexcmds", package.seeall)
local systemexitstatus
+function getversion()
+ tex.write("2011/04/10 v0.14")
+end
function strcmp(A, B)
if A == B then
tex.write("0")
@@ -80,7 +84,7 @@ function escapehex(str, mode)
end
)))
end
-function unescapehex(str, mode)
+function unescapehex(str, mode, patch)
local a = 0
local first = true
local result = {}
@@ -108,6 +112,23 @@ function unescapehex(str, mode)
if not first then
table.insert(result, a)
end
+ if patch == 1 then
+ local temp = {}
+ for i, a in ipairs(result) do
+ if a == 0 then
+ table.insert(temp, 1)
+ table.insert(temp, 1)
+ else
+ if a == 1 then
+ table.insert(temp, 1)
+ table.insert(temp, 2)
+ else
+ table.insert(temp, a)
+ end
+ end
+ end
+ result = temp
+ end
if mode == "byte" then
local utf8 = {}
for i, a in ipairs(result) do
@@ -250,7 +271,16 @@ function filemdfivesum(filename)
end
function shellescape()
if os.execute then
- tex.write("1")
+ local result = os.execute()
+ if result == 0 then
+ tex.write("0")
+ else
+ if result == nil then
+ tex.write("0")
+ else
+ tex.write("1")
+ end
+ end
else
tex.write("0")
end
@@ -278,7 +308,7 @@ function lastsystemexit()
tex.write(math.floor(result / 256))
end
end
-function pipe(cmdline)
+function pipe(cmdline, patch)
local result
systemexitstatus = nil
texio.write_nl("log", "pipe(" .. cmdline ..") ")
@@ -293,6 +323,23 @@ function pipe(cmdline)
texio.write("log", "disabled.")
end
if result then
+ if patch == 1 then
+ local temp = {}
+ for i, a in ipairs(result) do
+ if a == 0 then
+ table.insert(temp, 1)
+ table.insert(temp, 1)
+ else
+ if a == 1 then
+ table.insert(temp, 1)
+ table.insert(temp, 2)
+ else
+ table.insert(temp, a)
+ end
+ end
+ end
+ result = temp
+ end
tex.settoks(toks, result)
else
tex.settoks(toks, "")