summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-04-12 22:56:39 +0000
committerKarl Berry <karl@freefriends.org>2011-04-12 22:56:39 +0000
commit3c9b5c2960ae2455180bdb3a4e67bf10175b39af (patch)
tree53ac9731c23e82f60349ec920ed8d816738913dc /Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua
parentf437333cf5d63d69f5ab9fd1eb553af4175037d0 (diff)
oberdiek (12apr11)
git-svn-id: svn://tug.org/texlive/trunk@22061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua')
-rw-r--r--Master/texmf-dist/scripts/oberdiek/oberdiek.pdftexcmds.lua55
1 files changed, 51 insertions, 4 deletions
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, "")