summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2011-02-04 01:28:00 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2011-02-04 01:28:00 +0000
commitcf5a5823119760308e0499d1fe8030f644387e99 (patch)
treeaf1895cb36efa62cacad0ed67d819390b2c1930f /Master/texmf
parent03e09382f7f6749b5743134fd6ca7209f5c30a91 (diff)
tlgs/gswin32/*: revised, new ps2ps.tlu and ps2ps2.tlu
git-svn-id: svn://tug.org/texlive/trunk@21278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/eps2eps.tlu22
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/pdf2dsc.tlu2
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/pdfopt.tlu2
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2ascii.tlu6
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2pdf.tlu32
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2pdf12.tlu32
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2pdf13.tlu32
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2pdf14.tlu32
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2ps.tlu76
-rwxr-xr-xMaster/texmf/scripts/tlgs/gswin32/ps2ps2.tlu79
10 files changed, 217 insertions, 98 deletions
diff --git a/Master/texmf/scripts/tlgs/gswin32/eps2eps.tlu b/Master/texmf/scripts/tlgs/gswin32/eps2eps.tlu
index 0eafca53a09..fe862ec81b5 100755
--- a/Master/texmf/scripts/tlgs/gswin32/eps2eps.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/eps2eps.tlu
@@ -27,14 +27,24 @@ else
gs='gs'
end
-command={gs, '-q', '-sDEVICE=epswrite', '-dNOPAUSE',
- '-sOutputFile='..arg[#arg], '-dBATCH', '-dSAFER',
- '-dDEVICEWIDTH=250000', '-dDEVICEHEIGHT=250000'}
+command={gs, '-q', '-sDEVICE=epswrite'}
+
+if os.type=='unix' then
+ command[#command+1]='-sstdout=%stderr'
+end
+
+
+for _,v in ipairs{'-dNOPAUSE', '-sOutputFile='..arg[#arg],
+ '-dBATCH', '-dSAFER', '-dDEVICEWIDTH=250000',
+ '-dDEVICEHEIGHT=250000'} do
+ command[#command+1]=v
+end
+
files=0
for i=1, #arg do
- if not string.find(arg[i], '^-') then
+ if not string.find(arg[i], '^%-') then
files=files+1
end
command[#command+1]=arg[i]
@@ -42,9 +52,11 @@ end
if files < 2 then
io.stderr:write('Usage: eps2eps [options] input.eps output.eps\n')
- os.exit(0)
+ os.exit(0)
end
+command[#command]=nil -- already processed at -sOutputFile
+
command=fixwin(command)
--[[ prepend an additional hyphen to activate this code
diff --git a/Master/texmf/scripts/tlgs/gswin32/pdf2dsc.tlu b/Master/texmf/scripts/tlgs/gswin32/pdf2dsc.tlu
index 7b938594e1f..442284b4a17 100755
--- a/Master/texmf/scripts/tlgs/gswin32/pdf2dsc.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/pdf2dsc.tlu
@@ -36,7 +36,7 @@ pdffile=arg[1]
if #arg==2 then
dscfile=arg[2]
else
- dscfile=select(1, string.gsub(pdffile, '\.%a+$', '.dsc'))
+ dscfile=string.gsub(pdffile, '\.%a+$', '.dsc')
end
command={gs, '-q', '-dNODISPLAY', '-dSAFER', '-dDELAYSAFER',
diff --git a/Master/texmf/scripts/tlgs/gswin32/pdfopt.tlu b/Master/texmf/scripts/tlgs/gswin32/pdfopt.tlu
index b44feb70647..2169407a198 100755
--- a/Master/texmf/scripts/tlgs/gswin32/pdfopt.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/pdfopt.tlu
@@ -32,7 +32,7 @@ command={gs, '-q', '-dNODISPLAY', '-dSAFER', '-dDELAYSAFER'}
files={}
for i=1, #arg do
- if string.find(arg[i], '^-') then
+ if string.find(arg[i], '^%-') then
command[#command+1]=arg[i]
else
files[#files+1]=arg[i]
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2ascii.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2ascii.tlu
index 25cc36bf95d..2bc31ef26d9 100755
--- a/Master/texmf/scripts/tlgs/gswin32/ps2ascii.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2ascii.tlu
@@ -48,9 +48,9 @@ if #arg < 2 then
command=fixwin(command)
elseif #arg == 2 then
-- We need a shell for I/O redirection.
- command=gs..' -q -dNODISPLAY -dBATCH -dSAFER -dDELAYBIND'..
- '-dWRITESYSTEMDICT -dSIMPLE -c save'..
- '-f ps2ascii.ps > "'..arg[2]..'"'
+ command=gs..' -q -dNODISPLAY -dBATCH -dSAFER -dDELAYBIND '..
+ '-dWRITESYSTEMDICT -dSIMPLE -c save '..
+ '-f ps2ascii.ps "'..arg[1]..'" > "'..arg[2]..'"'
end
--[[ prepend an additional hyphen to activate this code
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu
index c3d8b12a5e5..68090e4eb3c 100755
--- a/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu
@@ -22,24 +22,12 @@ function fixwin (args_unix)
end
function filename (file)
- local filename
- if string.find(file, '/') then -- UNIX path
- filename=select(1, string.gsub(file, '.*/', ''))
- elseif string.find(file, '\\') then -- Windows path
- filename=select(1, string.gsub(file, '.*\\', ''))
- else -- no path
- filename=file
- end
- return(filename)
+ return string.match(file, '.*[/\\](.*)$')
end
function basename (file)
- local basename
- local fname
- fname=filename (file)
- basename=select(1, string.gsub(fname, '\.%a+$', ''))
- return(basename)
-end
+ return string.match(filename(file), '(.*)[\.].*')
+end
if os.type == 'windows' then
gs='gswin32c'
@@ -52,20 +40,20 @@ files={}
options={}
PDF_level='1.4'
-if string.find(basename(arg[0]), '12') then
+if string.find(filename(arg[0]), 'ps2pdf12') then
PDF_level='1.2'
-elseif string.find(basename(arg[0]), '13') then
+elseif string.find(filename(arg[0]), 'ps2pdf13') then
PDF_level='1.3'
-elseif string.find(basename(arg[0]), '14') then
+elseif string.find(filename(arg[0]), 'ps2pdf14') then
PDF_level='1.4'
end
options[#options+1]='-dCompatibilityLevel='..PDF_level
for i=1, #arg do
- if string.find(arg[i], '^-$') then
+ if arg[i] == '-' then
files[#files+1]=arg[i]
- elseif string.find(arg[i], '^-') then
+ elseif string.find(arg[i], '^%-') then
options[#options+1]=arg[i]
else
files[#files+1]=arg[i]
@@ -78,9 +66,9 @@ if #files < 1 or #files > 2 then
end
if #files == 1 then
- if string.find(files[1], '^-$') then
+ if files[1] == '-' then
outfile='-'
- elseif string.find(filename(files[1]), '\.e*ps$') then
+ elseif string.find(filename(files[1]), '\.[eE]?[pP][sS]$') then
outfile=basename(files[1])..'.pdf'
else
outfile=filename(files[1])..'.pdf'
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2pdf12.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2pdf12.tlu
index c3d8b12a5e5..68090e4eb3c 100755
--- a/Master/texmf/scripts/tlgs/gswin32/ps2pdf12.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2pdf12.tlu
@@ -22,24 +22,12 @@ function fixwin (args_unix)
end
function filename (file)
- local filename
- if string.find(file, '/') then -- UNIX path
- filename=select(1, string.gsub(file, '.*/', ''))
- elseif string.find(file, '\\') then -- Windows path
- filename=select(1, string.gsub(file, '.*\\', ''))
- else -- no path
- filename=file
- end
- return(filename)
+ return string.match(file, '.*[/\\](.*)$')
end
function basename (file)
- local basename
- local fname
- fname=filename (file)
- basename=select(1, string.gsub(fname, '\.%a+$', ''))
- return(basename)
-end
+ return string.match(filename(file), '(.*)[\.].*')
+end
if os.type == 'windows' then
gs='gswin32c'
@@ -52,20 +40,20 @@ files={}
options={}
PDF_level='1.4'
-if string.find(basename(arg[0]), '12') then
+if string.find(filename(arg[0]), 'ps2pdf12') then
PDF_level='1.2'
-elseif string.find(basename(arg[0]), '13') then
+elseif string.find(filename(arg[0]), 'ps2pdf13') then
PDF_level='1.3'
-elseif string.find(basename(arg[0]), '14') then
+elseif string.find(filename(arg[0]), 'ps2pdf14') then
PDF_level='1.4'
end
options[#options+1]='-dCompatibilityLevel='..PDF_level
for i=1, #arg do
- if string.find(arg[i], '^-$') then
+ if arg[i] == '-' then
files[#files+1]=arg[i]
- elseif string.find(arg[i], '^-') then
+ elseif string.find(arg[i], '^%-') then
options[#options+1]=arg[i]
else
files[#files+1]=arg[i]
@@ -78,9 +66,9 @@ if #files < 1 or #files > 2 then
end
if #files == 1 then
- if string.find(files[1], '^-$') then
+ if files[1] == '-' then
outfile='-'
- elseif string.find(filename(files[1]), '\.e*ps$') then
+ elseif string.find(filename(files[1]), '\.[eE]?[pP][sS]$') then
outfile=basename(files[1])..'.pdf'
else
outfile=filename(files[1])..'.pdf'
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2pdf13.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2pdf13.tlu
index c3d8b12a5e5..68090e4eb3c 100755
--- a/Master/texmf/scripts/tlgs/gswin32/ps2pdf13.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2pdf13.tlu
@@ -22,24 +22,12 @@ function fixwin (args_unix)
end
function filename (file)
- local filename
- if string.find(file, '/') then -- UNIX path
- filename=select(1, string.gsub(file, '.*/', ''))
- elseif string.find(file, '\\') then -- Windows path
- filename=select(1, string.gsub(file, '.*\\', ''))
- else -- no path
- filename=file
- end
- return(filename)
+ return string.match(file, '.*[/\\](.*)$')
end
function basename (file)
- local basename
- local fname
- fname=filename (file)
- basename=select(1, string.gsub(fname, '\.%a+$', ''))
- return(basename)
-end
+ return string.match(filename(file), '(.*)[\.].*')
+end
if os.type == 'windows' then
gs='gswin32c'
@@ -52,20 +40,20 @@ files={}
options={}
PDF_level='1.4'
-if string.find(basename(arg[0]), '12') then
+if string.find(filename(arg[0]), 'ps2pdf12') then
PDF_level='1.2'
-elseif string.find(basename(arg[0]), '13') then
+elseif string.find(filename(arg[0]), 'ps2pdf13') then
PDF_level='1.3'
-elseif string.find(basename(arg[0]), '14') then
+elseif string.find(filename(arg[0]), 'ps2pdf14') then
PDF_level='1.4'
end
options[#options+1]='-dCompatibilityLevel='..PDF_level
for i=1, #arg do
- if string.find(arg[i], '^-$') then
+ if arg[i] == '-' then
files[#files+1]=arg[i]
- elseif string.find(arg[i], '^-') then
+ elseif string.find(arg[i], '^%-') then
options[#options+1]=arg[i]
else
files[#files+1]=arg[i]
@@ -78,9 +66,9 @@ if #files < 1 or #files > 2 then
end
if #files == 1 then
- if string.find(files[1], '^-$') then
+ if files[1] == '-' then
outfile='-'
- elseif string.find(filename(files[1]), '\.e*ps$') then
+ elseif string.find(filename(files[1]), '\.[eE]?[pP][sS]$') then
outfile=basename(files[1])..'.pdf'
else
outfile=filename(files[1])..'.pdf'
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2pdf14.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2pdf14.tlu
index c3d8b12a5e5..68090e4eb3c 100755
--- a/Master/texmf/scripts/tlgs/gswin32/ps2pdf14.tlu
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2pdf14.tlu
@@ -22,24 +22,12 @@ function fixwin (args_unix)
end
function filename (file)
- local filename
- if string.find(file, '/') then -- UNIX path
- filename=select(1, string.gsub(file, '.*/', ''))
- elseif string.find(file, '\\') then -- Windows path
- filename=select(1, string.gsub(file, '.*\\', ''))
- else -- no path
- filename=file
- end
- return(filename)
+ return string.match(file, '.*[/\\](.*)$')
end
function basename (file)
- local basename
- local fname
- fname=filename (file)
- basename=select(1, string.gsub(fname, '\.%a+$', ''))
- return(basename)
-end
+ return string.match(filename(file), '(.*)[\.].*')
+end
if os.type == 'windows' then
gs='gswin32c'
@@ -52,20 +40,20 @@ files={}
options={}
PDF_level='1.4'
-if string.find(basename(arg[0]), '12') then
+if string.find(filename(arg[0]), 'ps2pdf12') then
PDF_level='1.2'
-elseif string.find(basename(arg[0]), '13') then
+elseif string.find(filename(arg[0]), 'ps2pdf13') then
PDF_level='1.3'
-elseif string.find(basename(arg[0]), '14') then
+elseif string.find(filename(arg[0]), 'ps2pdf14') then
PDF_level='1.4'
end
options[#options+1]='-dCompatibilityLevel='..PDF_level
for i=1, #arg do
- if string.find(arg[i], '^-$') then
+ if arg[i] == '-' then
files[#files+1]=arg[i]
- elseif string.find(arg[i], '^-') then
+ elseif string.find(arg[i], '^%-') then
options[#options+1]=arg[i]
else
files[#files+1]=arg[i]
@@ -78,9 +66,9 @@ if #files < 1 or #files > 2 then
end
if #files == 1 then
- if string.find(files[1], '^-$') then
+ if files[1] == '-' then
outfile='-'
- elseif string.find(filename(files[1]), '\.e*ps$') then
+ elseif string.find(filename(files[1]), '\.[eE]?[pP][sS]$') then
outfile=basename(files[1])..'.pdf'
else
outfile=filename(files[1])..'.pdf'
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2ps.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2ps.tlu
new file mode 100755
index 00000000000..2d414700ebb
--- /dev/null
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2ps.tlu
@@ -0,0 +1,76 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2010 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+-- Replacement for ps2ps.bat.
+-- 'Distill' PostScript.
+
+function fixwin(args_unix)
+ if os.type == 'windows' then
+ local args_win={} -- new table
+ args_win[0]=args_unix[1]
+ for i=1, #args_unix do
+ args_win[i]='"'..args_unix[i]..'"'
+ end
+ return args_win
+ else
+ return args_unix
+ end
+end
+
+if os.type == 'windows' then
+ gs='gswin32c'
+else
+ gs='gs'
+end
+
+
+files={}
+options={'-dNOPAUSE', '-dBATCH', '-dSAFER'}
+
+for i=1, #arg do
+ if string.find(arg[i], '^%-$') then
+ files[#files+1]=arg[i]
+ elseif string.find(arg[i], '^%-') then
+ options[#options+1]=arg[i]
+ else
+ files[#files+1]=arg[i]
+ end
+end
+
+
+if #files ~= 2 then
+ io.stderr:write('Usage: ps2ps [options] input.ps output.ps\n')
+ io.stderr:write(' e.g. ps2ps -sPAPERSIZE=a4 input.ps output.ps\n')
+ os.exit(1)
+end
+
+
+command={gs, '-q', '-sDEVICE=pswrite'}
+
+if os.type=='unix' then
+ command[#command+1]='-sstdout=%stderr'
+end
+
+command[#command+1]='-sOutputFile='..files[2]
+
+for i=1, #options do
+ command[#command+1]=options[i]
+end
+
+command[#command+1]=files[1]
+
+command=fixwin(command)
+
+--[[ prepend an additional hyphen to activate this code
+for i=0, #command do
+ print (command[i])
+end
+os.exit(ret)
+--]]
+
+ret=os.spawn(command)
+os.exit(ret)
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2ps2.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2ps2.tlu
new file mode 100755
index 00000000000..5fa86abf0d2
--- /dev/null
+++ b/Master/texmf/scripts/tlgs/gswin32/ps2ps2.tlu
@@ -0,0 +1,79 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2010 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+-- Replacement for ps2ps2.bat.
+-- Converting PostScript 3 or PDF into PostScript 2 with the
+-- Ghostscript 'ps2write' device.
+-- This generates a PDF-style stream with an attached
+-- PostScript program to interpret it.
+
+function fixwin(args_unix)
+ if os.type == 'windows' then
+ local args_win={} -- new table
+ args_win[0]=args_unix[1]
+ for i=1, #args_unix do
+ args_win[i]='"'..args_unix[i]..'"'
+ end
+ return args_win
+ else
+ return args_unix
+ end
+end
+
+if os.type == 'windows' then
+ gs='gswin32c'
+else
+ gs='gs'
+end
+
+
+files={}
+options={'-dNOPAUSE', '-dBATCH', '-dSAFER'}
+
+for i=1, #arg do
+ if string.find(arg[i], '^%-$') then
+ files[#files+1]=arg[i]
+ elseif string.find(arg[i], '^%-') then
+ options[#options+1]=arg[i]
+ else
+ files[#files+1]=arg[i]
+ end
+end
+
+
+if #files ~= 2 then
+ io.stderr:write('Usage: ps2ps2 [options] input.ps output.ps\n')
+ io.stderr:write(' e.g. ps2ps2 -sPAPERSIZE=a4 input.ps output.ps\n')
+ os.exit(1)
+end
+
+
+command={gs, '-q', '-sDEVICE=ps2write'}
+
+if os.type=='unix' then
+ command[#command+1]='-sstdout=%stderr'
+end
+
+command[#command+1]='-sOutputFile='..files[2]
+
+for i=1, #options do
+ command[#command+1]=options[i]
+end
+
+command[#command+1]=files[1]
+
+command=fixwin(command)
+
+--[[ prepend an additional hyphen to activate this code
+for i=0, #command do
+ print (command[i])
+end
+os.exit(ret)
+--]]
+
+ret=os.spawn(command)
+os.exit(ret)