From 9bdd9f27ea5243115a8b2f0aa891bfdf6dfdddf1 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 10 Jan 2011 13:10:28 +0000 Subject: change into linked scripts git-svn-id: svn://tug.org/texlive/trunk@21010 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/alpha-linux/deweb | 123 +---- Master/bin/alpha-linux/extractres | 97 +--- Master/bin/alpha-linux/fixdlsrps | 55 +- Master/bin/alpha-linux/fixfmps | 22 +- Master/bin/alpha-linux/fixpsditps | 26 +- Master/bin/alpha-linux/fixpspps | 59 +- Master/bin/alpha-linux/fixscribeps | 20 +- Master/bin/alpha-linux/fixtpps | 29 +- Master/bin/alpha-linux/fixwfwps | 34 +- Master/bin/alpha-linux/fixwpps | 32 +- Master/bin/alpha-linux/fixwwps | 21 +- Master/bin/alpha-linux/includeres | 47 +- Master/bin/alpha-linux/ps2eps | 936 +------------------------------- Master/bin/alpha-linux/psmerge | 86 +-- Master/bin/amd64-freebsd/deweb | 123 +---- Master/bin/amd64-freebsd/extractres | 97 +--- Master/bin/amd64-freebsd/fixdlsrps | 55 +- Master/bin/amd64-freebsd/fixfmps | 22 +- Master/bin/amd64-freebsd/fixpsditps | 26 +- Master/bin/amd64-freebsd/fixpspps | 59 +- Master/bin/amd64-freebsd/fixscribeps | 20 +- Master/bin/amd64-freebsd/fixtpps | 29 +- Master/bin/amd64-freebsd/fixwfwps | 34 +- Master/bin/amd64-freebsd/fixwpps | 32 +- Master/bin/amd64-freebsd/fixwwps | 21 +- Master/bin/amd64-freebsd/includeres | 47 +- Master/bin/amd64-freebsd/ps2eps | 936 +------------------------------- Master/bin/amd64-freebsd/psmerge | 86 +-- Master/bin/amd64-kfreebsd/deweb | 123 +---- Master/bin/amd64-kfreebsd/extractres | 97 +--- Master/bin/amd64-kfreebsd/fixdlsrps | 55 +- Master/bin/amd64-kfreebsd/fixfmps | 22 +- Master/bin/amd64-kfreebsd/fixpsditps | 26 +- Master/bin/amd64-kfreebsd/fixpspps | 59 +- Master/bin/amd64-kfreebsd/fixscribeps | 20 +- Master/bin/amd64-kfreebsd/fixtpps | 29 +- Master/bin/amd64-kfreebsd/fixwfwps | 34 +- Master/bin/amd64-kfreebsd/fixwpps | 32 +- Master/bin/amd64-kfreebsd/fixwwps | 21 +- Master/bin/amd64-kfreebsd/includeres | 47 +- Master/bin/amd64-kfreebsd/ps2eps | 936 +------------------------------- Master/bin/amd64-kfreebsd/psmerge | 86 +-- Master/bin/i386-cygwin/deweb | 123 +---- Master/bin/i386-cygwin/extractres | 97 +--- Master/bin/i386-cygwin/fixdlsrps | 55 +- Master/bin/i386-cygwin/fixfmps | 22 +- Master/bin/i386-cygwin/fixpsditps | 26 +- Master/bin/i386-cygwin/fixpspps | 59 +- Master/bin/i386-cygwin/fixscribeps | 20 +- Master/bin/i386-cygwin/fixtpps | 29 +- Master/bin/i386-cygwin/fixwfwps | 34 +- Master/bin/i386-cygwin/fixwpps | 32 +- Master/bin/i386-cygwin/fixwwps | 21 +- Master/bin/i386-cygwin/includeres | 47 +- Master/bin/i386-cygwin/ps2eps | 936 +------------------------------- Master/bin/i386-cygwin/psmerge | 86 +-- Master/bin/i386-freebsd/deweb | 123 +---- Master/bin/i386-freebsd/extractres | 97 +--- Master/bin/i386-freebsd/fixdlsrps | 55 +- Master/bin/i386-freebsd/fixfmps | 22 +- Master/bin/i386-freebsd/fixpsditps | 26 +- Master/bin/i386-freebsd/fixpspps | 59 +- Master/bin/i386-freebsd/fixscribeps | 20 +- Master/bin/i386-freebsd/fixtpps | 29 +- Master/bin/i386-freebsd/fixwfwps | 34 +- Master/bin/i386-freebsd/fixwpps | 32 +- Master/bin/i386-freebsd/fixwwps | 21 +- Master/bin/i386-freebsd/includeres | 47 +- Master/bin/i386-freebsd/ps2eps | 936 +------------------------------- Master/bin/i386-freebsd/psmerge | 86 +-- Master/bin/i386-kfreebsd/deweb | 123 +---- Master/bin/i386-kfreebsd/extractres | 97 +--- Master/bin/i386-kfreebsd/fixdlsrps | 55 +- Master/bin/i386-kfreebsd/fixfmps | 22 +- Master/bin/i386-kfreebsd/fixpsditps | 26 +- Master/bin/i386-kfreebsd/fixpspps | 59 +- Master/bin/i386-kfreebsd/fixscribeps | 20 +- Master/bin/i386-kfreebsd/fixtpps | 29 +- Master/bin/i386-kfreebsd/fixwfwps | 34 +- Master/bin/i386-kfreebsd/fixwpps | 32 +- Master/bin/i386-kfreebsd/fixwwps | 21 +- Master/bin/i386-kfreebsd/includeres | 47 +- Master/bin/i386-kfreebsd/ps2eps | 936 +------------------------------- Master/bin/i386-kfreebsd/psmerge | 86 +-- Master/bin/i386-linux/deweb | 123 +---- Master/bin/i386-linux/extractres | 97 +--- Master/bin/i386-linux/fixdlsrps | 55 +- Master/bin/i386-linux/fixfmps | 22 +- Master/bin/i386-linux/fixpsditps | 26 +- Master/bin/i386-linux/fixpspps | 59 +- Master/bin/i386-linux/fixscribeps | 20 +- Master/bin/i386-linux/fixtpps | 29 +- Master/bin/i386-linux/fixwfwps | 34 +- Master/bin/i386-linux/fixwpps | 32 +- Master/bin/i386-linux/fixwwps | 21 +- Master/bin/i386-linux/includeres | 47 +- Master/bin/i386-linux/ps2eps | 936 +------------------------------- Master/bin/i386-linux/psmerge | 86 +-- Master/bin/i386-netbsd/deweb | 123 +---- Master/bin/i386-netbsd/extractres | 97 +--- Master/bin/i386-netbsd/fixdlsrps | 55 +- Master/bin/i386-netbsd/fixfmps | 22 +- Master/bin/i386-netbsd/fixpsditps | 26 +- Master/bin/i386-netbsd/fixpspps | 59 +- Master/bin/i386-netbsd/fixscribeps | 20 +- Master/bin/i386-netbsd/fixtpps | 29 +- Master/bin/i386-netbsd/fixwfwps | 34 +- Master/bin/i386-netbsd/fixwpps | 32 +- Master/bin/i386-netbsd/fixwwps | 21 +- Master/bin/i386-netbsd/includeres | 47 +- Master/bin/i386-netbsd/ps2eps | 936 +------------------------------- Master/bin/i386-netbsd/psmerge | 86 +-- Master/bin/i386-solaris/deweb | 123 +---- Master/bin/i386-solaris/extractres | 97 +--- Master/bin/i386-solaris/fixdlsrps | 55 +- Master/bin/i386-solaris/fixfmps | 22 +- Master/bin/i386-solaris/fixpsditps | 26 +- Master/bin/i386-solaris/fixpspps | 59 +- Master/bin/i386-solaris/fixscribeps | 20 +- Master/bin/i386-solaris/fixtpps | 29 +- Master/bin/i386-solaris/fixwfwps | 34 +- Master/bin/i386-solaris/fixwpps | 32 +- Master/bin/i386-solaris/fixwwps | 21 +- Master/bin/i386-solaris/includeres | 47 +- Master/bin/i386-solaris/ps2eps | 936 +------------------------------- Master/bin/i386-solaris/psmerge | 86 +-- Master/bin/mips-irix/deweb | 123 +---- Master/bin/mips-irix/extractres | 97 +--- Master/bin/mips-irix/fixdlsrps | 55 +- Master/bin/mips-irix/fixfmps | 22 +- Master/bin/mips-irix/fixpsditps | 26 +- Master/bin/mips-irix/fixpspps | 59 +- Master/bin/mips-irix/fixscribeps | 20 +- Master/bin/mips-irix/fixtpps | 29 +- Master/bin/mips-irix/fixwfwps | 34 +- Master/bin/mips-irix/fixwpps | 32 +- Master/bin/mips-irix/fixwwps | 21 +- Master/bin/mips-irix/includeres | 47 +- Master/bin/mips-irix/ps2eps | 936 +------------------------------- Master/bin/mips-irix/psmerge | 86 +-- Master/bin/powerpc-aix/deweb | 123 +---- Master/bin/powerpc-aix/extractres | 97 +--- Master/bin/powerpc-aix/fixdlsrps | 55 +- Master/bin/powerpc-aix/fixfmps | 22 +- Master/bin/powerpc-aix/fixpsditps | 26 +- Master/bin/powerpc-aix/fixpspps | 59 +- Master/bin/powerpc-aix/fixscribeps | 20 +- Master/bin/powerpc-aix/fixtpps | 29 +- Master/bin/powerpc-aix/fixwfwps | 34 +- Master/bin/powerpc-aix/fixwpps | 32 +- Master/bin/powerpc-aix/fixwwps | 21 +- Master/bin/powerpc-aix/includeres | 47 +- Master/bin/powerpc-aix/ps2eps | 936 +------------------------------- Master/bin/powerpc-aix/psmerge | 86 +-- Master/bin/powerpc-linux/deweb | 123 +---- Master/bin/powerpc-linux/extractres | 97 +--- Master/bin/powerpc-linux/fixdlsrps | 55 +- Master/bin/powerpc-linux/fixfmps | 22 +- Master/bin/powerpc-linux/fixpsditps | 26 +- Master/bin/powerpc-linux/fixpspps | 59 +- Master/bin/powerpc-linux/fixscribeps | 20 +- Master/bin/powerpc-linux/fixtpps | 29 +- Master/bin/powerpc-linux/fixwfwps | 34 +- Master/bin/powerpc-linux/fixwpps | 32 +- Master/bin/powerpc-linux/fixwwps | 21 +- Master/bin/powerpc-linux/includeres | 47 +- Master/bin/powerpc-linux/ps2eps | 936 +------------------------------- Master/bin/powerpc-linux/psmerge | 86 +-- Master/bin/sparc-linux/deweb | 123 +---- Master/bin/sparc-linux/extractres | 97 +--- Master/bin/sparc-linux/fixdlsrps | 55 +- Master/bin/sparc-linux/fixfmps | 22 +- Master/bin/sparc-linux/fixpsditps | 26 +- Master/bin/sparc-linux/fixpspps | 59 +- Master/bin/sparc-linux/fixscribeps | 20 +- Master/bin/sparc-linux/fixtpps | 29 +- Master/bin/sparc-linux/fixwfwps | 34 +- Master/bin/sparc-linux/fixwpps | 32 +- Master/bin/sparc-linux/fixwwps | 21 +- Master/bin/sparc-linux/includeres | 47 +- Master/bin/sparc-linux/ps2eps | 936 +------------------------------- Master/bin/sparc-linux/psmerge | 86 +-- Master/bin/sparc-solaris/deweb | 123 +---- Master/bin/sparc-solaris/extractres | 97 +--- Master/bin/sparc-solaris/fixdlsrps | 55 +- Master/bin/sparc-solaris/fixfmps | 22 +- Master/bin/sparc-solaris/fixpsditps | 26 +- Master/bin/sparc-solaris/fixpspps | 59 +- Master/bin/sparc-solaris/fixscribeps | 20 +- Master/bin/sparc-solaris/fixtpps | 29 +- Master/bin/sparc-solaris/fixwfwps | 34 +- Master/bin/sparc-solaris/fixwpps | 32 +- Master/bin/sparc-solaris/fixwwps | 21 +- Master/bin/sparc-solaris/includeres | 47 +- Master/bin/sparc-solaris/ps2eps | 936 +------------------------------- Master/bin/sparc-solaris/psmerge | 86 +-- Master/bin/universal-darwin/deweb | 123 +---- Master/bin/universal-darwin/extractres | 97 +--- Master/bin/universal-darwin/fixdlsrps | 55 +- Master/bin/universal-darwin/fixfmps | 22 +- Master/bin/universal-darwin/fixpsditps | 26 +- Master/bin/universal-darwin/fixpspps | 59 +- Master/bin/universal-darwin/fixscribeps | 20 +- Master/bin/universal-darwin/fixtpps | 29 +- Master/bin/universal-darwin/fixwfwps | 34 +- Master/bin/universal-darwin/fixwpps | 32 +- Master/bin/universal-darwin/fixwwps | 21 +- Master/bin/universal-darwin/includeres | 47 +- Master/bin/universal-darwin/ps2eps | 936 +------------------------------- Master/bin/universal-darwin/psmerge | 86 +-- Master/bin/x86_64-darwin/deweb | 123 +---- Master/bin/x86_64-darwin/extractres | 97 +--- Master/bin/x86_64-darwin/fixdlsrps | 55 +- Master/bin/x86_64-darwin/fixfmps | 22 +- Master/bin/x86_64-darwin/fixpsditps | 26 +- Master/bin/x86_64-darwin/fixpspps | 59 +- Master/bin/x86_64-darwin/fixscribeps | 20 +- Master/bin/x86_64-darwin/fixtpps | 29 +- Master/bin/x86_64-darwin/fixwfwps | 34 +- Master/bin/x86_64-darwin/fixwpps | 32 +- Master/bin/x86_64-darwin/fixwwps | 21 +- Master/bin/x86_64-darwin/includeres | 47 +- Master/bin/x86_64-darwin/ps2eps | 936 +------------------------------- Master/bin/x86_64-darwin/psmerge | 86 +-- Master/bin/x86_64-solaris/deweb | 123 +---- Master/bin/x86_64-solaris/extractres | 97 +--- Master/bin/x86_64-solaris/fixdlsrps | 55 +- Master/bin/x86_64-solaris/fixfmps | 22 +- Master/bin/x86_64-solaris/fixpsditps | 26 +- Master/bin/x86_64-solaris/fixpspps | 59 +- Master/bin/x86_64-solaris/fixscribeps | 20 +- Master/bin/x86_64-solaris/fixtpps | 29 +- Master/bin/x86_64-solaris/fixwfwps | 34 +- Master/bin/x86_64-solaris/fixwpps | 32 +- Master/bin/x86_64-solaris/fixwwps | 21 +- Master/bin/x86_64-solaris/includeres | 47 +- Master/bin/x86_64-solaris/ps2eps | 936 +------------------------------- Master/bin/x86_64-solaris/psmerge | 86 +-- 238 files changed, 238 insertions(+), 26741 deletions(-) mode change 100755 => 120000 Master/bin/alpha-linux/deweb mode change 100755 => 120000 Master/bin/alpha-linux/extractres mode change 100755 => 120000 Master/bin/alpha-linux/fixdlsrps mode change 100755 => 120000 Master/bin/alpha-linux/fixfmps mode change 100755 => 120000 Master/bin/alpha-linux/fixpsditps mode change 100755 => 120000 Master/bin/alpha-linux/fixpspps mode change 100755 => 120000 Master/bin/alpha-linux/fixscribeps mode change 100755 => 120000 Master/bin/alpha-linux/fixtpps mode change 100755 => 120000 Master/bin/alpha-linux/fixwfwps mode change 100755 => 120000 Master/bin/alpha-linux/fixwpps mode change 100755 => 120000 Master/bin/alpha-linux/fixwwps mode change 100755 => 120000 Master/bin/alpha-linux/includeres mode change 100755 => 120000 Master/bin/alpha-linux/ps2eps mode change 100755 => 120000 Master/bin/alpha-linux/psmerge mode change 100755 => 120000 Master/bin/amd64-freebsd/deweb mode change 100755 => 120000 Master/bin/amd64-freebsd/extractres mode change 100755 => 120000 Master/bin/amd64-freebsd/fixdlsrps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixfmps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixpsditps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixpspps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixscribeps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixtpps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixwfwps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixwpps mode change 100755 => 120000 Master/bin/amd64-freebsd/fixwwps mode change 100755 => 120000 Master/bin/amd64-freebsd/includeres mode change 100755 => 120000 Master/bin/amd64-freebsd/ps2eps mode change 100755 => 120000 Master/bin/amd64-freebsd/psmerge mode change 100755 => 120000 Master/bin/amd64-kfreebsd/deweb mode change 100755 => 120000 Master/bin/amd64-kfreebsd/extractres mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixdlsrps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixfmps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixpsditps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixpspps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixscribeps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixtpps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixwfwps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixwpps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/fixwwps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/includeres mode change 100755 => 120000 Master/bin/amd64-kfreebsd/ps2eps mode change 100755 => 120000 Master/bin/amd64-kfreebsd/psmerge mode change 100755 => 120000 Master/bin/i386-cygwin/deweb mode change 100755 => 120000 Master/bin/i386-cygwin/extractres mode change 100755 => 120000 Master/bin/i386-cygwin/fixdlsrps mode change 100755 => 120000 Master/bin/i386-cygwin/fixfmps mode change 100755 => 120000 Master/bin/i386-cygwin/fixpsditps mode change 100755 => 120000 Master/bin/i386-cygwin/fixpspps mode change 100755 => 120000 Master/bin/i386-cygwin/fixscribeps mode change 100755 => 120000 Master/bin/i386-cygwin/fixtpps mode change 100755 => 120000 Master/bin/i386-cygwin/fixwfwps mode change 100755 => 120000 Master/bin/i386-cygwin/fixwpps mode change 100755 => 120000 Master/bin/i386-cygwin/fixwwps mode change 100755 => 120000 Master/bin/i386-cygwin/includeres mode change 100755 => 120000 Master/bin/i386-cygwin/ps2eps mode change 100755 => 120000 Master/bin/i386-cygwin/psmerge mode change 100755 => 120000 Master/bin/i386-freebsd/deweb mode change 100755 => 120000 Master/bin/i386-freebsd/extractres mode change 100755 => 120000 Master/bin/i386-freebsd/fixdlsrps mode change 100755 => 120000 Master/bin/i386-freebsd/fixfmps mode change 100755 => 120000 Master/bin/i386-freebsd/fixpsditps mode change 100755 => 120000 Master/bin/i386-freebsd/fixpspps mode change 100755 => 120000 Master/bin/i386-freebsd/fixscribeps mode change 100755 => 120000 Master/bin/i386-freebsd/fixtpps mode change 100755 => 120000 Master/bin/i386-freebsd/fixwfwps mode change 100755 => 120000 Master/bin/i386-freebsd/fixwpps mode change 100755 => 120000 Master/bin/i386-freebsd/fixwwps mode change 100755 => 120000 Master/bin/i386-freebsd/includeres mode change 100755 => 120000 Master/bin/i386-freebsd/ps2eps mode change 100755 => 120000 Master/bin/i386-freebsd/psmerge mode change 100755 => 120000 Master/bin/i386-kfreebsd/deweb mode change 100755 => 120000 Master/bin/i386-kfreebsd/extractres mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixdlsrps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixfmps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixpsditps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixpspps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixscribeps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixtpps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixwfwps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixwpps mode change 100755 => 120000 Master/bin/i386-kfreebsd/fixwwps mode change 100755 => 120000 Master/bin/i386-kfreebsd/includeres mode change 100755 => 120000 Master/bin/i386-kfreebsd/ps2eps mode change 100755 => 120000 Master/bin/i386-kfreebsd/psmerge mode change 100755 => 120000 Master/bin/i386-linux/deweb mode change 100755 => 120000 Master/bin/i386-linux/extractres mode change 100755 => 120000 Master/bin/i386-linux/fixdlsrps mode change 100755 => 120000 Master/bin/i386-linux/fixfmps mode change 100755 => 120000 Master/bin/i386-linux/fixpsditps mode change 100755 => 120000 Master/bin/i386-linux/fixpspps mode change 100755 => 120000 Master/bin/i386-linux/fixscribeps mode change 100755 => 120000 Master/bin/i386-linux/fixtpps mode change 100755 => 120000 Master/bin/i386-linux/fixwfwps mode change 100755 => 120000 Master/bin/i386-linux/fixwpps mode change 100755 => 120000 Master/bin/i386-linux/fixwwps mode change 100755 => 120000 Master/bin/i386-linux/includeres mode change 100755 => 120000 Master/bin/i386-linux/ps2eps mode change 100755 => 120000 Master/bin/i386-linux/psmerge mode change 100755 => 120000 Master/bin/i386-netbsd/deweb mode change 100755 => 120000 Master/bin/i386-netbsd/extractres mode change 100755 => 120000 Master/bin/i386-netbsd/fixdlsrps mode change 100755 => 120000 Master/bin/i386-netbsd/fixfmps mode change 100755 => 120000 Master/bin/i386-netbsd/fixpsditps mode change 100755 => 120000 Master/bin/i386-netbsd/fixpspps mode change 100755 => 120000 Master/bin/i386-netbsd/fixscribeps mode change 100755 => 120000 Master/bin/i386-netbsd/fixtpps mode change 100755 => 120000 Master/bin/i386-netbsd/fixwfwps mode change 100755 => 120000 Master/bin/i386-netbsd/fixwpps mode change 100755 => 120000 Master/bin/i386-netbsd/fixwwps mode change 100755 => 120000 Master/bin/i386-netbsd/includeres mode change 100755 => 120000 Master/bin/i386-netbsd/ps2eps mode change 100755 => 120000 Master/bin/i386-netbsd/psmerge mode change 100755 => 120000 Master/bin/i386-solaris/deweb mode change 100755 => 120000 Master/bin/i386-solaris/extractres mode change 100755 => 120000 Master/bin/i386-solaris/fixdlsrps mode change 100755 => 120000 Master/bin/i386-solaris/fixfmps mode change 100755 => 120000 Master/bin/i386-solaris/fixpsditps mode change 100755 => 120000 Master/bin/i386-solaris/fixpspps mode change 100755 => 120000 Master/bin/i386-solaris/fixscribeps mode change 100755 => 120000 Master/bin/i386-solaris/fixtpps mode change 100755 => 120000 Master/bin/i386-solaris/fixwfwps mode change 100755 => 120000 Master/bin/i386-solaris/fixwpps mode change 100755 => 120000 Master/bin/i386-solaris/fixwwps mode change 100755 => 120000 Master/bin/i386-solaris/includeres mode change 100755 => 120000 Master/bin/i386-solaris/ps2eps mode change 100755 => 120000 Master/bin/i386-solaris/psmerge mode change 100755 => 120000 Master/bin/mips-irix/deweb mode change 100755 => 120000 Master/bin/mips-irix/extractres mode change 100755 => 120000 Master/bin/mips-irix/fixdlsrps mode change 100755 => 120000 Master/bin/mips-irix/fixfmps mode change 100755 => 120000 Master/bin/mips-irix/fixpsditps mode change 100755 => 120000 Master/bin/mips-irix/fixpspps mode change 100755 => 120000 Master/bin/mips-irix/fixscribeps mode change 100755 => 120000 Master/bin/mips-irix/fixtpps mode change 100755 => 120000 Master/bin/mips-irix/fixwfwps mode change 100755 => 120000 Master/bin/mips-irix/fixwpps mode change 100755 => 120000 Master/bin/mips-irix/fixwwps mode change 100755 => 120000 Master/bin/mips-irix/includeres mode change 100755 => 120000 Master/bin/mips-irix/ps2eps mode change 100755 => 120000 Master/bin/mips-irix/psmerge mode change 100755 => 120000 Master/bin/powerpc-aix/deweb mode change 100755 => 120000 Master/bin/powerpc-aix/extractres mode change 100755 => 120000 Master/bin/powerpc-aix/fixdlsrps mode change 100755 => 120000 Master/bin/powerpc-aix/fixfmps mode change 100755 => 120000 Master/bin/powerpc-aix/fixpsditps mode change 100755 => 120000 Master/bin/powerpc-aix/fixpspps mode change 100755 => 120000 Master/bin/powerpc-aix/fixscribeps mode change 100755 => 120000 Master/bin/powerpc-aix/fixtpps mode change 100755 => 120000 Master/bin/powerpc-aix/fixwfwps mode change 100755 => 120000 Master/bin/powerpc-aix/fixwpps mode change 100755 => 120000 Master/bin/powerpc-aix/fixwwps mode change 100755 => 120000 Master/bin/powerpc-aix/includeres mode change 100755 => 120000 Master/bin/powerpc-aix/ps2eps mode change 100755 => 120000 Master/bin/powerpc-aix/psmerge mode change 100755 => 120000 Master/bin/powerpc-linux/deweb mode change 100755 => 120000 Master/bin/powerpc-linux/extractres mode change 100755 => 120000 Master/bin/powerpc-linux/fixdlsrps mode change 100755 => 120000 Master/bin/powerpc-linux/fixfmps mode change 100755 => 120000 Master/bin/powerpc-linux/fixpsditps mode change 100755 => 120000 Master/bin/powerpc-linux/fixpspps mode change 100755 => 120000 Master/bin/powerpc-linux/fixscribeps mode change 100755 => 120000 Master/bin/powerpc-linux/fixtpps mode change 100755 => 120000 Master/bin/powerpc-linux/fixwfwps mode change 100755 => 120000 Master/bin/powerpc-linux/fixwpps mode change 100755 => 120000 Master/bin/powerpc-linux/fixwwps mode change 100755 => 120000 Master/bin/powerpc-linux/includeres mode change 100755 => 120000 Master/bin/powerpc-linux/ps2eps mode change 100755 => 120000 Master/bin/powerpc-linux/psmerge mode change 100755 => 120000 Master/bin/sparc-linux/deweb mode change 100755 => 120000 Master/bin/sparc-linux/extractres mode change 100755 => 120000 Master/bin/sparc-linux/fixdlsrps mode change 100755 => 120000 Master/bin/sparc-linux/fixfmps mode change 100755 => 120000 Master/bin/sparc-linux/fixpsditps mode change 100755 => 120000 Master/bin/sparc-linux/fixpspps mode change 100755 => 120000 Master/bin/sparc-linux/fixscribeps mode change 100755 => 120000 Master/bin/sparc-linux/fixtpps mode change 100755 => 120000 Master/bin/sparc-linux/fixwfwps mode change 100755 => 120000 Master/bin/sparc-linux/fixwpps mode change 100755 => 120000 Master/bin/sparc-linux/fixwwps mode change 100755 => 120000 Master/bin/sparc-linux/includeres mode change 100755 => 120000 Master/bin/sparc-linux/ps2eps mode change 100755 => 120000 Master/bin/sparc-linux/psmerge mode change 100755 => 120000 Master/bin/sparc-solaris/deweb mode change 100755 => 120000 Master/bin/sparc-solaris/extractres mode change 100755 => 120000 Master/bin/sparc-solaris/fixdlsrps mode change 100755 => 120000 Master/bin/sparc-solaris/fixfmps mode change 100755 => 120000 Master/bin/sparc-solaris/fixpsditps mode change 100755 => 120000 Master/bin/sparc-solaris/fixpspps mode change 100755 => 120000 Master/bin/sparc-solaris/fixscribeps mode change 100755 => 120000 Master/bin/sparc-solaris/fixtpps mode change 100755 => 120000 Master/bin/sparc-solaris/fixwfwps mode change 100755 => 120000 Master/bin/sparc-solaris/fixwpps mode change 100755 => 120000 Master/bin/sparc-solaris/fixwwps mode change 100755 => 120000 Master/bin/sparc-solaris/includeres mode change 100755 => 120000 Master/bin/sparc-solaris/ps2eps mode change 100755 => 120000 Master/bin/sparc-solaris/psmerge mode change 100755 => 120000 Master/bin/universal-darwin/deweb mode change 100755 => 120000 Master/bin/universal-darwin/extractres mode change 100755 => 120000 Master/bin/universal-darwin/fixdlsrps mode change 100755 => 120000 Master/bin/universal-darwin/fixfmps mode change 100755 => 120000 Master/bin/universal-darwin/fixpsditps mode change 100755 => 120000 Master/bin/universal-darwin/fixpspps mode change 100755 => 120000 Master/bin/universal-darwin/fixscribeps mode change 100755 => 120000 Master/bin/universal-darwin/fixtpps mode change 100755 => 120000 Master/bin/universal-darwin/fixwfwps mode change 100755 => 120000 Master/bin/universal-darwin/fixwpps mode change 100755 => 120000 Master/bin/universal-darwin/fixwwps mode change 100755 => 120000 Master/bin/universal-darwin/includeres mode change 100755 => 120000 Master/bin/universal-darwin/ps2eps mode change 100755 => 120000 Master/bin/universal-darwin/psmerge mode change 100755 => 120000 Master/bin/x86_64-darwin/deweb mode change 100755 => 120000 Master/bin/x86_64-darwin/extractres mode change 100755 => 120000 Master/bin/x86_64-darwin/fixdlsrps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixfmps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixpsditps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixpspps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixscribeps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixtpps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixwfwps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixwpps mode change 100755 => 120000 Master/bin/x86_64-darwin/fixwwps mode change 100755 => 120000 Master/bin/x86_64-darwin/includeres mode change 100755 => 120000 Master/bin/x86_64-darwin/ps2eps mode change 100755 => 120000 Master/bin/x86_64-darwin/psmerge mode change 100755 => 120000 Master/bin/x86_64-solaris/deweb mode change 100755 => 120000 Master/bin/x86_64-solaris/extractres mode change 100755 => 120000 Master/bin/x86_64-solaris/fixdlsrps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixfmps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixpsditps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixpspps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixscribeps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixtpps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixwfwps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixwpps mode change 100755 => 120000 Master/bin/x86_64-solaris/fixwwps mode change 100755 => 120000 Master/bin/x86_64-solaris/includeres mode change 100755 => 120000 Master/bin/x86_64-solaris/ps2eps mode change 100755 => 120000 Master/bin/x86_64-solaris/psmerge (limited to 'Master/bin') diff --git a/Master/bin/alpha-linux/deweb b/Master/bin/alpha-linux/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/alpha-linux/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/alpha-linux/deweb b/Master/bin/alpha-linux/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/alpha-linux/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/extractres b/Master/bin/alpha-linux/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/alpha-linux/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/alpha-linux/extractres b/Master/bin/alpha-linux/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/alpha-linux/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixdlsrps b/Master/bin/alpha-linux/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/alpha-linux/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/alpha-linux/fixdlsrps b/Master/bin/alpha-linux/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/alpha-linux/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixfmps b/Master/bin/alpha-linux/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/alpha-linux/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixfmps b/Master/bin/alpha-linux/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/alpha-linux/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixpsditps b/Master/bin/alpha-linux/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/alpha-linux/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixpsditps b/Master/bin/alpha-linux/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/alpha-linux/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixpspps b/Master/bin/alpha-linux/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/alpha-linux/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixscribeps b/Master/bin/alpha-linux/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/alpha-linux/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixtpps b/Master/bin/alpha-linux/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/alpha-linux/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixtpps b/Master/bin/alpha-linux/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/alpha-linux/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixwfwps b/Master/bin/alpha-linux/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/alpha-linux/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/alpha-linux/fixwfwps b/Master/bin/alpha-linux/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/alpha-linux/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixwpps b/Master/bin/alpha-linux/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/alpha-linux/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixwpps b/Master/bin/alpha-linux/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/alpha-linux/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/fixwwps b/Master/bin/alpha-linux/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/alpha-linux/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/fixwwps b/Master/bin/alpha-linux/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/alpha-linux/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/includeres b/Master/bin/alpha-linux/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/alpha-linux/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/alpha-linux/includeres b/Master/bin/alpha-linux/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/alpha-linux/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/ps2eps b/Master/bin/alpha-linux/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/alpha-linux/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/alpha-linux/ps2eps b/Master/bin/alpha-linux/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/alpha-linux/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/alpha-linux/psmerge b/Master/bin/alpha-linux/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/alpha-linux/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/alpha-linux/psmerge b/Master/bin/alpha-linux/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/alpha-linux/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/deweb b/Master/bin/amd64-freebsd/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/amd64-freebsd/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/amd64-freebsd/deweb b/Master/bin/amd64-freebsd/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/amd64-freebsd/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/extractres b/Master/bin/amd64-freebsd/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/amd64-freebsd/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/amd64-freebsd/extractres b/Master/bin/amd64-freebsd/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/amd64-freebsd/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixdlsrps b/Master/bin/amd64-freebsd/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/amd64-freebsd/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/amd64-freebsd/fixdlsrps b/Master/bin/amd64-freebsd/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixfmps b/Master/bin/amd64-freebsd/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/amd64-freebsd/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixfmps b/Master/bin/amd64-freebsd/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixpsditps b/Master/bin/amd64-freebsd/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/amd64-freebsd/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixpsditps b/Master/bin/amd64-freebsd/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixpspps b/Master/bin/amd64-freebsd/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/amd64-freebsd/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixscribeps b/Master/bin/amd64-freebsd/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/amd64-freebsd/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixtpps b/Master/bin/amd64-freebsd/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/amd64-freebsd/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixtpps b/Master/bin/amd64-freebsd/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixwfwps b/Master/bin/amd64-freebsd/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/amd64-freebsd/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/amd64-freebsd/fixwfwps b/Master/bin/amd64-freebsd/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixwpps b/Master/bin/amd64-freebsd/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/amd64-freebsd/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixwpps b/Master/bin/amd64-freebsd/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/amd64-freebsd/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/fixwwps b/Master/bin/amd64-freebsd/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/amd64-freebsd/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/fixwwps b/Master/bin/amd64-freebsd/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/amd64-freebsd/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/includeres b/Master/bin/amd64-freebsd/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/amd64-freebsd/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-freebsd/includeres b/Master/bin/amd64-freebsd/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/amd64-freebsd/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/ps2eps b/Master/bin/amd64-freebsd/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/amd64-freebsd/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/amd64-freebsd/ps2eps b/Master/bin/amd64-freebsd/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/amd64-freebsd/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/psmerge b/Master/bin/amd64-freebsd/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/amd64-freebsd/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/amd64-freebsd/psmerge b/Master/bin/amd64-freebsd/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/amd64-freebsd/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/deweb b/Master/bin/amd64-kfreebsd/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/amd64-kfreebsd/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/amd64-kfreebsd/deweb b/Master/bin/amd64-kfreebsd/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/extractres b/Master/bin/amd64-kfreebsd/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/amd64-kfreebsd/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/amd64-kfreebsd/extractres b/Master/bin/amd64-kfreebsd/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixdlsrps b/Master/bin/amd64-kfreebsd/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/amd64-kfreebsd/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/amd64-kfreebsd/fixdlsrps b/Master/bin/amd64-kfreebsd/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixfmps b/Master/bin/amd64-kfreebsd/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/amd64-kfreebsd/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixfmps b/Master/bin/amd64-kfreebsd/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixpsditps b/Master/bin/amd64-kfreebsd/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/amd64-kfreebsd/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixpsditps b/Master/bin/amd64-kfreebsd/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixpspps b/Master/bin/amd64-kfreebsd/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/amd64-kfreebsd/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixscribeps b/Master/bin/amd64-kfreebsd/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixtpps b/Master/bin/amd64-kfreebsd/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/amd64-kfreebsd/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixtpps b/Master/bin/amd64-kfreebsd/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixwfwps b/Master/bin/amd64-kfreebsd/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/amd64-kfreebsd/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixwfwps b/Master/bin/amd64-kfreebsd/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixwpps b/Master/bin/amd64-kfreebsd/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/amd64-kfreebsd/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixwpps b/Master/bin/amd64-kfreebsd/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/fixwwps b/Master/bin/amd64-kfreebsd/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/amd64-kfreebsd/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/fixwwps b/Master/bin/amd64-kfreebsd/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/amd64-kfreebsd/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/includeres b/Master/bin/amd64-kfreebsd/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/amd64-kfreebsd/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/amd64-kfreebsd/includeres b/Master/bin/amd64-kfreebsd/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/ps2eps b/Master/bin/amd64-kfreebsd/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/amd64-kfreebsd/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/amd64-kfreebsd/ps2eps b/Master/bin/amd64-kfreebsd/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/amd64-kfreebsd/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/psmerge b/Master/bin/amd64-kfreebsd/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/amd64-kfreebsd/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/amd64-kfreebsd/psmerge b/Master/bin/amd64-kfreebsd/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/deweb b/Master/bin/i386-cygwin/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-cygwin/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-cygwin/deweb b/Master/bin/i386-cygwin/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-cygwin/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/extractres b/Master/bin/i386-cygwin/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-cygwin/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-cygwin/extractres b/Master/bin/i386-cygwin/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-cygwin/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixdlsrps b/Master/bin/i386-cygwin/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-cygwin/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-cygwin/fixdlsrps b/Master/bin/i386-cygwin/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-cygwin/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixfmps b/Master/bin/i386-cygwin/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-cygwin/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixfmps b/Master/bin/i386-cygwin/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-cygwin/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixpsditps b/Master/bin/i386-cygwin/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-cygwin/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixpsditps b/Master/bin/i386-cygwin/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-cygwin/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixpspps b/Master/bin/i386-cygwin/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-cygwin/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixscribeps b/Master/bin/i386-cygwin/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-cygwin/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixtpps b/Master/bin/i386-cygwin/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-cygwin/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixtpps b/Master/bin/i386-cygwin/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-cygwin/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixwfwps b/Master/bin/i386-cygwin/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-cygwin/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-cygwin/fixwfwps b/Master/bin/i386-cygwin/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-cygwin/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixwpps b/Master/bin/i386-cygwin/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-cygwin/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixwpps b/Master/bin/i386-cygwin/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-cygwin/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/fixwwps b/Master/bin/i386-cygwin/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-cygwin/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/fixwwps b/Master/bin/i386-cygwin/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-cygwin/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/includeres b/Master/bin/i386-cygwin/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-cygwin/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-cygwin/includeres b/Master/bin/i386-cygwin/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-cygwin/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/ps2eps b/Master/bin/i386-cygwin/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-cygwin/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-cygwin/ps2eps b/Master/bin/i386-cygwin/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-cygwin/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/psmerge b/Master/bin/i386-cygwin/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-cygwin/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-cygwin/psmerge b/Master/bin/i386-cygwin/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-cygwin/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/deweb b/Master/bin/i386-freebsd/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-freebsd/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-freebsd/deweb b/Master/bin/i386-freebsd/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-freebsd/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/extractres b/Master/bin/i386-freebsd/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-freebsd/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-freebsd/extractres b/Master/bin/i386-freebsd/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-freebsd/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixdlsrps b/Master/bin/i386-freebsd/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-freebsd/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-freebsd/fixdlsrps b/Master/bin/i386-freebsd/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-freebsd/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixfmps b/Master/bin/i386-freebsd/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-freebsd/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixfmps b/Master/bin/i386-freebsd/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-freebsd/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixpsditps b/Master/bin/i386-freebsd/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-freebsd/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixpsditps b/Master/bin/i386-freebsd/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-freebsd/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixpspps b/Master/bin/i386-freebsd/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-freebsd/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixscribeps b/Master/bin/i386-freebsd/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-freebsd/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixtpps b/Master/bin/i386-freebsd/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-freebsd/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixtpps b/Master/bin/i386-freebsd/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-freebsd/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixwfwps b/Master/bin/i386-freebsd/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-freebsd/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-freebsd/fixwfwps b/Master/bin/i386-freebsd/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-freebsd/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixwpps b/Master/bin/i386-freebsd/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-freebsd/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixwpps b/Master/bin/i386-freebsd/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-freebsd/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/fixwwps b/Master/bin/i386-freebsd/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-freebsd/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/fixwwps b/Master/bin/i386-freebsd/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-freebsd/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/includeres b/Master/bin/i386-freebsd/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-freebsd/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-freebsd/includeres b/Master/bin/i386-freebsd/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-freebsd/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/ps2eps b/Master/bin/i386-freebsd/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-freebsd/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-freebsd/ps2eps b/Master/bin/i386-freebsd/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-freebsd/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/psmerge b/Master/bin/i386-freebsd/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-freebsd/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-freebsd/psmerge b/Master/bin/i386-freebsd/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-freebsd/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/deweb b/Master/bin/i386-kfreebsd/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-kfreebsd/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-kfreebsd/deweb b/Master/bin/i386-kfreebsd/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-kfreebsd/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/extractres b/Master/bin/i386-kfreebsd/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-kfreebsd/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-kfreebsd/extractres b/Master/bin/i386-kfreebsd/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-kfreebsd/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixdlsrps b/Master/bin/i386-kfreebsd/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-kfreebsd/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-kfreebsd/fixdlsrps b/Master/bin/i386-kfreebsd/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixfmps b/Master/bin/i386-kfreebsd/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-kfreebsd/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixfmps b/Master/bin/i386-kfreebsd/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixpsditps b/Master/bin/i386-kfreebsd/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-kfreebsd/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixpsditps b/Master/bin/i386-kfreebsd/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixpspps b/Master/bin/i386-kfreebsd/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-kfreebsd/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixscribeps b/Master/bin/i386-kfreebsd/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixtpps b/Master/bin/i386-kfreebsd/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-kfreebsd/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixtpps b/Master/bin/i386-kfreebsd/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixwfwps b/Master/bin/i386-kfreebsd/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-kfreebsd/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-kfreebsd/fixwfwps b/Master/bin/i386-kfreebsd/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixwpps b/Master/bin/i386-kfreebsd/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-kfreebsd/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixwpps b/Master/bin/i386-kfreebsd/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/fixwwps b/Master/bin/i386-kfreebsd/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-kfreebsd/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/fixwwps b/Master/bin/i386-kfreebsd/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-kfreebsd/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/includeres b/Master/bin/i386-kfreebsd/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-kfreebsd/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-kfreebsd/includeres b/Master/bin/i386-kfreebsd/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-kfreebsd/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/ps2eps b/Master/bin/i386-kfreebsd/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-kfreebsd/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-kfreebsd/ps2eps b/Master/bin/i386-kfreebsd/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-kfreebsd/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/psmerge b/Master/bin/i386-kfreebsd/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-kfreebsd/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-kfreebsd/psmerge b/Master/bin/i386-kfreebsd/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-kfreebsd/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/deweb b/Master/bin/i386-linux/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-linux/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-linux/deweb b/Master/bin/i386-linux/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-linux/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/extractres b/Master/bin/i386-linux/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-linux/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-linux/extractres b/Master/bin/i386-linux/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-linux/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixdlsrps b/Master/bin/i386-linux/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-linux/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-linux/fixdlsrps b/Master/bin/i386-linux/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-linux/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixfmps b/Master/bin/i386-linux/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-linux/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixfmps b/Master/bin/i386-linux/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-linux/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixpsditps b/Master/bin/i386-linux/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-linux/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixpsditps b/Master/bin/i386-linux/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-linux/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixpspps b/Master/bin/i386-linux/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-linux/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixscribeps b/Master/bin/i386-linux/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-linux/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixtpps b/Master/bin/i386-linux/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-linux/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixtpps b/Master/bin/i386-linux/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-linux/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixwfwps b/Master/bin/i386-linux/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-linux/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-linux/fixwfwps b/Master/bin/i386-linux/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-linux/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixwpps b/Master/bin/i386-linux/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-linux/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixwpps b/Master/bin/i386-linux/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-linux/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/fixwwps b/Master/bin/i386-linux/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-linux/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-linux/fixwwps b/Master/bin/i386-linux/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-linux/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/includeres b/Master/bin/i386-linux/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-linux/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-linux/includeres b/Master/bin/i386-linux/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-linux/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/ps2eps b/Master/bin/i386-linux/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-linux/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-linux/ps2eps b/Master/bin/i386-linux/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-linux/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/psmerge b/Master/bin/i386-linux/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-linux/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-linux/psmerge b/Master/bin/i386-linux/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-linux/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/deweb b/Master/bin/i386-netbsd/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-netbsd/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-netbsd/deweb b/Master/bin/i386-netbsd/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-netbsd/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/extractres b/Master/bin/i386-netbsd/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-netbsd/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-netbsd/extractres b/Master/bin/i386-netbsd/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-netbsd/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixdlsrps b/Master/bin/i386-netbsd/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-netbsd/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-netbsd/fixdlsrps b/Master/bin/i386-netbsd/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-netbsd/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixfmps b/Master/bin/i386-netbsd/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-netbsd/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixfmps b/Master/bin/i386-netbsd/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-netbsd/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixpsditps b/Master/bin/i386-netbsd/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-netbsd/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixpsditps b/Master/bin/i386-netbsd/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-netbsd/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixpspps b/Master/bin/i386-netbsd/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-netbsd/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixscribeps b/Master/bin/i386-netbsd/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-netbsd/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixtpps b/Master/bin/i386-netbsd/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-netbsd/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixtpps b/Master/bin/i386-netbsd/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-netbsd/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixwfwps b/Master/bin/i386-netbsd/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-netbsd/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-netbsd/fixwfwps b/Master/bin/i386-netbsd/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-netbsd/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixwpps b/Master/bin/i386-netbsd/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-netbsd/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixwpps b/Master/bin/i386-netbsd/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-netbsd/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/fixwwps b/Master/bin/i386-netbsd/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-netbsd/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/fixwwps b/Master/bin/i386-netbsd/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-netbsd/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/includeres b/Master/bin/i386-netbsd/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-netbsd/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-netbsd/includeres b/Master/bin/i386-netbsd/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-netbsd/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/ps2eps b/Master/bin/i386-netbsd/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-netbsd/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-netbsd/ps2eps b/Master/bin/i386-netbsd/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-netbsd/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/psmerge b/Master/bin/i386-netbsd/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-netbsd/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-netbsd/psmerge b/Master/bin/i386-netbsd/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-netbsd/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/deweb b/Master/bin/i386-solaris/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/i386-solaris/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/i386-solaris/deweb b/Master/bin/i386-solaris/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/i386-solaris/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/extractres b/Master/bin/i386-solaris/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/i386-solaris/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/i386-solaris/extractres b/Master/bin/i386-solaris/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/i386-solaris/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixdlsrps b/Master/bin/i386-solaris/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/i386-solaris/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/i386-solaris/fixdlsrps b/Master/bin/i386-solaris/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/i386-solaris/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixfmps b/Master/bin/i386-solaris/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/i386-solaris/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixfmps b/Master/bin/i386-solaris/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/i386-solaris/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixpsditps b/Master/bin/i386-solaris/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/i386-solaris/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixpsditps b/Master/bin/i386-solaris/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/i386-solaris/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixpspps b/Master/bin/i386-solaris/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/i386-solaris/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixscribeps b/Master/bin/i386-solaris/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/i386-solaris/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixtpps b/Master/bin/i386-solaris/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/i386-solaris/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixtpps b/Master/bin/i386-solaris/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/i386-solaris/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixwfwps b/Master/bin/i386-solaris/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/i386-solaris/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/i386-solaris/fixwfwps b/Master/bin/i386-solaris/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/i386-solaris/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixwpps b/Master/bin/i386-solaris/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/i386-solaris/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixwpps b/Master/bin/i386-solaris/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/i386-solaris/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/fixwwps b/Master/bin/i386-solaris/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/i386-solaris/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/fixwwps b/Master/bin/i386-solaris/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/i386-solaris/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/includeres b/Master/bin/i386-solaris/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/i386-solaris/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/i386-solaris/includeres b/Master/bin/i386-solaris/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/i386-solaris/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/ps2eps b/Master/bin/i386-solaris/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/i386-solaris/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/i386-solaris/ps2eps b/Master/bin/i386-solaris/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/i386-solaris/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/psmerge b/Master/bin/i386-solaris/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/i386-solaris/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/i386-solaris/psmerge b/Master/bin/i386-solaris/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/i386-solaris/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/deweb b/Master/bin/mips-irix/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/mips-irix/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/mips-irix/deweb b/Master/bin/mips-irix/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/mips-irix/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/extractres b/Master/bin/mips-irix/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/mips-irix/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/mips-irix/extractres b/Master/bin/mips-irix/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/mips-irix/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixdlsrps b/Master/bin/mips-irix/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/mips-irix/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/mips-irix/fixdlsrps b/Master/bin/mips-irix/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/mips-irix/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixfmps b/Master/bin/mips-irix/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/mips-irix/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixfmps b/Master/bin/mips-irix/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/mips-irix/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixpsditps b/Master/bin/mips-irix/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/mips-irix/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixpsditps b/Master/bin/mips-irix/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/mips-irix/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixpspps b/Master/bin/mips-irix/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/mips-irix/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixscribeps b/Master/bin/mips-irix/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/mips-irix/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixtpps b/Master/bin/mips-irix/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/mips-irix/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixtpps b/Master/bin/mips-irix/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/mips-irix/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixwfwps b/Master/bin/mips-irix/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/mips-irix/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/mips-irix/fixwfwps b/Master/bin/mips-irix/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/mips-irix/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixwpps b/Master/bin/mips-irix/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/mips-irix/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixwpps b/Master/bin/mips-irix/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/mips-irix/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/fixwwps b/Master/bin/mips-irix/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/mips-irix/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/mips-irix/fixwwps b/Master/bin/mips-irix/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/mips-irix/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/includeres b/Master/bin/mips-irix/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/mips-irix/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/mips-irix/includeres b/Master/bin/mips-irix/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/mips-irix/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/ps2eps b/Master/bin/mips-irix/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/mips-irix/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/mips-irix/ps2eps b/Master/bin/mips-irix/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/mips-irix/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/mips-irix/psmerge b/Master/bin/mips-irix/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/mips-irix/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/mips-irix/psmerge b/Master/bin/mips-irix/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/mips-irix/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/deweb b/Master/bin/powerpc-aix/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/powerpc-aix/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/powerpc-aix/deweb b/Master/bin/powerpc-aix/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/powerpc-aix/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/extractres b/Master/bin/powerpc-aix/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/powerpc-aix/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/powerpc-aix/extractres b/Master/bin/powerpc-aix/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/powerpc-aix/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixdlsrps b/Master/bin/powerpc-aix/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/powerpc-aix/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/powerpc-aix/fixdlsrps b/Master/bin/powerpc-aix/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/powerpc-aix/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixfmps b/Master/bin/powerpc-aix/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/powerpc-aix/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixfmps b/Master/bin/powerpc-aix/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/powerpc-aix/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixpsditps b/Master/bin/powerpc-aix/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/powerpc-aix/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixpsditps b/Master/bin/powerpc-aix/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/powerpc-aix/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixpspps b/Master/bin/powerpc-aix/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/powerpc-aix/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixscribeps b/Master/bin/powerpc-aix/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/powerpc-aix/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixtpps b/Master/bin/powerpc-aix/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/powerpc-aix/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixtpps b/Master/bin/powerpc-aix/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/powerpc-aix/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixwfwps b/Master/bin/powerpc-aix/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/powerpc-aix/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/powerpc-aix/fixwfwps b/Master/bin/powerpc-aix/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/powerpc-aix/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixwpps b/Master/bin/powerpc-aix/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/powerpc-aix/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixwpps b/Master/bin/powerpc-aix/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/powerpc-aix/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/fixwwps b/Master/bin/powerpc-aix/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/powerpc-aix/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/fixwwps b/Master/bin/powerpc-aix/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/powerpc-aix/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/includeres b/Master/bin/powerpc-aix/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/powerpc-aix/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-aix/includeres b/Master/bin/powerpc-aix/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/powerpc-aix/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/ps2eps b/Master/bin/powerpc-aix/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/powerpc-aix/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/powerpc-aix/ps2eps b/Master/bin/powerpc-aix/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/powerpc-aix/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-aix/psmerge b/Master/bin/powerpc-aix/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/powerpc-aix/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/powerpc-aix/psmerge b/Master/bin/powerpc-aix/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/powerpc-aix/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/deweb b/Master/bin/powerpc-linux/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/powerpc-linux/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/powerpc-linux/deweb b/Master/bin/powerpc-linux/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/powerpc-linux/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/extractres b/Master/bin/powerpc-linux/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/powerpc-linux/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/powerpc-linux/extractres b/Master/bin/powerpc-linux/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/powerpc-linux/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixdlsrps b/Master/bin/powerpc-linux/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/powerpc-linux/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/powerpc-linux/fixdlsrps b/Master/bin/powerpc-linux/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/powerpc-linux/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixfmps b/Master/bin/powerpc-linux/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/powerpc-linux/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixfmps b/Master/bin/powerpc-linux/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/powerpc-linux/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixpsditps b/Master/bin/powerpc-linux/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/powerpc-linux/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixpsditps b/Master/bin/powerpc-linux/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/powerpc-linux/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixpspps b/Master/bin/powerpc-linux/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/powerpc-linux/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixscribeps b/Master/bin/powerpc-linux/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/powerpc-linux/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixtpps b/Master/bin/powerpc-linux/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/powerpc-linux/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixtpps b/Master/bin/powerpc-linux/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/powerpc-linux/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixwfwps b/Master/bin/powerpc-linux/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/powerpc-linux/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/powerpc-linux/fixwfwps b/Master/bin/powerpc-linux/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/powerpc-linux/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixwpps b/Master/bin/powerpc-linux/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/powerpc-linux/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixwpps b/Master/bin/powerpc-linux/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/powerpc-linux/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/fixwwps b/Master/bin/powerpc-linux/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/powerpc-linux/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/fixwwps b/Master/bin/powerpc-linux/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/powerpc-linux/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/includeres b/Master/bin/powerpc-linux/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/powerpc-linux/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/powerpc-linux/includeres b/Master/bin/powerpc-linux/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/powerpc-linux/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/ps2eps b/Master/bin/powerpc-linux/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/powerpc-linux/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/powerpc-linux/ps2eps b/Master/bin/powerpc-linux/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/powerpc-linux/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/psmerge b/Master/bin/powerpc-linux/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/powerpc-linux/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/powerpc-linux/psmerge b/Master/bin/powerpc-linux/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/powerpc-linux/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/deweb b/Master/bin/sparc-linux/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/sparc-linux/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/sparc-linux/deweb b/Master/bin/sparc-linux/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/sparc-linux/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/extractres b/Master/bin/sparc-linux/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/sparc-linux/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/sparc-linux/extractres b/Master/bin/sparc-linux/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/sparc-linux/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixdlsrps b/Master/bin/sparc-linux/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/sparc-linux/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/sparc-linux/fixdlsrps b/Master/bin/sparc-linux/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/sparc-linux/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixfmps b/Master/bin/sparc-linux/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/sparc-linux/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixfmps b/Master/bin/sparc-linux/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/sparc-linux/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixpsditps b/Master/bin/sparc-linux/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/sparc-linux/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixpsditps b/Master/bin/sparc-linux/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/sparc-linux/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixpspps b/Master/bin/sparc-linux/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/sparc-linux/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixscribeps b/Master/bin/sparc-linux/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/sparc-linux/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixtpps b/Master/bin/sparc-linux/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/sparc-linux/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixtpps b/Master/bin/sparc-linux/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/sparc-linux/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixwfwps b/Master/bin/sparc-linux/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/sparc-linux/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/sparc-linux/fixwfwps b/Master/bin/sparc-linux/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/sparc-linux/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixwpps b/Master/bin/sparc-linux/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/sparc-linux/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixwpps b/Master/bin/sparc-linux/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/sparc-linux/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/fixwwps b/Master/bin/sparc-linux/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/sparc-linux/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/fixwwps b/Master/bin/sparc-linux/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/sparc-linux/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/includeres b/Master/bin/sparc-linux/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/sparc-linux/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-linux/includeres b/Master/bin/sparc-linux/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/sparc-linux/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/ps2eps b/Master/bin/sparc-linux/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/sparc-linux/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/sparc-linux/ps2eps b/Master/bin/sparc-linux/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/sparc-linux/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/sparc-linux/psmerge b/Master/bin/sparc-linux/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/sparc-linux/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/sparc-linux/psmerge b/Master/bin/sparc-linux/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/sparc-linux/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/deweb b/Master/bin/sparc-solaris/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/sparc-solaris/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/sparc-solaris/deweb b/Master/bin/sparc-solaris/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/sparc-solaris/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/extractres b/Master/bin/sparc-solaris/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/sparc-solaris/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/sparc-solaris/extractres b/Master/bin/sparc-solaris/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/sparc-solaris/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixdlsrps b/Master/bin/sparc-solaris/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/sparc-solaris/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/sparc-solaris/fixdlsrps b/Master/bin/sparc-solaris/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/sparc-solaris/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixfmps b/Master/bin/sparc-solaris/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/sparc-solaris/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixfmps b/Master/bin/sparc-solaris/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/sparc-solaris/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixpsditps b/Master/bin/sparc-solaris/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/sparc-solaris/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixpsditps b/Master/bin/sparc-solaris/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/sparc-solaris/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixpspps b/Master/bin/sparc-solaris/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/sparc-solaris/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixscribeps b/Master/bin/sparc-solaris/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/sparc-solaris/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixtpps b/Master/bin/sparc-solaris/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/sparc-solaris/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixtpps b/Master/bin/sparc-solaris/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/sparc-solaris/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixwfwps b/Master/bin/sparc-solaris/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/sparc-solaris/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/sparc-solaris/fixwfwps b/Master/bin/sparc-solaris/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/sparc-solaris/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixwpps b/Master/bin/sparc-solaris/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/sparc-solaris/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixwpps b/Master/bin/sparc-solaris/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/sparc-solaris/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/fixwwps b/Master/bin/sparc-solaris/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/sparc-solaris/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/fixwwps b/Master/bin/sparc-solaris/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/sparc-solaris/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/includeres b/Master/bin/sparc-solaris/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/sparc-solaris/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/sparc-solaris/includeres b/Master/bin/sparc-solaris/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/sparc-solaris/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/ps2eps b/Master/bin/sparc-solaris/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/sparc-solaris/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/sparc-solaris/ps2eps b/Master/bin/sparc-solaris/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/sparc-solaris/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/psmerge b/Master/bin/sparc-solaris/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/sparc-solaris/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/sparc-solaris/psmerge b/Master/bin/sparc-solaris/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/sparc-solaris/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/deweb b/Master/bin/universal-darwin/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/universal-darwin/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/universal-darwin/deweb b/Master/bin/universal-darwin/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/universal-darwin/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/extractres b/Master/bin/universal-darwin/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/universal-darwin/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/universal-darwin/extractres b/Master/bin/universal-darwin/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/universal-darwin/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixdlsrps b/Master/bin/universal-darwin/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/universal-darwin/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/universal-darwin/fixdlsrps b/Master/bin/universal-darwin/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/universal-darwin/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixfmps b/Master/bin/universal-darwin/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/universal-darwin/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixfmps b/Master/bin/universal-darwin/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/universal-darwin/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixpsditps b/Master/bin/universal-darwin/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/universal-darwin/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixpsditps b/Master/bin/universal-darwin/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/universal-darwin/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixpspps b/Master/bin/universal-darwin/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/universal-darwin/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixscribeps b/Master/bin/universal-darwin/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/universal-darwin/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixtpps b/Master/bin/universal-darwin/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/universal-darwin/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixtpps b/Master/bin/universal-darwin/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/universal-darwin/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixwfwps b/Master/bin/universal-darwin/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/universal-darwin/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/universal-darwin/fixwfwps b/Master/bin/universal-darwin/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/universal-darwin/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixwpps b/Master/bin/universal-darwin/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/universal-darwin/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixwpps b/Master/bin/universal-darwin/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/universal-darwin/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/fixwwps b/Master/bin/universal-darwin/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/universal-darwin/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/fixwwps b/Master/bin/universal-darwin/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/universal-darwin/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/includeres b/Master/bin/universal-darwin/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/universal-darwin/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/universal-darwin/includeres b/Master/bin/universal-darwin/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/universal-darwin/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/ps2eps b/Master/bin/universal-darwin/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/universal-darwin/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/universal-darwin/ps2eps b/Master/bin/universal-darwin/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/universal-darwin/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/psmerge b/Master/bin/universal-darwin/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/universal-darwin/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/universal-darwin/psmerge b/Master/bin/universal-darwin/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/universal-darwin/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/deweb b/Master/bin/x86_64-darwin/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/x86_64-darwin/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/x86_64-darwin/deweb b/Master/bin/x86_64-darwin/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/x86_64-darwin/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/extractres b/Master/bin/x86_64-darwin/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/x86_64-darwin/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/x86_64-darwin/extractres b/Master/bin/x86_64-darwin/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/x86_64-darwin/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixdlsrps b/Master/bin/x86_64-darwin/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/x86_64-darwin/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/x86_64-darwin/fixdlsrps b/Master/bin/x86_64-darwin/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixfmps b/Master/bin/x86_64-darwin/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/x86_64-darwin/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixfmps b/Master/bin/x86_64-darwin/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixpsditps b/Master/bin/x86_64-darwin/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/x86_64-darwin/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixpsditps b/Master/bin/x86_64-darwin/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixpspps b/Master/bin/x86_64-darwin/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/x86_64-darwin/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixscribeps b/Master/bin/x86_64-darwin/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/x86_64-darwin/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixtpps b/Master/bin/x86_64-darwin/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/x86_64-darwin/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixtpps b/Master/bin/x86_64-darwin/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixwfwps b/Master/bin/x86_64-darwin/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/x86_64-darwin/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/x86_64-darwin/fixwfwps b/Master/bin/x86_64-darwin/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixwpps b/Master/bin/x86_64-darwin/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/x86_64-darwin/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixwpps b/Master/bin/x86_64-darwin/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/x86_64-darwin/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/fixwwps b/Master/bin/x86_64-darwin/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/x86_64-darwin/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/fixwwps b/Master/bin/x86_64-darwin/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/x86_64-darwin/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/includeres b/Master/bin/x86_64-darwin/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/x86_64-darwin/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-darwin/includeres b/Master/bin/x86_64-darwin/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/x86_64-darwin/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/ps2eps b/Master/bin/x86_64-darwin/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/x86_64-darwin/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/x86_64-darwin/ps2eps b/Master/bin/x86_64-darwin/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/x86_64-darwin/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/psmerge b/Master/bin/x86_64-darwin/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/x86_64-darwin/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/x86_64-darwin/psmerge b/Master/bin/x86_64-darwin/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/x86_64-darwin/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/deweb b/Master/bin/x86_64-solaris/deweb deleted file mode 100755 index 245119b134a..00000000000 --- a/Master/bin/x86_64-solaris/deweb +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env perl -# deweb v1.2, kills the C sections of a CWEB file, for passing to ChkTeX. -# Copyright (C) 1996 Jens T. Berger Thielemann -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Contact the author at: -# Jens Berger -# Spektrumvn. 4 -# N-0666 Oslo -# Norway -# E-mail: -# -# -# - -print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n"; - -undef $/; -$texmode = 1; -$_ = <>; - -while(/\@/) -{ - &out($`); - $_ = $'; - - if(/^@/) { - $_ = $'; - &out('@'); - next; - } - - if(/^([\s\n])/) { - $_ = $'; - print "\n" if $1 eq "\n"; - $texmode = 1; - next; - } - - if(/^[cpd]/i) { - $_ = $'; - $texmode = 0; - next; - } - - if(/^\,/i) { - $_ = $'; - print '\,'; - next; - } - - if(m!^/!) { - $_ = $'; - print '\\\\'; - next; - } - - if(/^[h\&\|\;\#\+]/i || /^i.*/i) { - $_ = $'; - next; - } - - if(/^\*[0-9\*]?((.|\n)*?\.)/) { - $_ = $'; - print $1; - $texmode = 1; - next; - } - - if(/^[<(^.t!]((.|\n)*?)\@\>/i) { - $_ = $'; - print '{'.$1.'}'; - $texmode = 0; - next; - } - - if(/^[=]((.|\n)*?)\@\>/) { - $_ = $'; - print &printnl($1); - next; - } - - if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) { - $_ = $'; - print &printnl($+); - next; - } - - @line = split(/\n/, $_, 2); - print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n"; - -} - -print $_; - -sub printnl { - my($foo); - if(defined $_[0]) { - $foo = $_[0]; - $foo =~ s/.//g; - } else { - $foo = ""; - } - $foo; -} - -sub out { - print $texmode? $_[0] : &printnl($_[0]); -} diff --git a/Master/bin/x86_64-solaris/deweb b/Master/bin/x86_64-solaris/deweb new file mode 120000 index 00000000000..339abe1c2d2 --- /dev/null +++ b/Master/bin/x86_64-solaris/deweb @@ -0,0 +1 @@ +../../texmf/scripts/chktex/deweb.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/extractres b/Master/bin/x86_64-solaris/extractres deleted file mode 100755 index c54056461a2..00000000000 --- a/Master/bin/x86_64-solaris/extractres +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env perl -# extractres: extract resources from PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%resources = (); # list of resources included -%merge = (); # list of resources extracted this time -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -while (@ARGV) { - $_ = shift; - if (/^-m(erge)?$/) { $merge = 1; } - elsif (/^-/) { - print STDERR "Usage: $prog [-merge] [file]\n"; - exit 1; - } else { - unshift(@ARGV, $_); - last; - } -} - -if (defined($ENV{TMPDIR})) { # set body file name - $body = "$ENV{TMPDIR}/body$$.ps"; -} else { - $body = "body$$.ps"; -} - -open(BODY, $body) && die "Temporary file $body already exists"; -open(BODY, ">$body") || die "Can't write file $body"; - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -$output = STDOUT; # start writing header out -while (<>) { - if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { - local($comment, @res) = split(/\s+/); # look at resource type - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res, $extn{$type}); # make file name - $saveout = $output; - if (!$resources{$name}) { - print "%%IncludeResource: $type ", join(" ", @res), "\n"; - if (!open(RES, $name)) { - open(RES, ">$name") || die "Can't write file $name"; - $resources{$name} = $name; - $merge{$name} = $merge; - $output = RES; - } else { # resource already exists - close(RES); - undef $output; - } - } elsif ($merge{$name}) { - open(RES, ">>$name") || die "Can't append to file $name"; - $output = RES; - } else { # resource already included - undef $output; - } - } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { - if (defined $output) { - print $output $_; - close($output); - } - $output = $saveout; - next; - } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { - $output = BODY; - } - print $output $_ - if defined $output; -} - -close(BODY); # close body output file - -open(BODY, $body); # reopen body for input -while () { # print it all - print $_; -} -close(BODY); - -unlink($body); # dispose of body file - diff --git a/Master/bin/x86_64-solaris/extractres b/Master/bin/x86_64-solaris/extractres new file mode 120000 index 00000000000..eca5094fca6 --- /dev/null +++ b/Master/bin/x86_64-solaris/extractres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/extractres.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixdlsrps b/Master/bin/x86_64-solaris/fixdlsrps deleted file mode 100755 index 2a1d85a654c..00000000000 --- a/Master/bin/x86_64-solaris/fixdlsrps +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -# fixdlsrps: fix DviLaser/PS document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$page = 1; -$infont = 0; - -@fonts = (); -@body = (); -$header = 1; - -while (<>) { - if (/^XP/) { - $infont++; - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ($infont) { - push(@fonts, $_); - $infont-- if /PXL.*RP/ || /DN?F.*RP/; - } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { - print @body; - @body = ("%%EndSetup\n"); - $header = 0; - } elsif (/^%%EndProlog/ && !$nesting) { - push(@body, - "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", - "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); - } elsif (/^%%BeginPageSetup/ && !$nesting) { - push(@body, "%%Page: $page $page\n", $_, - "Resolution 72 div dup scale Magnification 1000 div dup scale\n", - "/DocumentInitState where {\n", - "/DocumentInitState [ matrix currentmatrix currentlinewidth", - " currentlinecap currentlinejoin currentdash currentgray", - " currentmiterlimit] cvx put}if\n"); - $page++; - } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { - push(@body, $_); - } -} - -print @fonts; -print @body; - -exit 0; - diff --git a/Master/bin/x86_64-solaris/fixdlsrps b/Master/bin/x86_64-solaris/fixdlsrps new file mode 120000 index 00000000000..de3ca1ea8e6 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixdlsrps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixdlsrps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixfmps b/Master/bin/x86_64-solaris/fixfmps deleted file mode 100755 index 039ac8e5a3e..00000000000 --- a/Master/bin/x86_64-solaris/fixfmps +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -# fixfmps: get conforming PostScript out of FrameMaker version 2 file -# move all FMDEFINEFONTs to start of pages -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -%fonts=(); - -while (<>) { - if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { - $fonts{$1} = $_; - } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { - print $_, join('',values(%fonts)); - } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { - print "$1pop$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixfmps b/Master/bin/x86_64-solaris/fixfmps new file mode 120000 index 00000000000..1d34a8a3980 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixfmps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixfmps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixpsditps b/Master/bin/x86_64-solaris/fixpsditps deleted file mode 100755 index 2a1728a8204..00000000000 --- a/Master/bin/x86_64-solaris/fixpsditps +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl -# fixpsditps: fix psdit output for use in psutils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; - -while (<>) { - if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { - print "/p{pop showpage pagesave restore}def\n"; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/^%%Page:/ && $nesting == 0) { - print $_; - print "xi\n"; - } elsif (! /^xi$/) { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixpsditps b/Master/bin/x86_64-solaris/fixpsditps new file mode 120000 index 00000000000..3ae114e64b0 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixpsditps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixpsditps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixpspps b/Master/bin/x86_64-solaris/fixpspps deleted file mode 100755 index 77bba66d6b7..00000000000 --- a/Master/bin/x86_64-solaris/fixpspps +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -# mangle PostScript produced by PSPrint to make it almost conforming -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$header = 1; $ignore = 0; -$verbose = 0; -@body = (); -%fonts = (); $font = ""; -$inchar = 0; @char = (); - -while (<>) { - if (/^\@end$/) { - $ignore = 1; - } elsif (/^[0-9]+ \@bop0$/) { - $ignore = 0; - $header = 1; - } elsif ($header) { - if (/^\/([a-z.0-9]+) \@newfont$/) { - if (! defined($fonts{$1})) { - $fonts{$1} = 1; - print; - } elsif ($verbose) { - print STDERR "$font already defined\n"; - } - } elsif (/^([a-z.0-9]+) sf$/) { - $font = $1; - print; - } elsif (/^\[) { - if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { - print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; - $inepsf++; - } elsif (/^ PE/ && $inepsf) { - print "%%EndDocument\n", $_; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixscribeps b/Master/bin/x86_64-solaris/fixscribeps new file mode 120000 index 00000000000..1414c3cf31f --- /dev/null +++ b/Master/bin/x86_64-solaris/fixscribeps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixscribeps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixtpps b/Master/bin/x86_64-solaris/fixtpps deleted file mode 100755 index 4239bb9dfc5..00000000000 --- a/Master/bin/x86_64-solaris/fixtpps +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl -# fixtpps: fix tpscript document to work with PSUtils -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -$header = 1; - -while (<>) { - if (/^%%Page:/ && $nesting == 0) { - print $_; - print "save home\n"; - $header = 0; - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - print $_; - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - print $_; - $nesting--; - } elsif (/save home/) { - s/save home//; - print $_; - } elsif (!$header || (! /^save$/ && ! /^home$/)) { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixtpps b/Master/bin/x86_64-solaris/fixtpps new file mode 120000 index 00000000000..10cd40fcc78 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixtpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixtpps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixwfwps b/Master/bin/x86_64-solaris/fixwfwps deleted file mode 100755 index 92d88443fe1..00000000000 --- a/Master/bin/x86_64-solaris/fixwfwps +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# fixwfwps: fix Word for windows PostScript for printing. -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$nesting = 0; -while (<>) { - tr/\000-\010\012-\014\016-\037//d; - foreach (grep($_ ne "", split("\015"))) { - s!/SVDoc\s+save\s+def!!g; - s!SVDoc\s+restore!!g; - if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { - print "$1\n"; - $wfwepsf = 1; - } elsif (/^SS\s*$/ && $wfwepsf) { - print "%%Page: $wfwepsf $wfwepsf\n"; - $wfwepsf++; - print "$_\n"; - } elsif (/^%MSEPS Preamble/) { - print "%%BeginDocument: (Included EPSF)\n"; - print "$_\n"; - $nesting++; - } elsif (/^%MSEPS Trailer/) { - $nesting--; - print "$_\n"; - print "%%EndDocument\n"; - } elsif (! /^%%BoundingBox/) { - print "$_\n"; - } - } -} - diff --git a/Master/bin/x86_64-solaris/fixwfwps b/Master/bin/x86_64-solaris/fixwfwps new file mode 120000 index 00000000000..63a5b6ea2d0 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixwfwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwfwps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixwpps b/Master/bin/x86_64-solaris/fixwpps deleted file mode 100755 index 83a5fdfaf0b..00000000000 --- a/Master/bin/x86_64-solaris/fixwpps +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; -$nesting = 0; - -while (<>) { - s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug - if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { - print $_; - } elsif (/^(.*)(_bp.*)$/) { - print "$1\n" if $1 ne ""; - print "%%Page: $page $page\n"; - print "$2\n"; - $page++; - $nesting++; - } elsif (/_ep$/) { - print $_; - $nesting--; - } elsif (/^(.*)(_ed.*)/) { - print "$1\n" if $1 ne ""; - print "%%Trailer:\n"; - print "$2\n"; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixwpps b/Master/bin/x86_64-solaris/fixwpps new file mode 120000 index 00000000000..693a2161b13 --- /dev/null +++ b/Master/bin/x86_64-solaris/fixwpps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwpps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/fixwwps b/Master/bin/x86_64-solaris/fixwwps deleted file mode 100755 index bfd58c086da..00000000000 --- a/Master/bin/x86_64-solaris/fixwwps +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -# fixwwps: get semi-conforming PostScript out of Windows Write file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$page = 1; - -while (<>) { - if (/^(%!.*) EPSF-\d.\d/) { - print $1, "\n"; - } elsif (/^SS/) { - print "%%Page: $page $page\n"; - print $_; - $page++; - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/fixwwps b/Master/bin/x86_64-solaris/fixwwps new file mode 120000 index 00000000000..4c650dfbb0a --- /dev/null +++ b/Master/bin/x86_64-solaris/fixwwps @@ -0,0 +1 @@ +../../texmf/scripts/psutils/fixwwps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/includeres b/Master/bin/x86_64-solaris/includeres deleted file mode 100755 index 4547357cd93..00000000000 --- a/Master/bin/x86_64-solaris/includeres +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -# includeres: include resources in PostScript file -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -%extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns - "pattern", ".pat", "form", ".frm", "encoding", ".enc"); -%type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", - "%%BeginFont:", "font"); # resource types - -sub filename { # make filename for resource in @_ - local($name); - foreach (@_) { # sanitise name - s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; - $name .= $_; - } - $name =~ s@.*/@@; # drop directories - die "Filename not found for resource ", join(" ", @_), "\n" - if $name =~ /^$/; - $name; -} - -while (<>) { - if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { - local($comment, @res) = split(/\s+/); - local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); - local($name) = &filename(@res); - local($inc) = ""; # system include directory - if (open(RES, $name) || open(RES, "$name$extn{$type}") || - open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { - while () { - print $_; - } - close(RES); - } else { - print "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "Resource $name not found\n"; - } - } else { - print $_; - } -} - diff --git a/Master/bin/x86_64-solaris/includeres b/Master/bin/x86_64-solaris/includeres new file mode 120000 index 00000000000..362c59c64e0 --- /dev/null +++ b/Master/bin/x86_64-solaris/includeres @@ -0,0 +1 @@ +../../texmf/scripts/psutils/includeres.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/ps2eps b/Master/bin/x86_64-solaris/ps2eps deleted file mode 100755 index 7092cbb0007..00000000000 --- a/Master/bin/x86_64-solaris/ps2eps +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env perl -# The expression in the previous line replaces the unix specific line -# {#!/usr/bin/perl}. -# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files -# ------------------------------------------------------------------- -# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $ -# ------------------------------------------------------- -# (C)opyright 1999-2007 Roland Bless -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Author: Roland Bless -# Send bug reports to roland bless.de -# ------------------------------------------------------------------- -# Additional filtering is performed when Windows generated PostScript files -# are processed. Some instructions will otherwise lead to bad output -# if EPS-file gets embedded into other PostScript files. -# -# Requirements: -# + perl -# + gs (ghostscript supporting pbm output) -# + bbox (a little C program [ANSI-C - should work on every platform] -# for calculation of the actual BoundingBox) - -use POSIX; - -#use warnings; - -#use Getopt package -use Getopt::Long; -Getopt::Long::Configure("no_ignore_case"); - -$prgname= "ps2eps"; - -if (! -d "/usr/bin") -{ # we assume that we are running under native windows - $ghostscriptname = "gswin32c"; - $NULLDEV = "nul"; -} -else -{ # Unix or cygwin - $ghostscriptname = "gs"; - $NULLDEV = "/dev/null 2>&1"; -} - -$bboxver=`bbox >$NULLDEV -V`; -$bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #' -$insertPScode= 1; # Insert surrounding Postscript code -$infhandle = STDIN; # Standard input is the default input file -$outfhandle = STDOUT; # Standard output is default output if STDIN is input -$infname= '-'; -$outfname= '-'; -$forceoverwrite=0; # do not overwrite existing files -$ignoreBB= 0; # ignore existing Bounding Box comment -$removeDSC= 1; # remove Adobe document structure comments -$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] -$ignoreEOFDSC= 0; # ignore %%EOF DSC hint -$removePreview= 0; # remove preview -$quiet= 0; # write progress to stdout -$resolution= 144; # resolution for bounding box calculation is 2x72 dpi -$trytofixps= 1; # try to fix postscript code -$forcefixps= 0; # fix postscript code unconditionally if eq 1 -$filterorientation= 1;# filter Orientation line -$looseBB=''; # default: tight bounding box -$clip=0; # do not clip -$warnings=0; # do not print warnings concerning postscript sanity -$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call -$inch=2.54; # one inch is 2.54cm -$fullcolors= 1; # use ppm format (24-bit full color) -$trailerseen= 0; # Trailer comment seen? -$PSversion="2.0"; # default Postscript Version -$PSDSCversion="2.0"; # default Postscript DSC Version -$translate_x= 0; # translate by x postscript points -$translate_y= 0; # translate by y postscript points - -$defaultext = '(ps|prn)'; # default extension -$defaultoutext = '.eps'; # default output extension -$envname_size = 'PS2EPS_SIZE'; -$envname_gsbbox = 'PS2EPS_GSBBOX'; - -$gpar=""; -$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; -$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ -a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ -b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ -jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; -$trigger= 0; -$notsane= 0; -$dummy=""; - -@ver= split(/ /,$version); - -# filename for temporary files -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ - # it is less trouble to use the current directory if working on - # cygwin and nevertheless using gswin32c. - $tmpfname= "$prgname.$$"; - $win=1; -} -elsif (defined($ENV{'TMP'})) -{ - $tmpdir= $ENV{'TMP'}; - $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; - if ($tmpdir =~ /$filesep$/) - { $tmpfname= $tmpdir . "$prgname.$$"; } - else - { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } - $win=1; -} -else #assume we're on a UNIXBOX -{ - $tmpfname= "/tmp/" . "$prgname.$$"; - $win=0; -} - - -$licensetxt= "\ - This program is free software; you can redistribute it and/or modify\ - it under the terms of the GNU General Public License as published by\ - the Free Software Foundation; either version 2 of the License, or\ - (at your option) any later version.\ -\ - This program is distributed in the hope that it will be useful,\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ - GNU General Public License for more details.\ -\ - You should have received a copy of the GNU General Public License\ - along with this program; if not, write to the Free Software\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; - -@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2007 Roland Bless\n\n" ); - -@helptxt= ("Version: $ver[2]\n", - "Operation:\n", - " Without any argument, $prgname reads from standard input\n", - " and writes to standard output.\n", - " If filenames are given as arguments they are processed\n", - " one by one and output files are written to filenames\n", - " with extension '$defaultoutext'. If input filenames have the extension\n", - " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", - " In all other cases '$defaultoutext' is appended to the input filename.\n", - " Please note that PostScript files for input should contain\n", - " only one single page.\n\n", - " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); - -@usagetxt= ("Syntax:\n", - " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", - "Options:\n", - " -f, --force force overwriting existing files\n", - " -q, --quiet quiet operation (no output while processing files)\n", - " -N, --noinsert do not insert any postscript code\n", - " -O, --preserveorientation do not filter Orientation: header comment\n", - " -n, --nofix do not try to fix postscript code\n", - " -P, --removepreview remove preview image (smaller file, but no preview)\n", - " -F, --fixps fix postscript code unconditionally\n", - " -c, --comments preserve document structure comments\n", - " -C, --clip insert postscript code for clipping\n", - " -m, --mono use black/white bitmap as base for calculation\n", - " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", - " use --size=list to list pre-defined page sizes\n", - " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", - " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", - " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", - " -l, --loose expand the original bounding box by one point in each direction\n", - " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", - " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", - " -g, --gsbbox use internal bbox device of ghostscript\n", - " -H, --no-hires do not use a HiResBoundingBox\n", - " -h, --help help information\n", - " -L, --license show licensing information\n", - " -V, --version show version information\n", - " -d, --debuggs show ghostscript call\n", - " -W, --warnings show warnings about sanity of generated eps file\n", - " -- all following arguments are treated as files\n", - " (allows filenames starting with -)\n", - "\n", - "Arguments:\n", - " One or more names of PostScript files for input\n"); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- argument checking -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -#environment variable for papersize -if (defined($ENV{"$envname_size"})) -{ - $opt_s= $ENV{"$envname_size"}; -} -else -{ - $opt_s = ''; # for s-option -} - -if (defined($ENV{"$envname_gsbbox"})) -{ - $bboxname=""; -} - -$opt_t = ''; # for t-option -$opt_R = ''; # for R-option -$opt_r = ''; # for r-option -$stopnow = 0; -die "Wrong option(s), please check usage with $prgname --help\n" unless -GetOptions('f|force' => \$forceoverwrite, - 'q|quiet' => \$quiet, - 'm|mono' => sub { $fullcolors = 0 }, - 'n|nofix' => sub { $trytofixps = 0 }, - 'F|fixps' => \$forcefixps, - 'N|noinsert' => sub { $insertPScode = 0 }, - 'O|preserveorientation' => sub { $filterorientation= 0 }, - 'P|removepreview' => \$removePreview, - 'c|comments' => sub { $removeDSC = 0 }, - 'C|clip' => \$clip, - 'l|loose' => sub { $looseBB = '-l' }, - 'B|ignoreBB' => \$ignoreBB, - 'E|ignoreEOF'=> \$ignoreEOFDSC, - 's|size=s' => \$opt_s, - 't|translate=s' => \$opt_t, - 'r|resolution=s' => \$opt_r, - 'R|rotate=s' => \$opt_R, - 'g|gsbbox' => sub { $bboxname=""; }, - 'H|nohires' => \$nohires, - 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, - 'd|debuggs' => \$debuggs, - 'W|warnings' => \$warnings, - 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- wildcard processing -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## internal wildcard processing for current directory, -## only used for non UNIX-based OSs (which may lack shell wildcard expansion) -@filenames = (); -foreach $object (@ARGV) { - if ($win && $object =~ m/\*/o) # asterisk is present in filename - { - $wildcard = $object; - $wildcard =~ s/\./\\\./g; # replace . in pattern with \. - $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) - opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory - print STDERR $wildcard; - @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); - foreach (@fid) { push @filenames, $_; } - closedir DIR; - } - else { push @filenames, $object; } -} # end foreach -$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input - -print STDERR "Input files: @filenames\n" if (!$quiet); - -if ($opt_r ne '') -{ - $resolution=$opt_r; -} - -# papersize stuff -if ($opt_s ne '') -{ - # if explicit size is given, ignore existing BoundingBox always - $ignoreBB = 1; - $pagedimension = $opt_s; - if ($opt_s eq "list") - { - print STDERR "Available paper sizes: $papersize_help"; - exit 0; - } - - #explicit format XxY[cm|in] - if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) - { - ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); - if ( $x_dim !~ /^\d*\.?\d+$/ ) - { die "$x_dim in $arg is not a valid number, stopped"; } - if ( $y_dim !~ /^\d*\.?\d+$/ ) - { die "$y_dim in $arg is not a valid number, stopped"; } - - #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; - if (!defined($unit) ) - { - $unit='cm'; - $opt_s=$opt_s . $unit; - } - if ( $unit ne 'in' ) # assume centimeters - { # calculate dimension in pixels (remember: resolution is in dpi) - $xpixels= int(($x_dim * $resolution) / $inch)+1; - $ypixels= int(($y_dim * $resolution) / $inch)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - else - { - $xpixels= int($x_dim * $resolution)+1; - $ypixels= int($y_dim * $resolution)+1; - $gpar= "-g${xpixels}x${ypixels}"; - } - } #endif XxY in opt_s - else - { - if ($opt_s =~ /$known_papersizes/) - { - $gpar="-sPAPERSIZE=$opt_s"; - } - else - { - print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; - exit 1; - } - } -} - -#translate option -if ($opt_t ne '') -{ - ($translate_x,$translate_y)= split(/\,/,$opt_t); -} - -#rotate -$rotright='-90 rotate'; -$rotleft='90 rotate'; -$rotupsidedown='180 rotate'; -$rotate=''; -if ($opt_R ne '') -{ - if ($opt_R eq '+') { $rotate=$rotright; } - elsif ($opt_R eq '-') { $rotate=$rotleft; } - elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } - else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; -} - -$device= $fullcolors ? "ppmraw" : "pbmraw"; - -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -## -- iterate over different input files -- -## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -PROCESSFILE: -while ($infname= (shift @filenames)) -{ - # reset filter definitions for each file - undef $linefilter; - undef $rangefilter_begin; - undef $rangefilter_end; - $fixthisps= $trytofixps; - $fixmsgprinted= 0; - - if (!$quiet) { print STDERR "Processing: $infname\n"; } - unless (open($infhandle,"<$infname")) - { # skip over this file - print STDERR "$prgname: Can't open $infname: $!\n"; - next PROCESSFILE; - } - - # buffer input from stdin into temporary file, because it has to be read twice - # one time for ghostscript processing, the second time for generating output - if ($infname eq '-') # input is stdin - { - $tmpfhandle=''; - open($tmpfhandle,">$tmpfname") or - die "Cannot open temporary file $tmpfname for writing: $!\n"; - } - else # input is not stdin - { - undef $tmpfhandle; - #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext - if ($infname =~ /\.$defaultext$/i) - { - $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; - } - else # otherwise simply append the extension $defaultoutext - { - $outfname= $infname . "$defaultoutext"; - } - if (!$forceoverwrite and -s "$outfname") - { - die "$prgname: Sorry, file named $outfname already exists,", - " will not overwrite it.\n", - " You will have to use the -f option, delete it or rename it", - " before running $prgname again.\n"; - } - else - { - open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; - } - } #end else input is not stdin - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- process input file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - $linefilter= '^$'; #'# filter empty lines by default - while (<$infhandle>) - { - # get postscript and DSC version - if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) - { - $PSversion=$1; - $PSDSCversion=$2; - if (! ($PSversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - if (! ($PSDSCversion =~ /\d+\.\d+/)) - { - $PSDSCversion="2.0"; - } - } - - # check for existing BoundingBox parameters - if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) - { - $BBarg= $1; - # accept even negative and fractional BBs - if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments - { - ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; - #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; - if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } - if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } - - $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1; - $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1; - if (!$ignoreBB) - { - $gpar= "-g${xpixels}x${ypixels}"; - # check for meaningful values - if (($xpixels <= 1) || ($ypixels <= 1)) - { - $gpar=""; undef $eBBllx; undef $eBBlly; - } - else - { - if (!$quiet) - { - print STDERR "Rendering with existing $_"; - if (int($eBBllx) < 0 || int($eBBlly) < 0) - { - print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; - } - } - } - } #endif !$ignoreBB - } #endif $BBarg =~ - } - - - if ($fixthisps) # try to fix bad postscript code - { - # check for Windows 3.x output - if ( /^Win.*Dict/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } - $linefilter= '^(EJ|RS)'; - $rangefilter_begin= '^statusdict'; - $rangefilter_end= 'cvx\ settransfer$'; #' - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) - { - if (!$quiet && !$fixmsgprinted) - { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } - $linefilter= '^rs'; - $fixmsgprinted= 1; # stop printing message - } - else - { - if ( $forcefixps || - /^\/NTPS/ || - /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output - { - if (!$quiet && !$fixmsgprinted) - { - if ($forcefixps) - { - print STDERR "Postscript filtering requested, fixing\n"; - } - else - { - print STDERR "Windows generated Postscript file detected, fixing\n"; - } - } - $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' - $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; - $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' - $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; - #$triggered_rangefilter_begin= ''; #' - #$triggered_rangefilter_end= ''; #' - $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; - $fixreplacepat=' '; - $fixmsgprinted= 1; # stop printing message - } # end if NTPS - } #end else - } - } #end if trytofixps - - if (defined($tmpfhandle)) - { - print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; - } - - if (/^%%EOF\s*$/) - { - $totalEOFDSC++ - } - } #end while <$infhandle> - - if (defined($tmpfhandle)) - { - close($tmpfhandle); - } - else - { - $tmpfhandle= $infhandle; - $tmpfname= $infname; - } - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- calculate the bounding box -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x!=0 || $translate_y!=0) - { - $translation="$translate_x $translate_y translate"; - $translatecmd="-c $translation"; - } - else - { - $translation=""; - $translatecmd=""; - } - - if (!$quiet) - { - print STDERR "Calculating Bounding Box..."; - if ($opt_s) - { - print STDERR "using page size $opt_s..."; - } - } - - $rotatecmd=''; - if ($rotate ne '') - { - $rotatecmd="-c \"$rotate\"" - } - if ($bboxname ne '') - { - $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution"; - } - else - { - if (!$quiet) { - print STDERR "...using bbox device of $ghostscriptname..."; - } - $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; - } - - if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } - - # actual ghostscript call - $boundingbox=`$cmdline`; - if ($debuggs) { print STDERR "Call result: $boundingbox"; } - - # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/m) - { - print STDERR "Error: Could not determine bounding box!\n", - "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; - } - - $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; - if (defined($1)) # HiResBoundingBox given - { - ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - $cBBllx = floor($hcBBllx); - $cBBlly = floor($hcBBlly); - $cBBurx = ceil($hcBBurx); - $cBBury = ceil($hcBBury); - } - else - { #use normal BoundingBox - $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; - ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); - } - # if loose BB should be performed by ps2eps - # apply changes to resulting bounding box if needed - if ($looseBB ne '') - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - # extend clipping box by 1 point - if ($clip) - { - if ($cBBllx > 0) { $cBBllx--; } - if ($cBBlly > 0) { $cBBlly--; } - $cBBurx++; $cBBury++; - } - if ($cBBllx < 0 || $cBBlly < 0) - { - if (!$quiet) - { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; - } - $translate_x= -int($cBBllx); - $translate_y= -int($cBBlly); - $cBBllx=0; - $cBBurx= $cBBurx + $translate_x; - $cBBlly=0; - $cBBury= $cBBury + $translate_y; - - $hcBBurx= $hcBBurx + $hcBBllx; - $hcBBury= $hcBBury + $hcBBlly; - $hcBBllx= 0; - $hcBBlly= 0; - - $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; - - $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; - } - $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; - - if (!$quiet) { print STDERR "ready. $boundingbox" }; - - $before_startps= 1; - $inserted_prolog= 0; - $prolog_passed= 0; - - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ## -- Create output file -- - ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!$quiet) { print STDERR "Creating output file $outfname..."; } - - open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; - CREATEOUTPUT: - while (<$tmpfhandle>) - { - # check whether we are in a binary section - - $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) || - (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 - (/^pdfIm/ ... /^%-EOD-/); - - if ( !$binarysection ) - { - s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section - } - - # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code - if ($before_startps) - { - if ( /%!/ ) # This is usually the smallest magic sequence - { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable - # %! may be part of a binary sequence, but then control characters follow - # so skip %! if non alphanumeric characters follow - if ( ! /%!.*[^\w]{2,}/ ) - { - # some heading without two control characters found - $before_startps= 0; - if (! /%!PS-Adobe.*/i) # some strange programs use other magics - { - print STDERR "** Warning **: Weird heading line -- ",$_," -- "; - } - } - } - next CREATEOUTPUT; - } - else # we are hopefully in regular postscript code now - { - # count %%EOFs as we want to know when we got the last EOF - if ( /^%%EOF\s*$/ ) - { - $seenEOF++; - } - - # We should insert our own prologue including the newly calculated BoundingBox - if (! $inserted_prolog) - { - print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; - # check if we need to rotate - $transrotcmd=''; - if ($rotatecmd) - { - if ($rotate eq $rotright) - { - $transrotcmd="-$cBBlly $cBBurx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - - } - elsif ($rotate eq $rotleft) - { - $transrotcmd="$cBBury -$cBBllx translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; - } - } - elsif ($rotate eq $rotupsidedown) - { - $transrotcmd="$cBBurx $cBBury translate"; - $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; - if ($hiresboundingbox ne "") - { - $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; - } - } - } - print $outfhandle $boundingbox; - if (!defined($hiresboundingbox)) - { - $nohires=1; - } - if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } - $inserted_prolog= 1; - redo CREATEOUTPUT; - } - else # already inserted_prolog - { - if (! $prolog_passed) - { - #ignore the following lines in the prologue - if ( /^%%(HiRes)?BoundingBox/ || - /^%%Pages/ || - /^%%BeginProlog/ || - /^%%EndProlog/ || - ($filterorientation && /^%%Orientation/) || - ($removeDSC && /^%%.*: \(atend\)/) || - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) - { - next CREATEOUTPUT; - } - else - { - if ( /^[^%].*/ || - /^%%EndComments/ ) # line is not a comment - { - #output postscript code for proper EPS file - if ($insertPScode) - { - print $outfhandle "%%EndComments\n", - "% EPSF created by ps2eps $ver[2]\n", - "%%BeginProlog\n"; - } - # Insert own postscript code for clipping - if ($clip) - { - if (!defined($nohires)) - { - printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1; - } - else - { - printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; - } - } #endif clip - - if ($rotate ne '') - { - print $outfhandle "$transrotcmd\n"; - print $outfhandle "$rotate\n"; - } - if ($translation ne '') - { - print $outfhandle "$translation\n"; - } - - #insert surrounding postscript code - if ($insertPScode) - { - print $outfhandle "save\n", - "countdictstack\n", - "mark\n", - "newpath\n", - "/showpage {} def\n", - "/setpagedevice {pop} def\n", - "%%EndProlog\n", - "%%Page 1 1\n"; - } - $prolog_passed= 1; - if (/^%%EndComments/) { next CREATEOUTPUT; } - } #endif line is not a comment - } #end else - } #endif (we are in the prologue section) - else #we are in the main part of postscript file - { - #end of postscript file reached? - #Usually the DSC %%EOF signifies the end - if ( eof($tmpfhandle) || - ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) - || ( $trailerseen && /^II\*\000.*/ ) - ) - { - #do not forget to print last line if not terminated by LF - if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice - { - print $outfhandle $_,"\n"; - } - #add appropriate trailer - if ($insertPScode) - { - print $outfhandle "%%Trailer\n", - "cleartomark\n", - "countdictstack\n", - "exch sub { end } repeat\n", - "restore\n", - "%%EOF\n"; - } - last CREATEOUTPUT; - } # stop output - - # Trailer comment seen? - if ( /^%%Trailer\s*$/ ) - { - $trailerseen=1; - } - else - { - if (!/^\s*$/) #non empty lines follow - { - $trailerseen=0; - } - } - - # check for trigger - if (defined($triggerstring) && /^$triggerstring$/) - { - $trigger= 1; - }; - - # remove complete lines if one of the expression matches - if ( !$binarysection # only when not in binary section - && - ( - ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) - || # no preview - (defined($rangefilter_begin) && - (/$rangefilter_begin/ ... /$rangefilter_end/) && - (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) - ) - || - (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && - $trigger && - (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) - ) - || - /$linefilter/ # lines by linefilter - || - ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment - || - ($removeADO && - (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || - /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) - || - /^$/ # empty lines - ) - ) - { - next CREATEOUTPUT; - } - - # replacement - if ( defined($fixsearchpat) ) - { - #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } - #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} - s/$fixsearchpat/$fixreplacepat/; - } - - # sanity check for potential dangerous commands - if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) - { - $notsane= 1; - #print STDERR "Warning: dangerous command in line: ",$_,"\n"; - } - } # end else (this is main part) - - # Output the postscript line to result file - print $outfhandle $_; - - if (!$binarysection) - { - print $outfhandle "\n"; # terminate line with LF - } - } # end else prolog_passed - } # end else inserted_prolog - } # end while CREATEOUTPUT - - close($tmpfhandle); - - if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file - - close ($outfhandle); - - # print warning if magic sequence not found - if ( $before_startps ) - { - print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; - } - - if (!$quiet) { print STDERR "ready.\n"; } - if ($warnings and $notsane and !$quiet) - { - print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", - "of the following commands was still present:\n", - "clear erasepage initmatrix initclip initgraphics startjob\n", - "cleardictstack setmatrix setpagedevice copypage grestoreall\n", - "exitserver quit\n"; - } -} #end while PROCESSFILE - -# ---- end of perl-script ------- diff --git a/Master/bin/x86_64-solaris/ps2eps b/Master/bin/x86_64-solaris/ps2eps new file mode 120000 index 00000000000..81d5f53cfde --- /dev/null +++ b/Master/bin/x86_64-solaris/ps2eps @@ -0,0 +1 @@ +../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/psmerge b/Master/bin/x86_64-solaris/psmerge deleted file mode 100755 index 9500bcdf7e6..00000000000 --- a/Master/bin/x86_64-solaris/psmerge +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl -# psmerge: merge PostScript files produced by same application and setup -# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... -# -# Copyright (C) Angus J. C. Duggan 1991-1995 -# See file LICENSE for details. - -$prog = ($0 =~ s=.*/==); - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - if (/^-o(.+)/) { - if (!close(STDOUT) || !open(STDOUT, ">$1")) { - print STDERR "$prog: can't open $1 for output\n"; - exit 1; - } - } elsif (/^-t(horough)?$/) { - $thorough = 1; - } else { - print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; - exit 1; - } -} - -$page = 0; -$first = 1; -$nesting = 0; - -@header = (); -$header = 1; - -@trailer = (); -$trailer = 0; - -@pages = (); -@body = (); - -@resources = (); -$inresource = 0; - -while (<>) { - if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { - $inresource = 1; - push(@resources, $_); - } elsif ($inresource) { - push(@resources, $_); - $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; - } elsif (/^%%Page:/ && $nesting == 0) { - $header = $trailer = 0; - push(@pages, join("", @body)) if @body; - $page++; - @body = ("%%Page: ($page) $page\n"); - } elsif (/^%%Trailer/ && $nesting == 0) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($header) { - push(@trailer, $_); - push(@pages, join("", @body)) if @body; - @body = (); - $trailer = 1; - $header = 0; - } elsif ($trailer) { - if (/^%!/ || /%%EOF/) { - $trailer = $first = 0; - } elsif ($first) { - push(@trailer, $_); - } - } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { - push(@body, $_); - $nesting++; - } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { - push(@body, $_); - $nesting--; - } else { - print $_ if $print; - } -} - -print @trailer; - -exit 0; - diff --git a/Master/bin/x86_64-solaris/psmerge b/Master/bin/x86_64-solaris/psmerge new file mode 120000 index 00000000000..c424f18d568 --- /dev/null +++ b/Master/bin/x86_64-solaris/psmerge @@ -0,0 +1 @@ +../../texmf/scripts/psutils/psmerge.pl \ No newline at end of file -- cgit v1.2.3