summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua')
-rw-r--r--Master/texmf-dist/scripts/oberdiek/pdftexcmds.lua55
1 files changed, 51 insertions, 4 deletions
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, "")