summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/utils/README4
-rw-r--r--Build/source/utils/ps2eps/ChangeLog6
-rw-r--r--Build/source/utils/ps2eps/Makefile.am28
-rw-r--r--Build/source/utils/ps2eps/Makefile.in82
-rw-r--r--Build/source/utils/ps2eps/aclocal.m41
-rwxr-xr-xBuild/source/utils/ps2eps/configure88
-rw-r--r--Build/source/utils/ps2eps/configure.ac12
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/ChangeLog14
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/TL-Changes9
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-01-warnings227
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-02-WIN32-bug12
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-03-PERL10
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/Changes.txt (renamed from Build/source/utils/ps2eps/Changes.txt)21
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/INSTALL.txt (renamed from Build/source/utils/ps2eps/INSTALL.txt)23
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/LICENSE.txt (renamed from Build/source/utils/ps2eps/LICENSE.txt)0
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/Latest_is_1.68 (renamed from Build/source/utils/ps2eps/Latest_is_1.64)0
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/README.txt (renamed from Build/source/utils/ps2eps/README.txt)0
-rwxr-xr-xBuild/source/utils/ps2eps/ps2eps-1.68/bin/ps2eps (renamed from Build/source/utils/ps2eps/ps2eps)84
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/bbox.1 (renamed from Build/source/utils/ps2eps/bbox.1)10
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/ps2eps.1 (renamed from Build/source/utils/ps2eps/ps2eps.1)17
-rw-r--r--Build/source/utils/ps2eps/ps2eps-1.68/src/C/bbox.c (renamed from Build/source/utils/ps2eps/bbox.c)233
21 files changed, 669 insertions, 212 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README
index 3a3a16aee76..6e69310711a 100644
--- a/Build/source/utils/README
+++ b/Build/source/utils/README
@@ -15,8 +15,8 @@ chktex 1.6.4 - checked 3may10
dialog 1.1-20100428 - checked 26oct10
ftp://invisible-island.net/dialog/dialog.tar.gz
-ps2eps 1.64 - checked 19feb08
- http://www.ipv6.tm.uka.de/~bless/ps2eps
+ps2eps 1.68 - checked 15dec10
+ http://tm.uka.de/~bless/ps2eps
psutils p17 - checked 25nov06
http://www.tardis.ed.ac.uk/~ajcd/psutils/index.html
diff --git a/Build/source/utils/ps2eps/ChangeLog b/Build/source/utils/ps2eps/ChangeLog
index af3b0a13fda..f28c1a495da 100644
--- a/Build/source/utils/ps2eps/ChangeLog
+++ b/Build/source/utils/ps2eps/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import ps2eps-1.68.
+ * Makefile.am, configure.ac: Reformulate in terms of ps2eps-1.68
+ source tree and patches in ps2eps-1.68-PATCHES.
+
2010-02-23 Peter Breitenlohner <peb@mppmu.mpg.de>
* bbox.c (readppm_and_calcbb) [WIN32]: Add missing fprintf arg.
diff --git a/Build/source/utils/ps2eps/Makefile.am b/Build/source/utils/ps2eps/Makefile.am
index 3be009166d8..e0c4a4ce3fe 100644
--- a/Build/source/utils/ps2eps/Makefile.am
+++ b/Build/source/utils/ps2eps/Makefile.am
@@ -1,24 +1,30 @@
## Makefile.am for the TeX Live subdirectory utils/ps2eps/
##
-## Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
ACLOCAL_AMFLAGS = -I ../../m4
+## We want to re-distribute the whole original ps2eps source tree.
+EXTRA_DIST = $(PS2EPS_TREE)
+## Patches applied to the original source tree
+EXTRA_DIST += $(PS2EPS_TREE)-PATCHES
+
+# in case of an SVN repository
+dist-hook:
+ rm -rf `find $(distdir) -name .svn`
+
AM_CFLAGS = $(WARNING_CFLAGS)
bin_PROGRAMS = bbox
-bbox_SOURCES = bbox.c
-
-dist_bin_SCRIPTS = ps2eps
+bbox_SOURCES = \
+ $(PS2EPS_TREE)/src/C/bbox.c
-dist_man1_MANS = bbox.1 ps2eps.1
+bin_SCRIPTS = \
+ $(PS2EPS_TREE)/bin/ps2eps
-EXTRA_DIST = \
- Changes.txt \
- INSTALL.txt \
- LICENSE.txt \
- Latest_is_1.64 \
- README.txt
+man1_MANS = \
+ $(PS2EPS_TREE)/doc/man/man1/bbox.1 \
+ $(PS2EPS_TREE)/doc/man/man1/ps2eps.1
diff --git a/Build/source/utils/ps2eps/Makefile.in b/Build/source/utils/ps2eps/Makefile.in
index e1abd1e7afd..7624ddcf4ea 100644
--- a/Build/source/utils/ps2eps/Makefile.in
+++ b/Build/source/utils/ps2eps/Makefile.in
@@ -35,8 +35,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = bbox$(EXEEXT)
subdir = .
-DIST_COMMON = $(am__configure_deps) $(dist_bin_SCRIPTS) \
- $(dist_man1_MANS) $(srcdir)/../../build-aux/depcomp \
+DIST_COMMON = $(am__configure_deps) $(srcdir)/../../build-aux/depcomp \
$(srcdir)/../../build-aux/install-sh \
$(srcdir)/../../build-aux/missing $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure \
@@ -46,6 +45,7 @@ DIST_COMMON = $(am__configure_deps) $(dist_bin_SCRIPTS) \
../../build-aux/texinfo.tex ../../build-aux/ylwrap ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-warnings.m4 \
+ $(top_srcdir)/../../m4/kpse-win32.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -81,7 +81,7 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-SCRIPTS = $(dist_bin_SCRIPTS)
+SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp
am__depfiles_maybe = depfiles
@@ -94,7 +94,7 @@ SOURCES = $(bbox_SOURCES)
DIST_SOURCES = $(bbox_SOURCES)
man1dir = $(mandir)/man1
NROFF = nroff
-MANS = $(dist_man1_MANS)
+MANS = $(man1_MANS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -146,6 +146,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PS2EPS_TREE = @PS2EPS_TREE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -194,16 +195,17 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I ../../m4
+EXTRA_DIST = $(PS2EPS_TREE) $(PS2EPS_TREE)-PATCHES
AM_CFLAGS = $(WARNING_CFLAGS)
-bbox_SOURCES = bbox.c
-dist_bin_SCRIPTS = ps2eps
-dist_man1_MANS = bbox.1 ps2eps.1
-EXTRA_DIST = \
- Changes.txt \
- INSTALL.txt \
- LICENSE.txt \
- Latest_is_1.64 \
- README.txt
+bbox_SOURCES = \
+ $(PS2EPS_TREE)/src/C/bbox.c
+
+bin_SCRIPTS = \
+ $(PS2EPS_TREE)/bin/ps2eps
+
+man1_MANS = \
+ $(PS2EPS_TREE)/doc/man/man1/bbox.1 \
+ $(PS2EPS_TREE)/doc/man/man1/ps2eps.1
all: all-am
@@ -283,10 +285,10 @@ clean-binPROGRAMS:
bbox$(EXEEXT): $(bbox_OBJECTS) $(bbox_DEPENDENCIES)
@rm -f bbox$(EXEEXT)
$(LINK) $(bbox_OBJECTS) $(bbox_LDADD) $(LIBS)
-install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
@@ -309,9 +311,9 @@ install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
} \
; done
-uninstall-dist_binSCRIPTS:
+uninstall-binSCRIPTS:
@$(NORMAL_UNINSTALL)
- @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
test -n "$$list" || exit 0; \
@@ -339,10 +341,24 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-install-man1: $(dist_man1_MANS)
+
+bbox.o: $(PS2EPS_TREE)/src/C/bbox.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bbox.o -MD -MP -MF $(DEPDIR)/bbox.Tpo -c -o bbox.o `test -f '$(PS2EPS_TREE)/src/C/bbox.c' || echo '$(srcdir)/'`$(PS2EPS_TREE)/src/C/bbox.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bbox.Tpo $(DEPDIR)/bbox.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(PS2EPS_TREE)/src/C/bbox.c' object='bbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bbox.o `test -f '$(PS2EPS_TREE)/src/C/bbox.c' || echo '$(srcdir)/'`$(PS2EPS_TREE)/src/C/bbox.c
+
+bbox.obj: $(PS2EPS_TREE)/src/C/bbox.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bbox.obj -MD -MP -MF $(DEPDIR)/bbox.Tpo -c -o bbox.obj `if test -f '$(PS2EPS_TREE)/src/C/bbox.c'; then $(CYGPATH_W) '$(PS2EPS_TREE)/src/C/bbox.c'; else $(CYGPATH_W) '$(srcdir)/$(PS2EPS_TREE)/src/C/bbox.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bbox.Tpo $(DEPDIR)/bbox.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(PS2EPS_TREE)/src/C/bbox.c' object='bbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bbox.obj `if test -f '$(PS2EPS_TREE)/src/C/bbox.c'; then $(CYGPATH_W) '$(PS2EPS_TREE)/src/C/bbox.c'; else $(CYGPATH_W) '$(srcdir)/$(PS2EPS_TREE)/src/C/bbox.c'; fi`
+install-man1: $(man1_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+ @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
@@ -366,7 +382,7 @@ install-man1: $(dist_man1_MANS)
uninstall-man1:
@$(NORMAL_UNINSTALL)
- @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+ @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
@@ -471,6 +487,9 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
@@ -647,7 +666,7 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS
+install-exec-am: install-binPROGRAMS install-binSCRIPTS
install-html: install-html-am
@@ -688,8 +707,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
- uninstall-man
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-man
uninstall-man: uninstall-man1
@@ -697,12 +715,12 @@ uninstall-man: uninstall-man1
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
- dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
- distcheck distclean distclean-compile distclean-generic \
- distclean-tags distcleancheck distdir distuninstallcheck dvi \
- dvi-am html html-am info info-am install install-am \
- install-binPROGRAMS install-data install-data-am \
- install-dist_binSCRIPTS install-dvi install-dvi-am \
+ dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-binSCRIPTS \
+ install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-man1 \
install-pdf install-pdf-am install-ps install-ps-am \
@@ -710,8 +728,12 @@ uninstall-man: uninstall-man1
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-dist_binSCRIPTS uninstall-man uninstall-man1
+ uninstall-binSCRIPTS uninstall-man uninstall-man1
+
+# in case of an SVN repository
+dist-hook:
+ rm -rf `find $(distdir) -name .svn`
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/Build/source/utils/ps2eps/aclocal.m4 b/Build/source/utils/ps2eps/aclocal.m4
index 8cd538d37dc..fec8c1cedf3 100644
--- a/Build/source/utils/ps2eps/aclocal.m4
+++ b/Build/source/utils/ps2eps/aclocal.m4
@@ -990,3 +990,4 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../../m4/kpse-warnings.m4])
+m4_include([../../m4/kpse-win32.m4])
diff --git a/Build/source/utils/ps2eps/configure b/Build/source/utils/ps2eps/configure
index 1a655d66444..5e3a9c23c9a 100755
--- a/Build/source/utils/ps2eps/configure
+++ b/Build/source/utils/ps2eps/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ps2eps for TeX Live 1.64.
+# Generated by GNU Autoconf 2.68 for ps2eps for TeX Live 1.68.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -559,16 +559,19 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ps2eps for TeX Live'
PACKAGE_TARNAME='ps2eps-for-tex-live'
-PACKAGE_VERSION='1.64'
-PACKAGE_STRING='ps2eps for TeX Live 1.64'
+PACKAGE_VERSION='1.68'
+PACKAGE_STRING='ps2eps for TeX Live 1.68'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
-ac_unique_file="ps2eps"
+ac_unique_file="ps2eps-1.68/bin/ps2eps"
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+PS2EPS_TREE
+WIN32_FALSE
+WIN32_TRUE
WARNING_CFLAGS
am__fastdepCC_FALSE
am__fastdepCC_TRUE
@@ -1207,7 +1210,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ps2eps for TeX Live 1.64 to adapt to many kinds of systems.
+\`configure' configures ps2eps for TeX Live 1.68 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1274,7 +1277,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ps2eps for TeX Live 1.64:";;
+ short | recursive ) echo "Configuration of ps2eps for TeX Live 1.68:";;
esac
cat <<\_ACEOF
@@ -1365,7 +1368,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ps2eps for TeX Live configure 1.64
+ps2eps for TeX Live configure 1.68
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1420,7 +1423,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ps2eps for TeX Live $as_me 1.64, which was
+It was created by ps2eps for TeX Live $as_me 1.68, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2239,7 +2242,7 @@ fi
# Define the identity of the package.
PACKAGE='ps2eps-for-tex-live'
- VERSION='1.64'
+ VERSION='1.68'
cat >>confdefs.h <<_ACEOF
@@ -3350,6 +3353,65 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native WIN32 or MINGW32" >&5
+$as_echo_n "checking for native WIN32 or MINGW32... " >&6; }
+if ${kpse_cv_have_win32+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef WIN32
+ choke me
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __MINGW32__
+ choke me
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ kpse_cv_have_win32=mingw32
+else
+ kpse_cv_have_win32=native
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ kpse_cv_have_win32=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $kpse_cv_have_win32" >&5
+$as_echo "$kpse_cv_have_win32" >&6; }
+
+ if test "x$kpse_cv_have_win32" != xno; then
+ WIN32_TRUE=
+ WIN32_FALSE='#'
+else
+ WIN32_TRUE='#'
+ WIN32_FALSE=
+fi
+
+
+PS2EPS_TREE=ps2eps-1.68
+
+
ac_config_files="$ac_config_files Makefile"
@@ -3518,6 +3580,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then
+ as_fn_error $? "conditional \"WIN32\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
@@ -3927,7 +3993,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ps2eps for TeX Live $as_me 1.64, which was
+This file was extended by ps2eps for TeX Live $as_me 1.68, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3984,7 +4050,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ps2eps for TeX Live config.status 1.64
+ps2eps for TeX Live config.status 1.68
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/utils/ps2eps/configure.ac b/Build/source/utils/ps2eps/configure.ac
index e8ccc0399c8..9456d699ffb 100644
--- a/Build/source/utils/ps2eps/configure.ac
+++ b/Build/source/utils/ps2eps/configure.ac
@@ -1,14 +1,15 @@
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-AC_INIT([ps2eps for TeX Live], [1.64], [tex-k@tug.org])
+m4_define([ps2eps_version], [1.68])[]dnl using unmodified ps2eps source tree
+AC_INIT([ps2eps for TeX Live], ps2eps_version, [tex-k@tug.org])
AC_PREREQ([2.65])
-AC_CONFIG_SRCDIR([ps2eps])
+AC_CONFIG_SRCDIR([ps2eps-]ps2eps_version[/bin/ps2eps])
AC_CONFIG_AUX_DIR([../../build-aux])
AC_CONFIG_MACRO_DIR([../../m4])
@@ -19,6 +20,11 @@ AC_PROG_CC
KPSE_COMPILER_WARNINGS
+KPSE_CHECK_WIN32
+AM_CONDITIONAL([WIN32], [test "x$kpse_cv_have_win32" != xno])
+
+AC_SUBST([PS2EPS_TREE], [ps2eps-]ps2eps_version)
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/ChangeLog b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/ChangeLog
new file mode 100644
index 00000000000..08b4aba6bb3
--- /dev/null
+++ b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/ChangeLog
@@ -0,0 +1,14 @@
+2010-12-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import ps2eps-1.68, patches in ps2eps-1.68-PATCHES.
+
+ * patch-01-warnings: Avoid compiler warnings.
+ * src/C/bbox.c (minus_one, plus_one): Declare as static.
+ (readppm_and_calcbb): Static, avoid uninitialized warning.
+ Also remove trailing whitespace.
+
+ * patch-02-WIN32-bug:
+ * src/C/bbox.c (readppm_and_calcbb): Add missing fprintf arg.
+
+ * patch-03-PERL: For TeX Live we prefer '#!/usr/bin/env perl'.
+
diff --git a/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/TL-Changes b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/TL-Changes
new file mode 100644
index 00000000000..59fffabaabf
--- /dev/null
+++ b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/TL-Changes
@@ -0,0 +1,9 @@
+Changes applied to the ps2eps-1.68 tree as obtained from:
+ http://www.tm.uka.de/~bless/ps2eps-1.68.tar.gz
+
+Remove:
+ bin/linux/
+ bin/win32/
+ doc/html/
+ doc/pdf/
+
diff --git a/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-01-warnings b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-01-warnings
new file mode 100644
index 00000000000..1439f4926e5
--- /dev/null
+++ b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-01-warnings
@@ -0,0 +1,227 @@
+diff -ur ps2eps-1.68.orig/src/C/bbox.c ps2eps-1.68/src/C/bbox.c
+--- ps2eps-1.68.orig/src/C/bbox.c 2010-08-31 10:58:37.000000000 +0200
++++ ps2eps-1.68/src/C/bbox.c 2010-12-15 13:39:27.000000000 +0100
+@@ -4,25 +4,25 @@
+ /** Author: Roland Bless <roland -at- bless.de> **/
+ /** Copyright (C) 1998-2009 Roland Bless **/
+ /** To compile simply use: **/
+-/** "cc bbox.c -o bbox" or "make bbox" **/
++/** "cc bbox.c -o bbox" or "make bbox" **/
+ /********************************************************************/
+ /*
+ * $Id: bbox.c,v 1.18 2009-10-13 15:03:49 bless Exp $
+ */
+
+ /**
+-* 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
++* 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
+ *
+ **/
+@@ -69,12 +69,14 @@
+ 1
+ };
+
+-unsigned int minus_one(const unsigned x)
++static
++unsigned int minus_one(const unsigned x)
+ {
+ return (x == 0) ? x : x-1;
+ }
+
+-unsigned int plus_one(const unsigned x)
++static
++unsigned int plus_one(const unsigned x)
+ {
+ return (x == (unsigned int) ~0U) ? x : x+1;
+ }
+@@ -95,8 +97,9 @@
+ * and printed to stdout *
+ ************************************************************************/
+ /* calculate the bounding box in postscript points, given a resolution in dpi */
+-void readppm_and_calcbb(const char *name,
+- const unsigned int resolution,
++static
++void readppm_and_calcbb(const char *name,
++ const unsigned int resolution,
+ const unsigned char tight)
+ {
+ FILE *inputfile;
+@@ -109,29 +112,29 @@
+ double hllx, hlly, hurx, hury; /* hires bounding box */
+ unsigned char *image_row, /* ImageRow */
+ *tmpcolumnbytep;
+- unsigned int width,height; /* Image Size */
++ unsigned int width,height; /* Image Size */
+ unsigned int byte_width;
+ unsigned char stepsize;
+ unsigned char colormax= 0; /* max color value */
+ unsigned int ui_colormax= 0; /* max color value */
+-
+- if ( name == NULL )
++
++ if ( name == NULL )
+ {
+ inputfile = stdin;
+ name = "- STDIN -";
+ }
+- else
++ else
+ {
+ inputfile = fopen(name,"r");
+ if ( inputfile == NULL )
+ {
+- fprintf(stderr,"%s: ERROR -- could not open file %s\n",
++ fprintf(stderr,"%s: ERROR -- could not open file %s\n",
+ prgname, name);
+ return;
+ }
+ }
+ /** check for magic number **/
+- do
++ do
+ {
+ fgets(inputline, 1024, inputfile);
+ #ifdef DEBUG
+@@ -150,7 +153,7 @@
+ }
+ }
+ while ( !feof(inputfile) && !magic_found );
+-
++
+ if ( !magic_found )
+ {
+ fprintf(stderr,"%s: ERROR -- %s is not in ppmraw or pbmraw format\n",
+@@ -158,7 +161,7 @@
+ return;
+ }
+ /** skip comments **/
+- do
++ do
+ {
+ fgets(inputline, 1024, inputfile);
+ #ifdef DEBUG
+@@ -175,15 +178,16 @@
+ if ( magic_found == 6 ) /* PPM file has maximum color-component value */
+ {
+ fgets(inputline, 1024, inputfile);
+- sscanf(inputline,"%u",&ui_colormax);
++ sscanf(inputline,"%u",&ui_colormax);
+ colormax = (unsigned char) ui_colormax; /* this is safer */
+ }
+ #ifdef DEBUG
+ fprintf(stderr,"\nreading picture: %s size X: %u Y: %u\n",name,width,height);
+ #endif
++ x = 0; /* avoid uninitialized warning */
+ x_min= width>0 ? width-1 : 0;
+- x_max= 0;
+- y_min= height>0 ? height-1 : 0;
++ x_max= 0;
++ y_min= height>0 ? height-1 : 0;
+ y_max= 0;
+ if ( magic_found == 4 ) /* PBMRAW = Bitmap */
+ { /** read raw pbmfile **/
+@@ -192,12 +196,12 @@
+ byte_width++;
+ }
+ else /** assume ppm raw **/
+- {
++ {
+ byte_width= width * 3; /* we have RGB, i.e. three bytes for each pixel */
+ }
+- /*
++ /*
+ * Now read a raster of Width * Height pixels, proceeding through the image in normal English reading order,
+- * i.e., starting from top left then moving right
++ * i.e., starting from top left then moving right
+ */
+ /* we allocate only one line */
+ image_row= malloc(byte_width);
+@@ -258,8 +262,8 @@
+ { /* there was a pixel with no background color */
+ tmpcolumnbytep= image_row+byte_width-1;
+ /* inspect this line from the right */
+- for (byte_x= byte_width-1;
+- byte_x >= 0;
++ for (byte_x= byte_width-1;
++ byte_x >= 0;
+ byte_x--,tmpcolumnbytep--)
+ {
+ if ( *tmpcolumnbytep != colormax ) /* there are pixels not white */
+@@ -292,7 +296,7 @@
+ y_min,y_max,x_min,x_max);
+ #endif
+ break;
+- } /* if there are pixels not white */
++ } /* if there are pixels not white */
+ } /* end for byte_x */
+ } /* if line contained not only background color */
+ } /* end for y */
+@@ -303,7 +307,7 @@
+ hllx= (x_min*pt_dpi_dbl)/resolution;
+ /* distance from the bottom edge to the bottommost point */
+ hlly= ((minus_one(height)-y_max)*pt_dpi_dbl)/resolution;
+- /* distance from the left edge to the righmost point */
++ /* distance from the left edge to the righmost point */
+ hurx= (plus_one(x_max)*pt_dpi_dbl)/resolution;
+ /* distance from the bottom edge to the uppermost point */
+ hury= ((height-y_min)*pt_dpi_dbl)/resolution;
+@@ -315,7 +319,7 @@
+ llx= minus_one((unsigned int) ((unsigned long) x_min*72UL)/resolution);
+ /* distance from the bottom edge to the bottommost point */
+ lly= minus_one((unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution);
+- /* distance from the left edge to the righmost point */
++ /* distance from the left edge to the righmost point */
+ urx= plus_one((unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution);
+ /* distance from the bottom edge to the uppermost point */
+ ury= plus_one((unsigned int) ((unsigned long) (height-y_min)*72UL)/resolution);
+@@ -335,7 +339,7 @@
+ llx= (unsigned int) ((unsigned long) x_min*72UL)/resolution;
+ /* distance from the bottom edge to the bottommost point */
+ lly= (unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution;
+- /* distance from the left edge to the righmost point */
++ /* distance from the left edge to the righmost point */
+ urx= (unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution;
+ /* round up if we got a remainder */
+ if ( (((unsigned long) plus_one(x_max)*72UL) % resolution) != 0 )
+@@ -357,15 +361,15 @@
+ }
+ else
+ fprintf(stderr,"%s: ERROR -- not enough memory to read in one row of the picture\n",prgname);
+-
++
+ fclose(inputfile);
+ free(image_row);
+ }
+
+
+-int
++int
+ main(int argc, char **argv)
+-{
++{
+ int i;
+ char *filename= NULL;
+ unsigned int resolution= 72; /* use 72 dpi as default resolution */
diff --git a/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-02-WIN32-bug b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-02-WIN32-bug
new file mode 100644
index 00000000000..febf91d94ac
--- /dev/null
+++ b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-02-WIN32-bug
@@ -0,0 +1,12 @@
+diff -ur ps2eps-1.68.orig/src/C/bbox.c ps2eps-1.68/src/C/bbox.c
+--- ps2eps-1.68.orig/src/C/bbox.c 2010-12-15 13:39:27.000000000 +0100
++++ ps2eps-1.68/src/C/bbox.c 2010-12-15 13:46:23.000000000 +0100
+@@ -210,7 +210,7 @@
+ #if defined(_WIN32) && !defined(__CYGWIN__) /* this is really braindead stuff for MSVC */
+ i= _setmode( _fileno(stdin), _O_BINARY);
+ if (i == -1)
+- fprintf(stderr,"%s: ERROR - Cannot set binary mode for STDIN\n");
++ fprintf(stderr,"%s: ERROR - Cannot set binary mode for STDIN\n", prgname);
+ #endif
+ for (y= 0; y<height; y++) /* for every image row 0..height-1 */
+ {
diff --git a/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-03-PERL b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-03-PERL
new file mode 100644
index 00000000000..bdefc3f8617
--- /dev/null
+++ b/Build/source/utils/ps2eps/ps2eps-1.68-PATCHES/patch-03-PERL
@@ -0,0 +1,10 @@
+diff -ur ps2eps-1.68.orig/bin/ps2eps ps2eps-1.68/bin/ps2eps
+--- ps2eps-1.68.orig/bin/ps2eps 2010-08-31 10:58:37.000000000 +0200
++++ ps2eps-1.68/bin/ps2eps 2010-12-15 14:05:24.000000000 +0100
+@@ -1,5 +1,4 @@
+-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' # -*-perl-*-
+- if 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
diff --git a/Build/source/utils/ps2eps/Changes.txt b/Build/source/utils/ps2eps/ps2eps-1.68/Changes.txt
index 50af3dfbe34..ef0c46602cd 100644
--- a/Build/source/utils/ps2eps/Changes.txt
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/Changes.txt
@@ -1,6 +1,25 @@
----------------------------
Detailed Change Log:
----------------------------
+revision 1.68
+date: 2010-05-07 21:42:35 +0200; author: bless; state: Exp; lines: +3 -3;
+- quoted translate command string
+----------------------------
+revision 1.67
+date: 2009-12-05 23:44:19 +0100; author: bless; state: Exp; lines: +39 -33;
+- quote of tmpfname for coping with spaces in filenames
+- added -a option
+- changed handling of hiresBB (now rounded to hiresprecision, by default 0.5pt)
+----------------------------
+revision 1.66
+date: 2007-10-30 12:04:24 +0100; author: bless; state: Exp; lines: +9 -5;
+- added %%BeginData %%EndData as indicators for Binary Section
+- added new option -b (treat as binary) to prevent filtering CR/LF stuff
+----------------------------
+revision 1.65
+date: 2007-01-24 14:19:42 +0100; author: bless; state: Exp; lines: +3 -3;
+- fixed help/usage formatting output
+----------------------------
revision 1.64
date: 2007-01-24 13:32:59 +0100; author: bless; state: Exp; lines: +4 -4;
- Year (C) update
@@ -266,4 +285,4 @@ ps2eps now draws in color (ppm) by default.
Monochrome option added.
Fixing message was not printed for each file.
----------------------------
-not released before... \ No newline at end of file
+not released before...
diff --git a/Build/source/utils/ps2eps/INSTALL.txt b/Build/source/utils/ps2eps/ps2eps-1.68/INSTALL.txt
index 11a2cc5e73d..d3ca8d0926c 100644
--- a/Build/source/utils/ps2eps/INSTALL.txt
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/INSTALL.txt
@@ -2,15 +2,17 @@ INSTALLATION
------------
* Prerequisites
-you need:
- - perl (an interpreter for the perl language, see http://www.perl.com)
- - ghostscript (an interpreter/raster image processor
- for the PostScript language,
- see http://www.cs.wisc.edu/~ghost/)
- - maybe an ANSI-C compiler if you don't use Linux, Solaris, Digital Unix,
- HP-UX or Windows 9x/NT/2000. Sorry for the inconvenience, but I tried
- to write a bbox equivalent in perl and it was terribly slow. Therefore
- I stick to C, because of much better performance.
+ you need:
+ - perl (an interpreter for the perl language, see http://www.perl.com)
+ - ghostscript (an interpreter/raster image processor
+ for the PostScript language,
+ see http://pages.cs.wisc.edu/~ghost/)
+ - maybe an ANSI-C compiler if the provided binaries for bbox do not work
+ for you. Sorry for the inconvenience, but I tried to write a bbox
+ equivalent in perl and it was terribly slow. Therefore I stick to C,
+ because of much better performance.
+ ALTERNATIVELY you can use ps2eps option -g, then no bbox binary is
+ required.
* How to install
@@ -25,6 +27,7 @@ you need:
into any directory of the system search path. Otherwise, you have
to compile bbox.c first by invoking
cc -o bbox bbox.c.
+ (sometimes "make bbox" also works).
Please make sure that bbox is executable (chmod a+x bbox).
If you already have a working perl and a working ghostscript, you're
finished here, else you have to install them first.
@@ -61,4 +64,4 @@ UPDATES
-------
Possibly you can find the newest version at the
following URL:
-http://www.tm.uka.de/~bless/ps2eps
+http://tm.uka.de/~bless/ps2eps
diff --git a/Build/source/utils/ps2eps/LICENSE.txt b/Build/source/utils/ps2eps/ps2eps-1.68/LICENSE.txt
index 60549be514a..60549be514a 100644
--- a/Build/source/utils/ps2eps/LICENSE.txt
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/LICENSE.txt
diff --git a/Build/source/utils/ps2eps/Latest_is_1.64 b/Build/source/utils/ps2eps/ps2eps-1.68/Latest_is_1.68
index e69de29bb2d..e69de29bb2d 100644
--- a/Build/source/utils/ps2eps/Latest_is_1.64
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/Latest_is_1.68
diff --git a/Build/source/utils/ps2eps/README.txt b/Build/source/utils/ps2eps/ps2eps-1.68/README.txt
index 0f9784de357..0f9784de357 100644
--- a/Build/source/utils/ps2eps/README.txt
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/README.txt
diff --git a/Build/source/utils/ps2eps/ps2eps b/Build/source/utils/ps2eps/ps2eps-1.68/bin/ps2eps
index 7092cbb0007..7daa8752bff 100755
--- a/Build/source/utils/ps2eps/ps2eps
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/bin/ps2eps
@@ -3,9 +3,9 @@
# {#!/usr/bin/perl}.
# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files
# -------------------------------------------------------------------
-# $Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $
+# $Id: ps2eps,v 1.68 2010-05-07 19:42:35 bless Exp $
# -------------------------------------------------------
-# (C)opyright 1999-2007 Roland Bless
+# (C)opyright 1999-2009 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
@@ -16,7 +16,7 @@
# 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
@@ -57,7 +57,7 @@ else
$bboxver=`bbox >$NULLDEV -V`;
$bboxname= ($?== -1) ? "" : "bbox";
-$version= '$Id: ps2eps,v 1.64 2007/01/24 12:32:59 bless Exp $'; #'
+$version= '$Id: ps2eps,v 1.68 2010-05-07 19:42:35 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
@@ -85,6 +85,9 @@ $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
+$allbinary= 0; # treat postscript as binary do not filter or change stuff
+$alphaopt=""; # rendering option for ghostscript "-dTextAlphaBits=4 -dGraphicsAlphaBits=4"
+$hiresprecision=0.5; # amount that is changed of HiresBB in case that looseBB was requested
$defaultext = '(ps|prn)'; # default extension
$defaultoutext = '.eps'; # default output extension
@@ -144,7 +147,7 @@ $licensetxt= "\
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" );
+ "(C)opyright 1998-2009 Roland Bless\n\n" );
@helptxt= ("Version: $ver[2]\n",
"Operation:\n",
@@ -160,7 +163,7 @@ $licensetxt= "\
" 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 <pagedim>] [-R +|-|^] [-t <x,y>] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n",
+ " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-b] [-C] [-m] [-B] [-E] [-s <pagedim>] [-R +|-|^] [-t <x,y>] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-a] [-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",
@@ -170,13 +173,14 @@ $licensetxt= "\
" -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",
+ " -b, --binary treat postscript as binary, do not modify characters\n",
" -C, --clip insert postscript code for clipping\n",
" -m, --mono use black/white bitmap as base for calculation\n",
" -s, --size=<pagedim> 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=<direction> rotate resulting EPS. <direction>: +=+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)",
+ " -r, --resolution specify dpi resolution to render with ghostscript (default 144)\n",
" -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",
@@ -186,6 +190,7 @@ $licensetxt= "\
" -L, --license show licensing information\n",
" -V, --version show version information\n",
" -d, --debuggs show ghostscript call\n",
+ " -a, --accuracy improve accuracy during rendering (maybe slower)\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",
@@ -225,6 +230,7 @@ GetOptions('f|force' => \$forceoverwrite,
'O|preserveorientation' => sub { $filterorientation= 0 },
'P|removepreview' => \$removePreview,
'c|comments' => sub { $removeDSC = 0 },
+ 'b|binary' => sub { $allbinary = 1 },
'C|clip' => \$clip,
'l|loose' => sub { $looseBB = '-l' },
'B|ignoreBB' => \$ignoreBB,
@@ -237,6 +243,7 @@ GetOptions('f|force' => \$forceoverwrite,
'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"; },
+ 'a|accuracy' => sub { $alphaopt = '-dTextAlphaBits=4 -dGraphicsAlphaBits=4' },
'd|debuggs' => \$debuggs,
'W|warnings' => \$warnings,
'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow);
@@ -385,17 +392,6 @@ while ($infname= (shift @filenames))
{
$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
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -431,8 +427,8 @@ while ($infname= (shift @filenames))
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;
+ $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72 + 0.5);
+ $ypixels= int((($eBBury-$eBBlly) * $resolution)/72 + 0.5);
if (!$ignoreBB)
{
$gpar= "-g${xpixels}x${ypixels}";
@@ -536,7 +532,7 @@ while ($infname= (shift @filenames))
if ($translate_x!=0 || $translate_y!=0)
{
$translation="$translate_x $translate_y translate";
- $translatecmd="-c $translation";
+ $translatecmd="-c \'$translation\'";
}
else
{
@@ -560,14 +556,14 @@ while ($infname= (shift @filenames))
}
if ($bboxname ne '')
{
- $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution";
+ $cmdline="$ghostscriptname -dSAFER -dNOPAUSE $alphaopt -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";
+ $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"; }
@@ -579,8 +575,8 @@ while ($infname= (shift @filenames))
# 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";
+ die "Error: Could not determine bounding box!\n",
+ "I suppose $ghostscriptname had some trouble interpreting the postscript-file $infname. Exiting now.\n";
}
$boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m;
@@ -598,20 +594,21 @@ while ($infname= (shift @filenames))
$boundingbox =~ /^%%.*BoundingBox:\s*(.*)/;
($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1);
}
- # if loose BB should be performed by ps2eps
+ # if loose BB is requested
# 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++;
+ $cBBurx++;
+ $cBBury++;
+
+ if ($hcBBllx-$hiresprecision >= 0.0) { $hcBBllx-= $hiresprecision; }
+ if ($hcBBlly-$hiresprecision >= 0.0) { $hcBBlly-= $hiresprecision; }
+ $hcBBurx+= $hiresprecision;
+ $hcBBury+= $hiresprecision;
+ $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n";
+
}
if ($cBBllx < 0 || $cBBlly < 0)
{
@@ -647,7 +644,19 @@ while ($infname= (shift @filenames))
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## -- Create output file --
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if (!$quiet) { print STDERR "Creating output file $outfname..."; }
+ if (!$quiet) { print STDERR "Creating output file $outfname ... "; }
+ 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";
+ }
+
open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading";
CREATEOUTPUT:
@@ -655,7 +664,8 @@ while ($infname= (shift @filenames))
{
# check whether we are in a binary section
- $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) ||
+ $binarysection=$allbinary ||
+ (/^(%%Begin(Binary|Data))|(beginimage)\r?\n?$/ ... /^(%%End(Binary|Data))|^(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-/);
@@ -770,7 +780,7 @@ while ($infname= (shift @filenames))
{
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;
+ printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx,$hcBBlly,$hcBBurx,$hcBBlly,$hcBBurx,$hcBBury,$hcBBllx,$hcBBury;
}
else
{
diff --git a/Build/source/utils/ps2eps/bbox.1 b/Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/bbox.1
index 9efc9e05c2d..64696f32645 100644
--- a/Build/source/utils/ps2eps/bbox.1
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/bbox.1
@@ -3,12 +3,13 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "BBOX" "1" "21 April 2004" "" ""
+.TH "BBOX" "1" "31 August 2010" "" ""
+
.SH NAME
bbox \- prints out the bounding box of a rawppm or rawpbm image
.SH SYNOPSIS
-\fBbbox\fR [ \fB-l\fR] [ \fB-r\fR] [ \fB-h\fR] [ \fB-V\fR] [ \fB\fIrawpbmfile\fB\fR]
+\fBbbox\fR [ \fB-l\fR ] [ \fB-r\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB\fIrawpbmfile\fB\fR ]
.SH "DESCRIPTION"
.PP
@@ -41,7 +42,7 @@ resolution of picture in dpi
.TP
\fB-l \fR
loose bounding box (integer bounding box is expanded by 1
-point, hires bounding box is not widened)
+point, hires bounding box is expanded by 0.5 points)
.SH "SEE ALSO"
.PP
ps2eps (1)
@@ -50,6 +51,9 @@ ps2eps (1)
\fBbbox\fR was written by Roland Bless.
.SS "ACKNOWLEDGMENTS"
.PP
+Special thanks goes to Michael Sharpe from UCSD who suggested a lot of improvements for
+bbox to become more precise and robust, especially for small drawings.
+.PP
An earlier version of this manual page was originally written by
Rafael Laboissiere <rafael@debian.org> for
the Debian system. Thank you Rafael! Permission is
diff --git a/Build/source/utils/ps2eps/ps2eps.1 b/Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/ps2eps.1
index 4c0c674ada8..d74e88ca34f 100644
--- a/Build/source/utils/ps2eps/ps2eps.1
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/doc/man/man1/ps2eps.1
@@ -3,17 +3,17 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "PS2EPS" "1" "24 Januar 2007" "" ""
+.TH "PS2EPS" "1" "31 August 2010" "" ""
.SH NAME
ps2eps \- convert PostScript to EPS (Encapsulated PostScript) files
.SH SYNOPSIS
-\fBps2eps\fR [ \fB-f\fR ] [ \fB-q\fR ] [ \fB-N\fR ] [ \fB-O\fR ] [ \fB-n\fR ] [ \fB-P\fR ] [ \fB-c\fR ] [ \fB-C\fR ] [ \fB-m\fR ] [ \fB-B\fR ] [ \fB-E\fR ] [ \fB-s \fIpagedim\fB\fR ] [ \fB-t \fIoffset\fB\fR ] [ \fB-r \fIresolution\fB\fR ] [ \fB-R \fI+|-|^\fB\fR ] [ \fB-l\fR ] [ \fB-g\fR ] [ \fB-H\fR ] [ \fB-d\fR ] [ \fB-h|--help\fR ] [ \fB-W\fR ] [ \fB-L\fR ] [ \fB-V|--version\fR ] [ \fB--\fR ] [ \fB\fIpsfile1\fB\fR ] [ \fB\fIpsfile2\fB\fR ] [ \fB\fI\&...\fB\fR ]
+\fBps2eps\fR [ \fB-f\fR ] [ \fB-q\fR ] [ \fB-N\fR ] [ \fB-O\fR ] [ \fB-n\fR ] [ \fB-P\fR ] [ \fB-c\fR ] [ \fB-C\fR ] [ \fB-m\fR ] [ \fB-B\fR ] [ \fB-E\fR ] [ \fB-s \fIpagedim\fB\fR ] [ \fB-t \fIoffset\fB\fR ] [ \fB-r \fIresolution\fB\fR ] [ \fB-R \fI+|-|^\fB\fR ] [ \fB-l\fR ] [ \fB-g\fR ] [ \fB-H\fR ] [ \fB-d\fR ] [ \fB-h|--help\fR ] [ \fB-a\fR ] [ \fB-W\fR ] [ \fB-L\fR ] [ \fB-V|--version\fR ] [ \fB--\fR ] [ \fB\fIpsfile1\fB\fR ] [ \fB\fIpsfile2\fB\fR ] [ \fB\fI\&...\fB\fR ]
.SH "DESCRIPTION"
.PP
-This manual page documents \fBps2eps\fR version 1.64.
+This manual page documents \fBps2eps\fR version 1.68.
.PP
\fBps2eps\fR is a tool (written in Perl) to produce
Encapsulated PostScript Files (EPS/EPSF) from usual one-paged Postscript
@@ -140,6 +140,9 @@ See also environment variable PS2EPS_GSBBOX\&.
\fB-H, --nohires \fR
do not generate a %%HiResBoundingBox comment for output.
.TP
+\fB-a, --accuracy \fR
+increase the accuracy by turning subsample antialiasing on (may be slower)
+.TP
\fB-L, --license \fR
show licensing information.
.TP
@@ -284,6 +287,10 @@ for using a monochrome image. But this will probably result in wrongly
determined bounding boxes with colored
images, because ghostscript has to do black/white dithering and may thus suppress
objects drawn in light colors.
+.PP
+Another option in case of memory problems and too long run times
+is to use the much more memory efficient internal ghostscript bbox by using the
+\fB-g\fR option.
.SH "ENVIRONMENT VARIABLES"
.PP
Please note that a command line option always takes precedence over
@@ -331,7 +338,9 @@ an additional point of white space around the tight bounding box.
.PP
Some people contributed code or suggestions to improve \fBps2eps\fR\&. Here
are at least some names (sorry if I forgot your name):
-Christophe Druet, Hans Ecke, Berend Hasselman, Erik Joergensen, Koji Nakamaru, Hans Fredrik Nordhaug
+Christophe Druet, Hans Ecke, Berend Hasselman, Erik Joergensen, Koji Nakamaru, Hans Fredrik Nordhaug, Michael Sharpe.
+Special thanks goes to Michael Sharpe from UCSD who suggested a lot of useful features for ps2eps and
+who fixed bbox to become more precise and robust.
.PP
An earlier version of this manual page was originally written by
Rafael Laboissiere <rafael at debian.org> for
diff --git a/Build/source/utils/ps2eps/bbox.c b/Build/source/utils/ps2eps/ps2eps-1.68/src/C/bbox.c
index ea741102d8d..81454187e22 100644
--- a/Build/source/utils/ps2eps/bbox.c
+++ b/Build/source/utils/ps2eps/ps2eps-1.68/src/C/bbox.c
@@ -1,33 +1,45 @@
/********************************************************************/
/** bbox -- calculates Bounding Box of a pbmraw/ppmraw-picture **/
-/** Created: Nov. 1997, revised Feb. 1998, Dec. 1999 **/
-/** Author: Roland Bless <roland@bless.de> **/
-/** Copyright (C) 1998-2000 Roland Bless **/
+/** Created: Nov. 1997, revised Feb. 1998, Dec. 1999, June 2009 **/
+/** Author: Roland Bless <roland -at- bless.de> **/
+/** Copyright (C) 1998-2009 Roland Bless **/
/** To compile simply use: **/
/** "cc bbox.c -o bbox" or "make bbox" **/
/********************************************************************/
-
/*
- * $Id: bbox.c,v 1.13 2004/01/25 10:15:48 bless Exp $
- *
- * $Log: bbox.c,v $
- * Revision 1.13 2004/01/25 10:15:48 bless
- * - added %%HiResBoundingBox: output (now compatible with bbox device output of ghostscript)
- *
- * Revision 1.12 2003/11/09 18:16:53 bless
- * - print help, license and version to stdout instead of stderr (incorporated patch from Rafael Laboissiere <rafael@debian.org>)
- *
- * Revision 1.11 2003/07/08 11:14:12 bless
- * - added include <string.h> for strcmp()
- * - removed unused argument in fprintf() call
- *
- * Revision 1.10 2000/08/04 08:46:47 bless
- * Incorporated bugfix by Dan Blake <dblake@rose.hp.com>: read
- * unsigned int into unsigned char variable via sscanf caused crash
- * under HP-UX. Thanks, Dan!
- *
- *
+ * $Id: bbox.c,v 1.18 2009-10-13 15:03:49 bless Exp $
*/
+
+/**
+* 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
+*
+**/
+
+/* Quoting EPSF Spec:
+ http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
+
+ %!PS-Adobe-3.0 EPSF-3.0
+ %%BoundingBox: llx lly urx ury
+
+ The four arguments of the bounding box comment correspond to the
+ lower-left (llx, lly) and upper-right (urx, ury) corners of the
+ bounding box. They are expressed in the default PostScript
+ coordinate system. For an EPS file, the bounding box is the smallest
+ rectangle that encloses all the marks painted on the single page of
+ the EPS file.
+*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,9 +52,11 @@
/**********************
* global variables *
**********************/
-const char *const version= "$Revision: 1.13 $ $Date: 2004/01/25 10:15:48 $";
+const char *const version= "$Revision: 1.18 $ $Date: 2009-10-13 15:03:49 $";
const char *const prgname= "bbox";
+const double round_precision= 1e-6;
+
unsigned char bitval[8]=
{
1 << 7,
@@ -55,14 +69,14 @@ unsigned char bitval[8]=
1
};
-static unsigned int
-minus_one(const unsigned x)
+static
+unsigned int minus_one(const unsigned x)
{
return (x == 0) ? x : x-1;
}
-static unsigned int
-plus_one(const unsigned x)
+static
+unsigned int plus_one(const unsigned x)
{
return (x == (unsigned int) ~0U) ? x : x+1;
}
@@ -83,43 +97,44 @@ plus_one(const unsigned x)
* and printed to stdout *
************************************************************************/
/* calculate the bounding box in postscript points, given a resolution in dpi */
-static void
-readppm_and_calcbb(const char *name,
- const unsigned int resolution,
- const unsigned char tight)
+static
+void readppm_and_calcbb(const char *name,
+ const unsigned int resolution,
+ const unsigned char tight)
{
FILE *inputfile;
char inputline[1024];
unsigned char magic_found= 0;
int x,y,byte_x,i;
+ const double pt_dpi_dbl= 72.0;
unsigned int x_min, x_max, y_min, y_max;
unsigned int llx, lly, urx, ury; /* bounding box */
double hllx, hlly, hurx, hury; /* hires bounding box */
unsigned char *image_row, /* ImageRow */
- *tmprowp;
- unsigned int xmax,ymax; /* Image Size */
- unsigned int byte_xmax;
+ *tmpcolumnbytep;
+ unsigned int width,height; /* Image Size */
+ unsigned int byte_width;
unsigned char stepsize;
- unsigned char colmax= 0; /* max color value */
- unsigned int ui_colmax= 0; /* max color value */
-
- if ( name == NULL )
+ unsigned char colormax= 0; /* max color value */
+ unsigned int ui_colormax= 0; /* max color value */
+
+ if ( name == NULL )
{
inputfile = stdin;
name = "- STDIN -";
}
- else
+ else
{
inputfile = fopen(name,"r");
if ( inputfile == NULL )
{
- fprintf(stderr,"%s: ERROR -- could not open file %s\n",
+ fprintf(stderr,"%s: ERROR -- could not open file %s\n",
prgname, name);
return;
}
}
/** check for magic number **/
- do
+ do
{
fgets(inputline, 1024, inputfile);
#ifdef DEBUG
@@ -138,7 +153,7 @@ readppm_and_calcbb(const char *name,
}
}
while ( !feof(inputfile) && !magic_found );
-
+
if ( !magic_found )
{
fprintf(stderr,"%s: ERROR -- %s is not in ppmraw or pbmraw format\n",
@@ -146,7 +161,7 @@ readppm_and_calcbb(const char *name,
return;
}
/** skip comments **/
- do
+ do
{
fgets(inputline, 1024, inputfile);
#ifdef DEBUG
@@ -159,33 +174,37 @@ readppm_and_calcbb(const char *name,
}
while ( !feof(inputfile) );
/** read picture size: width, height **/
- sscanf(inputline,"%u %u",&xmax,&ymax);
+ sscanf(inputline,"%u %u",&width,&height);
if ( magic_found == 6 ) /* PPM file has maximum color-component value */
{
fgets(inputline, 1024, inputfile);
- sscanf(inputline,"%u",&ui_colmax);
- colmax = (unsigned char) ui_colmax; /* this is safer */
+ sscanf(inputline,"%u",&ui_colormax);
+ colormax = (unsigned char) ui_colormax; /* this is safer */
}
#ifdef DEBUG
- fprintf(stderr,"\nreading picture: %s X: %u Y: %u\n",name,xmax,ymax);
+ fprintf(stderr,"\nreading picture: %s size X: %u Y: %u\n",name,width,height);
#endif
- x = 0; /* avoid uninitialized warning */
- x_min= xmax;
- x_max= 0;
- y_min= ymax;
+ x = 0; /* avoid uninitialized warning */
+ x_min= width>0 ? width-1 : 0;
+ x_max= 0;
+ y_min= height>0 ? height-1 : 0;
y_max= 0;
if ( magic_found == 4 ) /* PBMRAW = Bitmap */
{ /** read raw pbmfile **/
- byte_xmax= xmax / 8;
- if (xmax % 8 != 0)
- byte_xmax++;
+ byte_width= width / 8;
+ if (width % 8 != 0)
+ byte_width++;
}
else /** assume ppm raw **/
- {
- byte_xmax= xmax * 3; /* we have RGB, i.e. three bytes for each pixel */
+ {
+ byte_width= width * 3; /* we have RGB, i.e. three bytes for each pixel */
}
-
- image_row= malloc(byte_xmax);
+ /*
+ * Now read a raster of Width * Height pixels, proceeding through the image in normal English reading order,
+ * i.e., starting from top left then moving right
+ */
+ /* we allocate only one line */
+ image_row= malloc(byte_width);
if ( image_row )
{
#if defined(_WIN32) && !defined(__CYGWIN__) /* this is really braindead stuff for MSVC */
@@ -193,29 +212,29 @@ readppm_and_calcbb(const char *name,
if (i == -1)
fprintf(stderr,"%s: ERROR - Cannot set binary mode for STDIN\n", prgname);
#endif
- for (y= 0; y<ymax-1; y++) /* for every image row */
+ for (y= 0; y<height; y++) /* for every image row 0..height-1 */
{
- if (fread(image_row, byte_xmax, 1, inputfile) != 1)
+ if (fread(image_row, byte_width, 1, inputfile) != 1)
{
fprintf(stderr,"%s: WARNING -- fread incomplete - file %s seems to be corrupt\n", prgname, name);
break;
}
- tmprowp= image_row;
- /* inspect this line from the left */
- for (byte_x= 0; byte_x<byte_xmax; byte_x++,tmprowp++)
+ tmpcolumnbytep= image_row;
+ /* inspect this line from left to right */
+ for (byte_x= 0; byte_x<byte_width; byte_x++,tmpcolumnbytep++)
{
- if (*tmprowp != colmax) /* there are pixels not white */
+ if (*tmpcolumnbytep != colormax) /* there are pixels not white */
{
if (magic_found == 4)
{
for (i= 0; i<8 ; i++)
{
- if (*tmprowp & bitval[i])
+ if (*tmpcolumnbytep & bitval[i])
{
x= byte_x*8+i;
- if ( x >= xmax ) break;
+ if ( x >= width ) break;
#ifdef DEBUG
- printf("(%04d,%04d): <not white>\n",y,x);
+ printf("(row %04d, %04d): <not white>\n",y,x);
#endif
}
} /* end for */
@@ -224,7 +243,7 @@ readppm_and_calcbb(const char *name,
{ /* assume PPM */
x= byte_x/3; /* we have 3 bytes per pixel */
#ifdef DEBUG
- printf("(%04d,%04d)%04d: <not %d>\n",y,x,byte_x,colmax);
+ printf("(row %04d, col %04d) byte %04d: <not %d>\n",y,x,byte_x,colormax);
#endif
}
/* update bounding box */
@@ -233,30 +252,30 @@ readppm_and_calcbb(const char *name,
if ( y < y_min ) y_min= y;
if ( y > y_max ) y_max= y;
#ifdef DEBUG
- printf("ymin,ymax:(%04d,%04d) xmin,xmax:(%04d,%04d)",
+ printf("ymin,height:(%04d,%04d) xmin,width:(%04d,%04d)\n",
y_min,y_max,x_min,x_max);
#endif
- break; /* stop here */
- } /* if there are pixels not white */
+ break;
+ } /* if there are pixels not white */
} /* end for byte_x */
- if ( byte_x != byte_xmax )
+ if ( byte_x != byte_width )
{ /* there was a pixel with no background color */
- tmprowp= image_row+byte_xmax-1;
+ tmpcolumnbytep= image_row+byte_width-1;
/* inspect this line from the right */
- for (byte_x= byte_xmax-1;
- byte_x >= 0;
- byte_x--,tmprowp--)
+ for (byte_x= byte_width-1;
+ byte_x >= 0;
+ byte_x--,tmpcolumnbytep--)
{
- if ( *tmprowp != colmax ) /* there are pixels not white */
+ if ( *tmpcolumnbytep != colormax ) /* there are pixels not white */
{
if ( magic_found == 4 )
{
for (i= 0; i<8 ; i++)
{
- if ( *tmprowp & bitval[i] )
+ if ( *tmpcolumnbytep & bitval[i] )
{
x= byte_x*8+i;
- if (x >= xmax) break;
+ if (x >= width) break;
#ifdef DEBUG
printf("(%04d,%04d): <not white>\n",y,x);
#endif
@@ -272,22 +291,26 @@ readppm_and_calcbb(const char *name,
if ( x > x_max ) x_max= x;
if ( y < y_min ) y_min= y;
if ( y > y_max ) y_max= y;
+#ifdef DEBUG
+ printf("ymin,height:(%04d,%04d) xmin,width:(%04d,%04d)\n",
+ y_min,y_max,x_min,x_max);
+#endif
break;
- } /* if there are pixels not white */
+ } /* if there are pixels not white */
} /* end for byte_x */
} /* if line contained not only background color */
} /* end for y */
#ifdef DEBUG_BOX
- fprintf(stderr,"(%04d,%04d), (%04d,%04d)\n", x_min,ymax-y_max,x_max,ymax-y_min);
+ fprintf(stderr,"(%04d,%04d), (%04d,%04d)\n", x_min,height-y_max,x_max,height-y_min);
#endif
/* distance from the left edge to the leftmost point */
- hllx= (x_min*72.0)/resolution;
+ hllx= (x_min*pt_dpi_dbl)/resolution;
/* distance from the bottom edge to the bottommost point */
- hlly= ((ymax-y_max)*72.0)/resolution;
- /* distance from the left edge to the righmost point */
- hurx= (x_max*72.0)/resolution;
+ hlly= ((minus_one(height)-y_max)*pt_dpi_dbl)/resolution;
+ /* distance from the left edge to the righmost point */
+ hurx= (plus_one(x_max)*pt_dpi_dbl)/resolution;
/* distance from the bottom edge to the uppermost point */
- hury= ((ymax-y_min)*72.0)/resolution;
+ hury= ((height-y_min)*pt_dpi_dbl)/resolution;
if ( !tight )
@@ -295,25 +318,35 @@ readppm_and_calcbb(const char *name,
/* distance from the left edge to the leftmost point */
llx= minus_one((unsigned int) ((unsigned long) x_min*72UL)/resolution);
/* distance from the bottom edge to the bottommost point */
- lly= minus_one((unsigned int) ((unsigned long) (ymax-y_max)*72UL)/resolution);
- /* distance from the left edge to the righmost point */
- urx= plus_one((unsigned int) ((unsigned long) x_max*72UL)/resolution);
+ lly= minus_one((unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution);
+ /* distance from the left edge to the righmost point */
+ urx= plus_one((unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution);
/* distance from the bottom edge to the uppermost point */
- ury= plus_one((unsigned int) ((unsigned long) (ymax-y_min)*72UL)/resolution);
+ ury= plus_one((unsigned int) ((unsigned long) (height-y_min)*72UL)/resolution);
+
+ /* also loosen hires BBox by default precision */
+ if (hllx-round_precision >= 0.0)
+ hllx-= round_precision;
+ if (hlly-round_precision >= 0.0)
+ hlly-= round_precision;
+
+ hurx+= round_precision;
+ hury+= round_precision;
}
else /* tight bounding box */
{
/* distance from the left edge to the leftmost point */
llx= (unsigned int) ((unsigned long) x_min*72UL)/resolution;
/* distance from the bottom edge to the bottommost point */
- lly= (unsigned int) ((unsigned long) (ymax-y_max)*72UL)/resolution;
- /* distance from the left edge to the righmost point */
- urx= (unsigned int) ((unsigned long) x_max*72UL)/resolution;
- if ( (((unsigned long) x_max*72UL) % resolution) != 0 )
+ lly= (unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution;
+ /* distance from the left edge to the righmost point */
+ urx= (unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution;
+ /* round up if we got a remainder */
+ if ( (((unsigned long) plus_one(x_max)*72UL) % resolution) != 0 )
urx= plus_one(urx);
/* distance from the bottom edge to the uppermost point */
- ury= (unsigned int) ((unsigned long) (ymax-y_min)*72UL)/resolution;
- if ( (((unsigned long) (y_max-y_min)*72UL) % resolution) != 0 )
+ ury= (unsigned int) ((unsigned long) (height-y_min)*72UL)/resolution;
+ if ( (((unsigned long) (height-y_min)*72UL) % resolution) != 0 )
ury= plus_one(ury);
}
/* skip the rest of the file if any data is still present */
@@ -328,15 +361,15 @@ readppm_and_calcbb(const char *name,
}
else
fprintf(stderr,"%s: ERROR -- not enough memory to read in one row of the picture\n",prgname);
-
+
fclose(inputfile);
free(image_row);
}
-int
+int
main(int argc, char **argv)
-{
+{
int i;
char *filename= NULL;
unsigned int resolution= 72; /* use 72 dpi as default resolution */