summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tlgs
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2015-05-05 21:26:28 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2015-05-05 21:26:28 +0000
commitc51296e843e35a3d133557000409674baae01b54 (patch)
tree571fdfb2f2660b3c7d6bd5d522a1268a776f8ab4 /Master/texmf-dist/scripts/tlgs
parentfe576e3d01b31dbc35e1bc4008052c06c47d3cf3 (diff)
texlua scripts revised
pdfopt.tlu is using -dFastWebView now instead of pdfopt.ps git-svn-id: svn://tug.org/texlive/trunk@37204 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tlgs')
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu116
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu32
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu147
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu140
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu163
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu163
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu163
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu163
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu117
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2ps2.tlu79
10 files changed, 860 insertions, 423 deletions
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu
index 715e7c1ff25..43701447a0d 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu
@@ -2,12 +2,22 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
-- Replacement for eps2eps.bat.
-- 'Distill' Encapsulated PostScript.
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n'..
+ ' <inputfile> can be either a PS, EPS, PDF file, or stdin.\n'..
+ ' A single hyphen (-) denotes stdin.\n'
+ return message
+end
+
+
function fixwin(args_unix)
if os.type == 'windows' then
local args_win={} -- new table
@@ -21,41 +31,103 @@ function fixwin(args_unix)
end
end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
end
-command={gs, '-q', '-sDEVICE=eps2write'}
-if os.type=='unix' then
- command[#command+1]='-sstdout=%stderr'
+local function filename (file)
+ -- strip path
+ if string.find(file, '[/\\]') then
+ return string.match(file, '.*[/\\](.*)$')
+ else
+ return file
+ end
end
-for _,v in ipairs{'-dNOPAUSE', '-sOutputFile='..arg[#arg],
- '-dBATCH', '-dSAFER', '-dDEVICEWIDTH=250000',
- '-dDEVICEHEIGHT=250000'} do
- command[#command+1]=v
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-files=0
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ else
+ return false
+ end
+end
+
+
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
+ else
+ progname=basename
+ end
-for i=1, #arg do
- if not string.find(arg[i], '^%-') then
- files=files+1
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
end
- command[#command+1]=arg[i]
+ files.input =files[1]
+ files.output=files[2]
+
+ return progname, options, files
end
-if files < 2 then
- io.stderr:write('Usage: eps2eps [options] input.eps output.eps\n')
- os.exit(1)
+
+local function check_files (progname, files)
+ if #files < 2 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ end
end
-command[#command]=nil -- already processed at -sOutputFile
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files (progname, file)
+
+-- setup command
+
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
+
+push(command, '-q', '-sDEVICE=eps2write')
+
+if os.type=='unix' then push (command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-dNOPAUSE',
+ '-dBATCH', '-P-', '-dSAFER', '-dDEVICEWIDTH=250000',
+ '-dDEVICEHEIGHT=250000')
+
+push(command, options)
+push(command, file.input)
command=fixwin(command)
@@ -63,7 +135,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu
index 25921db23ea..5a6cd479a7e 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu
@@ -21,13 +21,22 @@ function fixwin (args_unix)
end
end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
end
-if #arg == 0 or #arg > 2 then
+
+if #arg ~= 2 then
io.stderr:write('Usage: pdf2dsc input.pdf [output.dsc]\n')
os.exit(1)
end
@@ -39,9 +48,14 @@ else
dscfile=string.gsub(pdffile, '%.%a+$', '.dsc')
end
-command={gs, '-q', '-dNODISPLAY', '-dSAFER', '-dDELAYSAFER',
- '-sPDFname='..pdffile, '-sDSCname='..dscfile, 'pdf2dsc.ps',
- '-c', 'quit'}
+-- setup command
+
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
+
+push(command, '-q', '-dNODISPLAY', '-dSAFER', '-dDELAYSAFER',
+ '-sPDFname='..pdffile, '-sDSCname='..dscfile, 'pdf2dsc.ps',
+ '-c', 'quit')
command=fixwin(command)
@@ -49,7 +63,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu
index d267d55f057..d694047cfff 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu
@@ -2,13 +2,24 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for pdfopt.bat.
--- Linearize PDF
+-- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-function fixwin (args_unix)
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
+ ' A single hyphen (-) denotes stdin.\n\n'..
+ ' <outputfile> is required if <inputfile> is a PDF file\n'..
+ ' or input is read from stdin.\n'
+ return message
+end
+
+
+local function fixwin (args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
@@ -21,43 +32,133 @@ function fixwin (args_unix)
end
end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+end
+
+
+local function filename (file)
+ -- strip path
+ if string.find(file, '[/\\]') then
+ return string.match(file, '.*[/\\](.*)$')
+ else
+ return file
+ end
+end
+
+
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
+end
+
+
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
end
-command={gs, '-q', '-dNODISPLAY', '-dSAFER', '-dDELAYSAFER'}
-files={}
+local function parse_cmdline ()
+ local files={}
+ local options={}
-for i=1, #arg do
- if string.find(arg[i], '^%-') then
- command[#command+1]=arg[i]
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
else
- files[#files+1]=arg[i]
+ progname=basename
end
+
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-command[#command+1]='--'
-command[#command+1]='pdfopt.ps'
-if #files ~= 2 then
- io.stderr:write('Usage: pdfopt [options] input.pdf output.pdf\n')
- os.exit(1)
-else
- for i=1, #files do
- command[#command+1]=files[i]
+local function check_files (progname, files, default_output_ext)
+ if #files < 1 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ end
+
+ if #files < 2 then
+ if extension(files.input) then
+ local ext=string.lower(extension(files.input))
+ if ext:match(default_output_ext..'$') then
+ io.stderr:write('!Error: no output file specified.\n\n')
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ else
+ files.output=basename(files.input)..'.'..default_output_ext
+ end
+ else -- the input file has no extension
+ files.output=files.input..'.'..default_output_ext
+ end
end
end
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files(progname, file, 'pdf')
+
+-- determine PDF level
+local PDF_level='1.4' -- default, may be changed in the future
+if progname == 'ps2pdf12' then PDF_level='1.2'
+elseif progname == 'ps2pdf13' then PDF_level='1.3'
+elseif progname == 'ps2pdf14' then PDF_level='1.4'
+end
+
+-- setup command
+
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
+
+push(command, '-P-', '-dSAFER', options, '-dCompatibilityLevel='..PDF_level)
+
+if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
+
+push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
+
+if os.type == 'unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
+
+-- We have to include the options twice because -I only takes effect
+-- if it appears before other options [see ps2pdfwr].
+push(command, options, '-c', '.setpdfwrite', '-f', file.input)
+
command=fixwin(command)
--[[ prepend an additional hyphen to activate this code
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu
index 2bc31ef26d9..d23c0458ea8 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu
@@ -2,26 +2,55 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
-- Replacement for ps2ascii.bat.
--- Convert PostScript to ASCII
-
-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]..'"'
+
+-- Extract ASCII text from a PostScript file. Usage:
+--
+-- ps2ascii [infile.ps [outfile.txt]]
+--
+-- If outfile is omitted, output goes to stdout.
+-- If both infile and outfile are omitted, ps2ascii acts as a filter,
+-- reading from stdin and writing on stdout.
+
+
+-- We have to pass the command as a string to os.execute() because we
+-- need a shell for i/o-redirection. But we create a table first and
+-- convert it to a string, just to make sure we don't miss any spaces.
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
end
- return args_win
+ end
+end
+
+
+local function filename (file)
+ -- strip path
+ if string.find(file, '[/\\]') then
+ return string.match(file, '.*[/\\](.*)$')
else
- return args_unix
+ return file
end
end
-function remove_tmpfiles (tmpfiles)
+
+local function remove_tmpfiles (tmpfiles)
+ -- The shell script contains
+ --
+ -- trap "rm -f _temp_.err _temp_.out" 0 1 2 15
+ --
+ -- texlua doesn't support signals (yet). So we remove temporary files
+ -- if possible.
for i=1, #tmpfiles do
if lfs.isfile(tmpfiles[i]) then
os.remove(tmpfiles[i])
@@ -29,46 +58,71 @@ function remove_tmpfiles (tmpfiles)
end
end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
-end
-command={gs, '-q', '-dNODISPLAY', '-dBATCH', '-dSAFER', '-dDELAYBIND',
- '-dWRITESYSTEMDICT', '-dSIMPLE', '-c', 'save',
- '-f', 'ps2ascii.ps'}
+local function parse_cmdline ()
+ local files={}
+ local options={}
-if #arg < 2 then
- if #arg == 0 then
- command[#command+1]='-'
- elseif #arg == 1 then
- command[#command+1]=arg[1]
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
+ else
+ progname=basename
end
- 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[1]..'" > "'..arg[2]..'"'
-end
---[[ prepend an additional hyphen to activate this code
-if type(command) == 'string' then
- print(command)
-else
- for i=0, #command do
- print (command[i])
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-os.exit(ret)
---]]
-if type(command) == 'string' then
- ret=os.execute(command)
+
+-- main --
+
+local progname, options, files=parse_cmdline ()
+
+-- setup command
+
+local command={gs}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
+
+push(command, {'-q', '-dNODISPLAY', '-P-', '-dSAFER', '-dDELAYBIND',
+ '-dWRITESYSTEMDICT', '-dSIMPLE'})
+
+push(command, '-c', 'save', '-f', 'ps2ascii.ps')
+
+if #files == 0 then
+ push(command, '-')
else
- ret=os.spawn(command)
+ push(command, '"'..files.input..'"')
end
+push(command, '-c', 'quit')
+
+if #files > 1 then
+ push(command, '>', '"'..files.output..'"')
+end
+
+local cmd_string=table.concat(command, ' ')
+
+--[[ prepend an additional hyphen to activate this code
+print(cmd_string)
+os.exit(0)
+--]]
+
+ret=os.execute(cmd_string)
+
+-- The last character of the ASCII file is a form feed (^L).
+-- Uncomment the following line if this confuses your terminal.
+--
+-- if #files < 2 then io.stdout:write('\r') end
+
remove_tmpfiles{'_temp_.err', '_temp_.out'}
os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu
index 7cb82173cfa..d694047cfff 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu
@@ -2,13 +2,24 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for ps2pdf*.bat.
--- Convert PS to PDF
+-- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-function fixwin (args_unix)
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
+ ' A single hyphen (-) denotes stdin.\n\n'..
+ ' <outputfile> is required if <inputfile> is a PDF file\n'..
+ ' or input is read from stdin.\n'
+ return message
+end
+
+
+local function fixwin (args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
@@ -21,7 +32,23 @@ function fixwin (args_unix)
end
end
-function filename (file)
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+end
+
+
+local function filename (file)
+ -- strip path
if string.find(file, '[/\\]') then
return string.match(file, '.*[/\\](.*)$')
else
@@ -29,75 +56,101 @@ function filename (file)
end
end
-function basename (file)
- return string.match(filename(file), '(.*)[%.].*')
-end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-command={gs}
-files={}
-options={}
-
-PDF_level='1.4'
-if string.find(filename(arg[0]), 'ps2pdf12') then
- PDF_level='1.2'
-elseif string.find(filename(arg[0]), 'ps2pdf13') then
- PDF_level='1.3'
-elseif string.find(filename(arg[0]), 'ps2pdf14') then
- PDF_level='1.4'
+
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
end
-options[#options+1]='-dCompatibilityLevel='..PDF_level
-for i=1, #arg do
- if arg[i] == '-' then
- files[#files+1]=arg[i]
- elseif string.find(arg[i], '^%-') then
- options[#options+1]=arg[i]
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
else
- files[#files+1]=arg[i]
+ progname=basename
end
-end
-if #files < 1 or #files > 2 then
- io.stderr:write('Usage: ps2pdf [options] (input.[e]ps|-) [output.pdf]\n')
- os.exit(1)
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-if #files == 1 then
- if files[1] == '-' then
- outfile='-'
- elseif string.find(filename(files[1]), '%.[eE]?[pP][sS]$') then
- outfile=basename(files[1])..'.pdf'
- else
- outfile=filename(files[1])..'.pdf'
+
+local function check_files (progname, files, default_output_ext)
+ if #files < 1 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
end
-else
- outfile=files[2]
-end
-for i=1, #options do
- command[#command+1]=options[i]
+ if #files < 2 then
+ if extension(files.input) then
+ local ext=string.lower(extension(files.input))
+ if ext:match(default_output_ext..'$') then
+ io.stderr:write('!Error: no output file specified.\n\n')
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ else
+ files.output=basename(files.input)..'.'..default_output_ext
+ end
+ else -- the input file has no extension
+ files.output=files.input..'.'..default_output_ext
+ end
+ end
end
-other_opts={'-q', '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite'}
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files(progname, file, 'pdf')
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
+-- determine PDF level
+local PDF_level='1.4' -- default, may be changed in the future
+if progname == 'ps2pdf12' then PDF_level='1.2'
+elseif progname == 'ps2pdf13' then PDF_level='1.3'
+elseif progname == 'ps2pdf14' then PDF_level='1.4'
end
-command[#command+1]='-sOutputFile='..outfile
+-- setup command
-other_opts={'-c', '.setpdfwrite', '-f', files[1]}
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
-end
+push(command, '-P-', '-dSAFER', options, '-dCompatibilityLevel='..PDF_level)
+
+if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
+
+push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
+
+if os.type == 'unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
+
+-- We have to include the options twice because -I only takes effect
+-- if it appears before other options [see ps2pdfwr].
+push(command, options, '-c', '.setpdfwrite', '-f', file.input)
command=fixwin(command)
@@ -105,7 +158,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu
index a35e3b0912a..d694047cfff 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu
@@ -2,13 +2,24 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for ps2pdf*.bat.
--- Convert PS to PDF
+-- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-function fixwin (args_unix)
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
+ ' A single hyphen (-) denotes stdin.\n\n'..
+ ' <outputfile> is required if <inputfile> is a PDF file\n'..
+ ' or input is read from stdin.\n'
+ return message
+end
+
+
+local function fixwin (args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
@@ -21,7 +32,23 @@ function fixwin (args_unix)
end
end
-function filename (file)
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+end
+
+
+local function filename (file)
+ -- strip path
if string.find(file, '[/\\]') then
return string.match(file, '.*[/\\](.*)$')
else
@@ -29,75 +56,101 @@ function filename (file)
end
end
-function basename (file)
- return string.match(filename(file), '(.*)[%.].*')
-end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-command={gs}
-files={}
-options={}
-
-PDF_level='1.4'
-if string.find(filename(arg[0]), 'ps2pdf12') then
- PDF_level='1.2'
-elseif string.find(filename(arg[0]), 'ps2pdf13') then
- PDF_level='1.3'
-elseif string.find(filename(arg[0]), 'ps2pdf14') then
- PDF_level='1.4'
+
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
end
-options[#options+1]='-dCompatibilityLevel='..PDF_level
-for i=1, #arg do
- if arg[i] == '-' then
- files[#files+1]=arg[i]
- elseif string.find(arg[i], '^%-') then
- options[#options+1]=arg[i]
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
else
- files[#files+1]=arg[i]
+ progname=basename
end
-end
-if #files < 1 or #files > 2 then
- io.stderr:write('Usage: ps2pdf [options] (input.[e]ps|-) [output.pdf]\n')
- os.exit(1)
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-if #files == 1 then
- if files[1] == '-' then
- outfile='-'
- elseif string.find(filename(files[1]), '%.[eE]?[pP][sS]$') then
- outfile=basename(files[1])..'.pdf'
- else
- outfile=filename(files[1])..'.pdf'
+
+local function check_files (progname, files, default_output_ext)
+ if #files < 1 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
end
-else
- outfile=files[2]
-end
-for i=1, #options do
- command[#command+1]=options[i]
+ if #files < 2 then
+ if extension(files.input) then
+ local ext=string.lower(extension(files.input))
+ if ext:match(default_output_ext..'$') then
+ io.stderr:write('!Error: no output file specified.\n\n')
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ else
+ files.output=basename(files.input)..'.'..default_output_ext
+ end
+ else -- the input file has no extension
+ files.output=files.input..'.'..default_output_ext
+ end
+ end
end
-other_opts={'-q', '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite'}
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files(progname, file, 'pdf')
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
+-- determine PDF level
+local PDF_level='1.4' -- default, may be changed in the future
+if progname == 'ps2pdf12' then PDF_level='1.2'
+elseif progname == 'ps2pdf13' then PDF_level='1.3'
+elseif progname == 'ps2pdf14' then PDF_level='1.4'
end
-command[#command+1]='-sOutputFile='..outfile
+-- setup command
-other_opts={'-c', '.setpdfwrite', '-f', files[1]}
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
-end
+push(command, '-P-', '-dSAFER', options, '-dCompatibilityLevel='..PDF_level)
+
+if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
+
+push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
+
+if os.type == 'unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
+
+-- We have to include the options twice because -I only takes effect
+-- if it appears before other options [see ps2pdfwr].
+push(command, options, '-c', '.setpdfwrite', '-f', file.input)
command=fixwin(command)
@@ -105,7 +158,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu
index a35e3b0912a..d694047cfff 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu
@@ -2,13 +2,24 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for ps2pdf*.bat.
--- Convert PS to PDF
+-- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-function fixwin (args_unix)
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
+ ' A single hyphen (-) denotes stdin.\n\n'..
+ ' <outputfile> is required if <inputfile> is a PDF file\n'..
+ ' or input is read from stdin.\n'
+ return message
+end
+
+
+local function fixwin (args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
@@ -21,7 +32,23 @@ function fixwin (args_unix)
end
end
-function filename (file)
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+end
+
+
+local function filename (file)
+ -- strip path
if string.find(file, '[/\\]') then
return string.match(file, '.*[/\\](.*)$')
else
@@ -29,75 +56,101 @@ function filename (file)
end
end
-function basename (file)
- return string.match(filename(file), '(.*)[%.].*')
-end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-command={gs}
-files={}
-options={}
-
-PDF_level='1.4'
-if string.find(filename(arg[0]), 'ps2pdf12') then
- PDF_level='1.2'
-elseif string.find(filename(arg[0]), 'ps2pdf13') then
- PDF_level='1.3'
-elseif string.find(filename(arg[0]), 'ps2pdf14') then
- PDF_level='1.4'
+
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
end
-options[#options+1]='-dCompatibilityLevel='..PDF_level
-for i=1, #arg do
- if arg[i] == '-' then
- files[#files+1]=arg[i]
- elseif string.find(arg[i], '^%-') then
- options[#options+1]=arg[i]
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
else
- files[#files+1]=arg[i]
+ progname=basename
end
-end
-if #files < 1 or #files > 2 then
- io.stderr:write('Usage: ps2pdf [options] (input.[e]ps|-) [output.pdf]\n')
- os.exit(1)
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-if #files == 1 then
- if files[1] == '-' then
- outfile='-'
- elseif string.find(filename(files[1]), '%.[eE]?[pP][sS]$') then
- outfile=basename(files[1])..'.pdf'
- else
- outfile=filename(files[1])..'.pdf'
+
+local function check_files (progname, files, default_output_ext)
+ if #files < 1 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
end
-else
- outfile=files[2]
-end
-for i=1, #options do
- command[#command+1]=options[i]
+ if #files < 2 then
+ if extension(files.input) then
+ local ext=string.lower(extension(files.input))
+ if ext:match(default_output_ext..'$') then
+ io.stderr:write('!Error: no output file specified.\n\n')
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ else
+ files.output=basename(files.input)..'.'..default_output_ext
+ end
+ else -- the input file has no extension
+ files.output=files.input..'.'..default_output_ext
+ end
+ end
end
-other_opts={'-q', '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite'}
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files(progname, file, 'pdf')
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
+-- determine PDF level
+local PDF_level='1.4' -- default, may be changed in the future
+if progname == 'ps2pdf12' then PDF_level='1.2'
+elseif progname == 'ps2pdf13' then PDF_level='1.3'
+elseif progname == 'ps2pdf14' then PDF_level='1.4'
end
-command[#command+1]='-sOutputFile='..outfile
+-- setup command
-other_opts={'-c', '.setpdfwrite', '-f', files[1]}
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
-end
+push(command, '-P-', '-dSAFER', options, '-dCompatibilityLevel='..PDF_level)
+
+if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
+
+push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
+
+if os.type == 'unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
+
+-- We have to include the options twice because -I only takes effect
+-- if it appears before other options [see ps2pdfwr].
+push(command, options, '-c', '.setpdfwrite', '-f', file.input)
command=fixwin(command)
@@ -105,7 +158,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu
index a35e3b0912a..d694047cfff 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu
@@ -2,13 +2,24 @@
--*-Lua-*-
-- $Id$
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2008-2015 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for ps2pdf*.bat.
--- Convert PS to PDF
+-- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-function fixwin (args_unix)
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
+ ' A single hyphen (-) denotes stdin.\n\n'..
+ ' <outputfile> is required if <inputfile> is a PDF file\n'..
+ ' or input is read from stdin.\n'
+ return message
+end
+
+
+local function fixwin (args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
@@ -21,7 +32,23 @@ function fixwin (args_unix)
end
end
-function filename (file)
+
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+end
+
+
+local function filename (file)
+ -- strip path
if string.find(file, '[/\\]') then
return string.match(file, '.*[/\\](.*)$')
else
@@ -29,75 +56,101 @@ function filename (file)
end
end
-function basename (file)
- return string.match(filename(file), '(.*)[%.].*')
-end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-command={gs}
-files={}
-options={}
-
-PDF_level='1.4'
-if string.find(filename(arg[0]), 'ps2pdf12') then
- PDF_level='1.2'
-elseif string.find(filename(arg[0]), 'ps2pdf13') then
- PDF_level='1.3'
-elseif string.find(filename(arg[0]), 'ps2pdf14') then
- PDF_level='1.4'
+
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
end
-options[#options+1]='-dCompatibilityLevel='..PDF_level
-for i=1, #arg do
- if arg[i] == '-' then
- files[#files+1]=arg[i]
- elseif string.find(arg[i], '^%-') then
- options[#options+1]=arg[i]
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
else
- files[#files+1]=arg[i]
+ progname=basename
end
-end
-if #files < 1 or #files > 2 then
- io.stderr:write('Usage: ps2pdf [options] (input.[e]ps|-) [output.pdf]\n')
- os.exit(1)
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+ return progname, options, files
end
-if #files == 1 then
- if files[1] == '-' then
- outfile='-'
- elseif string.find(filename(files[1]), '%.[eE]?[pP][sS]$') then
- outfile=basename(files[1])..'.pdf'
- else
- outfile=filename(files[1])..'.pdf'
+
+local function check_files (progname, files, default_output_ext)
+ if #files < 1 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
end
-else
- outfile=files[2]
-end
-for i=1, #options do
- command[#command+1]=options[i]
+ if #files < 2 then
+ if extension(files.input) then
+ local ext=string.lower(extension(files.input))
+ if ext:match(default_output_ext..'$') then
+ io.stderr:write('!Error: no output file specified.\n\n')
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ else
+ files.output=basename(files.input)..'.'..default_output_ext
+ end
+ else -- the input file has no extension
+ files.output=files.input..'.'..default_output_ext
+ end
+ end
end
-other_opts={'-q', '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite'}
+-- main --
+
+-- parse command line
+local progname, options, file=parse_cmdline()
+
+check_files(progname, file, 'pdf')
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
+-- determine PDF level
+local PDF_level='1.4' -- default, may be changed in the future
+if progname == 'ps2pdf12' then PDF_level='1.2'
+elseif progname == 'ps2pdf13' then PDF_level='1.3'
+elseif progname == 'ps2pdf14' then PDF_level='1.4'
end
-command[#command+1]='-sOutputFile='..outfile
+-- setup command
-other_opts={'-c', '.setpdfwrite', '-f', files[1]}
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-for i=1, #other_opts do
- command[#command+1]=other_opts[i]
-end
+push(command, '-P-', '-dSAFER', options, '-dCompatibilityLevel='..PDF_level)
+
+if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
+
+push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
+
+if os.type == 'unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
+
+-- We have to include the options twice because -I only takes effect
+-- if it appears before other options [see ps2pdfwr].
+push(command, options, '-c', '.setpdfwrite', '-f', file.input)
command=fixwin(command)
@@ -105,7 +158,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu
index 2d414700ebb..063fc76d0cc 100755
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu
+++ b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu
@@ -5,8 +5,21 @@
-- Copyright (C) 2010 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.
--- Replacement for ps2ps.bat.
--- 'Distill' PostScript.
+-- 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.
+
+
+local function usage (progname)
+ local message=
+ 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
+ ' <inputfile> can be either a PS, EPS, PDF file, or stdin.\n'..
+ ' A single hyphen (-) denotes stdin.\n'
+ return message
+end
+
function fixwin(args_unix)
if os.type == 'windows' then
@@ -21,47 +34,97 @@ function fixwin(args_unix)
end
end
-if os.type == 'windows' then
- gs='gswin32c'
-else
- gs='gs'
-end
+local function push (t, ...)
+ local args={...}
+ for _,v in ipairs(args) do
+ if type(v) == 'table' then
+ for _,x in ipairs(v) do
+ t[#t+1]=x
+ end
+ else
+ t[#t+1]=v
+ end
+ end
+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]
+local function filename (file)
+ -- strip path
+ if string.find(file, '[/\\]') then
+ return string.match(file, '.*[/\\](.*)$')
else
- files[#files+1]=arg[i]
+ return file
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)
+local function basename (file)
+ -- strip extension
+ return string.match(filename(file), '(.*)%..*')
end
-command={gs, '-q', '-sDEVICE=pswrite'}
+local function extension (file)
+ -- return extension if available, false otherwise.
+ local fn=filename(file)
+ if fn:find('%.') then
+ return string.match(fn, '.*%.(.*)')
+ end
+end
+
+
+local function parse_cmdline ()
+ local files={}
+ local options={}
+
+ local progname
+ local basename=filename(arg[0])
+ if basename:find('%.') then
+ progname=basename:match('(.*)%..*')
+ else
+ progname=basename
+ end
-if os.type=='unix' then
- command[#command+1]='-sstdout=%stderr'
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ push(options, arg[i])
+ else
+ push(files, arg[i])
+ end
+ end
+ files.input =files[1]
+ files.output=files[2]
+
+ return progname, options, files
end
-command[#command+1]='-sOutputFile='..files[2]
-for i=1, #options do
- command[#command+1]=options[i]
+local function check_files (progname, files)
+ if #files < 2 then
+ io.stderr:write(usage(progname))
+ os.exit(1)
+ end
end
-command[#command+1]=files[1]
+-- main --
+
+local progname, options, file=parse_cmdline()
+
+check_files (progname, file)
+
+-- setup command
+
+local command={}
+if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
+
+push(command, '-q', '-sDEVICE=ps2write')
+
+if os.type=='unix' then push(command, '-sstdout=%stderr') end
+
+push(command, '-sOutputFile='..file.output)
+push(command, '-dNOPAUSE', '-dBATCH', '-P-', '-dSAFER')
+push(command, options, file.input)
command=fixwin(command)
@@ -69,7 +132,7 @@ command=fixwin(command)
for i=0, #command do
print (command[i])
end
-os.exit(ret)
+os.exit(0)
--]]
ret=os.spawn(command)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps2.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps2.tlu
deleted file mode 100755
index 5fa86abf0d2..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps2.tlu
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/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)