summaryrefslogtreecommitdiff
path: root/tiff/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'tiff/contrib')
-rw-r--r--tiff/contrib/Makefile.am29
-rw-r--r--tiff/contrib/Makefile.in623
-rw-r--r--tiff/contrib/README2
-rw-r--r--tiff/contrib/acorn/Makefile.acorn165
-rw-r--r--tiff/contrib/acorn/Makefile.am28
-rw-r--r--tiff/contrib/acorn/Makefile.in421
-rw-r--r--tiff/contrib/acorn/ReadMe79
-rw-r--r--tiff/contrib/acorn/SetVars3
-rw-r--r--tiff/contrib/acorn/cleanlib5
-rw-r--r--tiff/contrib/acorn/convert175
-rw-r--r--tiff/contrib/acorn/install128
-rw-r--r--tiff/contrib/addtiffo/Makefile.am36
-rw-r--r--tiff/contrib/addtiffo/Makefile.in556
-rw-r--r--tiff/contrib/addtiffo/Makefile.vc28
-rw-r--r--tiff/contrib/addtiffo/README142
-rw-r--r--tiff/contrib/addtiffo/addtiffo.c176
-rw-r--r--tiff/contrib/addtiffo/tif_overview.c896
-rw-r--r--tiff/contrib/addtiffo/tif_ovrcache.c341
-rw-r--r--tiff/contrib/addtiffo/tif_ovrcache.h108
-rw-r--r--tiff/contrib/dbs/Makefile.am43
-rw-r--r--tiff/contrib/dbs/Makefile.in737
-rw-r--r--tiff/contrib/dbs/README7
-rw-r--r--tiff/contrib/dbs/tiff-bi.c91
-rw-r--r--tiff/contrib/dbs/tiff-grayscale.c146
-rw-r--r--tiff/contrib/dbs/tiff-palette.c283
-rw-r--r--tiff/contrib/dbs/tiff-rgb.c201
-rw-r--r--tiff/contrib/dbs/xtiff/Makefile.am43
-rw-r--r--tiff/contrib/dbs/xtiff/Makefile.in436
-rw-r--r--tiff/contrib/dbs/xtiff/README6
-rw-r--r--tiff/contrib/dbs/xtiff/patchlevel.h8
-rw-r--r--tiff/contrib/dbs/xtiff/xtiff.c1290
-rw-r--r--tiff/contrib/dbs/xtiff/xtifficon.h21
-rw-r--r--tiff/contrib/iptcutil/Makefile.am36
-rw-r--r--tiff/contrib/iptcutil/Makefile.in553
-rw-r--r--tiff/contrib/iptcutil/README25
-rw-r--r--tiff/contrib/iptcutil/iptcutil.c941
-rw-r--r--tiff/contrib/iptcutil/test.iptcbin0 -> 1107 bytes
-rw-r--r--tiff/contrib/iptcutil/test.txt32
-rw-r--r--tiff/contrib/mac-cw/Makefile.am27
-rw-r--r--tiff/contrib/mac-cw/Makefile.in420
-rw-r--r--tiff/contrib/mac-cw/Makefile.script72
-rw-r--r--tiff/contrib/mac-cw/README18
-rw-r--r--tiff/contrib/mac-cw/mac_main.c27
-rw-r--r--tiff/contrib/mac-cw/mac_main.h19
-rw-r--r--tiff/contrib/mac-cw/metrowerks.note84
-rw-r--r--tiff/contrib/mac-cw/mkg3_main.c21
-rw-r--r--tiff/contrib/mac-cw/version.h11
-rw-r--r--tiff/contrib/mac-mpw/BUILD.mpw47
-rw-r--r--tiff/contrib/mac-mpw/Makefile.am27
-rw-r--r--tiff/contrib/mac-mpw/Makefile.in420
-rw-r--r--tiff/contrib/mac-mpw/README20
-rw-r--r--tiff/contrib/mac-mpw/libtiff.make202
-rw-r--r--tiff/contrib/mac-mpw/mactrans.c63
-rw-r--r--tiff/contrib/mac-mpw/port.make53
-rw-r--r--tiff/contrib/mac-mpw/tools.make138
-rw-r--r--tiff/contrib/mac-mpw/top.make133
-rw-r--r--tiff/contrib/mfs/Makefile.am28
-rw-r--r--tiff/contrib/mfs/Makefile.in421
-rw-r--r--tiff/contrib/mfs/README37
-rw-r--r--tiff/contrib/mfs/mfs_file.c586
-rw-r--r--tiff/contrib/pds/Makefile.am28
-rw-r--r--tiff/contrib/pds/Makefile.in421
-rw-r--r--tiff/contrib/pds/README90
-rw-r--r--tiff/contrib/pds/tif_imageiter.c525
-rw-r--r--tiff/contrib/pds/tif_imageiter.h64
-rw-r--r--tiff/contrib/pds/tif_pdsdirread.c1131
-rw-r--r--tiff/contrib/pds/tif_pdsdirwrite.c971
-rw-r--r--tiff/contrib/ras/Makefile.am28
-rw-r--r--tiff/contrib/ras/Makefile.in421
-rw-r--r--tiff/contrib/ras/README10
-rw-r--r--tiff/contrib/ras/ras2tif.c254
-rw-r--r--tiff/contrib/ras/tif2ras.c344
-rw-r--r--tiff/contrib/stream/Makefile.am28
-rw-r--r--tiff/contrib/stream/Makefile.in421
-rw-r--r--tiff/contrib/stream/README30
-rw-r--r--tiff/contrib/stream/tiffstream.cpp238
-rw-r--r--tiff/contrib/stream/tiffstream.h69
-rw-r--r--tiff/contrib/tags/Makefile.am28
-rw-r--r--tiff/contrib/tags/Makefile.in421
-rw-r--r--tiff/contrib/tags/README132
-rw-r--r--tiff/contrib/tags/listtif.c39
-rw-r--r--tiff/contrib/tags/maketif.c77
-rw-r--r--tiff/contrib/tags/xtif_dir.c350
-rw-r--r--tiff/contrib/tags/xtiffio.h59
-rw-r--r--tiff/contrib/tags/xtiffiop.h72
-rw-r--r--tiff/contrib/win_dib/Makefile.am28
-rw-r--r--tiff/contrib/win_dib/Makefile.in421
-rw-r--r--tiff/contrib/win_dib/Makefile.w95134
-rw-r--r--tiff/contrib/win_dib/README.Tiffile31
-rw-r--r--tiff/contrib/win_dib/README.tiff2dib51
-rw-r--r--tiff/contrib/win_dib/Tiffile.cpp449
-rw-r--r--tiff/contrib/win_dib/tiff2dib.c379
92 files changed, 19458 insertions, 0 deletions
diff --git a/tiff/contrib/Makefile.am b/tiff/contrib/Makefile.am
new file mode 100644
index 0000000..574b67b
--- /dev/null
+++ b/tiff/contrib/Makefile.am
@@ -0,0 +1,29 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README
+
+SUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs pds ras stream tags win_dib
+
diff --git a/tiff/contrib/Makefile.in b/tiff/contrib/Makefile.in
new file mode 100644
index 0000000..3a7bb9d
--- /dev/null
+++ b/tiff/contrib/Makefile.in
@@ -0,0 +1,623 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README
+SUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs pds ras stream tags win_dib
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am 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-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/README b/tiff/contrib/README
new file mode 100644
index 0000000..26b7c5f
--- /dev/null
+++ b/tiff/contrib/README
@@ -0,0 +1,2 @@
+This directory contains various contributions from libtiff users.
+
diff --git a/tiff/contrib/acorn/Makefile.acorn b/tiff/contrib/acorn/Makefile.acorn
new file mode 100644
index 0000000..8f01477
--- /dev/null
+++ b/tiff/contrib/acorn/Makefile.acorn
@@ -0,0 +1,165 @@
+# Project: LibTIFF
+
+
+# Toolflags:
+CCflags = -c -zo -ffah -depend !Depend -IC:
+C++flags = -c -depend !Depend -IC: -throwback
+Linkflags = -aif -c++ -o $@
+DrLinkflags = -nounused -aif -c++ -o $@
+ObjAsmflags = -throwback -NoCache -depend !Depend
+CMHGflags =
+LibFileflags = -c -o $@
+Squeezeflags = -o $@
+
+
+# Final targets:
+@.o.LIBTIFF: \
+ @.o.tif_acorn \
+ @.o.tif_aux \
+ @.o.tif_close \
+ @.o.tif_codec \
+ @.o.tif_compress \
+ @.o.tif_dir \
+ @.o.tif_dirinfo \
+ @.o.tif_dirread \
+ @.o.tif_dirwrite \
+ @.o.tif_dumpmode \
+ @.o.tif_error \
+ @.o.tif_fax3 \
+ @.o.tif_flush \
+ @.o.tif_getimage \
+ @.o.tif_jpeg \
+ @.o.tif_lzw \
+ @.o.tif_next \
+ @.o.tif_open \
+ @.o.tif_packbits \
+ @.o.tif_predict \
+ @.o.tif_print \
+ @.o.tif_read \
+ @.o.tif_strip \
+ @.o.tif_swab \
+ @.o.tif_thunder \
+ @.o.tif_tile \
+ @.o.tif_version \
+ @.o.tif_warning \
+ @.o.tif_write \
+ @.o.tif_zip \
+ @.o.tif_fax3sm \
+ @.h.version
+ LibFile $(LibFileflags) \
+ @.o.tif_acorn \
+ @.o.tif_aux \
+ @.o.tif_close \
+ @.o.tif_codec \
+ @.o.tif_compress \
+ @.o.tif_dir \
+ @.o.tif_dirinfo \
+ @.o.tif_dirread \
+ @.o.tif_dirwrite \
+ @.o.tif_dumpmode \
+ @.o.tif_error \
+ @.o.tif_fax3 \
+ @.o.tif_flush \
+ @.o.tif_getimage \
+ @.o.tif_jpeg \
+ @.o.tif_lzw \
+ @.o.tif_next \
+ @.o.tif_open \
+ @.o.tif_packbits \
+ @.o.tif_predict \
+ @.o.tif_print \
+ @.o.tif_read \
+ @.o.tif_strip \
+ @.o.tif_swab \
+ @.o.tif_thunder \
+ @.o.tif_tile \
+ @.o.tif_version \
+ @.o.tif_warning \
+ @.o.tif_write \
+ @.o.tif_zip \
+ @.o.tif_fax3sm
+
+
+# User-editable dependencies:
+@.mkversion: @.o.mkversion C:o.Stubs
+ Link $(linkflags) @.o.mkversion C:o.Stubs
+@.h.version: @.VERSION @.mkversion
+ <Prefix$Dir>.mkversion -v @.VERSION -a @.tiff/alpha @.h.version
+@.mkg3states: @.o.mkg3states @.o.getopt C:o.Stubs
+ link $(linkflags) @.o.mkg3states C:o.Stubs @.o.getopt
+@.c.tif_fax3sm: @.mkg3states
+ <Prefix$Dir>.mkg3states -c const @.c.tif_fax3sm
+
+# Static dependencies:
+@.o.tif_acorn: @.c.tif_acorn
+ cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn
+@.o.tif_aux: @.c.tif_aux
+ cc $(ccflags) -o @.o.tif_aux @.c.tif_aux
+@.o.tif_close: @.c.tif_close
+ cc $(ccflags) -o @.o.tif_close @.c.tif_close
+@.o.tif_codec: @.c.tif_codec
+ cc $(ccflags) -o @.o.tif_codec @.c.tif_codec
+@.o.tif_compress: @.c.tif_compress
+ cc $(ccflags) -o @.o.tif_compress @.c.tif_compress
+@.o.tif_dir: @.c.tif_dir
+ cc $(ccflags) -o @.o.tif_dir @.c.tif_dir
+@.o.tif_dirinfo: @.c.tif_dirinfo
+ cc $(ccflags) -o @.o.tif_dirinfo @.c.tif_dirinfo
+@.o.tif_dirread: @.c.tif_dirread
+ cc $(ccflags) -o @.o.tif_dirread @.c.tif_dirread
+@.o.tif_dirwrite: @.c.tif_dirwrite
+ cc $(ccflags) -o @.o.tif_dirwrite @.c.tif_dirwrite
+@.o.tif_dumpmode: @.c.tif_dumpmode
+ cc $(ccflags) -o @.o.tif_dumpmode @.c.tif_dumpmode
+@.o.tif_error: @.c.tif_error
+ cc $(ccflags) -o @.o.tif_error @.c.tif_error
+@.o.tif_fax3: @.c.tif_fax3
+ cc $(ccflags) -o @.o.tif_fax3 @.c.tif_fax3
+@.o.tif_flush: @.c.tif_flush
+ cc $(ccflags) -o @.o.tif_flush @.c.tif_flush
+@.o.tif_getimage: @.c.tif_getimage
+ cc $(ccflags) -o @.o.tif_getimage @.c.tif_getimage
+@.o.tif_jpeg: @.c.tif_jpeg
+ cc $(ccflags) -o @.o.tif_jpeg @.c.tif_jpeg
+@.o.tif_lzw: @.c.tif_lzw
+ cc $(ccflags) -o @.o.tif_lzw @.c.tif_lzw
+@.o.tif_next: @.c.tif_next
+ cc $(ccflags) -o @.o.tif_next @.c.tif_next
+@.o.tif_open: @.c.tif_open
+ cc $(ccflags) -o @.o.tif_open @.c.tif_open
+@.o.tif_packbits: @.c.tif_packbits
+ cc $(ccflags) -o @.o.tif_packbits @.c.tif_packbits
+@.o.tif_predict: @.c.tif_predict
+ cc $(ccflags) -o @.o.tif_predict @.c.tif_predict
+@.o.tif_print: @.c.tif_print
+ cc $(ccflags) -o @.o.tif_print @.c.tif_print
+@.o.tif_read: @.c.tif_read
+ cc $(ccflags) -o @.o.tif_read @.c.tif_read
+@.o.tif_strip: @.c.tif_strip
+ cc $(ccflags) -o @.o.tif_strip @.c.tif_strip
+@.o.tif_swab: @.c.tif_swab
+ cc $(ccflags) -o @.o.tif_swab @.c.tif_swab
+@.o.tif_thunder: @.c.tif_thunder
+ cc $(ccflags) -o @.o.tif_thunder @.c.tif_thunder
+@.o.tif_tile: @.c.tif_tile
+ cc $(ccflags) -o @.o.tif_tile @.c.tif_tile
+@.o.tif_version: @.c.tif_version
+ cc $(ccflags) -o @.o.tif_version @.c.tif_version
+@.o.tif_warning: @.c.tif_warning
+ cc $(ccflags) -o @.o.tif_warning @.c.tif_warning
+@.o.tif_write: @.c.tif_write
+ cc $(ccflags) -o @.o.tif_write @.c.tif_write
+@.o.tif_zip: @.c.tif_zip
+ cc $(ccflags) -o @.o.tif_zip @.c.tif_zip
+@.o.mkg3states: @.c.mkg3states
+ cc $(ccflags) -o @.o.mkg3states @.c.mkg3states
+@.o.getopt: @.c.getopt
+ cc $(ccflags) -o @.o.getopt @.c.getopt
+@.o.mkspans: @.c.mkspans
+ cc $(ccflags) -o @.o.mkspans @.c.mkspans
+@.o.tif_fax3sm: @.c.tif_fax3sm
+ cc $(ccflags) -o @.o.tif_fax3sm @.c.tif_fax3sm
+@.o.mkversion: @.c.mkversion
+ cc $(ccflags) -o @.o.mkversion @.c.mkversion
+
+# Dynamic dependencies:
diff --git a/tiff/contrib/acorn/Makefile.am b/tiff/contrib/acorn/Makefile.am
new file mode 100644
index 0000000..ca2b132
--- /dev/null
+++ b/tiff/contrib/acorn/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/acorn/Makefile.in b/tiff/contrib/acorn/Makefile.in
new file mode 100644
index 0000000..593bda9
--- /dev/null
+++ b/tiff/contrib/acorn/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/acorn
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/acorn/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/acorn/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/acorn/ReadMe b/tiff/contrib/acorn/ReadMe
new file mode 100644
index 0000000..dc16a79
--- /dev/null
+++ b/tiff/contrib/acorn/ReadMe
@@ -0,0 +1,79 @@
+Building the Software on an Acorn RISC OS system
+
+The directory contrib/acorn contains support for compiling the library under
+Acorn C/C++ under Acorn's RISC OS 3.10 or above. Subsequent pathnames will
+use the Acorn format: The full-stop or period character is a pathname
+delimeter, and the slash character is not interpreted; the reverse position
+from Unix. Thus "libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c".
+
+This support was contributed by Peter Greenham.
+(peterg@angmulti.demon.co.uk).
+
+Installing LibTIFF:
+
+LIBTIFF uses several files which have names longer than the normal RISC OS
+maximum of ten characters. This complicates matters. Maybe one day Acorn will
+address the problem and implement long filenames properly. Until then this
+gets messy, especially as I'm trying to do this with obeyfiles and not have
+to include binaries in this distribution.
+
+First of all, ensure you have Truncate configured on (type *Configure
+Truncate On) Although it is, of course, preferable to have long filenames,
+LIBTIFF can be installed with short filenames, and it will compile and link
+without problems. However, getting it there is more problematic.
+contrib.acorn.install is an installation obeyfile which will create a normal
+Acorn-style library from the source (ie: with c, h and o folders etc.), but
+needs the distribution library to have been unpacked into a location which is
+capable of supporting long filenames, even if only temporarily.
+
+My recommendation, until Acorn address this problem properly, is to use Jason
+Tribbeck's LongFilenames , or any other working system that gives you long
+filenames, like a nearby NFS server for instance.
+
+If you are using Longfilenames, even if only temporarily to install LIBTIFF,
+unpack the TAR into a RAMDisc which has been longfilenamed (ie: *addlongfs
+ram) and then install from there to the hard disk. Unfortunately
+Longfilenames seems a bit unhappy about copying a bunch of long-named files
+across the same filing system, but is happy going between systems. You'll
+need to create a ramdisk of about 2Mb.
+
+Now you can run the installation script I've supplied (in contrib.acorn),
+which will automate the process of installing LIBTIFF as an Acorn-style
+library. The syntax is as follows:
+
+install <source_dir> <dest_dir>
+
+Install will then create <dest_dir> and put the library in there. For
+example, having used LongFilenames on the RAMDisk and unpacked the library
+into there, you can then type:
+
+Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ ADFS::4.$.LIBTIFF
+
+It doesn't matter if the destination location can cope with long filenames or
+not. The filenames will be truncated if necessary (*Configure Truncate On if
+you get errors) and all will be well.
+
+Compiling LibTIFF:
+
+Once the LibTIFF folder has been created and the files put inside, making the
+library should be just a matter of running 'SetVars' to set the appropriate
+system variables, then running 'Makefile'.
+
+OSLib
+
+OSLib is a comprehensive API for RISC OS machines, written by Jonathan
+Coxhead of Acorn Computers (although OSLib is not an official Acorn product).
+Using the OSLib SWI veneers produces code which is more compact and more
+efficient than code written using _kernel_swi or _swi. The Acorn port of
+LibTIFF can take advantage of this if present. Edit the Makefile and go to
+the Static dependencies section. The first entry is:
+
+# Static dependencies:
+@.o.tif_acorn: @.c.tif_acorn
+ cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn
+Change the cc line to:
+
+ cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn
+
+Remember, however, that OSLib is only recommended for efficiency's sake. It
+is not required.
diff --git a/tiff/contrib/acorn/SetVars b/tiff/contrib/acorn/SetVars
new file mode 100644
index 0000000..ea12d71
--- /dev/null
+++ b/tiff/contrib/acorn/SetVars
@@ -0,0 +1,3 @@
+Set LibTIFF$Dir <Obey$Dir>
+Set LibTIFF$Path <LibTIFF$Dir>.
+Set C$Path <C$Path>,LibTIFF:
diff --git a/tiff/contrib/acorn/cleanlib b/tiff/contrib/acorn/cleanlib
new file mode 100644
index 0000000..78a2d03
--- /dev/null
+++ b/tiff/contrib/acorn/cleanlib
@@ -0,0 +1,5 @@
+IfThere LibTIFF:o.* THEN Wipe LibTIFF:o.* ~CFR~V
+IfThere LibTIFF:c.tif_fax3sm THEN Delete LibTIFF:c.tif_fax3sm
+IfThere LibTIFF:mkg3states THEN Delete LibTIFF:mkg3states
+IfThere LibTIFF:h.version THEN Delete LibTIFF:h.version
+IfThere LibTIFF:mkversion THEN Delete LibTIFF:mkversion
diff --git a/tiff/contrib/acorn/convert b/tiff/contrib/acorn/convert
new file mode 100644
index 0000000..1f64ed2
--- /dev/null
+++ b/tiff/contrib/acorn/convert
@@ -0,0 +1,175 @@
+RISC OS Conversion log
+======================
+
+mkversion.c
+~~~~~~~~~~~
+The RISC OS command-line does not allow the direct creation of the version.h
+file in the proper manner. To remedy this in such a way that the version
+header is made at compiletime, I wrote this small program. It is fully
+portable, so should work quite happily for any other platform that might need
+it.
+
+msg3states.c
+~~~~~~~~~~~~
+Needed getopt.c from the port folder, then compiled and worked fine.
+
+
+tiff.h
+~~~~~~
+
+====1====
+
+The symbol _MIPS_SZLONG, if not defined, causes a compiler error. Fixed by
+ensuring it does exist. This looks to me like this wouldn't be an
+Acorn-specific problem. The new code fragment is as follows:
+
+#ifndef _MIPS_SZLONG
+#define _MIPS_SZLONG 32
+#endif
+#if defined(__alpha) || _MIPS_SZLONG == 64
+
+
+
+tiffcomp.h
+~~~~~~~~~~
+
+====1====
+
+#if !defined(__MWERKS__) && !defined(THINK_C)
+#include <sys/types.h>
+#endif
+
+Acorn also doesn't have this header so:
+
+#if !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acorn)
+#include <sys/types.h>
+#endif
+
+====2====
+
+#ifdef VMS
+#include <file.h>
+#include <unixio.h>
+#else
+#include <fcntl.h>
+#endif
+
+This seems to indicate that fcntl.h is included on all systems except
+VMS. Odd, because I've never heard of it before. Sure it's in the ANSI
+definition? Anyway, following change:
+
+#ifdef VMS
+#include <file.h>
+#include <unixio.h>
+#else
+#ifndef __acorn
+#include <fcntl.h>
+#endif
+#endif
+
+This will probably change when I find out what it wants from fcntl.h!
+
+====3====
+
+#if defined(__MWERKS__) || defined(THINK_C) || defined(applec)
+#include <stdlib.h>
+#define BSDTYPES
+#endif
+
+Added RISC OS to above thus:
+
+#if defined(__MWERKS__) || defined(THINK_C) || defined(applec) || defined(__acorn)
+#include <stdlib.h>
+#define BSDTYPES
+#endif
+
+====4====
+
+/*
+ * The library uses the ANSI C/POSIX SEEK_*
+ * definitions that should be defined in unistd.h
+ * (except on VMS where they are in stdio.h and
+ * there is no unistd.h).
+ */
+#ifndef SEEK_SET
+#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__)
+#include <unistd.h>
+#endif
+
+RISC OS is like VMS and Mac in this regard. So changed to:
+
+/*
+ * The library uses the ANSI C/POSIX SEEK_*
+ * definitions that should be defined in unistd.h
+ * (except on VMS or the Mac or RISC OS, where they are in stdio.h and
+ * there is no unistd.h).
+ */
+#ifndef SEEK_SET
+#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__) && !defined(__acorn)
+#include <unistd.h>
+#endif
+#endif
+
+====5====
+
+NB: HAVE_IEEEFP is defined in tiffconf.h, not tiffcomp.h as mentioned
+in libtiff.README. (Note written on original port from 3.4beta004)
+
+Acorn C/C++ claims to accord with IEEE 754, so no change (yet) to
+tiffconf.h.
+
+====6====
+
+Unsure about whether this compiler supports inline functions. Will
+leave it on for the time being and see if it works! (Likely if
+everything else does.)
+
+... Seems to be OK ...
+
+====7====
+
+Added to the end:
+
+/*
+ * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
+ * on C alone. For that reason, the relevant functions have been
+ * implemented by myself in tif_acorn.c, and the elements from the header
+ * included here.
+ */
+
+#ifdef __acorn
+#ifdef __cplusplus
+#include <osfcn.h>
+#else
+#include "kernel.h"
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+#define O_APPEND 8
+#define O_CREAT 0x200
+#define O_TRUNC 0x400
+typedef long off_t;
+extern int open(const char *name, int flags, int mode);
+extern int close(int fd);
+extern int write(int fd, const char *buf, int nbytes);
+extern int read(int fd, char *buf, int nbytes);
+extern off_t lseek(int fd, off_t offset, int whence);
+#endif
+#endif
+
+
+===============================================================================
+
+tif_acorn.c
+~~~~~~~~~~~
+
+Created file tif_acorn.c, copied initially from tif_unix.c
+
+Documented internally where necessary.
+
+Note that I have implemented the low-level file-handling functions normally
+found in osfcn.h in here, and put the header info at the bottom of
+tiffcomp.h. This is further documented from a RISC OS perspective inside the
+file.
+
+===============================================================================
diff --git a/tiff/contrib/acorn/install b/tiff/contrib/acorn/install
new file mode 100644
index 0000000..fa49d1b
--- /dev/null
+++ b/tiff/contrib/acorn/install
@@ -0,0 +1,128 @@
+If "%0" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
+If "%1" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
+Set LibTiffInstall$Dir %0
+Set LibTiff$Dir %1
+Set Alias$CPY Copy <LibTiffInstall$Dir>.%%0 <LibTiff$Dir>.%%1 ~C~DF~NRV
+CDir <LibTiff$Dir>
+CDir <LibTiff$Dir>.c
+CDir <LibTiff$Dir>.h
+CDir <LibTiff$Dir>.o
+CPY COPYRIGHT COPYRIGHT
+CPY README README
+CPY VERSION VERSION
+CPY dist.tiff/alpha tiff/alpha
+CPY contrib.acorn.SetVars SetVars
+CPY contrib.acorn.Makefile Makefile
+CPY contrib.acorn.cleanlib cleanlib
+CPY port.getopt/c c.getopt
+CPY libtiff.mkg3states/c c.mkg3states
+CPY libtiff.mkspans/c c.mkspans
+CPY libtiff.mkversion/c c.mkversion
+CPY libtiff.tif_acorn/c c.tif_acorn
+CPY libtiff.tif_aux/c c.tif_aux
+CPY libtiff.tif_close/c c.tif_close
+CPY libtiff.tif_codec/c c.tif_codec
+CPY libtiff.tif_compress/c c.tif_compre
+CPY libtiff.tif_dir/c c.tif_dir
+CPY libtiff.tif_dirinfo/c c.tif_dirinf
+CPY libtiff.tif_dirread/c c.tif_dirrea
+CPY libtiff.tif_dirwrite/c c.tif_dirwri
+CPY libtiff.tif_dumpmode/c c.tif_dumpmo
+CPY libtiff.tif_error/c c.tif_error
+CPY libtiff.tif_fax3/c c.tif_fax3
+CPY libtiff.tif_flush/c c.tif_flush
+CPY libtiff.tif_getimage/c c.tif_getima
+CPY libtiff.tif_jpeg/c c.tif_jpeg
+CPY libtiff.tif_lzw/c c.tif_lzw
+CPY libtiff.tif_next/c c.tif_next
+CPY libtiff.tif_open/c c.tif_open
+CPY libtiff.tif_packbits/c c.tif_packbi
+CPY libtiff.tif_predict/c c.tif_predic
+CPY libtiff.tif_print/c c.tif_print
+CPY libtiff.tif_read/c c.tif_read
+CPY libtiff.tif_strip/c c.tif_strip
+CPY libtiff.tif_swab/c c.tif_swab
+CPY libtiff.tif_thunder/c c.tif_thunde
+CPY libtiff.tif_tile/c c.tif_tile
+CPY libtiff.tif_version/c c.tif_versio
+CPY libtiff.tif_warning/c c.tif_warnin
+CPY libtiff.tif_write/c c.tif_write
+CPY libtiff.tif_zip/c c.tif_zip
+CPY libtiff.t4/h h.t4
+CPY libtiff.tiff/h h.tiff
+CPY libtiff.tiffcomp/h h.tiffcomp
+CPY libtiff.tiffconf/h h.tiffconf
+CPY libtiff.tiffio/h h.tiffio
+CPY libtiff.tiffiop/h h.tiffiop
+CPY libtiff.tif_dir/h h.tif_dir
+CPY libtiff.tif_fax3/h h.tif_fax3
+CPY libtiff.tif_predict/h h.tif_predic
+SetType <LibTiff$Dir>.COPYRIGHT Text
+SetType <LibTiff$Dir>.README Text
+SetType <LibTiff$Dir>.VERSION Text
+SetType <LibTiff$Dir>.tiff/alpha Text
+SetType <LibTiff$Dir>.SetVars Obey
+SetType <LibTiff$Dir>.Makefile fe1
+SetType <LibTiff$Dir>.cleanlib Obey
+SetType <LibTiff$Dir>.c.getopt Text
+SetType <LibTiff$Dir>.c.mkg3states Text
+SetType <LibTiff$Dir>.c.mkspans Text
+SetType <LibTiff$Dir>.c.mkversion Text
+SetType <LibTiff$Dir>.c.tif_acorn Text
+SetType <LibTiff$Dir>.c.tif_aux Text
+SetType <LibTiff$Dir>.c.tif_close Text
+SetType <LibTiff$Dir>.c.tif_codec Text
+SetType <LibTiff$Dir>.c.tif_compre Text
+SetType <LibTiff$Dir>.c.tif_dir Text
+SetType <LibTiff$Dir>.c.tif_dirinf Text
+SetType <LibTiff$Dir>.c.tif_dirrea Text
+SetType <LibTiff$Dir>.c.tif_dirwri Text
+SetType <LibTiff$Dir>.c.tif_dumpmo Text
+SetType <LibTiff$Dir>.c.tif_error Text
+SetType <LibTiff$Dir>.c.tif_fax3 Text
+SetType <LibTiff$Dir>.c.tif_flush Text
+SetType <LibTiff$Dir>.c.tif_getima Text
+SetType <LibTiff$Dir>.c.tif_jpeg Text
+SetType <LibTiff$Dir>.c.tif_lzw Text
+SetType <LibTiff$Dir>.c.tif_next Text
+SetType <LibTiff$Dir>.c.tif_open Text
+SetType <LibTiff$Dir>.c.tif_packbi Text
+SetType <LibTiff$Dir>.c.tif_predic Text
+SetType <LibTiff$Dir>.c.tif_print Text
+SetType <LibTiff$Dir>.c.tif_read Text
+SetType <LibTiff$Dir>.c.tif_strip Text
+SetType <LibTiff$Dir>.c.tif_swab Text
+SetType <LibTiff$Dir>.c.tif_thunde Text
+SetType <LibTiff$Dir>.c.tif_tile Text
+SetType <LibTiff$Dir>.c.tif_versio Text
+SetType <LibTiff$Dir>.c.tif_warnin Text
+SetType <LibTiff$Dir>.c.tif_write Text
+SetType <LibTiff$Dir>.c.tif_zip Text
+SetType <LibTiff$Dir>.h.t4 Text
+SetType <LibTiff$Dir>.h.tiff Text
+SetType <LibTiff$Dir>.h.tiffcomp Text
+SetType <LibTiff$Dir>.h.tiffconf Text
+SetType <LibTiff$Dir>.h.tiffio Text
+SetType <LibTiff$Dir>.h.tiffiop Text
+SetType <LibTiff$Dir>.h.tif_dir Text
+SetType <LibTiff$Dir>.h.tif_fax3 Text
+SetType <LibTiff$Dir>.h.tif_predic Text
+Unset Alias$CPY
+Unset LibTiffInstall$Dir
+| Now attempt to restore longfilename status. If it causes an error, OK.
+Set Alias$RN Rename <LibTiff$Dir>.%%0 <LibTiff$Dir>.%%1
+Unset LibTiff$Dir
+RN c.tif_compre c.tif_compress
+RN c.tif_dirinf c.tif_dirinfo
+RN c.tif_dirrea c.tif_dirread
+RN c.tif_dirwri c.tif_dirwrite
+RN c.tif_dumpmo c.tif_dumpmode
+RN c.tif_getima c.tif_getimage
+RN c.tif_packbi c.tif_packbits
+RN c.tif_predic c.tif_predict
+RN c.tif_thunde c.tif_thunder
+RN c.tif_versio c.tif_version
+RN c.tif_warnin c.tif_warning
+RN h.tif_predic h.tif_predict
+Unset Alias$RN
+Echo All done!
diff --git a/tiff/contrib/addtiffo/Makefile.am b/tiff/contrib/addtiffo/Makefile.am
new file mode 100644
index 0000000..f3158ef
--- /dev/null
+++ b/tiff/contrib/addtiffo/Makefile.am
@@ -0,0 +1,36 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README Makefile.vc
+
+noinst_PROGRAMS = addtiffo
+
+addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
+addtiffo_LDADD = $(LIBTIFF)
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+
diff --git a/tiff/contrib/addtiffo/Makefile.in b/tiff/contrib/addtiffo/Makefile.in
new file mode 100644
index 0000000..4cf406f
--- /dev/null
+++ b/tiff/contrib/addtiffo/Makefile.in
@@ -0,0 +1,556 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = addtiffo$(EXEEXT)
+subdir = contrib/addtiffo
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_addtiffo_OBJECTS = addtiffo.$(OBJEXT) tif_overview.$(OBJEXT) \
+ tif_ovrcache.$(OBJEXT)
+addtiffo_OBJECTS = $(am_addtiffo_OBJECTS)
+addtiffo_DEPENDENCIES = $(LIBTIFF)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(addtiffo_SOURCES)
+DIST_SOURCES = $(addtiffo_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README Makefile.vc
+addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
+addtiffo_LDADD = $(LIBTIFF)
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/addtiffo/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/addtiffo/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+addtiffo$(EXEEXT): $(addtiffo_OBJECTS) $(addtiffo_DEPENDENCIES)
+ @rm -f addtiffo$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(addtiffo_OBJECTS) $(addtiffo_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addtiffo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_overview.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ovrcache.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/addtiffo/Makefile.vc b/tiff/contrib/addtiffo/Makefile.vc
new file mode 100644
index 0000000..2777dc2
--- /dev/null
+++ b/tiff/contrib/addtiffo/Makefile.vc
@@ -0,0 +1,28 @@
+#
+# If libtiff.a is installed in /usr/lib or /usr/local/lib just point
+# LIBTIFF_DIR there. It doesn't need a full libtiff tree.
+#
+!INCLUDE ..\..\nmake.opt
+
+LIBTIFF_DIR = ..\..\libtiff
+#
+INCL = -I..\..\libtiff
+LIBS = $(LIBTIFF_DIR)\libtiff.lib
+
+addtiffo: addtiffo.obj tif_overview.obj tif_ovrcache.obj
+ $(CC) $(CFLAGS) addtiffo.obj tif_overview.obj tif_ovrcache.obj \
+ $(LIBS) /Feaddtiffo.exe
+
+
+addtiffo.obj: addtiffo.c
+ $(CC) -c $(CFLAGS) addtiffo.c
+
+tif_overview.obj: tif_overview.c
+ $(CC) -c $(CFLAGS) tif_overview.c
+
+tif_ovrcache.obj: tif_ovrcache.c
+ $(CC) -c $(CFLAGS) tif_ovrcache.c
+
+clean:
+ -del *.obj
+ -del addtiffo.exe
diff --git a/tiff/contrib/addtiffo/README b/tiff/contrib/addtiffo/README
new file mode 100644
index 0000000..a6ca45f
--- /dev/null
+++ b/tiff/contrib/addtiffo/README
@@ -0,0 +1,142 @@
+ addtiffo 1.0
+ ============
+
+The addtiffo utility is used to add overview pyramids to an existing
+TIFF or GeoTIFF file. Some applications can take advantage of these
+overviews to accelerate overview display performance of large rasters.
+
+This release of addtiffo is primarily intended for compatibility testing
+with applications, and to see if there is interest in a cleaner release
+of the capability ... perhaps incorporation into the libtiff tools
+distribution.
+
+Please feel free to contact me with questions, or problems.
+
+warmerda@home.com
+http://home.gdal.org/~warmerda/
+
+
+Usage
+-----
+
+Usage: addtiffo [-r {average/nearest} [-subifd]
+ tiff_filename [resolution_reductions]
+
+Example:
+ % addtiffo abc.tif 2 4 8 16
+
+The numeric arguments are the list of reduction factors to
+generate. In this example a 1/2, 1/4 1/8 and 1/16
+
+
+
+Limitations
+-----------
+
+See tif_overview.cpp for up to date details.
+
+ o Currently only images with bits_per_sample of a multiple of eight
+ will work.
+
+ o The code will attempt to use the same kind of compression,
+ photometric interpretation, and organization as the source image, but
+ it doesn't copy geotiff tags to the reduced resolution images.
+
+ o Reduced resolution overviews for multi-sample files will currently
+ always be generated as PLANARCONFIG_SEPARATE. This could be fixed
+ reasonable easily if needed to improve compatibility with other
+ packages. Many don't properly support PLANARCONFIG_SEPARATE.
+
+ o Overviews are always written as appended IFDs, rather than using the
+ ``tree of tree's'' approach using the SUBIFD tag. I wanted to implement
+ both, but it isn't currently easy to add a SUBIFD tag to an existing
+ main tiff IFD with libtiff. I hope to try this again later.
+
+
+TIFF File Tags
+--------------
+
+The results of running addtiffo on a 1024x1024 tiled greyscale file
+with the arguments ``2 4 8 16'' is to add four additional TIFF directories
+appended on the file with the SUBFILETYPE flag to 0x1 indicating the extra
+items are reduced resolution images.
+
+The tiffinfo output of such a file might look like this:
+
+TIFF Directory at offset 0x118008
+ Image Width: 1024 Image Length: 1024
+ Tile Width: 256 Tile Length: 112
+ Bits/Sample: 8
+ Compression Scheme: none
+ Photometric Interpretation: min-is-black
+ Samples/Pixel: 1
+ Planar Configuration: single image plane
+TIFF Directory at offset 0x15e1d2
+ Subfile Type: reduced-resolution image (1 = 0x1)
+ Image Width: 512 Image Length: 512
+ Tile Width: 256 Tile Length: 112
+ Bits/Sample: 8
+ Compression Scheme: none
+ Photometric Interpretation: min-is-black
+ Samples/Pixel: 1
+ Planar Configuration: separate image planes
+TIFF Directory at offset 0x1732b8
+ Subfile Type: reduced-resolution image (1 = 0x1)
+ Image Width: 256 Image Length: 256
+ Tile Width: 256 Tile Length: 112
+ Bits/Sample: 8
+ Compression Scheme: none
+ Photometric Interpretation: min-is-black
+ Samples/Pixel: 1
+ Planar Configuration: separate image planes
+TIFF Directory at offset 0x17a366
+ Subfile Type: reduced-resolution image (1 = 0x1)
+ Image Width: 128 Image Length: 128
+ Tile Width: 128 Tile Length: 112
+ Bits/Sample: 8
+ Compression Scheme: none
+ Photometric Interpretation: min-is-black
+ Samples/Pixel: 1
+ Planar Configuration: separate image planes
+TIFF Directory at offset 0x17b40c
+ Subfile Type: reduced-resolution image (1 = 0x1)
+ Image Width: 64 Image Length: 64
+ Tile Width: 64 Tile Length: 64
+ Bits/Sample: 8
+ Compression Scheme: none
+ Photometric Interpretation: min-is-black
+ Samples/Pixel: 1
+ Planar Configuration: separate image planes
+
+
+Building
+--------
+
+You will need a C compiler. You will need to have libtiff already
+built and installed. The provided Makefile should work on most Unix systems.
+A similar file will be needed for Windows, but is not provided.
+
+The CFLAGS and LIBS macros in the Makefile will have to be updated to
+point to the correct location of the libtiff include files, and library.
+
+
+Credits
+-------
+
+ o Intergraph Corporation for partially funding the work.
+
+ o Global Geomatics for partially funding reorganization of the overview
+ building ability as a separate utility.
+
+ o Orrin Long, and Ed Grissom of Intergraph for explaining what needed to
+ be done.
+
+ o Max Martinez of Erdas for his discussion of external overviews.
+
+ o Atlantis Scientific who supported adding averaging, and some other
+ generalizations.
+
+ o Frank Warmerdam for writing the bulk of the code.
+
+ o Sam Leffler since this only exists because of his libtiff.
+
diff --git a/tiff/contrib/addtiffo/addtiffo.c b/tiff/contrib/addtiffo/addtiffo.c
new file mode 100644
index 0000000..107df36
--- /dev/null
+++ b/tiff/contrib/addtiffo/addtiffo.c
@@ -0,0 +1,176 @@
+/******************************************************************************
+ * $Id: addtiffo.c,v 1.6.2.1 2010-06-08 18:50:40 bfriesen Exp $
+ *
+ * Project: GeoTIFF Overview Builder
+ * Purpose: Mainline for building overviews in a TIFF file.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: addtiffo.c,v $
+ * Revision 1.6.2.1 2010-06-08 18:50:40 bfriesen
+ * * Add an emacs formatting mode footer to all source files so that
+ * emacs can be effectively used.
+ *
+ * Revision 1.6 2005/12/16 05:59:55 fwarmerdam
+ * Major upgrade to support YCbCr subsampled jpeg images
+ *
+ * Revision 1.4 2004/09/21 13:31:23 dron
+ * Add missed include string.h.
+ *
+ * Revision 1.3 2000/04/18 22:48:31 warmerda
+ * Added support for averaging resampling
+ *
+ * Revision 1.2 2000/01/28 15:36:38 warmerda
+ * pass TIFF handle instead of filename to overview builder
+ *
+ * Revision 1.1 1999/08/17 01:47:59 warmerda
+ * New
+ *
+ * Revision 1.1 1999/03/12 17:46:32 warmerda
+ * New
+ *
+ * Revision 1.2 1999/02/11 22:27:12 warmerda
+ * Added multi-sample support
+ *
+ * Revision 1.1 1999/02/11 18:12:30 warmerda
+ * New
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "tiffio.h"
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+ int (*)(double,void*), void * );
+
+/************************************************************************/
+/* main() */
+/************************************************************************/
+
+int main( int argc, char ** argv )
+
+{
+ int anOverviews[100]; /* TODO: un-hardwire array length, flexible allocate */
+ int nOverviewCount = 0;
+ int bUseSubIFD = 0;
+ TIFF *hTIFF;
+ const char *pszResampling = "nearest";
+
+/* -------------------------------------------------------------------- */
+/* Usage: */
+/* -------------------------------------------------------------------- */
+ if( argc < 2 )
+ {
+ printf( "Usage: addtiffo [-r {nearest,average,mode}]\n"
+ " tiff_filename [resolution_reductions]\n"
+ "\n"
+ "Example:\n"
+ " %% addtiffo abc.tif 2 4 8 16\n" );
+ return( 1 );
+ }
+
+ while( argv[1][0] == '-' )
+ {
+ if( strcmp(argv[1],"-subifd") == 0 )
+ {
+ bUseSubIFD = 1;
+ argv++;
+ argc--;
+ }
+ else if( strcmp(argv[1],"-r") == 0 )
+ {
+ argv += 2;
+ argc -= 2;
+ pszResampling = *argv;
+ }
+ else
+ {
+ fprintf( stderr, "Incorrect parameters\n" );
+ return( 1 );
+ }
+ }
+
+ /* TODO: resampling mode parameter needs to be encoded in an integer from this point on */
+
+/* -------------------------------------------------------------------- */
+/* Collect the user requested reduction factors. */
+/* -------------------------------------------------------------------- */
+ while( nOverviewCount < argc - 2 && nOverviewCount < 100 )
+ {
+ anOverviews[nOverviewCount] = atoi(argv[nOverviewCount+2]);
+ if( anOverviews[nOverviewCount] <= 0)
+ {
+ fprintf( stderr, "Incorrect parameters\n" );
+ return(1);
+ }
+ nOverviewCount++;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Default to four overview levels. It would be nicer if it */
+/* defaulted based on the size of the source image. */
+/* -------------------------------------------------------------------- */
+ /* TODO: make it default based on the size of the source image */
+ if( nOverviewCount == 0 )
+ {
+ nOverviewCount = 4;
+
+ anOverviews[0] = 2;
+ anOverviews[1] = 4;
+ anOverviews[2] = 8;
+ anOverviews[3] = 16;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Build the overview. */
+/* -------------------------------------------------------------------- */
+ hTIFF = TIFFOpen( argv[1], "r+" );
+ if( hTIFF == NULL )
+ {
+ fprintf( stderr, "TIFFOpen(%s) failed.\n", argv[1] );
+ return( 1 );
+ }
+
+ TIFFBuildOverviews( hTIFF, nOverviewCount, anOverviews, bUseSubIFD,
+ pszResampling, NULL, NULL );
+
+ TIFFClose( hTIFF );
+
+/* -------------------------------------------------------------------- */
+/* Optionally test for memory leaks. */
+/* -------------------------------------------------------------------- */
+#ifdef DBMALLOC
+ malloc_dump(1);
+#endif
+
+ return( 0 );
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/addtiffo/tif_overview.c b/tiff/contrib/addtiffo/tif_overview.c
new file mode 100644
index 0000000..994451c
--- /dev/null
+++ b/tiff/contrib/addtiffo/tif_overview.c
@@ -0,0 +1,896 @@
+/******************************************************************************
+ * tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp
+ *
+ * Project: TIFF Overview Builder
+ * Purpose: Library function for building overviews in a TIFF file.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ * Notes:
+ * o Currently only images with bits_per_sample of a multiple of eight
+ * will work.
+ *
+ * o The downsampler currently just takes the top left pixel from the
+ * source rectangle. Eventually sampling options of averaging, mode, and
+ * ``center pixel'' should be offered.
+ *
+ * o The code will attempt to use the same kind of compression,
+ * photometric interpretation, and organization as the source image, but
+ * it doesn't copy geotiff tags to the reduced resolution images.
+ *
+ * o Reduced resolution overviews for multi-sample files will currently
+ * always be generated as PLANARCONFIG_SEPARATE. This could be fixed
+ * reasonable easily if needed to improve compatibility with other
+ * packages. Many don't properly support PLANARCONFIG_SEPARATE.
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+/* TODO: update notes in header above */
+
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+#include "tif_ovrcache.h"
+
+#ifndef FALSE
+# define FALSE 0
+# define TRUE 1
+#endif
+
+#ifndef MAX
+# define MIN(a,b) ((a<b) ? a : b)
+# define MAX(a,b) ((a>b) ? a : b)
+#endif
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+ int (*)(double,void*), void * );
+
+/************************************************************************/
+/* TIFF_WriteOverview() */
+/* */
+/* Create a new directory, without any image data for an overview. */
+/* Returns offset of newly created overview directory, but the */
+/* current directory is reset to be the one in used when this */
+/* function is called. */
+/************************************************************************/
+
+uint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,
+ int nBitsPerPixel, int nPlanarConfig, int nSamples,
+ int nBlockXSize, int nBlockYSize,
+ int bTiled, int nCompressFlag, int nPhotometric,
+ int nSampleFormat,
+ unsigned short *panRed,
+ unsigned short *panGreen,
+ unsigned short *panBlue,
+ int bUseSubIFDs,
+ int nHorSubsampling, int nVerSubsampling )
+
+{
+ uint32 nBaseDirOffset;
+ uint32 nOffset;
+
+ nBaseDirOffset = TIFFCurrentDirOffset( hTIFF );
+
+ TIFFCreateDirectory( hTIFF );
+
+/* -------------------------------------------------------------------- */
+/* Setup TIFF fields. */
+/* -------------------------------------------------------------------- */
+ TIFFSetField( hTIFF, TIFFTAG_IMAGEWIDTH, nXSize );
+ TIFFSetField( hTIFF, TIFFTAG_IMAGELENGTH, nYSize );
+ if( nSamples == 1 )
+ TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );
+ else
+ TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig );
+
+ TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );
+ TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );
+ TIFFSetField( hTIFF, TIFFTAG_COMPRESSION, nCompressFlag );
+ TIFFSetField( hTIFF, TIFFTAG_PHOTOMETRIC, nPhotometric );
+ TIFFSetField( hTIFF, TIFFTAG_SAMPLEFORMAT, nSampleFormat );
+
+ if( bTiled )
+ {
+ TIFFSetField( hTIFF, TIFFTAG_TILEWIDTH, nBlockXSize );
+ TIFFSetField( hTIFF, TIFFTAG_TILELENGTH, nBlockYSize );
+ }
+ else
+ TIFFSetField( hTIFF, TIFFTAG_ROWSPERSTRIP, nBlockYSize );
+
+ TIFFSetField( hTIFF, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE );
+
+ if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
+ {
+ TIFFSetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, nHorSubsampling, nVerSubsampling);
+ /* TODO: also write YCbCrPositioning and YCbCrCoefficients tag identical to source IFD */
+ }
+ /* TODO: add command-line parameter for selecting jpeg compression quality
+ * that gets ignored when compression isn't jpeg */
+
+/* -------------------------------------------------------------------- */
+/* Write color table if one is present. */
+/* -------------------------------------------------------------------- */
+ if( panRed != NULL )
+ {
+ TIFFSetField( hTIFF, TIFFTAG_COLORMAP, panRed, panGreen, panBlue );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Write directory, and return byte offset. */
+/* -------------------------------------------------------------------- */
+ if( TIFFWriteCheck( hTIFF, bTiled, "TIFFBuildOverviews" ) == 0 )
+ return 0;
+
+ TIFFWriteDirectory( hTIFF );
+ TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-1) );
+
+ nOffset = TIFFCurrentDirOffset( hTIFF );
+
+ TIFFSetSubDirectory( hTIFF, nBaseDirOffset );
+
+ return nOffset;
+}
+
+/************************************************************************/
+/* TIFF_GetSourceSamples() */
+/************************************************************************/
+
+static void
+TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc,
+ int nPixelBytes, int nSampleFormat,
+ int nXSize, int nYSize,
+ int nPixelOffset, int nLineOffset )
+{
+ int iXOff, iYOff, iSample;
+
+ iSample = 0;
+
+ for( iYOff = 0; iYOff < nYSize; iYOff++ )
+ {
+ for( iXOff = 0; iXOff < nXSize; iXOff++ )
+ {
+ unsigned char *pabyData;
+
+ pabyData = pabySrc + iYOff * nLineOffset + iXOff * nPixelOffset;
+
+ if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
+ {
+ padfSamples[iSample++] = *pabyData;
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
+ {
+ padfSamples[iSample++] = ((uint16 *) pabyData)[0];
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
+ {
+ padfSamples[iSample++] = ((uint32 *) pabyData)[0];
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
+ {
+ padfSamples[iSample++] = ((int16 *) pabyData)[0];
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
+ {
+ padfSamples[iSample++] = ((int32 *) pabyData)[0];
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
+ {
+ padfSamples[iSample++] = ((float *) pabyData)[0];
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
+ {
+ padfSamples[iSample++] = ((double *) pabyData)[0];
+ }
+ }
+ }
+}
+
+/************************************************************************/
+/* TIFF_SetSample() */
+/************************************************************************/
+
+static void
+TIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat,
+ double dfValue )
+
+{
+ if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
+ {
+ *pabyData = (unsigned char) MAX(0,MIN(255,dfValue));
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
+ {
+ *((uint16 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue));
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
+ {
+ *((uint32 *)pabyData) = (uint32) dfValue;
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
+ {
+ *((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue));
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
+ {
+ *((int32 *)pabyData) = (int32) dfValue;
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
+ {
+ *((float *)pabyData) = (float) dfValue;
+ }
+ else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
+ {
+ *((double *)pabyData) = dfValue;
+ }
+}
+
+/************************************************************************/
+/* TIFF_DownSample() */
+/* */
+/* Down sample a tile of full res data into a window of a tile */
+/* of downsampled data. */
+/************************************************************************/
+
+static
+void TIFF_DownSample( unsigned char *pabySrcTile,
+ int nBlockXSize, int nBlockYSize,
+ int nPixelSkewBits, int nBitsPerPixel,
+ unsigned char * pabyOTile,
+ int nOBlockXSize, int nOBlockYSize,
+ int nTXOff, int nTYOff, int nOMult,
+ int nSampleFormat, const char * pszResampling )
+
+{
+ int i, j, k, nPixelBytes = (nBitsPerPixel) / 8;
+ int nPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8;
+ unsigned char *pabySrc, *pabyDst;
+ double *padfSamples;
+
+ assert( nBitsPerPixel >= 8 );
+
+ padfSamples = (double *) malloc(sizeof(double) * nOMult * nOMult);
+
+/* ==================================================================== */
+/* Loop over scanline chunks to process, establishing where the */
+/* data is going. */
+/* ==================================================================== */
+ for( j = 0; j*nOMult < nBlockYSize; j++ )
+ {
+ if( j + nTYOff >= nOBlockYSize )
+ break;
+
+ pabyDst = pabyOTile + ((j+nTYOff)*nOBlockXSize + nTXOff)
+ * nPixelBytes * nPixelGroupBytes;
+
+/* -------------------------------------------------------------------- */
+/* Handler nearest resampling ... we don't even care about the */
+/* data type, we just do a bytewise copy. */
+/* -------------------------------------------------------------------- */
+ if( strncmp(pszResampling,"nearest",4) == 0
+ || strncmp(pszResampling,"NEAR",4) == 0 )
+ {
+ pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
+
+ for( i = 0; i*nOMult < nBlockXSize; i++ )
+ {
+ if( i + nTXOff >= nOBlockXSize )
+ break;
+
+ /*
+ * For now use simple subsampling, from the top left corner
+ * of the source block of pixels.
+ */
+
+ for( k = 0; k < nPixelBytes; k++ )
+ pabyDst[k] = pabySrc[k];
+
+ pabyDst += nPixelBytes * nPixelGroupBytes;
+ pabySrc += nOMult * nPixelGroupBytes;
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Handle the case of averaging. For this we also have to */
+/* handle each sample format we are concerned with. */
+/* -------------------------------------------------------------------- */
+ else if( strncmp(pszResampling,"averag",6) == 0
+ || strncmp(pszResampling,"AVERAG",6) == 0 )
+ {
+ pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
+
+ for( i = 0; i*nOMult < nBlockXSize; i++ )
+ {
+ double dfTotal;
+ int iSample;
+ int nXSize, nYSize;
+
+ if( i + nTXOff >= nOBlockXSize )
+ break;
+
+ nXSize = MIN(nOMult,nBlockXSize-i);
+ nYSize = MIN(nOMult,nBlockYSize-j);
+
+ TIFF_GetSourceSamples( padfSamples, pabySrc,
+ nPixelBytes, nSampleFormat,
+ nXSize, nYSize,
+ nPixelGroupBytes,
+ nPixelGroupBytes * nBlockXSize );
+
+ dfTotal = 0;
+ for( iSample = 0; iSample < nXSize*nYSize; iSample++ )
+ {
+ dfTotal += padfSamples[iSample];
+ }
+
+ TIFF_SetSample( pabyDst, nPixelBytes, nSampleFormat,
+ dfTotal / (nXSize*nYSize) );
+
+ pabySrc += nOMult * nPixelGroupBytes;
+ pabyDst += nPixelBytes;
+ }
+ }
+ }
+
+ free( padfSamples );
+}
+
+/************************************************************************/
+/* TIFF_DownSample_Subsampled() */
+/************************************************************************/
+static
+void TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,
+ int nBlockXSize, int nBlockYSize,
+ unsigned char * pabyOTile,
+ int nOBlockXSize, int nOBlockYSize,
+ int nTXOff, int nTYOff, int nOMult,
+ const char * pszResampling,
+ int nHorSubsampling, int nVerSubsampling )
+{
+ /* TODO: test with variety of subsampling values, and incovinient tile/strip sizes */
+ int nSampleBlockSize;
+ int nSourceSampleRowSize;
+ int nDestSampleRowSize;
+ int nSourceX, nSourceY;
+ int nSourceXSec, nSourceYSec;
+ int nSourceXSecEnd, nSourceYSecEnd;
+ int nDestX, nDestY;
+ int nSampleOffsetInSampleBlock;
+ unsigned char * pSourceBase;
+ unsigned char * pDestBase;
+ int nSourceBaseInc;
+ unsigned char * pSourceBaseEnd;
+ unsigned int nCummulator;
+ unsigned int nCummulatorCount;
+
+ nSampleBlockSize = nHorSubsampling * nVerSubsampling + 2;
+ nSourceSampleRowSize =
+ ( ( nBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
+ nDestSampleRowSize =
+ ( ( nOBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
+
+ if( strncmp(pszResampling,"nearest",4) == 0
+ || strncmp(pszResampling,"NEAR",4) == 0 )
+ {
+ if( nSample == 0 )
+ {
+ for( nSourceY = 0, nDestY = nTYOff;
+ nSourceY < nBlockYSize;
+ nSourceY += nOMult, nDestY ++)
+ {
+ if( nDestY >= nOBlockYSize )
+ break;
+
+ for( nSourceX = 0, nDestX = nTXOff;
+ nSourceX < nBlockXSize;
+ nSourceX += nOMult, nDestX ++)
+ {
+ if( nDestX >= nOBlockXSize )
+ break;
+
+ * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+ + ( nDestY % nVerSubsampling ) * nHorSubsampling
+ + ( nDestX / nHorSubsampling ) * nSampleBlockSize
+ + ( nDestX % nHorSubsampling ) ) =
+ * ( pabySrcTile + ( nSourceY / nVerSubsampling ) * nSourceSampleRowSize
+ + ( nSourceY % nVerSubsampling ) * nHorSubsampling
+ + ( nSourceX / nHorSubsampling ) * nSampleBlockSize
+ + ( nSourceX % nHorSubsampling ) );
+ }
+ }
+ }
+ else
+ {
+ nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
+ for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling );
+ nSourceY < ( nBlockYSize / nVerSubsampling );
+ nSourceY += nOMult, nDestY ++)
+ {
+ if( nDestY*nVerSubsampling >= nOBlockYSize )
+ break;
+
+ for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling );
+ nSourceX < ( nBlockXSize / nHorSubsampling );
+ nSourceX += nOMult, nDestX ++)
+ {
+ if( nDestX*nHorSubsampling >= nOBlockXSize )
+ break;
+
+ * ( pabyOTile + nDestY * nDestSampleRowSize
+ + nDestX * nSampleBlockSize
+ + nSampleOffsetInSampleBlock ) =
+ * ( pabySrcTile + nSourceY * nSourceSampleRowSize
+ + nSourceX * nSampleBlockSize
+ + nSampleOffsetInSampleBlock );
+ }
+ }
+ }
+ }
+ else if( strncmp(pszResampling,"averag",6) == 0
+ || strncmp(pszResampling,"AVERAG",6) == 0 )
+ {
+ if( nSample == 0 )
+ {
+ for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)
+ {
+ if( nDestY >= nOBlockYSize )
+ break;
+
+ for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)
+ {
+ if( nDestX >= nOBlockXSize )
+ break;
+
+ nSourceXSecEnd = nSourceX + nOMult;
+ if( nSourceXSecEnd > nBlockXSize )
+ nSourceXSecEnd = nBlockXSize;
+ nSourceYSecEnd = nSourceY + nOMult;
+ if( nSourceYSecEnd > nBlockYSize )
+ nSourceYSecEnd = nBlockYSize;
+ nCummulator = 0;
+ for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
+ {
+ for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
+ {
+ nCummulator += * ( pabySrcTile + ( nSourceYSec / nVerSubsampling ) * nSourceSampleRowSize
+ + ( nSourceYSec % nVerSubsampling ) * nHorSubsampling
+ + ( nSourceXSec / nHorSubsampling ) * nSampleBlockSize
+ + ( nSourceXSec % nHorSubsampling ) );
+ }
+ }
+ nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
+ * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+ + ( nDestY % nVerSubsampling ) * nHorSubsampling
+ + ( nDestX / nHorSubsampling ) * nSampleBlockSize
+ + ( nDestX % nHorSubsampling ) ) =
+ ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
+ }
+ }
+ }
+ else
+ {
+ nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
+ for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling );
+ nSourceY += nOMult, nDestY ++)
+ {
+ if( nDestY*nVerSubsampling >= nOBlockYSize )
+ break;
+
+ for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); nSourceX < ( nBlockXSize / nHorSubsampling );
+ nSourceX += nOMult, nDestX ++)
+ {
+ if( nDestX*nHorSubsampling >= nOBlockXSize )
+ break;
+
+ nSourceXSecEnd = nSourceX + nOMult;
+ if( nSourceXSecEnd > ( nBlockXSize / nHorSubsampling ) )
+ nSourceXSecEnd = ( nBlockXSize / nHorSubsampling );
+ nSourceYSecEnd = nSourceY + nOMult;
+ if( nSourceYSecEnd > ( nBlockYSize / nVerSubsampling ) )
+ nSourceYSecEnd = ( nBlockYSize / nVerSubsampling );
+ nCummulator = 0;
+ for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
+ {
+ for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
+ {
+ nCummulator += * ( pabySrcTile + nSourceYSec * nSourceSampleRowSize
+ + nSourceXSec * nSampleBlockSize
+ + nSampleOffsetInSampleBlock );
+ }
+ }
+ nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
+ * ( pabyOTile + nDestY * nDestSampleRowSize
+ + nDestX * nSampleBlockSize
+ + nSampleOffsetInSampleBlock ) =
+ ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
+ }
+ }
+ }
+ }
+}
+
+/************************************************************************/
+/* TIFF_ProcessFullResBlock() */
+/* */
+/* Process one block of full res data, downsampling into each */
+/* of the overviews. */
+/************************************************************************/
+
+void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
+ int bSubsampled, int nHorSubsampling, int nVerSubsampling,
+ int nOverviews, int * panOvList,
+ int nBitsPerPixel,
+ int nSamples, TIFFOvrCache ** papoRawBIs,
+ int nSXOff, int nSYOff,
+ unsigned char *pabySrcTile,
+ int nBlockXSize, int nBlockYSize,
+ int nSampleFormat, const char * pszResampling )
+
+{
+ int iOverview, iSample;
+
+ for( iSample = 0; iSample < nSamples; iSample++ )
+ {
+ /*
+ * We have to read a tile/strip for each sample for
+ * PLANARCONFIG_SEPARATE. Otherwise, we just read all the samples
+ * at once when handling the first sample.
+ */
+ if( nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0 )
+ {
+ if( TIFFIsTiled(hTIFF) )
+ {
+ TIFFReadEncodedTile( hTIFF,
+ TIFFComputeTile(hTIFF, nSXOff, nSYOff,
+ 0, (tsample_t)iSample ),
+ pabySrcTile,
+ TIFFTileSize(hTIFF));
+ }
+ else
+ {
+ TIFFReadEncodedStrip( hTIFF,
+ TIFFComputeStrip(hTIFF, nSYOff,
+ (tsample_t) iSample),
+ pabySrcTile,
+ TIFFStripSize(hTIFF) );
+ }
+ }
+
+ /*
+ * Loop over destination overview layers
+ */
+ for( iOverview = 0; iOverview < nOverviews; iOverview++ )
+ {
+ TIFFOvrCache *poRBI = papoRawBIs[iOverview];
+ unsigned char *pabyOTile;
+ int nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
+ int nOBlockXSize = poRBI->nBlockXSize;
+ int nOBlockYSize = poRBI->nBlockYSize;
+ int nSkewBits, nSampleByteOffset;
+
+ /*
+ * Fetch the destination overview tile
+ */
+ nOMult = panOvList[iOverview];
+ nOXOff = (nSXOff/nOMult) / nOBlockXSize;
+ nOYOff = (nSYOff/nOMult) / nOBlockYSize;
+
+ if( bSubsampled )
+ {
+ pabyOTile = TIFFGetOvrBlock_Subsampled( poRBI, nOXOff, nOYOff );
+
+ /*
+ * Establish the offset into this tile at which we should
+ * start placing data.
+ */
+ nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
+ nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
+
+
+#ifdef DBMALLOC
+ malloc_chain_check( 1 );
+#endif
+ TIFF_DownSample_Subsampled( pabySrcTile, iSample,
+ nBlockXSize, nBlockYSize,
+ pabyOTile,
+ poRBI->nBlockXSize, poRBI->nBlockYSize,
+ nTXOff, nTYOff,
+ nOMult, pszResampling,
+ nHorSubsampling, nVerSubsampling );
+#ifdef DBMALLOC
+ malloc_chain_check( 1 );
+#endif
+
+ }
+ else
+ {
+
+ pabyOTile = TIFFGetOvrBlock( poRBI, nOXOff, nOYOff, iSample );
+
+ /*
+ * Establish the offset into this tile at which we should
+ * start placing data.
+ */
+ nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
+ nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
+
+ /*
+ * Figure out the skew (extra space between ``our samples'') and
+ * the byte offset to the first sample.
+ */
+ assert( (nBitsPerPixel % 8) == 0 );
+ if( nPlanarConfig == PLANARCONFIG_SEPARATE )
+ {
+ nSkewBits = 0;
+ nSampleByteOffset = 0;
+ }
+ else
+ {
+ nSkewBits = nBitsPerPixel * (nSamples-1);
+ nSampleByteOffset = (nBitsPerPixel/8) * iSample;
+ }
+
+ /*
+ * Perform the downsampling.
+ */
+#ifdef DBMALLOC
+ malloc_chain_check( 1 );
+#endif
+ TIFF_DownSample( pabySrcTile + nSampleByteOffset,
+ nBlockXSize, nBlockYSize,
+ nSkewBits, nBitsPerPixel, pabyOTile,
+ poRBI->nBlockXSize, poRBI->nBlockYSize,
+ nTXOff, nTYOff,
+ nOMult, nSampleFormat, pszResampling );
+#ifdef DBMALLOC
+ malloc_chain_check( 1 );
+#endif
+ }
+ }
+ }
+}
+
+/************************************************************************/
+/* TIFF_BuildOverviews() */
+/* */
+/* Build the requested list of overviews. Overviews are */
+/* maintained in a bunch of temporary files and then these are */
+/* written back to the TIFF file. Only one pass through the */
+/* source TIFF file is made for any number of output */
+/* overviews. */
+/************************************************************************/
+
+void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
+ int bUseSubIFDs, const char *pszResampleMethod,
+ int (*pfnProgress)( double, void * ),
+ void * pProgressData )
+
+{
+ TIFFOvrCache **papoRawBIs;
+ uint32 nXSize, nYSize, nBlockXSize, nBlockYSize;
+ uint16 nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
+ nPlanarConfig, nSampleFormat;
+ int bSubsampled;
+ uint16 nHorSubsampling, nVerSubsampling;
+ int bTiled, nSXOff, nSYOff, i;
+ unsigned char *pabySrcTile;
+ uint16 *panRedMap, *panGreenMap, *panBlueMap;
+ TIFFErrorHandler pfnWarning;
+
+/* -------------------------------------------------------------------- */
+/* Get the base raster size. */
+/* -------------------------------------------------------------------- */
+ TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize );
+ TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &nYSize );
+
+ TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel );
+ /* TODO: nBitsPerPixel seems misnomer and may need renaming to nBitsPerSample */
+ TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples );
+ TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig );
+
+ TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric );
+ TIFFGetFieldDefaulted( hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag );
+ TIFFGetFieldDefaulted( hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat );
+
+ if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
+ {
+ if( nBitsPerPixel != 8 || nSamples != 3 || nPlanarConfig != PLANARCONFIG_CONTIG ||
+ nSampleFormat != SAMPLEFORMAT_UINT)
+ {
+ /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+ TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
+ "File `%s' has an unsupported subsampling configuration.\n",
+ TIFFFileName(hTIFF) );
+ /* If you need support for this particular flavor, please contact either
+ * Frank Warmerdam warmerdam@pobox.com
+ * Joris Van Damme info@awaresystems.be
+ */
+ return;
+ }
+ bSubsampled = 1;
+ TIFFGetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling, &nVerSubsampling );
+ /* TODO: find out if maybe TIFFGetFieldDefaulted is better choice for YCbCrSubsampling tag */
+ }
+ else
+ {
+ if( nBitsPerPixel < 8 )
+ {
+ /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+ TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
+ "File `%s' has samples of %d bits per sample. Sample\n"
+ "sizes of less than 8 bits per sample are not supported.\n",
+ TIFFFileName(hTIFF), nBitsPerPixel );
+ return;
+ }
+ bSubsampled = 0;
+ nHorSubsampling = 1;
+ nVerSubsampling = 1;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Turn off warnings to avoid alot of repeated warnings while */
+/* rereading directories. */
+/* -------------------------------------------------------------------- */
+ pfnWarning = TIFFSetWarningHandler( NULL );
+
+/* -------------------------------------------------------------------- */
+/* Get the base raster block size. */
+/* -------------------------------------------------------------------- */
+ if( TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize) ) )
+ {
+ nBlockXSize = nXSize;
+ bTiled = FALSE;
+ }
+ else
+ {
+ TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize );
+ TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize );
+ bTiled = TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Capture the pallette if there is one. */
+/* -------------------------------------------------------------------- */
+ if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,
+ &panRedMap, &panGreenMap, &panBlueMap ) )
+ {
+ uint16 *panRed2, *panGreen2, *panBlue2;
+ int nColorCount = 1 << nBitsPerPixel;
+
+ panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+ panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+ panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+
+ memcpy( panRed2, panRedMap, 2 * nColorCount );
+ memcpy( panGreen2, panGreenMap, 2 * nColorCount );
+ memcpy( panBlue2, panBlueMap, 2 * nColorCount );
+
+ panRedMap = panRed2;
+ panGreenMap = panGreen2;
+ panBlueMap = panBlue2;
+ }
+ else
+ {
+ panRedMap = panGreenMap = panBlueMap = NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Initialize overviews. */
+/* -------------------------------------------------------------------- */
+ papoRawBIs = (TIFFOvrCache **) _TIFFmalloc(nOverviews*sizeof(void*));
+
+ for( i = 0; i < nOverviews; i++ )
+ {
+ int nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
+ uint32 nDirOffset;
+
+ nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];
+ nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];
+
+ nOBlockXSize = MIN((int)nBlockXSize,nOXSize);
+ nOBlockYSize = MIN((int)nBlockYSize,nOYSize);
+
+ if( bTiled )
+ {
+ if( (nOBlockXSize % 16) != 0 )
+ nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);
+
+ if( (nOBlockYSize % 16) != 0 )
+ nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);
+ }
+
+ nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
+ nBitsPerPixel, nPlanarConfig,
+ nSamples, nOBlockXSize, nOBlockYSize,
+ bTiled, nCompressFlag, nPhotometric,
+ nSampleFormat,
+ panRedMap, panGreenMap, panBlueMap,
+ bUseSubIFDs,
+ nHorSubsampling, nVerSubsampling );
+
+ papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );
+ }
+
+ if( panRedMap != NULL )
+ {
+ _TIFFfree( panRedMap );
+ _TIFFfree( panGreenMap );
+ _TIFFfree( panBlueMap );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Allocate a buffer to hold a source block. */
+/* -------------------------------------------------------------------- */
+ if( bTiled )
+ pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFTileSize(hTIFF));
+ else
+ pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFStripSize(hTIFF));
+
+/* -------------------------------------------------------------------- */
+/* Loop over the source raster, applying data to the */
+/* destination raster. */
+/* -------------------------------------------------------------------- */
+ for( nSYOff = 0; nSYOff < (int) nYSize; nSYOff += nBlockYSize )
+ {
+ for( nSXOff = 0; nSXOff < (int) nXSize; nSXOff += nBlockXSize )
+ {
+ /*
+ * Read and resample into the various overview images.
+ */
+
+ TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,
+ bSubsampled,nHorSubsampling,nVerSubsampling,
+ nOverviews, panOvList,
+ nBitsPerPixel, nSamples, papoRawBIs,
+ nSXOff, nSYOff, pabySrcTile,
+ nBlockXSize, nBlockYSize,
+ nSampleFormat, pszResampleMethod );
+ }
+ }
+
+ _TIFFfree( pabySrcTile );
+
+/* -------------------------------------------------------------------- */
+/* Cleanup the rawblockedimage files. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < nOverviews; i++ )
+ {
+ TIFFDestroyOvrCache( papoRawBIs[i] );
+ }
+
+ if( papoRawBIs != NULL )
+ _TIFFfree( papoRawBIs );
+
+ TIFFSetWarningHandler( pfnWarning );
+}
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/addtiffo/tif_ovrcache.c b/tiff/contrib/addtiffo/tif_ovrcache.c
new file mode 100644
index 0000000..646b534
--- /dev/null
+++ b/tiff/contrib/addtiffo/tif_ovrcache.c
@@ -0,0 +1,341 @@
+/******************************************************************************
+ * $Id: tif_ovrcache.c,v 1.7.2.1 2010-06-08 18:50:40 bfriesen Exp $
+ *
+ * Project: TIFF Overview Builder
+ * Purpose: Library functions to maintain two rows of tiles or two strips
+ * of data for output overviews as an output cache.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+#include "tiffiop.h"
+#include "tif_ovrcache.h"
+#include <assert.h>
+
+/************************************************************************/
+/* TIFFCreateOvrCache() */
+/* */
+/* Create an overview cache to hold two rows of blocks from an */
+/* existing TIFF directory. */
+/************************************************************************/
+
+TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset )
+
+{
+ TIFFOvrCache *psCache;
+ uint32 nBaseDirOffset;
+
+ psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache));
+ psCache->nDirOffset = nDirOffset;
+ psCache->hTIFF = hTIFF;
+
+/* -------------------------------------------------------------------- */
+/* Get definition of this raster from the TIFF file itself. */
+/* -------------------------------------------------------------------- */
+ nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
+ TIFFSetSubDirectory( hTIFF, nDirOffset );
+
+ TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) );
+ TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize) );
+
+ TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel) );
+ TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples) );
+ TIFFGetField( hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig) );
+
+ if( !TIFFIsTiled( hTIFF ) )
+ {
+ TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize) );
+ psCache->nBlockXSize = psCache->nXSize;
+ psCache->nBytesPerBlock = TIFFStripSize(hTIFF);
+ psCache->bTiled = FALSE;
+ }
+ else
+ {
+ TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize) );
+ TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize) );
+ psCache->nBytesPerBlock = TIFFTileSize(hTIFF);
+ psCache->bTiled = TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Compute some values from this. */
+/* -------------------------------------------------------------------- */
+
+ psCache->nBlocksPerRow = (psCache->nXSize + psCache->nBlockXSize - 1)
+ / psCache->nBlockXSize;
+ psCache->nBlocksPerColumn = (psCache->nYSize + psCache->nBlockYSize - 1)
+ / psCache->nBlockYSize;
+
+ if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+ psCache->nBytesPerRow = psCache->nBytesPerBlock
+ * psCache->nBlocksPerRow * psCache->nSamples;
+ else
+ psCache->nBytesPerRow =
+ psCache->nBytesPerBlock * psCache->nBlocksPerRow;
+
+
+/* -------------------------------------------------------------------- */
+/* Allocate and initialize the data buffers. */
+/* -------------------------------------------------------------------- */
+
+ psCache->pabyRow1Blocks =
+ (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
+ psCache->pabyRow2Blocks =
+ (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
+
+ if( psCache->pabyRow1Blocks == NULL
+ || psCache->pabyRow2Blocks == NULL )
+ {
+ TIFFErrorExt( hTIFF->tif_clientdata, hTIFF->tif_name,
+ "Can't allocate memory for overview cache." );
+ /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+ return NULL;
+ }
+
+ _TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow );
+ _TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow );
+
+ psCache->nBlockOffset = 0;
+
+ TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
+
+ return psCache;
+}
+
+/************************************************************************/
+/* TIFFWriteOvrRow() */
+/* */
+/* Write one entire row of blocks (row 1) to the tiff file, and */
+/* then rotate the block buffers, essentially moving things */
+/* down by one block. */
+/************************************************************************/
+
+static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
+
+{
+ int nRet, iTileX, iTileY = psCache->nBlockOffset;
+ unsigned char *pabyData;
+ uint32 nBaseDirOffset;
+ uint32 RowsInStrip;
+
+/* -------------------------------------------------------------------- */
+/* If the output cache is multi-byte per sample, and the file */
+/* being written to is of a different byte order than the current */
+/* platform, we will need to byte swap the data. */
+/* -------------------------------------------------------------------- */
+ if( TIFFIsByteSwapped(psCache->hTIFF) )
+ {
+ if( psCache->nBitsPerPixel == 16 )
+ TIFFSwabArrayOfShort( (uint16 *) psCache->pabyRow1Blocks,
+ (psCache->nBytesPerBlock * psCache->nSamples) / 2 );
+
+ else if( psCache->nBitsPerPixel == 32 )
+ TIFFSwabArrayOfLong( (uint32 *) psCache->pabyRow1Blocks,
+ (psCache->nBytesPerBlock * psCache->nSamples) / 4 );
+
+ else if( psCache->nBitsPerPixel == 64 )
+ TIFFSwabArrayOfDouble( (double *) psCache->pabyRow1Blocks,
+ (psCache->nBytesPerBlock * psCache->nSamples) / 8 );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Record original directory position, so we can restore it at */
+/* end. */
+/* -------------------------------------------------------------------- */
+ nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
+ nRet = TIFFSetSubDirectory( psCache->hTIFF, psCache->nDirOffset );
+ assert( nRet == 1 );
+
+/* -------------------------------------------------------------------- */
+/* Write blocks to TIFF file. */
+/* -------------------------------------------------------------------- */
+ for( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )
+ {
+ int nTileID;
+
+ if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+ {
+ int iSample;
+
+ for( iSample = 0; iSample < psCache->nSamples; iSample++ )
+ {
+ pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );
+
+ if( psCache->bTiled )
+ {
+ nTileID = TIFFComputeTile( psCache->hTIFF,
+ iTileX * psCache->nBlockXSize,
+ iTileY * psCache->nBlockYSize,
+ 0, (tsample_t) iSample );
+ TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
+ pabyData,
+ TIFFTileSize(psCache->hTIFF) );
+ }
+ else
+ {
+ nTileID = TIFFComputeStrip( psCache->hTIFF,
+ iTileY * psCache->nBlockYSize,
+ (tsample_t) iSample );
+ RowsInStrip=psCache->nBlockYSize;
+ if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
+ RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
+ TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
+ pabyData,
+ TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
+ }
+ }
+
+ }
+ else
+ {
+ pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );
+
+ if( psCache->bTiled )
+ {
+ nTileID = TIFFComputeTile( psCache->hTIFF,
+ iTileX * psCache->nBlockXSize,
+ iTileY * psCache->nBlockYSize,
+ 0, 0 );
+ TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
+ pabyData,
+ TIFFTileSize(psCache->hTIFF) );
+ }
+ else
+ {
+ nTileID = TIFFComputeStrip( psCache->hTIFF,
+ iTileY * psCache->nBlockYSize,
+ 0 );
+ RowsInStrip=psCache->nBlockYSize;
+ if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
+ RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
+ TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
+ pabyData,
+ TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
+ }
+ }
+ }
+ /* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */
+
+/* -------------------------------------------------------------------- */
+/* Rotate buffers. */
+/* -------------------------------------------------------------------- */
+ pabyData = psCache->pabyRow1Blocks;
+ psCache->pabyRow1Blocks = psCache->pabyRow2Blocks;
+ psCache->pabyRow2Blocks = pabyData;
+
+ _TIFFmemset( pabyData, 0, psCache->nBytesPerRow );
+
+ psCache->nBlockOffset++;
+
+/* -------------------------------------------------------------------- */
+/* Restore access to original directory. */
+/* -------------------------------------------------------------------- */
+ TIFFFlush( psCache->hTIFF );
+ /* TODO: add checks on error status return of TIFFFlush */
+ TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
+ /* TODO: add checks on error status return of TIFFSetSubDirectory */
+}
+
+/************************************************************************/
+/* TIFFGetOvrBlock() */
+/************************************************************************/
+
+/* TODO: make TIFF_Downsample handle iSample offset, so that we can
+ * do with a single TIFFGetOvrBlock and no longer need TIFFGetOvrBlock_Subsampled */
+unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
+ int iSample )
+
+{
+ int nRowOffset;
+
+ if( iTileY > psCache->nBlockOffset + 1 )
+ TIFFWriteOvrRow( psCache );
+
+ assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
+ assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
+ assert( iTileY >= psCache->nBlockOffset
+ && iTileY < psCache->nBlockOffset+2 );
+ assert( iSample >= 0 && iSample < psCache->nSamples );
+
+ if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+ nRowOffset = ((iTileX * psCache->nSamples) + iSample)
+ * psCache->nBytesPerBlock;
+ else
+ nRowOffset = iTileX * psCache->nBytesPerBlock +
+ (psCache->nBitsPerPixel + 7) / 8 * iSample;
+
+ if( iTileY == psCache->nBlockOffset )
+ return psCache->pabyRow1Blocks + nRowOffset;
+ else
+ return psCache->pabyRow2Blocks + nRowOffset;
+}
+
+/************************************************************************/
+/* TIFFGetOvrBlock_Subsampled() */
+/************************************************************************/
+
+unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache,
+ int iTileX, int iTileY )
+
+{
+ int nRowOffset;
+
+ if( iTileY > psCache->nBlockOffset + 1 )
+ TIFFWriteOvrRow( psCache );
+
+ assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
+ assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
+ assert( iTileY >= psCache->nBlockOffset
+ && iTileY < psCache->nBlockOffset+2 );
+ assert( psCache->nPlanarConfig != PLANARCONFIG_SEPARATE );
+
+ nRowOffset = iTileX * psCache->nBytesPerBlock;
+
+ if( iTileY == psCache->nBlockOffset )
+ return psCache->pabyRow1Blocks + nRowOffset;
+ else
+ return psCache->pabyRow2Blocks + nRowOffset;
+}
+
+/************************************************************************/
+/* TIFFDestroyOvrCache() */
+/************************************************************************/
+
+void TIFFDestroyOvrCache( TIFFOvrCache * psCache )
+
+{
+ while( psCache->nBlockOffset < psCache->nBlocksPerColumn )
+ TIFFWriteOvrRow( psCache );
+
+ _TIFFfree( psCache->pabyRow1Blocks );
+ _TIFFfree( psCache->pabyRow2Blocks );
+ _TIFFfree( psCache );
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/addtiffo/tif_ovrcache.h b/tiff/contrib/addtiffo/tif_ovrcache.h
new file mode 100644
index 0000000..928de36
--- /dev/null
+++ b/tiff/contrib/addtiffo/tif_ovrcache.h
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp
+ *
+ * Project: TIFF Overview Builder
+ * Purpose: Library functions to maintain two rows of tiles or two strips
+ * of data for output overviews as an output cache.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ * This code could potentially be used by other applications wanting to
+ * manage a once-through write cache.
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+#ifndef TIF_OVRCACHE_H_INCLUDED
+#define TIF_OVRCACHE_H_INCLUDED
+
+#include "tiffio.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct
+{
+ uint32 nXSize;
+ uint32 nYSize;
+
+ uint16 nBitsPerPixel;
+ uint16 nSamples;
+ uint16 nPlanarConfig;
+ uint32 nBlockXSize;
+ uint32 nBlockYSize;
+ uint32 nBytesPerBlock;
+ uint32 nBytesPerRow;
+
+ int nBlocksPerRow;
+ int nBlocksPerColumn;
+
+ int nBlockOffset; /* what block is the first in papabyBlocks? */
+ unsigned char *pabyRow1Blocks;
+ unsigned char *pabyRow2Blocks;
+
+ int nDirOffset;
+ TIFF *hTIFF;
+ int bTiled;
+
+} TIFFOvrCache;
+
+TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset );
+unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
+ int iSample );
+unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, int iTileX, int iTileY );
+void TIFFDestroyOvrCache( TIFFOvrCache * );
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+ int (*)(double,void*), void * );
+
+void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
+ int bSubsampled, int nHorSamples, int nVerSamples,
+ int nOverviews, int * panOvList,
+ int nBitsPerPixel,
+ int nSamples, TIFFOvrCache ** papoRawBIs,
+ int nSXOff, int nSYOff,
+ unsigned char *pabySrcTile,
+ int nBlockXSize, int nBlockYSize,
+ int nSampleFormat, const char * pszResampling );
+
+uint32 TIFF_WriteOverview( TIFF *, int, int, int, int, int, int, int,
+ int, int, int, int, unsigned short *,
+ unsigned short *, unsigned short *, int,
+ int, int);
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/Makefile.am b/tiff/contrib/dbs/Makefile.am
new file mode 100644
index 0000000..608a0ad
--- /dev/null
+++ b/tiff/contrib/dbs/Makefile.am
@@ -0,0 +1,43 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+SUBDIRS = xtiff
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README
+
+noinst_PROGRAMS = tiff-bi tiff-grayscale tiff-palette tiff-rgb
+
+tiff_bi_SOURCES = tiff-bi.c
+tiff_bi_LDADD = $(LIBTIFF)
+tiff_grayscale_SOURCES = tiff-grayscale.c
+tiff_grayscale_LDADD = $(LIBTIFF)
+tiff_palette_SOURCES = tiff-palette.c
+tiff_palette_LDADD = $(LIBTIFF)
+tiff_rgb_SOURCES = tiff-rgb.c
+tiff_rgb_LDADD = $(LIBTIFF)
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/dbs/Makefile.in b/tiff/contrib/dbs/Makefile.in
new file mode 100644
index 0000000..72eaf43
--- /dev/null
+++ b/tiff/contrib/dbs/Makefile.in
@@ -0,0 +1,737 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = tiff-bi$(EXEEXT) tiff-grayscale$(EXEEXT) \
+ tiff-palette$(EXEEXT) tiff-rgb$(EXEEXT)
+subdir = contrib/dbs
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_tiff_bi_OBJECTS = tiff-bi.$(OBJEXT)
+tiff_bi_OBJECTS = $(am_tiff_bi_OBJECTS)
+tiff_bi_DEPENDENCIES = $(LIBTIFF)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+am_tiff_grayscale_OBJECTS = tiff-grayscale.$(OBJEXT)
+tiff_grayscale_OBJECTS = $(am_tiff_grayscale_OBJECTS)
+tiff_grayscale_DEPENDENCIES = $(LIBTIFF)
+am_tiff_palette_OBJECTS = tiff-palette.$(OBJEXT)
+tiff_palette_OBJECTS = $(am_tiff_palette_OBJECTS)
+tiff_palette_DEPENDENCIES = $(LIBTIFF)
+am_tiff_rgb_OBJECTS = tiff-rgb.$(OBJEXT)
+tiff_rgb_OBJECTS = $(am_tiff_rgb_OBJECTS)
+tiff_rgb_DEPENDENCIES = $(LIBTIFF)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \
+ $(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)
+DIST_SOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \
+ $(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = xtiff
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README
+tiff_bi_SOURCES = tiff-bi.c
+tiff_bi_LDADD = $(LIBTIFF)
+tiff_grayscale_SOURCES = tiff-grayscale.c
+tiff_grayscale_LDADD = $(LIBTIFF)
+tiff_palette_SOURCES = tiff-palette.c
+tiff_palette_LDADD = $(LIBTIFF)
+tiff_rgb_SOURCES = tiff-rgb.c
+tiff_rgb_LDADD = $(LIBTIFF)
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/dbs/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/dbs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+tiff-bi$(EXEEXT): $(tiff_bi_OBJECTS) $(tiff_bi_DEPENDENCIES)
+ @rm -f tiff-bi$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tiff_bi_OBJECTS) $(tiff_bi_LDADD) $(LIBS)
+tiff-grayscale$(EXEEXT): $(tiff_grayscale_OBJECTS) $(tiff_grayscale_DEPENDENCIES)
+ @rm -f tiff-grayscale$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tiff_grayscale_OBJECTS) $(tiff_grayscale_LDADD) $(LIBS)
+tiff-palette$(EXEEXT): $(tiff_palette_OBJECTS) $(tiff_palette_DEPENDENCIES)
+ @rm -f tiff-palette$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tiff_palette_OBJECTS) $(tiff_palette_LDADD) $(LIBS)
+tiff-rgb$(EXEEXT): $(tiff_rgb_OBJECTS) $(tiff_rgb_DEPENDENCIES)
+ @rm -f tiff-rgb$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tiff_rgb_OBJECTS) $(tiff_rgb_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-bi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-grayscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-palette.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-rgb.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstPROGRAMS ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/dbs/README b/tiff/contrib/dbs/README
new file mode 100644
index 0000000..e05d0a9
--- /dev/null
+++ b/tiff/contrib/dbs/README
@@ -0,0 +1,7 @@
+Wed May 9 09:11:35 PDT 1990
+
+This directory contains programs from Dan Sears
+(dbs@decwrl.dec.com). Contact him directly if
+you have questions/problems.
+
+ Sam
diff --git a/tiff/contrib/dbs/tiff-bi.c b/tiff/contrib/dbs/tiff-bi.c
new file mode 100644
index 0000000..f549209
--- /dev/null
+++ b/tiff/contrib/dbs/tiff-bi.c
@@ -0,0 +1,91 @@
+/* $Id: tiff-bi.c,v 1.2.2.1 2010-06-08 18:50:40 bfriesen Exp $ */
+
+/*
+ * tiff-bi.c -- create a Class B (bilevel) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "tiffio.h"
+
+#define WIDTH 512
+#define HEIGHT WIDTH
+
+int main(int argc, char **argv)
+{
+ int i;
+ unsigned char * scan_line;
+ TIFF * tif;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s tiff-image\n", argv[0]);
+ return 0;
+ }
+
+ if ((tif = TIFFOpen(argv[1], "w")) == NULL) {
+ fprintf(stderr, "can't open %s as a TIFF file\n", argv[1]);
+ return 0;
+ }
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 1);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+
+ scan_line = (unsigned char *) malloc(WIDTH / 8);
+
+ for (i = 0; i < (WIDTH / 8) / 2; i++)
+ scan_line[i] = 0;
+
+ for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
+ scan_line[i] = 255;
+
+ for (i = 0; i < HEIGHT / 2; i++)
+ TIFFWriteScanline(tif, scan_line, i, 0);
+
+ for (i = 0; i < (WIDTH / 8) / 2; i++)
+ scan_line[i] = 255;
+
+ for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
+ scan_line[i] = 0;
+
+ for (i = HEIGHT / 2; i < HEIGHT; i++)
+ TIFFWriteScanline(tif, scan_line, i, 0);
+
+ free(scan_line);
+ TIFFClose(tif);
+ return 0;
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/tiff-grayscale.c b/tiff/contrib/dbs/tiff-grayscale.c
new file mode 100644
index 0000000..e8f474c
--- /dev/null
+++ b/tiff/contrib/dbs/tiff-grayscale.c
@@ -0,0 +1,146 @@
+/* $Id: tiff-grayscale.c,v 1.4.2.1 2010-06-08 18:50:40 bfriesen Exp $ */
+
+/*
+ * tiff-grayscale.c -- create a Class G (grayscale) TIFF file
+ * with a gray response curve in linear optical density
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define WIDTH 512
+#define HEIGHT WIDTH
+
+char * programName;
+void Usage();
+
+int main(int argc, char **argv)
+{
+ int bits_per_pixel = 8, cmsize, i, j, k,
+ gray_index, chunk_size = 32, nchunks = 16;
+ unsigned char * scan_line;
+ uint16 * gray;
+ float refblackwhite[2*1];
+ TIFF * tif;
+
+ programName = argv[0];
+
+ if (argc != 4)
+ Usage();
+
+ if (!strcmp(argv[1], "-depth"))
+ bits_per_pixel = atoi(argv[2]);
+ else
+ Usage();
+
+ switch (bits_per_pixel) {
+ case 8:
+ nchunks = 16;
+ chunk_size = 32;
+ break;
+ case 4:
+ nchunks = 4;
+ chunk_size = 128;
+ break;
+ case 2:
+ nchunks = 2;
+ chunk_size = 256;
+ break;
+ default:
+ Usage();
+ }
+
+ cmsize = nchunks * nchunks;
+ gray = (uint16 *) malloc(cmsize * sizeof(uint16));
+
+ gray[0] = 3000;
+ for (i = 1; i < cmsize; i++)
+ gray[i] = (uint16) (-log10((double) i / (cmsize - 1)) * 1000);
+
+ refblackwhite[0] = 0.0;
+ refblackwhite[1] = (float)((1L<<bits_per_pixel) - 1);
+
+ if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
+ fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
+ return 0;
+ }
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
+ TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, gray);
+ TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+
+ scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
+
+ for (i = 0; i < HEIGHT; i++) {
+ for (j = 0, k = 0; j < WIDTH;) {
+ gray_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
+
+ switch (bits_per_pixel) {
+ case 8:
+ scan_line[k++] = gray_index;
+ j++;
+ break;
+ case 4:
+ scan_line[k++] = (gray_index << 4) + gray_index;
+ j += 2;
+ break;
+ case 2:
+ scan_line[k++] = (gray_index << 6) + (gray_index << 4)
+ + (gray_index << 2) + gray_index;
+ j += 4;
+ break;
+ }
+ }
+ TIFFWriteScanline(tif, scan_line, i, 0);
+ }
+
+ free(scan_line);
+ TIFFClose(tif);
+ return 0;
+}
+
+void
+Usage()
+{
+ fprintf(stderr, "Usage: %s -depth (8 | 4 | 2) tiff-image\n", programName);
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/tiff-palette.c b/tiff/contrib/dbs/tiff-palette.c
new file mode 100644
index 0000000..054000b
--- /dev/null
+++ b/tiff/contrib/dbs/tiff-palette.c
@@ -0,0 +1,283 @@
+/* $Id: tiff-palette.c,v 1.3.2.1 2010-06-08 18:50:40 bfriesen Exp $ */
+
+/*
+ * tiff-palette.c -- create a Class P (palette) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define WIDTH 512
+#define HEIGHT WIDTH
+#define SCALE(x) ((x) * 257L)
+
+char * programName;
+void Usage();
+
+int main(int argc, char **argv)
+{
+ int bits_per_pixel = 8, cmsize, i, j, k,
+ cmap_index, chunk_size = 32, nchunks = 16;
+ unsigned char * scan_line;
+ uint16 *red, *green, *blue;
+ TIFF * tif;
+
+ programName = argv[0];
+
+ if (argc != 4)
+ Usage();
+
+ if (!strcmp(argv[1], "-depth"))
+ bits_per_pixel = atoi(argv[2]);
+ else
+ Usage();
+
+ switch (bits_per_pixel) {
+ case 8:
+ nchunks = 16;
+ chunk_size = 32;
+ break;
+ case 4:
+ nchunks = 4;
+ chunk_size = 128;
+ break;
+ case 2:
+ nchunks = 2;
+ chunk_size = 256;
+ break;
+ case 1:
+ nchunks = 2;
+ chunk_size = 256;
+ break;
+ default:
+ Usage();
+ }
+
+ if (bits_per_pixel != 1) {
+ cmsize = nchunks * nchunks;
+ } else {
+ cmsize = 2;
+ }
+ red = (uint16 *) malloc(cmsize * sizeof(uint16));
+ green = (uint16 *) malloc(cmsize * sizeof(uint16));
+ blue = (uint16 *) malloc(cmsize * sizeof(uint16));
+
+ switch (bits_per_pixel) {
+ case 8:
+ for (i = 0; i < cmsize; i++) {
+ if (i < 32)
+ red[i] = 0;
+ else if (i < 64)
+ red[i] = SCALE(36);
+ else if (i < 96)
+ red[i] = SCALE(73);
+ else if (i < 128)
+ red[i] = SCALE(109);
+ else if (i < 160)
+ red[i] = SCALE(146);
+ else if (i < 192)
+ red[i] = SCALE(182);
+ else if (i < 224)
+ red[i] = SCALE(219);
+ else if (i < 256)
+ red[i] = SCALE(255);
+
+ if ((i % 32) < 4)
+ green[i] = 0;
+ else if (i < 8)
+ green[i] = SCALE(36);
+ else if ((i % 32) < 12)
+ green[i] = SCALE(73);
+ else if ((i % 32) < 16)
+ green[i] = SCALE(109);
+ else if ((i % 32) < 20)
+ green[i] = SCALE(146);
+ else if ((i % 32) < 24)
+ green[i] = SCALE(182);
+ else if ((i % 32) < 28)
+ green[i] = SCALE(219);
+ else if ((i % 32) < 32)
+ green[i] = SCALE(255);
+
+ if ((i % 4) == 0)
+ blue[i] = SCALE(0);
+ else if ((i % 4) == 1)
+ blue[i] = SCALE(85);
+ else if ((i % 4) == 2)
+ blue[i] = SCALE(170);
+ else if ((i % 4) == 3)
+ blue[i] = SCALE(255);
+ }
+ break;
+ case 4:
+ red[0] = SCALE(255);
+ green[0] = 0;
+ blue[0] = 0;
+
+ red[1] = 0;
+ green[1] = SCALE(255);
+ blue[1] = 0;
+
+ red[2] = 0;
+ green[2] = 0;
+ blue[2] = SCALE(255);
+
+ red[3] = SCALE(255);
+ green[3] = SCALE(255);
+ blue[3] = SCALE(255);
+
+ red[4] = 0;
+ green[4] = SCALE(255);
+ blue[4] = SCALE(255);
+
+ red[5] = SCALE(255);
+ green[5] = 0;
+ blue[5] = SCALE(255);
+
+ red[6] = SCALE(255);
+ green[6] = SCALE(255);
+ blue[6] = 0;
+
+ red[7] = 0;
+ green[7] = 0;
+ blue[7] = 0;
+
+ red[8] = SCALE(176);
+ green[8] = SCALE(224);
+ blue[8] = SCALE(230);
+ red[9] = SCALE(100);
+ green[9] = SCALE(149);
+ blue[9] = SCALE(237);
+ red[10] = SCALE(46);
+ green[10] = SCALE(139);
+ blue[10] = SCALE(87);
+ red[11] = SCALE(160);
+ green[11] = SCALE(82);
+ blue[11] = SCALE(45);
+ red[12] = SCALE(238);
+ green[12] = SCALE(130);
+ blue[12] = SCALE(238);
+ red[13] = SCALE(176);
+ green[13] = SCALE(48);
+ blue[13] = SCALE(96);
+ red[14] = SCALE(50);
+ green[14] = SCALE(205);
+ blue[14] = SCALE(50);
+ red[15] = SCALE(240);
+ green[15] = SCALE(152);
+ blue[15] = SCALE(35);
+ break;
+ case 2:
+ red[0] = SCALE(255);
+ green[0] = 0;
+ blue[0] = 0;
+
+ red[1] = 0;
+ green[1] = SCALE(255);
+ blue[1] = 0;
+
+ red[2] = 0;
+ green[2] = 0;
+ blue[2] = SCALE(255);
+ red[3] = SCALE(255);
+ green[3] = SCALE(255);
+ blue[3] = SCALE(255);
+ break;
+ case 1:
+ red[0] = 0;
+ green[0] = 0;
+ blue[0] = 0;
+
+ red[1] = SCALE(255);
+ green[1] = SCALE(255);
+ blue[1] = SCALE(255);
+ break;
+ }
+
+ if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
+ fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
+ return 0;
+ }
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+ TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+
+ scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
+
+ for (i = 0; i < HEIGHT; i++) {
+ for (j = 0, k = 0; j < WIDTH;) {
+ cmap_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
+
+ switch (bits_per_pixel) {
+ case 8:
+ scan_line[k++] = cmap_index;
+ j++;
+ break;
+ case 4:
+ scan_line[k++] = (cmap_index << 4) + cmap_index;
+ j += 2;
+ break;
+ case 2:
+ scan_line[k++] = (cmap_index << 6) + (cmap_index << 4)
+ + (cmap_index << 2) + cmap_index;
+ j += 4;
+ break;
+ case 1:
+ scan_line[k++] =
+ ((j / chunk_size) == (i / chunk_size)) ? 0x00 : 0xff;
+ j += 8;
+ break;
+ }
+ }
+ TIFFWriteScanline(tif, scan_line, i, 0);
+ }
+
+ free(scan_line);
+ TIFFClose(tif);
+ return 0;
+}
+
+void
+Usage()
+{
+ fprintf(stderr, "Usage: %s -depth (8 | 4 | 2 | 1) tiff-image\n", programName);
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/tiff-rgb.c b/tiff/contrib/dbs/tiff-rgb.c
new file mode 100644
index 0000000..dcde673
--- /dev/null
+++ b/tiff/contrib/dbs/tiff-rgb.c
@@ -0,0 +1,201 @@
+/* $Id: tiff-rgb.c,v 1.3.2.1 2010-06-08 18:50:40 bfriesen Exp $ */
+
+/*
+ * tiff-rgb.c -- create a 24-bit Class R (rgb) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define ROUND(x) (uint16) ((x) + 0.5)
+#define CMSIZE 256
+#define WIDTH 525
+#define HEIGHT 512
+#define TIFF_GAMMA 2.2
+
+void Usage();
+char * programName;
+
+int main(int argc, char **argv)
+{
+ char * input_file = NULL;
+ double image_gamma = TIFF_GAMMA;
+ int i, j;
+ TIFF * tif;
+ unsigned char * scan_line;
+ uint16 red[CMSIZE], green[CMSIZE], blue[CMSIZE];
+ float refblackwhite[2*3];
+
+ programName = argv[0];
+
+ switch (argc) {
+ case 2:
+ image_gamma = TIFF_GAMMA;
+ input_file = argv[1];
+ break;
+ case 4:
+ if (!strcmp(argv[1], "-gamma")) {
+ image_gamma = atof(argv[2]);
+ input_file = argv[3];
+ } else
+ Usage();
+ break;
+ default:
+ Usage();
+ }
+
+ for (i = 0; i < CMSIZE; i++) {
+ if (i == 0)
+ red[i] = green[i] = blue[i] = 0;
+ else {
+ red[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+ green[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+ blue[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+ }
+ }
+ refblackwhite[0] = 0.0; refblackwhite[1] = 255.0;
+ refblackwhite[2] = 0.0; refblackwhite[3] = 255.0;
+ refblackwhite[4] = 0.0; refblackwhite[5] = 255.0;
+
+ if ((tif = TIFFOpen(input_file, "w")) == NULL) {
+ fprintf(stderr, "can't open %s as a TIFF file\n", input_file);
+ exit(0);
+ }
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+#ifdef notdef
+ TIFFSetField(tif, TIFFTAG_WHITEPOINT, whitex, whitey);
+ TIFFSetField(tif, TIFFTAG_PRIMARYCHROMATICITIES, primaries);
+#endif
+ TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
+ TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, red, green, blue);
+
+ scan_line = (unsigned char *) malloc(WIDTH * 3);
+
+ for (i = 0; i < 255; i++) {
+ for (j = 0; j < 75; j++) {
+ scan_line[j * 3] = 255;
+ scan_line[(j * 3) + 1] = 255 - i;
+ scan_line[(j * 3) + 2] = 255 - i;
+ }
+ for (j = 75; j < 150; j++) {
+ scan_line[j * 3] = 255 - i;
+ scan_line[(j * 3) + 1] = 255;
+ scan_line[(j * 3) + 2] = 255 - i;
+ }
+ for (j = 150; j < 225; j++) {
+ scan_line[j * 3] = 255 - i;
+ scan_line[(j * 3) + 1] = 255 - i;
+ scan_line[(j * 3) + 2] = 255;
+ }
+ for (j = 225; j < 300; j++) {
+ scan_line[j * 3] = (i - 1) / 2;
+ scan_line[(j * 3) + 1] = (i - 1) / 2;
+ scan_line[(j * 3) + 2] = (i - 1) / 2;
+ }
+ for (j = 300; j < 375; j++) {
+ scan_line[j * 3] = 255 - i;
+ scan_line[(j * 3) + 1] = 255;
+ scan_line[(j * 3) + 2] = 255;
+ }
+ for (j = 375; j < 450; j++) {
+ scan_line[j * 3] = 255;
+ scan_line[(j * 3) + 1] = 255 - i;
+ scan_line[(j * 3) + 2] = 255;
+ }
+ for (j = 450; j < 525; j++) {
+ scan_line[j * 3] = 255;
+ scan_line[(j * 3) + 1] = 255;
+ scan_line[(j * 3) + 2] = 255 - i;
+ }
+ TIFFWriteScanline(tif, scan_line, i, 0);
+ }
+ for (i = 255; i < 512; i++) {
+ for (j = 0; j < 75; j++) {
+ scan_line[j * 3] = i;
+ scan_line[(j * 3) + 1] = 0;
+ scan_line[(j * 3) + 2] = 0;
+ }
+ for (j = 75; j < 150; j++) {
+ scan_line[j * 3] = 0;
+ scan_line[(j * 3) + 1] = i;
+ scan_line[(j * 3) + 2] = 0;
+ }
+ for (j = 150; j < 225; j++) {
+ scan_line[j * 3] = 0;
+ scan_line[(j * 3) + 1] = 0;
+ scan_line[(j * 3) + 2] = i;
+ }
+ for (j = 225; j < 300; j++) {
+ scan_line[j * 3] = (i - 1) / 2;
+ scan_line[(j * 3) + 1] = (i - 1) / 2;
+ scan_line[(j * 3) + 2] = (i - 1) / 2;
+ }
+ for (j = 300; j < 375; j++) {
+ scan_line[j * 3] = 0;
+ scan_line[(j * 3) + 1] = i;
+ scan_line[(j * 3) + 2] = i;
+ }
+ for (j = 375; j < 450; j++) {
+ scan_line[j * 3] = i;
+ scan_line[(j * 3) + 1] = 0;
+ scan_line[(j * 3) + 2] = i;
+ }
+ for (j = 450; j < 525; j++) {
+ scan_line[j * 3] = i;
+ scan_line[(j * 3) + 1] = i;
+ scan_line[(j * 3) + 2] = 0;
+ }
+ TIFFWriteScanline(tif, scan_line, i, 0);
+ }
+
+ free(scan_line);
+ TIFFClose(tif);
+ exit(0);
+}
+
+void
+Usage()
+{
+ fprintf(stderr, "Usage: %s -gamma gamma tiff-image\n", programName);
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/xtiff/Makefile.am b/tiff/contrib/dbs/xtiff/Makefile.am
new file mode 100644
index 0000000..84c8a16
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/Makefile.am
@@ -0,0 +1,43 @@
+# $Id: Makefile.am,v 1.4 2007/02/24 15:03:49 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+#LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README patchlevel.h xtiff.c xtifficon.h
+
+#noinst_PROGRAMS =
+
+#if HAVE_XAW
+#noinst_PROGRAMS += xtiff
+#endif
+
+#xtiff_SOURCES = patchlevel.h xtiff.c xtifficon.h
+#xtiff_CFLAGS = $(CFLAGS) $(XAW_CFLAGS) $(AM_CFLAGS)
+#xtiff_LDADD = $(LIBTIFF) $(X_LIBS) $(XAW_LIBS)
+
+#INCLUDES = -I$(top_srcdir)/libtiff
+
diff --git a/tiff/contrib/dbs/xtiff/Makefile.in b/tiff/contrib/dbs/xtiff/Makefile.in
new file mode 100644
index 0000000..65b5259
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/Makefile.in
@@ -0,0 +1,436 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id: Makefile.am,v 1.4 2007/02/24 15:03:49 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+#LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/dbs/xtiff
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README patchlevel.h xtiff.c xtifficon.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/dbs/xtiff/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/dbs/xtiff/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+#noinst_PROGRAMS =
+
+#if HAVE_XAW
+#noinst_PROGRAMS += xtiff
+#endif
+
+#xtiff_SOURCES = patchlevel.h xtiff.c xtifficon.h
+#xtiff_CFLAGS = $(CFLAGS) $(XAW_CFLAGS) $(AM_CFLAGS)
+#xtiff_LDADD = $(LIBTIFF) $(X_LIBS) $(XAW_LIBS)
+
+#INCLUDES = -I$(top_srcdir)/libtiff
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/dbs/xtiff/README b/tiff/contrib/dbs/xtiff/README
new file mode 100644
index 0000000..fa15147
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/README
@@ -0,0 +1,6 @@
+xtiff 2.0
+
+xtiff is a tool for viewing a TIFF file in an X window. It was written to
+handle as many different kinds of TIFF files as possible while remaining
+simple, portable and efficient. xtiff requires X11 R4, the Athena Widgets
+and Sam Leffler's libtiff package (which can be found on ucbvax.berkeley.edu).
diff --git a/tiff/contrib/dbs/xtiff/patchlevel.h b/tiff/contrib/dbs/xtiff/patchlevel.h
new file mode 100644
index 0000000..538b6d9
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/patchlevel.h
@@ -0,0 +1,8 @@
+#define PATCHLEVEL 0
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/xtiff/xtiff.c b/tiff/contrib/dbs/xtiff/xtiff.c
new file mode 100644
index 0000000..7fe3977
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/xtiff.c
@@ -0,0 +1,1290 @@
+/*
+ * $Id: xtiff.c,v 1.2.2.1 2010-06-08 18:50:40 bfriesen Exp $
+ *
+ * xtiff - view a TIFF file in an X window
+ *
+ * Dan Sears
+ * Chris Sears
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Revision 1.0 90/05/07
+ * Initial release.
+ * Revision 2.0 90/12/20
+ * Converted to use the Athena Widgets and the Xt Intrinsics.
+ *
+ * Notes:
+ *
+ * According to the TIFF 5.0 Specification, it is possible to have
+ * both a TIFFTAG_COLORMAP and a TIFFTAG_COLORRESPONSECURVE. This
+ * doesn't make sense since a TIFFTAG_COLORMAP is 16 bits wide and
+ * a TIFFTAG_COLORRESPONSECURVE is tfBitsPerSample bits wide for each
+ * channel. This is probably a bug in the specification.
+ * In this case, TIFFTAG_COLORRESPONSECURVE is ignored.
+ * This might make sense if TIFFTAG_COLORMAP was 8 bits wide.
+ *
+ * TIFFTAG_COLORMAP is often incorrectly written as ranging from
+ * 0 to 255 rather than from 0 to 65535. CheckAndCorrectColormap()
+ * takes care of this.
+ *
+ * Only ORIENTATION_TOPLEFT is supported correctly. This is the
+ * default TIFF and X orientation. Other orientations will be
+ * displayed incorrectly.
+ *
+ * There is no support for or use of 3/3/2 DirectColor visuals.
+ * TIFFTAG_MINSAMPLEVALUE and TIFFTAG_MAXSAMPLEVALUE are not supported.
+ *
+ * Only TIFFTAG_BITSPERSAMPLE values that are 1, 2, 4 or 8 are supported.
+ */
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tiffio.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Xproto.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Label.h>
+#include <X11/cursorfont.h>
+#define XK_MISCELLANY
+#include <X11/keysymdef.h>
+#include "xtifficon.h"
+
+#define TIFF_GAMMA "2.2" /* default gamma from the TIFF 5.0 spec */
+#define ROUND(x) (uint16) ((x) + 0.5)
+#define SCALE(x, s) (((x) * 65535L) / (s))
+#define MCHECK(m) if (!m) { fprintf(stderr, "malloc failed\n"); exit(0); }
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define VIEWPORT_WIDTH 700
+#define VIEWPORT_HEIGHT 500
+#define KEY_TRANSLATE 20
+
+#ifdef __STDC__
+#define PP(args) args
+#else
+#define PP(args) ()
+#endif
+
+int main PP((int argc, char **argv));
+void OpenTIFFFile PP((void));
+void GetTIFFHeader PP((void));
+void SetNameLabel PP((void));
+void CheckAndCorrectColormap PP((void));
+void SimpleGammaCorrection PP((void));
+void GetVisual PP((void));
+Boolean SearchVisualList PP((int image_depth,
+ int visual_class, Visual **visual));
+void GetTIFFImage PP((void));
+void CreateXImage PP((void));
+XtCallbackProc SelectProc PP((Widget w, caddr_t unused_1, caddr_t unused_2));
+void QuitProc PP((void));
+void NextProc PP((void));
+void PreviousProc PP((void));
+void PageProc PP((int direction));
+void EventProc PP((Widget widget, caddr_t unused, XEvent *event));
+void ResizeProc PP((void));
+int XTiffErrorHandler PP((Display *display, XErrorEvent *error_event));
+void Usage PP((void));
+
+int xtVersion = XtSpecificationRelease; /* xtiff depends on R4 or higher */
+
+/*
+ * Xt data structures
+ */
+Widget shellWidget, formWidget, listWidget, labelWidget, imageWidget;
+
+enum { ButtonQuit = 0, ButtonPreviousPage = 1, ButtonNextPage = 2 };
+
+String buttonStrings[] = { "Quit", "Previous", "Next" };
+
+static XrmOptionDescRec shellOptions[] = {
+ { "-help", "*help", XrmoptionNoArg, (caddr_t) "True" },
+ { "-gamma", "*gamma", XrmoptionSepArg, NULL },
+ { "-usePixmap", "*usePixmap", XrmoptionSepArg, NULL },
+ { "-viewportWidth", "*viewportWidth", XrmoptionSepArg, NULL },
+ { "-viewportHeight", "*viewportHeight", XrmoptionSepArg, NULL },
+ { "-translate", "*translate", XrmoptionSepArg, NULL },
+ { "-verbose", "*verbose", XrmoptionSepArg, NULL }
+};
+
+typedef struct {
+ Boolean help;
+ float gamma;
+ Boolean usePixmap;
+ uint32 viewportWidth;
+ uint32 viewportHeight;
+ int translate;
+ Boolean verbose;
+} AppData, *AppDataPtr;
+
+AppData appData;
+
+XtResource clientResources[] = {
+ {
+ "help", XtCBoolean, XtRBoolean, sizeof(Boolean),
+ XtOffset(AppDataPtr, help), XtRImmediate, (XtPointer) False
+ }, {
+ "gamma", "Gamma", XtRFloat, sizeof(float),
+ XtOffset(AppDataPtr, gamma), XtRString, (XtPointer) TIFF_GAMMA
+ }, {
+ "usePixmap", "UsePixmap", XtRBoolean, sizeof(Boolean),
+ XtOffset(AppDataPtr, usePixmap), XtRImmediate, (XtPointer) True
+ }, {
+ "viewportWidth", "ViewportWidth", XtRInt, sizeof(int),
+ XtOffset(AppDataPtr, viewportWidth), XtRImmediate,
+ (XtPointer) VIEWPORT_WIDTH
+ }, {
+ "viewportHeight", "ViewportHeight", XtRInt, sizeof(int),
+ XtOffset(AppDataPtr, viewportHeight), XtRImmediate,
+ (XtPointer) VIEWPORT_HEIGHT
+ }, {
+ "translate", "Translate", XtRInt, sizeof(int),
+ XtOffset(AppDataPtr, translate), XtRImmediate, (XtPointer) KEY_TRANSLATE
+ }, {
+ "verbose", "Verbose", XtRBoolean, sizeof(Boolean),
+ XtOffset(AppDataPtr, verbose), XtRImmediate, (XtPointer) True
+ }
+};
+
+Arg formArgs[] = {
+ { XtNresizable, True }
+};
+
+Arg listArgs[] = {
+ { XtNresizable, False },
+ { XtNborderWidth, 0 },
+ { XtNdefaultColumns, 3 },
+ { XtNforceColumns, True },
+ { XtNlist, (int) buttonStrings },
+ { XtNnumberStrings, XtNumber(buttonStrings) },
+ { XtNtop, XtChainTop },
+ { XtNleft, XtChainLeft },
+ { XtNbottom, XtChainTop },
+ { XtNright, XtChainLeft }
+};
+
+Arg labelArgs[] = {
+ { XtNresizable, False },
+ { XtNwidth, 200 },
+ { XtNborderWidth, 0 },
+ { XtNjustify, XtJustifyLeft },
+ { XtNtop, XtChainTop },
+ { XtNleft, XtChainLeft },
+ { XtNbottom, XtChainTop },
+ { XtNright, XtChainLeft }
+};
+
+Arg imageArgs[] = {
+ { XtNresizable, True },
+ { XtNborderWidth, 0 },
+ { XtNtop, XtChainTop },
+ { XtNleft, XtChainLeft },
+ { XtNbottom, XtChainTop },
+ { XtNright, XtChainLeft }
+};
+
+XtActionsRec actionsTable[] = {
+ { "quit", QuitProc },
+ { "next", NextProc },
+ { "previous", PreviousProc },
+ { "notifyresize", ResizeProc }
+};
+
+char translationsTable[] = "<Key>q: quit() \n \
+ <Key>Q: quit() \n \
+ <Message>WM_PROTOCOLS: quit()\n \
+ <Key>p: previous() \n \
+ <Key>P: previous() \n \
+ <Key>n: next() \n \
+ <Key>N: next() \n \
+ <Configure>: notifyresize()";
+
+/*
+ * X data structures
+ */
+Colormap xColormap;
+Display * xDisplay;
+Pixmap xImagePixmap;
+Visual * xVisual;
+XImage * xImage;
+GC xWinGc;
+int xImageDepth, xScreen, xRedMask, xGreenMask, xBlueMask,
+ xOffset = 0, yOffset = 0, grabX = -1, grabY = -1;
+unsigned char basePixel = 0;
+
+/*
+ * TIFF data structures
+ */
+TIFF * tfFile = NULL;
+uint32 tfImageWidth, tfImageHeight;
+uint16 tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
+ tfPhotometricInterpretation, tfGrayResponseUnit,
+ tfImageDepth, tfBytesPerRow;
+int tfDirectory = 0, tfMultiPage = False;
+double tfUnitMap, tfGrayResponseUnitMap[] = {
+ -1, -10, -100, -1000, -10000, -100000
+ };
+
+/*
+ * display data structures
+ */
+double *dRed, *dGreen, *dBlue;
+
+/*
+ * shared data structures
+ */
+uint16 * redMap = NULL, *greenMap = NULL, *blueMap = NULL,
+ *grayMap = NULL, colormapSize;
+char * imageMemory;
+char * fileName;
+
+int
+main(int argc, char **argv)
+{
+ XSetWindowAttributes window_attributes;
+ Widget widget_list[3];
+ Arg args[5];
+
+ setbuf(stdout, NULL); setbuf(stderr, NULL);
+
+ shellWidget = XtInitialize(argv[0], "XTiff", shellOptions,
+ XtNumber(shellOptions), &argc, argv);
+
+ XSetErrorHandler(XTiffErrorHandler);
+
+ XtGetApplicationResources(shellWidget, &appData,
+ (XtResourceList) clientResources, (Cardinal) XtNumber(clientResources),
+ (ArgList) NULL, (Cardinal) 0);
+
+ if ((argc <= 1) || (argc > 2) || appData.help)
+ Usage();
+
+ if (appData.verbose == False) {
+ TIFFSetErrorHandler(0);
+ TIFFSetWarningHandler(0);
+ }
+
+ fileName = argv[1];
+
+ xDisplay = XtDisplay(shellWidget);
+ xScreen = DefaultScreen(xDisplay);
+
+ OpenTIFFFile();
+ GetTIFFHeader();
+ SimpleGammaCorrection();
+ GetVisual();
+ GetTIFFImage();
+
+ /*
+ * Send visual, colormap, depth and iconPixmap to shellWidget.
+ * Sending the visual to the shell is only possible with the advent of R4.
+ */
+ XtSetArg(args[0], XtNvisual, xVisual);
+ XtSetArg(args[1], XtNcolormap, xColormap);
+ XtSetArg(args[2], XtNdepth,
+ xImageDepth == 1 ? DefaultDepth(xDisplay, xScreen) : xImageDepth);
+ XtSetArg(args[3], XtNiconPixmap,
+ XCreateBitmapFromData(xDisplay, RootWindow(xDisplay, xScreen),
+ xtifficon_bits, xtifficon_width, xtifficon_height));
+ XtSetArg(args[4], XtNallowShellResize, True);
+ XtSetValues(shellWidget, args, 5);
+
+ /*
+ * widget instance hierarchy
+ */
+ formWidget = XtCreateManagedWidget("form", formWidgetClass,
+ shellWidget, formArgs, XtNumber(formArgs));
+
+ widget_list[0] = listWidget = XtCreateWidget("list",
+ listWidgetClass, formWidget, listArgs, XtNumber(listArgs));
+
+ widget_list[1] = labelWidget = XtCreateWidget("label",
+ labelWidgetClass, formWidget, labelArgs, XtNumber(labelArgs));
+
+ widget_list[2] = imageWidget = XtCreateWidget("image",
+ widgetClass, formWidget, imageArgs, XtNumber(imageArgs));
+
+ XtManageChildren(widget_list, XtNumber(widget_list));
+
+ /*
+ * initial widget sizes - for small images let xtiff size itself
+ */
+ if (tfImageWidth >= appData.viewportWidth) {
+ XtSetArg(args[0], XtNwidth, appData.viewportWidth);
+ XtSetValues(shellWidget, args, 1);
+ }
+ if (tfImageHeight >= appData.viewportHeight) {
+ XtSetArg(args[0], XtNheight, appData.viewportHeight);
+ XtSetValues(shellWidget, args, 1);
+ }
+
+ XtSetArg(args[0], XtNwidth, tfImageWidth);
+ XtSetArg(args[1], XtNheight, tfImageHeight);
+ XtSetValues(imageWidget, args, 2);
+
+ /*
+ * formWidget uses these constraints but they are stored in the children.
+ */
+ XtSetArg(args[0], XtNfromVert, listWidget);
+ XtSetValues(imageWidget, args, 1);
+ XtSetArg(args[0], XtNfromHoriz, listWidget);
+ XtSetValues(labelWidget, args, 1);
+
+ SetNameLabel();
+
+ XtAddCallback(listWidget, XtNcallback, (XtCallbackProc) SelectProc,
+ (XtPointer) NULL);
+
+ XtAddActions(actionsTable, XtNumber(actionsTable));
+ XtSetArg(args[0], XtNtranslations,
+ XtParseTranslationTable(translationsTable));
+ XtSetValues(formWidget, &args[0], 1);
+ XtSetValues(imageWidget, &args[0], 1);
+
+ /*
+ * This is intended to be a little faster than going through
+ * the translation manager.
+ */
+ XtAddEventHandler(imageWidget, ExposureMask | ButtonPressMask
+ | ButtonReleaseMask | Button1MotionMask | KeyPressMask,
+ False, EventProc, NULL);
+
+ XtRealizeWidget(shellWidget);
+
+ window_attributes.cursor = XCreateFontCursor(xDisplay, XC_fleur);
+ XChangeWindowAttributes(xDisplay, XtWindow(imageWidget),
+ CWCursor, &window_attributes);
+
+ CreateXImage();
+
+ XtMainLoop();
+
+ return 0;
+}
+
+void
+OpenTIFFFile()
+{
+ if (tfFile != NULL)
+ TIFFClose(tfFile);
+
+ if ((tfFile = TIFFOpen(fileName, "r")) == NULL) {
+ fprintf(appData.verbose ? stderr : stdout,
+ "xtiff: can't open %s as a TIFF file\n", fileName);
+ exit(0);
+ }
+
+ tfMultiPage = (TIFFLastDirectory(tfFile) ? False : True);
+}
+
+void
+GetTIFFHeader()
+{
+ register int i;
+
+ if (!TIFFSetDirectory(tfFile, tfDirectory)) {
+ fprintf(stderr, "xtiff: can't seek to directory %d in %s\n",
+ tfDirectory, fileName);
+ exit(0);
+ }
+
+ TIFFGetField(tfFile, TIFFTAG_IMAGEWIDTH, &tfImageWidth);
+ TIFFGetField(tfFile, TIFFTAG_IMAGELENGTH, &tfImageHeight);
+
+ /*
+ * If the following tags aren't present then use the TIFF defaults.
+ */
+ TIFFGetFieldDefaulted(tfFile, TIFFTAG_BITSPERSAMPLE, &tfBitsPerSample);
+ TIFFGetFieldDefaulted(tfFile, TIFFTAG_SAMPLESPERPIXEL, &tfSamplesPerPixel);
+ TIFFGetFieldDefaulted(tfFile, TIFFTAG_PLANARCONFIG, &tfPlanarConfiguration);
+ TIFFGetFieldDefaulted(tfFile, TIFFTAG_GRAYRESPONSEUNIT, &tfGrayResponseUnit);
+
+ tfUnitMap = tfGrayResponseUnitMap[tfGrayResponseUnit];
+ colormapSize = 1 << tfBitsPerSample;
+ tfImageDepth = tfBitsPerSample * tfSamplesPerPixel;
+
+ dRed = (double *) malloc(colormapSize * sizeof(double));
+ dGreen = (double *) malloc(colormapSize * sizeof(double));
+ dBlue = (double *) malloc(colormapSize * sizeof(double));
+ MCHECK(dRed); MCHECK(dGreen); MCHECK(dBlue);
+
+ /*
+ * If TIFFTAG_PHOTOMETRIC is not present then assign a reasonable default.
+ * The TIFF 5.0 specification doesn't give a default.
+ */
+ if (!TIFFGetField(tfFile, TIFFTAG_PHOTOMETRIC,
+ &tfPhotometricInterpretation)) {
+ if (tfSamplesPerPixel != 1)
+ tfPhotometricInterpretation = PHOTOMETRIC_RGB;
+ else if (tfBitsPerSample == 1)
+ tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;
+ else if (TIFFGetField(tfFile, TIFFTAG_COLORMAP,
+ &redMap, &greenMap, &blueMap)) {
+ tfPhotometricInterpretation = PHOTOMETRIC_PALETTE;
+ redMap = greenMap = blueMap = NULL;
+ } else
+ tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;
+ }
+
+ /*
+ * Given TIFFTAG_PHOTOMETRIC extract or create the response curves.
+ */
+ switch (tfPhotometricInterpretation) {
+ case PHOTOMETRIC_RGB:
+ redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+ for (i = 0; i < colormapSize; i++)
+ dRed[i] = dGreen[i] = dBlue[i]
+ = (double) SCALE(i, colormapSize - 1);
+ break;
+ case PHOTOMETRIC_PALETTE:
+ if (!TIFFGetField(tfFile, TIFFTAG_COLORMAP,
+ &redMap, &greenMap, &blueMap)) {
+ redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+ for (i = 0; i < colormapSize; i++)
+ dRed[i] = dGreen[i] = dBlue[i]
+ = (double) SCALE(i, colormapSize - 1);
+ } else {
+ CheckAndCorrectColormap();
+ for (i = 0; i < colormapSize; i++) {
+ dRed[i] = (double) redMap[i];
+ dGreen[i] = (double) greenMap[i];
+ dBlue[i] = (double) blueMap[i];
+ }
+ }
+ break;
+ case PHOTOMETRIC_MINISWHITE:
+ redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+ for (i = 0; i < colormapSize; i++)
+ dRed[i] = dGreen[i] = dBlue[i] = (double)
+ SCALE(colormapSize-1-i, colormapSize-1);
+ break;
+ case PHOTOMETRIC_MINISBLACK:
+ redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+ for (i = 0; i < colormapSize; i++)
+ dRed[i] = dGreen[i] = dBlue[i] = (double) SCALE(i, colormapSize-1);
+ break;
+ default:
+ fprintf(stderr,
+ "xtiff: can't display photometric interpretation type %d\n",
+ tfPhotometricInterpretation);
+ exit(0);
+ }
+}
+
+void
+SetNameLabel()
+{
+ char buffer[BUFSIZ];
+ Arg args[1];
+
+ if (tfMultiPage)
+ sprintf(buffer, "%s - page %d", fileName, tfDirectory);
+ else
+ strcpy(buffer, fileName);
+ XtSetArg(args[0], XtNlabel, buffer);
+ XtSetValues(labelWidget, args, 1);
+}
+
+/*
+ * Many programs get TIFF colormaps wrong. They use 8-bit colormaps instead of
+ * 16-bit colormaps. This function is a heuristic to detect and correct this.
+ */
+void
+CheckAndCorrectColormap()
+{
+ register int i;
+
+ for (i = 0; i < colormapSize; i++)
+ if ((redMap[i] > 255) || (greenMap[i] > 255) || (blueMap[i] > 255))
+ return;
+
+ for (i = 0; i < colormapSize; i++) {
+ redMap[i] = SCALE(redMap[i], 255);
+ greenMap[i] = SCALE(greenMap[i], 255);
+ blueMap[i] = SCALE(blueMap[i], 255);
+ }
+ TIFFWarning(fileName, "Assuming 8-bit colormap");
+}
+
+void
+SimpleGammaCorrection()
+{
+ register int i;
+ register double i_gamma = 1.0 / appData.gamma;
+
+ for (i = 0; i < colormapSize; i++) {
+ if (((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
+ && (i == colormapSize - 1))
+ || ((tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK)
+ && (i == 0)))
+ redMap[i] = greenMap[i] = blueMap[i] = 0;
+ else {
+ redMap[i] = ROUND((pow(dRed[i] / 65535.0, i_gamma) * 65535.0));
+ greenMap[i] = ROUND((pow(dGreen[i] / 65535.0, i_gamma) * 65535.0));
+ blueMap[i] = ROUND((pow(dBlue[i] / 65535.0, i_gamma) * 65535.0));
+ }
+ }
+
+ free(dRed); free(dGreen); free(dBlue);
+}
+
+static char* classNames[] = {
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor",
+ "DirectColor"
+};
+
+/*
+ * Current limitation: the visual is set initially by the first file.
+ * It cannot be changed.
+ */
+void
+GetVisual()
+{
+ XColor *colors = NULL;
+ unsigned long *pixels = NULL;
+ unsigned long i;
+
+ switch (tfImageDepth) {
+ /*
+ * X really wants a 32-bit image with the fourth channel unused,
+ * but the visual structure thinks it's 24-bit. bitmap_unit is 32.
+ */
+ case 32:
+ case 24:
+ if (SearchVisualList(24, DirectColor, &xVisual) == False) {
+ fprintf(stderr, "xtiff: 24-bit DirectColor visual not available\n");
+ exit(0);
+ }
+
+ colors = (XColor *) malloc(3 * colormapSize * sizeof(XColor));
+ MCHECK(colors);
+
+ for (i = 0; i < colormapSize; i++) {
+ colors[i].pixel = (i << 16) + (i << 8) + i;
+ colors[i].red = redMap[i];
+ colors[i].green = greenMap[i];
+ colors[i].blue = blueMap[i];
+ colors[i].flags = DoRed | DoGreen | DoBlue;
+ }
+
+ xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+ xVisual, AllocAll);
+ XStoreColors(xDisplay, xColormap, colors, colormapSize);
+ break;
+ case 8:
+ case 4:
+ case 2:
+ /*
+ * We assume that systems with 24-bit visuals also have 8-bit visuals.
+ * We don't promote from 8-bit PseudoColor to 24/32 bit DirectColor.
+ */
+ switch (tfPhotometricInterpretation) {
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ if (SearchVisualList((int) tfImageDepth, GrayScale, &xVisual) == True)
+ break;
+ case PHOTOMETRIC_PALETTE:
+ if (SearchVisualList((int) tfImageDepth, PseudoColor, &xVisual) == True)
+ break;
+ default:
+ fprintf(stderr, "xtiff: Unsupported TIFF/X configuration\n");
+ exit(0);
+ }
+
+ colors = (XColor *) malloc(colormapSize * sizeof(XColor));
+ MCHECK(colors);
+
+ for (i = 0; i < colormapSize; i++) {
+ colors[i].pixel = i;
+ colors[i].red = redMap[i];
+ colors[i].green = greenMap[i];
+ colors[i].blue = blueMap[i];
+ colors[i].flags = DoRed | DoGreen | DoBlue;
+ }
+
+ /*
+ * xtiff's colormap allocation is private. It does not attempt
+ * to detect whether any existing colormap entries are suitable
+ * for its use. This will cause colormap flashing. Furthermore,
+ * background and foreground are taken from the environment.
+ * For example, the foreground color may be red when the visual
+ * is GrayScale. If the colormap is completely populated,
+ * Xt will not be able to allocate fg and bg.
+ */
+ if (tfImageDepth == 8)
+ xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+ xVisual, AllocAll);
+ else {
+ xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+ xVisual, AllocNone);
+ pixels = (unsigned long *)
+ malloc(colormapSize * sizeof(unsigned long));
+ MCHECK(pixels);
+ (void) XAllocColorCells(xDisplay, xColormap, True,
+ NULL, 0, pixels, colormapSize);
+ basePixel = (unsigned char) pixels[0];
+ free(pixels);
+ }
+ XStoreColors(xDisplay, xColormap, colors, colormapSize);
+ break;
+ case 1:
+ xImageDepth = 1;
+ xVisual = DefaultVisual(xDisplay, xScreen);
+ xColormap = DefaultColormap(xDisplay, xScreen);
+ break;
+ default:
+ fprintf(stderr, "xtiff: unsupported image depth %d\n", tfImageDepth);
+ exit(0);
+ }
+
+ if (appData.verbose == True)
+ fprintf(stderr, "%s: Using %d-bit %s visual.\n",
+ fileName, xImageDepth, classNames[xVisual->class]);
+
+ if (colors != NULL)
+ free(colors);
+ if (grayMap != NULL)
+ free(grayMap);
+ if (redMap != NULL)
+ free(redMap);
+ if (greenMap != NULL)
+ free(greenMap);
+ if (blueMap != NULL)
+ free(blueMap);
+
+ colors = NULL; grayMap = redMap = greenMap = blueMap = NULL;
+}
+
+/*
+ * Search for an appropriate visual. Promote where necessary.
+ * Check to make sure that ENOUGH colormap entries are writeable.
+ * basePixel was determined when XAllocColorCells() contiguously
+ * allocated enough entries. basePixel is used below in GetTIFFImage.
+ */
+Boolean
+SearchVisualList(image_depth, visual_class, visual)
+ int image_depth, visual_class;
+ Visual **visual;
+{
+ XVisualInfo template_visual, *visual_list, *vl;
+ int i, n_visuals;
+
+ template_visual.screen = xScreen;
+ vl = visual_list = XGetVisualInfo(xDisplay, VisualScreenMask,
+ &template_visual, &n_visuals);
+
+ if (n_visuals == 0) {
+ fprintf(stderr, "xtiff: visual list not available\n");
+ exit(0);
+ }
+
+ for (i = 0; i < n_visuals; vl++, i++) {
+ if ((vl->class == visual_class) && (vl->depth >= image_depth)
+ && (vl->visual->map_entries >= (1 << vl->depth))) {
+ *visual = vl->visual;
+ xImageDepth = vl->depth;
+ xRedMask = vl->red_mask;
+ xGreenMask = vl->green_mask;
+ xBlueMask = vl->blue_mask;
+ XFree((char *) visual_list);
+ return True;
+ }
+ }
+
+ XFree((char *) visual_list);
+ return False;
+}
+
+void
+GetTIFFImage()
+{
+ int pixel_map[3], red_shift, green_shift, blue_shift;
+ char *scan_line, *output_p, *input_p;
+ uint32 i, j;
+ uint16 s;
+
+ scan_line = (char *) malloc(tfBytesPerRow = TIFFScanlineSize(tfFile));
+ MCHECK(scan_line);
+
+ if ((tfImageDepth == 32) || (tfImageDepth == 24)) {
+ output_p = imageMemory = (char *)
+ malloc(tfImageWidth * tfImageHeight * 4);
+ MCHECK(imageMemory);
+
+ /*
+ * Handle different color masks for different frame buffers.
+ */
+ if (ImageByteOrder(xDisplay) == LSBFirst) { /* DECstation 5000 */
+ red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 3
+ : (xRedMask == 0xFF0000 ? 2 : (xRedMask == 0xFF00 ? 1 : 0));
+ green_shift = pixel_map[1] = xGreenMask == 0xFF000000 ? 3
+ : (xGreenMask == 0xFF0000 ? 2 : (xGreenMask == 0xFF00 ? 1 : 0));
+ blue_shift = pixel_map[2] = xBlueMask == 0xFF000000 ? 3
+ : (xBlueMask == 0xFF0000 ? 2 : (xBlueMask == 0xFF00 ? 1 : 0));
+ } else { /* Ardent */
+ red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 0
+ : (xRedMask == 0xFF0000 ? 1 : (xRedMask == 0xFF00 ? 2 : 3));
+ green_shift = pixel_map[0] = xGreenMask == 0xFF000000 ? 0
+ : (xGreenMask == 0xFF0000 ? 1 : (xGreenMask == 0xFF00 ? 2 : 3));
+ blue_shift = pixel_map[0] = xBlueMask == 0xFF000000 ? 0
+ : (xBlueMask == 0xFF0000 ? 1 : (xBlueMask == 0xFF00 ? 2 : 3));
+ }
+
+ if (tfPlanarConfiguration == PLANARCONFIG_CONTIG) {
+ for (i = 0; i < tfImageHeight; i++) {
+ if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+ break;
+ for (input_p = scan_line, j = 0; j < tfImageWidth; j++) {
+ *(output_p + red_shift) = *input_p++;
+ *(output_p + green_shift) = *input_p++;
+ *(output_p + blue_shift) = *input_p++;
+ output_p += 4;
+ if (tfSamplesPerPixel == 4) /* skip the fourth channel */
+ input_p++;
+ }
+ }
+ } else {
+ for (s = 0; s < tfSamplesPerPixel; s++) {
+ if (s == 3) /* skip the fourth channel */
+ continue;
+ for (i = 0; i < tfImageHeight; i++) {
+ if (TIFFReadScanline(tfFile, scan_line, i, s) < 0)
+ break;
+ input_p = scan_line;
+ output_p = imageMemory + (i*tfImageWidth*4) + pixel_map[s];
+ for (j = 0; j < tfImageWidth; j++, output_p += 4)
+ *output_p = *input_p++;
+ }
+ }
+ }
+ } else {
+ if (xImageDepth == tfImageDepth) {
+ output_p = imageMemory = (char *)
+ malloc(tfBytesPerRow * tfImageHeight);
+ MCHECK(imageMemory);
+
+ for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
+ if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
+ break;
+ } else if ((xImageDepth == 8) && (tfImageDepth == 4)) {
+ output_p = imageMemory = (char *)
+ malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
+ MCHECK(imageMemory);
+
+ /*
+ * If a scanline is of odd size the inner loop below will overshoot.
+ * This is handled very simply by recalculating the start point at
+ * each scanline and padding imageMemory a little at the end.
+ */
+ for (i = 0; i < tfImageHeight; i++) {
+ if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+ break;
+ output_p = &imageMemory[i * tfImageWidth];
+ input_p = scan_line;
+ for (j = 0; j < tfImageWidth; j += 2, input_p++) {
+ *output_p++ = (*input_p >> 4) + basePixel;
+ *output_p++ = (*input_p & 0xf) + basePixel;
+ }
+ }
+ } else if ((xImageDepth == 8) && (tfImageDepth == 2)) {
+ output_p = imageMemory = (char *)
+ malloc(tfBytesPerRow * 4 * tfImageHeight + 4);
+ MCHECK(imageMemory);
+
+ for (i = 0; i < tfImageHeight; i++) {
+ if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+ break;
+ output_p = &imageMemory[i * tfImageWidth];
+ input_p = scan_line;
+ for (j = 0; j < tfImageWidth; j += 4, input_p++) {
+ *output_p++ = (*input_p >> 6) + basePixel;
+ *output_p++ = ((*input_p >> 4) & 3) + basePixel;
+ *output_p++ = ((*input_p >> 2) & 3) + basePixel;
+ *output_p++ = (*input_p & 3) + basePixel;
+ }
+ }
+ } else if ((xImageDepth == 4) && (tfImageDepth == 2)) {
+ output_p = imageMemory = (char *)
+ malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
+ MCHECK(imageMemory);
+
+ for (i = 0; i < tfImageHeight; i++) {
+ if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+ break;
+ output_p = &imageMemory[i * tfBytesPerRow * 2];
+ input_p = scan_line;
+ for (j = 0; j < tfImageWidth; j += 4, input_p++) {
+ *output_p++ = (((*input_p>>6) << 4)
+ | ((*input_p >> 4) & 3)) + basePixel;
+ *output_p++ = ((((*input_p>>2) & 3) << 4)
+ | (*input_p & 3)) + basePixel;
+ }
+ }
+ } else {
+ fprintf(stderr,
+ "xtiff: can't handle %d-bit TIFF file on an %d-bit display\n",
+ tfImageDepth, xImageDepth);
+ exit(0);
+ }
+ }
+
+ free(scan_line);
+}
+
+void
+CreateXImage()
+{
+ XGCValues gc_values;
+ GC bitmap_gc;
+
+ xOffset = yOffset = 0;
+ grabX = grabY = -1;
+
+ xImage = XCreateImage(xDisplay, xVisual, xImageDepth,
+ xImageDepth == 1 ? XYBitmap : ZPixmap, /* offset */ 0,
+ (char *) imageMemory, tfImageWidth, tfImageHeight,
+ /* bitmap_pad */ 8, /* bytes_per_line */ 0);
+
+ /*
+ * libtiff converts LSB data into MSB but doesn't change the FillOrder tag.
+ */
+ if (xImageDepth == 1)
+ xImage->bitmap_bit_order = MSBFirst;
+ if (xImageDepth <= 8)
+ xImage->byte_order = MSBFirst;
+
+ /*
+ * create an appropriate GC
+ */
+ gc_values.function = GXcopy;
+ gc_values.plane_mask = AllPlanes;
+ if (tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK) {
+ gc_values.foreground = XWhitePixel(xDisplay, xScreen);
+ gc_values.background = XBlackPixel(xDisplay, xScreen);
+ } else {
+ gc_values.foreground = XBlackPixel(xDisplay, xScreen);
+ gc_values.background = XWhitePixel(xDisplay, xScreen);
+ }
+ xWinGc = XCreateGC(xDisplay, XtWindow(shellWidget),
+ GCFunction | GCPlaneMask | GCForeground | GCBackground, &gc_values);
+
+ /*
+ * create the pixmap and load the image
+ */
+ if (appData.usePixmap == True) {
+ xImagePixmap = XCreatePixmap(xDisplay, RootWindow(xDisplay, xScreen),
+ xImage->width, xImage->height, xImageDepth);
+
+ /*
+ * According to the O'Reilly X Protocol Reference Manual, page 53,
+ * "A pixmap depth of one is always supported and listed, but windows
+ * of depth one might not be supported." Therefore we create a pixmap
+ * of depth one and use XCopyPlane(). This is idiomatic.
+ */
+ if (xImageDepth == 1) { /* just pass the bits through */
+ gc_values.foreground = 1; /* foreground describes set bits */
+ gc_values.background = 0; /* background describes clear bits */
+ bitmap_gc = XCreateGC(xDisplay, xImagePixmap,
+ GCForeground | GCBackground, &gc_values);
+ XPutImage(xDisplay, xImagePixmap, bitmap_gc, xImage,
+ 0, 0, 0, 0, xImage->width, xImage->height);
+ } else
+ XPutImage(xDisplay, xImagePixmap, xWinGc, xImage,
+ 0, 0, 0, 0, xImage->width, xImage->height);
+ XDestroyImage(xImage);
+ free(imageMemory);
+ }
+}
+
+XtCallbackProc
+SelectProc(w, unused_1, unused_2)
+ Widget w;
+ caddr_t unused_1;
+ caddr_t unused_2;
+{
+ XawListReturnStruct *list_return;
+
+ list_return = XawListShowCurrent(w);
+
+ switch (list_return->list_index) {
+ case ButtonQuit:
+ QuitProc();
+ break;
+ case ButtonPreviousPage:
+ PreviousProc();
+ break;
+ case ButtonNextPage:
+ NextProc();
+ break;
+ default:
+ fprintf(stderr, "error in SelectProc\n");
+ exit(0);
+ }
+ XawListUnhighlight(w);
+}
+
+void
+QuitProc(void)
+{
+ exit(0);
+}
+
+void
+NextProc()
+{
+ PageProc(ButtonNextPage);
+}
+
+void
+PreviousProc()
+{
+ PageProc(ButtonPreviousPage);
+}
+
+void
+PageProc(direction)
+ int direction;
+{
+ XEvent fake_event;
+ Arg args[4];
+
+ switch (direction) {
+ case ButtonPreviousPage:
+ if (tfDirectory > 0)
+ TIFFSetDirectory(tfFile, --tfDirectory);
+ else
+ return;
+ break;
+ case ButtonNextPage:
+ if (TIFFReadDirectory(tfFile) == True)
+ tfDirectory++;
+ else
+ return;
+ break;
+ default:
+ fprintf(stderr, "error in PageProc\n");
+ exit(0);
+ }
+
+ xOffset = yOffset = 0;
+ grabX = grabY = -1;
+
+ GetTIFFHeader();
+ SetNameLabel();
+ GetTIFFImage();
+
+ if (appData.usePixmap == True)
+ XFreePixmap(xDisplay, xImagePixmap);
+ else
+ XDestroyImage(xImage);
+
+ CreateXImage();
+
+ /*
+ * Using XtSetValues() to set the widget size causes a resize.
+ * This resize gets propagated up to the parent shell.
+ * In order to disable this visually disconcerting effect,
+ * shell resizing is temporarily disabled.
+ */
+ XtSetArg(args[0], XtNallowShellResize, False);
+ XtSetValues(shellWidget, args, 1);
+
+ XtSetArg(args[0], XtNwidth, tfImageWidth);
+ XtSetArg(args[1], XtNheight, tfImageHeight);
+ XtSetValues(imageWidget, args, 2);
+
+ XtSetArg(args[0], XtNallowShellResize, True);
+ XtSetValues(shellWidget, args, 1);
+
+ XClearWindow(xDisplay, XtWindow(imageWidget));
+
+ fake_event.type = Expose;
+ fake_event.xexpose.x = fake_event.xexpose.y = 0;
+ fake_event.xexpose.width = tfImageWidth; /* the window will clip */
+ fake_event.xexpose.height = tfImageHeight;
+ EventProc(imageWidget, NULL, &fake_event);
+}
+
+void
+EventProc(widget, unused, event)
+ Widget widget;
+ caddr_t unused;
+ XEvent *event;
+{
+ int ih, iw, ww, wh, sx, sy, w, h, dx, dy;
+ Dimension w_width, w_height;
+ XEvent next_event;
+ Arg args[2];
+
+ if (event->type == MappingNotify) {
+ XRefreshKeyboardMapping((XMappingEvent *) event);
+ return;
+ }
+
+ if (!XtIsRealized(widget))
+ return;
+
+ if ((event->type == ButtonPress) || (event->type == ButtonRelease))
+ if (event->xbutton.button != Button1)
+ return;
+
+ iw = tfImageWidth; /* avoid sign problems */
+ ih = tfImageHeight;
+
+ /*
+ * The grabX and grabY variables record where the user grabbed the image.
+ * They also record whether the mouse button is down or not.
+ */
+ if (event->type == ButtonPress) {
+ grabX = event->xbutton.x;
+ grabY = event->xbutton.y;
+ return;
+ }
+
+ /*
+ * imageWidget is a Core widget and doesn't get resized.
+ * So we calculate the size of its viewport here.
+ */
+ XtSetArg(args[0], XtNwidth, &w_width);
+ XtSetArg(args[1], XtNheight, &w_height);
+ XtGetValues(shellWidget, args, 2);
+ ww = w_width;
+ wh = w_height;
+ XtGetValues(listWidget, args, 2);
+ wh -= w_height;
+
+ switch (event->type) {
+ case Expose:
+ dx = event->xexpose.x;
+ dy = event->xexpose.y;
+ sx = dx + xOffset;
+ sy = dy + yOffset;
+ w = MIN(event->xexpose.width, iw);
+ h = MIN(event->xexpose.height, ih);
+ break;
+ case KeyPress:
+ if ((grabX >= 0) || (grabY >= 0)) /* Mouse button is still down */
+ return;
+ switch (XLookupKeysym((XKeyEvent *) event, /* KeySyms index */ 0)) {
+ case XK_Up:
+ if (ih < wh) /* Don't scroll if the window fits the image. */
+ return;
+ sy = yOffset + appData.translate;
+ sy = MIN(ih - wh, sy);
+ if (sy == yOffset) /* Filter redundant stationary refreshes. */
+ return;
+ yOffset = sy;
+ sx = xOffset;
+ dx = dy = 0;
+ w = ww; h = wh;
+ break;
+ case XK_Down:
+ if (ih < wh)
+ return;
+ sy = yOffset - appData.translate;
+ sy = MAX(sy, 0);
+ if (sy == yOffset)
+ return;
+ yOffset = sy;
+ sx = xOffset;
+ dx = dy = 0;
+ w = ww; h = wh;
+ break;
+ case XK_Left:
+ if (iw < ww)
+ return;
+ sx = xOffset + appData.translate;
+ sx = MIN(iw - ww, sx);
+ if (sx == xOffset)
+ return;
+ xOffset = sx;
+ sy = yOffset;
+ dx = dy = 0;
+ w = ww; h = wh;
+ break;
+ case XK_Right:
+ if (iw < ww)
+ return;
+ sx = xOffset - appData.translate;
+ sx = MAX(sx, 0);
+ if (sx == xOffset)
+ return;
+ xOffset = sx;
+ sy = yOffset;
+ dx = dy = 0;
+ w = ww; h = wh;
+ break;
+ default:
+ return;
+ }
+ break;
+ case MotionNotify:
+ /*
+ * MotionEvent compression. Ignore multiple motion events.
+ * Ignore motion events if the mouse button is up.
+ */
+ if (XPending(xDisplay)) /* Xlib doesn't flush the output buffer */
+ if (XtPeekEvent(&next_event))
+ if (next_event.type == MotionNotify)
+ return;
+ if ((grabX < 0) || (grabY < 0))
+ return;
+ sx = xOffset + grabX - (int) event->xmotion.x;
+ if (sx >= (iw - ww)) /* clamp x motion but allow y motion */
+ sx = iw - ww;
+ sx = MAX(sx, 0);
+ sy = yOffset + grabY - (int) event->xmotion.y;
+ if (sy >= (ih - wh)) /* clamp y motion but allow x motion */
+ sy = ih - wh;
+ sy = MAX(sy, 0);
+ if ((sx == xOffset) && (sy == yOffset))
+ return;
+ dx = dy = 0;
+ w = ww; h = wh;
+ break;
+ case ButtonRelease:
+ xOffset = xOffset + grabX - (int) event->xbutton.x;
+ xOffset = MIN(iw - ww, xOffset);
+ xOffset = MAX(xOffset, 0);
+ yOffset = yOffset + grabY - (int) event->xbutton.y;
+ yOffset = MIN(ih - wh, yOffset);
+ yOffset = MAX(yOffset, 0);
+ grabX = grabY = -1;
+ default:
+ return;
+ }
+
+ if (appData.usePixmap == True) {
+ if (xImageDepth == 1)
+ XCopyPlane(xDisplay, xImagePixmap, XtWindow(widget),
+ xWinGc, sx, sy, w, h, dx, dy, 1);
+ else
+ XCopyArea(xDisplay, xImagePixmap, XtWindow(widget),
+ xWinGc, sx, sy, w, h, dx, dy);
+ } else
+ XPutImage(xDisplay, XtWindow(widget), xWinGc, xImage,
+ sx, sy, dx, dy, w, h);
+}
+
+void
+ResizeProc()
+{
+ Dimension w_width, w_height;
+ int xo, yo, ww, wh;
+ XEvent fake_event;
+ Arg args[2];
+
+ if ((xOffset == 0) && (yOffset == 0))
+ return;
+
+ XtSetArg(args[0], XtNwidth, &w_width);
+ XtSetArg(args[1], XtNheight, &w_height);
+ XtGetValues(shellWidget, args, 2);
+ ww = w_width;
+ wh = w_height;
+ XtGetValues(listWidget, args, 2);
+ wh -= w_height;
+
+ xo = xOffset; yo = yOffset;
+
+ if ((xOffset + ww) >= tfImageWidth)
+ xOffset = MAX((int) tfImageWidth - ww, 0);
+ if ((yOffset + wh) >= tfImageHeight)
+ yOffset = MAX((int) tfImageHeight - wh, 0);
+
+ /*
+ * Send an ExposeEvent if the origin changed.
+ * We have to do this because of the use and semantics of bit gravity.
+ */
+ if ((xo != xOffset) || (yo != yOffset)) {
+ fake_event.type = Expose;
+ fake_event.xexpose.x = fake_event.xexpose.y = 0;
+ fake_event.xexpose.width = tfImageWidth;
+ fake_event.xexpose.height = tfImageHeight;
+ EventProc(imageWidget, NULL, &fake_event);
+ }
+}
+
+int
+XTiffErrorHandler(display, error_event)
+ Display *display;
+ XErrorEvent *error_event;
+{
+ char message[80];
+
+ /*
+ * Some X servers limit the size of pixmaps.
+ */
+ if ((error_event->error_code == BadAlloc)
+ && (error_event->request_code == X_CreatePixmap))
+ fprintf(stderr, "xtiff: requested pixmap too big for display\n");
+ else {
+ XGetErrorText(display, error_event->error_code, message, 80);
+ fprintf(stderr, "xtiff: error code %s\n", message);
+ }
+
+ exit(0);
+}
+
+void
+Usage()
+{
+ fprintf(stderr, "Usage xtiff: [options] tiff-file\n");
+ fprintf(stderr, "\tstandard Xt options\n");
+ fprintf(stderr, "\t[-help]\n");
+ fprintf(stderr, "\t[-gamma gamma]\n");
+ fprintf(stderr, "\t[-usePixmap (True | False)]\n");
+ fprintf(stderr, "\t[-viewportWidth pixels]\n");
+ fprintf(stderr, "\t[-viewportHeight pixels]\n");
+ fprintf(stderr, "\t[-translate pixels]\n");
+ fprintf(stderr, "\t[-verbose (True | False)]\n");
+ exit(0);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/dbs/xtiff/xtifficon.h b/tiff/contrib/dbs/xtiff/xtifficon.h
new file mode 100644
index 0000000..3eac48e
--- /dev/null
+++ b/tiff/contrib/dbs/xtiff/xtifficon.h
@@ -0,0 +1,21 @@
+#define xtifficon_width 32
+#define xtifficon_height 32
+static char xtifficon_bits[] = {
+ 0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x7e, 0xc0, 0xfc, 0x03, 0x7e, 0x60,
+ 0xf8, 0x07, 0x06, 0x30, 0xf8, 0x07, 0x1e, 0x18, 0xf0, 0x0f, 0x1e, 0x0c,
+ 0xe0, 0x1f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x03,
+ 0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
+ 0x00, 0xfe, 0x31, 0x7e, 0x7e, 0xfc, 0x33, 0x7e, 0x7e, 0xf8, 0x1b, 0x06,
+ 0x18, 0xf0, 0x0d, 0x1e, 0x18, 0xf0, 0x0e, 0x1e, 0x18, 0x60, 0x1f, 0x06,
+ 0x18, 0xb0, 0x3f, 0x06, 0x18, 0x98, 0x7f, 0x06, 0x18, 0x98, 0x7f, 0x00,
+ 0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x63, 0xfc, 0x03,
+ 0x80, 0x61, 0xfc, 0x03, 0xc0, 0x60, 0xf8, 0x07, 0xc0, 0x60, 0xf0, 0x0f,
+ 0x60, 0x60, 0xe0, 0x1f, 0x30, 0x60, 0xe0, 0x1f, 0x18, 0x60, 0xc0, 0x3f,
+ 0x0c, 0x60, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/iptcutil/Makefile.am b/tiff/contrib/iptcutil/Makefile.am
new file mode 100644
index 0000000..9b94ed7
--- /dev/null
+++ b/tiff/contrib/iptcutil/Makefile.am
@@ -0,0 +1,36 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README test.iptc test.txt
+
+noinst_PROGRAMS = iptcutil
+
+iptcutil_SOURCES = iptcutil.c
+iptcutil_LDADD = $(LIBTIFF)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+
diff --git a/tiff/contrib/iptcutil/Makefile.in b/tiff/contrib/iptcutil/Makefile.in
new file mode 100644
index 0000000..6207a44
--- /dev/null
+++ b/tiff/contrib/iptcutil/Makefile.in
@@ -0,0 +1,553 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = iptcutil$(EXEEXT)
+subdir = contrib/iptcutil
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_iptcutil_OBJECTS = iptcutil.$(OBJEXT)
+iptcutil_OBJECTS = $(am_iptcutil_OBJECTS)
+iptcutil_DEPENDENCIES = $(LIBTIFF)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(iptcutil_SOURCES)
+DIST_SOURCES = $(iptcutil_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README test.iptc test.txt
+iptcutil_SOURCES = iptcutil.c
+iptcutil_LDADD = $(LIBTIFF)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/iptcutil/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/iptcutil/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+iptcutil$(EXEEXT): $(iptcutil_OBJECTS) $(iptcutil_DEPENDENCIES)
+ @rm -f iptcutil$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(iptcutil_OBJECTS) $(iptcutil_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iptcutil.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/iptcutil/README b/tiff/contrib/iptcutil/README
new file mode 100644
index 0000000..1619ef4
--- /dev/null
+++ b/tiff/contrib/iptcutil/README
@@ -0,0 +1,25 @@
+
+Program: IPTCUTIL.C
+
+Purpose: Convert between IPTC binary and a "special" IPTC text file format.
+
+Usage: iptcutil -t | -b [-i file] [-o file] <input >output
+
+Notes: You tell the program the "type" of input file via the -t and -b
+ switches. The -t says that the input is text, while the -b says
+ that the input is binary IPTC. You can use either the -i or the
+ -o switches to tell the program what the input and output files
+ will be, or use simple piping.
+
+Author: William T. Radcliffe (billr@corbis.com)
+ Parts of this program were derived from other places. The original
+ binary to text conversion was taken from the PHP distribution and
+ the tokenizer was written many years ago, by someone else as well.
+
+This software is provided freely "as is", without warranty of any kind,
+express or implied, including but not limited to the warranties of
+merchantability, fitness for a particular purpose and noninfringement.
+In no event shall William T. Radcliffe be liable for any claim, damages or
+other liability, whether in an action of contract, tort or otherwise,
+arising from, out of or in connection with IPTCUTIL
+
diff --git a/tiff/contrib/iptcutil/iptcutil.c b/tiff/contrib/iptcutil/iptcutil.c
new file mode 100644
index 0000000..557a67e
--- /dev/null
+++ b/tiff/contrib/iptcutil/iptcutil.c
@@ -0,0 +1,941 @@
+/* $Id: iptcutil.c,v 1.4.2.2 2010-06-08 18:50:41 bfriesen Exp $ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+#include <ctype.h>
+
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef WIN32
+#define STRNICMP strnicmp
+#else
+#define STRNICMP strncasecmp
+#endif
+
+typedef struct _tag_spec
+{
+ short
+ id;
+
+ char
+ *name;
+} tag_spec;
+
+static tag_spec tags[] = {
+ { 5,"Image Name" },
+ { 7,"Edit Status" },
+ { 10,"Priority" },
+ { 15,"Category" },
+ { 20,"Supplemental Category" },
+ { 22,"Fixture Identifier" },
+ { 25,"Keyword" },
+ { 30,"Release Date" },
+ { 35,"Release Time" },
+ { 40,"Special Instructions" },
+ { 45,"Reference Service" },
+ { 47,"Reference Date" },
+ { 50,"Reference Number" },
+ { 55,"Created Date" },
+ { 60,"Created Time" },
+ { 65,"Originating Program" },
+ { 70,"Program Version" },
+ { 75,"Object Cycle" },
+ { 80,"Byline" },
+ { 85,"Byline Title" },
+ { 90,"City" },
+ { 95,"Province State" },
+ { 100,"Country Code" },
+ { 101,"Country" },
+ { 103,"Original Transmission Reference" },
+ { 105,"Headline" },
+ { 110,"Credit" },
+ { 115,"Source" },
+ { 116,"Copyright String" },
+ { 120,"Caption" },
+ { 121,"Local Caption" },
+ { 122,"Caption Writer" },
+ { 200,"Custom Field 1" },
+ { 201,"Custom Field 2" },
+ { 202,"Custom Field 3" },
+ { 203,"Custom Field 4" },
+ { 204,"Custom Field 5" },
+ { 205,"Custom Field 6" },
+ { 206,"Custom Field 7" },
+ { 207,"Custom Field 8" },
+ { 208,"Custom Field 9" },
+ { 209,"Custom Field 10" },
+ { 210,"Custom Field 11" },
+ { 211,"Custom Field 12" },
+ { 212,"Custom Field 13" },
+ { 213,"Custom Field 14" },
+ { 214,"Custom Field 15" },
+ { 215,"Custom Field 16" },
+ { 216,"Custom Field 17" },
+ { 217,"Custom Field 18" },
+ { 218,"Custom Field 19" },
+ { 219,"Custom Field 20" }
+};
+
+/*
+ * We format the output using HTML conventions
+ * to preserve control characters and such.
+ */
+void formatString(FILE *ofile, const char *s, int len)
+{
+ putc('"', ofile);
+ for (; len > 0; --len, ++s) {
+ int c = *s;
+ switch (c) {
+ case '&':
+ fputs("&amp;", ofile);
+ break;
+#ifdef HANDLE_GT_LT
+ case '<':
+ fputs("&lt;", ofile);
+ break;
+ case '>':
+ fputs("&gt;", ofile);
+ break;
+#endif
+ case '"':
+ fputs("&quot;", ofile);
+ break;
+ default:
+ if (iscntrl(c))
+ fprintf(ofile, "&#%d;", c);
+ else
+ putc(*s, ofile);
+ break;
+ }
+ }
+ fputs("\"\n", ofile);
+}
+
+typedef struct _html_code
+{
+ short
+ len;
+ const char
+ *code,
+ val;
+} html_code;
+
+static html_code html_codes[] = {
+#ifdef HANDLE_GT_LT
+ { 4,"&lt;",'<' },
+ { 4,"&gt;",'>' },
+#endif
+ { 5,"&amp;",'&' },
+ { 6,"&quot;",'"' }
+};
+
+/*
+ * This routine converts HTML escape sequence
+ * back to the original ASCII representation.
+ * - returns the number of characters dropped.
+ */
+int convertHTMLcodes(char *s, int len)
+{
+ if (len <=0 || s==(char*)NULL || *s=='\0')
+ return 0;
+
+ if (s[1] == '#')
+ {
+ int val, o;
+
+ if (sscanf(s,"&#%d;",&val) == 1)
+ {
+ o = 3;
+ while (s[o] != ';')
+ {
+ o++;
+ if (o > 5)
+ break;
+ }
+ if (o < 5)
+ strcpy(s+1, s+1+o);
+ *s = val;
+ return o;
+ }
+ }
+ else
+ {
+ int
+ i,
+ codes = sizeof(html_codes) / sizeof(html_code);
+
+ for (i=0; i < codes; i++)
+ {
+ if (html_codes[i].len <= len)
+ if (STRNICMP(s, html_codes[i].code, html_codes[i].len) == 0)
+ {
+ strcpy(s+1, s+html_codes[i].len);
+ *s = html_codes[i].val;
+ return html_codes[i].len-1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int formatIPTC(FILE *ifile, FILE *ofile)
+{
+ unsigned int
+ foundiptc,
+ tagsfound;
+
+ unsigned char
+ recnum,
+ dataset;
+
+ char
+ *readable,
+ *str;
+
+ long
+ tagindx,
+ taglen;
+
+ int
+ i,
+ tagcount = sizeof(tags) / sizeof(tag_spec);
+
+ char
+ c;
+
+ foundiptc = 0; /* found the IPTC-Header */
+ tagsfound = 0; /* number of tags found */
+
+ c = getc(ifile);
+ while (c != EOF)
+ {
+ if (c == 0x1c)
+ foundiptc = 1;
+ else
+ {
+ if (foundiptc)
+ return -1;
+ else
+ continue;
+ }
+
+ /* we found the 0x1c tag and now grab the dataset and record number tags */
+ dataset = getc(ifile);
+ if ((char) dataset == EOF)
+ return -1;
+ recnum = getc(ifile);
+ if ((char) recnum == EOF)
+ return -1;
+ /* try to match this record to one of the ones in our named table */
+ for (i=0; i< tagcount; i++)
+ {
+ if (tags[i].id == recnum)
+ break;
+ }
+ if (i < tagcount)
+ readable = tags[i].name;
+ else
+ readable = "";
+
+ /* then we decode the length of the block that follows - long or short fmt */
+ c = getc(ifile);
+ if (c == EOF)
+ return 0;
+ if (c & (unsigned char) 0x80)
+ {
+ unsigned char
+ buffer[4];
+
+ for (i=0; i<4; i++)
+ {
+ c = buffer[i] = getc(ifile);
+ if (c == EOF)
+ return -1;
+ }
+ taglen = (((long) buffer[ 0 ]) << 24) |
+ (((long) buffer[ 1 ]) << 16) |
+ (((long) buffer[ 2 ]) << 8) |
+ (((long) buffer[ 3 ]));
+ }
+ else
+ {
+ unsigned char
+ x = c;
+
+ taglen = ((long) x) << 8;
+ x = getc(ifile);
+ if ((char)x == EOF)
+ return -1;
+ taglen |= (long) x;
+ }
+ /* make a buffer to hold the tag data and snag it from the input stream */
+ str = (char *) malloc((unsigned int) (taglen+1));
+ if (str == (char *) NULL)
+ {
+ printf("Memory allocation failed");
+ return 0;
+ }
+ for (tagindx=0; tagindx<taglen; tagindx++)
+ {
+ c = str[tagindx] = getc(ifile);
+ if (c == EOF)
+ return -1;
+ }
+ str[ taglen ] = 0;
+
+ /* now finish up by formatting this binary data into ASCII equivalent */
+ if (strlen(readable) > 0)
+ fprintf(ofile, "%d#%d#%s=",(unsigned int)dataset, (unsigned int) recnum, readable);
+ else
+ fprintf(ofile, "%d#%d=",(unsigned int)dataset, (unsigned int) recnum);
+ formatString( ofile, str, taglen );
+ free(str);
+
+ tagsfound++;
+
+ c = getc(ifile);
+ }
+ return tagsfound;
+}
+
+int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
+char *white,char *brkchar,char *quote,char eschar,char *brkused,
+int *next,char *quoted);
+
+char *super_fgets(char *b, int *blen, FILE *file)
+{
+ int
+ c,
+ len;
+
+ char
+ *q;
+
+ len=*blen;
+ for (q=b; ; q++)
+ {
+ c=fgetc(file);
+ if (c == EOF || c == '\n')
+ break;
+ if (((int)q - (int)b + 1 ) >= (int) len)
+ {
+ int
+ tlen;
+
+ tlen=(int)q-(int)b;
+ len<<=1;
+ b=(char *) realloc((char *) b,(len+2));
+ if ((char *) b == (char *) NULL)
+ break;
+ q=b+tlen;
+ }
+ *q=(unsigned char) c;
+ }
+ *blen=0;
+ if ((unsigned char *)b != (unsigned char *) NULL)
+ {
+ int
+ tlen;
+
+ tlen=(int)q - (int)b;
+ if (tlen == 0)
+ return (char *) NULL;
+ b[tlen] = '\0';
+ *blen=++tlen;
+ }
+ return b;
+}
+
+#define BUFFER_SZ 4096
+
+int main(int argc, char *argv[])
+{
+ unsigned int
+ length;
+
+ unsigned char
+ *buffer;
+
+ int
+ i,
+ mode; /* iptc binary, or iptc text */
+
+ FILE
+ *ifile = stdin,
+ *ofile = stdout;
+
+ char
+ c,
+ *usage = "usage: iptcutil -t | -b [-i file] [-o file] <input >output";
+
+ if( argc < 2 )
+ {
+ printf("%s\n", usage);
+ return 1;
+ }
+
+ mode = 0;
+ length = -1;
+ buffer = (unsigned char *)NULL;
+
+ for (i=1; i<argc; i++)
+ {
+ c = argv[i][0];
+ if (c == '-' || c == '/')
+ {
+ c = argv[i][1];
+ switch( c )
+ {
+ case 't':
+ mode = 1;
+#ifdef WIN32
+ /* Set "stdout" to binary mode: */
+ _setmode( _fileno( ofile ), _O_BINARY );
+#endif
+ break;
+ case 'b':
+ mode = 0;
+#ifdef WIN32
+ /* Set "stdin" to binary mode: */
+ _setmode( _fileno( ifile ), _O_BINARY );
+#endif
+ break;
+ case 'i':
+ if (mode == 0)
+ ifile = fopen(argv[++i], "rb");
+ else
+ ifile = fopen(argv[++i], "rt");
+ if (ifile == (FILE *)NULL)
+ {
+ printf("Unable to open: %s\n", argv[i]);
+ return 1;
+ }
+ break;
+ case 'o':
+ if (mode == 0)
+ ofile = fopen(argv[++i], "wt");
+ else
+ ofile = fopen(argv[++i], "wb");
+ if (ofile == (FILE *)NULL)
+ {
+ printf("Unable to open: %s\n", argv[i]);
+ return 1;
+ }
+ break;
+ default:
+ printf("Unknown option: %s\n", argv[i]);
+ return 1;
+ }
+ }
+ else
+ {
+ printf("%s\n", usage);
+ return 1;
+ }
+ }
+
+ if (mode == 0) /* handle binary iptc info */
+ formatIPTC(ifile, ofile);
+
+ if (mode == 1) /* handle text form of iptc info */
+ {
+ char
+ brkused,
+ quoted,
+ *line,
+ *token,
+ *newstr;
+
+ int
+ state,
+ next;
+
+ unsigned char
+ recnum = 0,
+ dataset = 0;
+
+ int
+ inputlen = BUFFER_SZ;
+
+ line = (char *) malloc(inputlen);
+ token = (char *)NULL;
+ while((line = super_fgets(line,&inputlen,ifile))!=NULL)
+ {
+ state=0;
+ next=0;
+
+ token = (char *) malloc(inputlen);
+ newstr = (char *) malloc(inputlen);
+ while(tokenizer(0, token, inputlen, line, "", "=", "\"", 0,
+ &brkused,&next,&quoted)==0)
+ {
+ if (state == 0)
+ {
+ int
+ state,
+ next;
+
+ char
+ brkused,
+ quoted;
+
+ state=0;
+ next=0;
+ while(tokenizer(0, newstr, inputlen, token, "", "#", "", 0,
+ &brkused, &next, &quoted)==0)
+ {
+ if (state == 0)
+ dataset = (unsigned char) atoi(newstr);
+ else
+ if (state == 1)
+ recnum = (unsigned char) atoi(newstr);
+ state++;
+ }
+ }
+ else
+ if (state == 1)
+ {
+ int
+ next;
+
+ unsigned long
+ len;
+
+ char
+ brkused,
+ quoted;
+
+ next=0;
+ len = strlen(token);
+ while(tokenizer(0, newstr, inputlen, token, "", "&", "", 0,
+ &brkused, &next, &quoted)==0)
+ {
+ if (brkused && next > 0)
+ {
+ char
+ *s = &token[next-1];
+
+ len -= convertHTMLcodes(s, strlen(s));
+ }
+ }
+
+ fputc(0x1c, ofile);
+ fputc(dataset, ofile);
+ fputc(recnum, ofile);
+ if (len < 0x10000)
+ {
+ fputc((len >> 8) & 255, ofile);
+ fputc(len & 255, ofile);
+ }
+ else
+ {
+ fputc(((len >> 24) & 255) | 0x80, ofile);
+ fputc((len >> 16) & 255, ofile);
+ fputc((len >> 8) & 255, ofile);
+ fputc(len & 255, ofile);
+ }
+ next=0;
+ while (len--)
+ fputc(token[next++], ofile);
+ }
+ state++;
+ }
+ free(token);
+ token = (char *)NULL;
+ free(newstr);
+ newstr = (char *)NULL;
+ }
+ free(line);
+
+ fclose( ifile );
+ fclose( ofile );
+ }
+
+ return 0;
+}
+
+/*
+ This routine is a generalized, finite state token parser. It allows
+ you extract tokens one at a time from a string of characters. The
+ characters used for white space, for break characters, and for quotes
+ can be specified. Also, characters in the string can be preceded by
+ a specifiable escape character which removes any special meaning the
+ character may have.
+
+ There are a lot of formal parameters in this subroutine call, but
+ once you get familiar with them, this routine is fairly easy to use.
+ "#define" macros can be used to generate simpler looking calls for
+ commonly used applications of this routine.
+
+ First, some terminology:
+
+ token: used here, a single unit of information in
+ the form of a group of characters.
+
+ white space: space that gets ignored (except within quotes
+ or when escaped), like blanks and tabs. in
+ addition, white space terminates a non-quoted
+ token.
+
+ break character: a character that separates non-quoted tokens.
+ commas are a common break character. the
+ usage of break characters to signal the end
+ of a token is the same as that of white space,
+ except multiple break characters with nothing
+ or only white space between generate a null
+ token for each two break characters together.
+
+ for example, if blank is set to be the white
+ space and comma is set to be the break
+ character, the line ...
+
+ A, B, C , , DEF
+
+ ... consists of 5 tokens:
+
+ 1) "A"
+ 2) "B"
+ 3) "C"
+ 4) "" (the null string)
+ 5) "DEF"
+
+ quote character: a character that, when surrounding a group
+ of other characters, causes the group of
+ characters to be treated as a single token,
+ no matter how many white spaces or break
+ characters exist in the group. also, a
+ token always terminates after the closing
+ quote. for example, if ' is the quote
+ character, blank is white space, and comma
+ is the break character, the following
+ string ...
+
+ A, ' B, CD'EF GHI
+
+ ... consists of 4 tokens:
+
+ 1) "A"
+ 2) " B, CD" (note the blanks & comma)
+ 3) "EF"
+ 4) "GHI"
+
+ the quote characters themselves do
+ not appear in the resultant tokens. the
+ double quotes are delimiters i use here for
+ documentation purposes only.
+
+ escape character: a character which itself is ignored but
+ which causes the next character to be
+ used as is. ^ and \ are often used as
+ escape characters. an escape in the last
+ position of the string gets treated as a
+ "normal" (i.e., non-quote, non-white,
+ non-break, and non-escape) character.
+ for example, assume white space, break
+ character, and quote are the same as in the
+ above examples, and further, assume that
+ ^ is the escape character. then, in the
+ string ...
+
+ ABC, ' DEF ^' GH' I ^ J K^ L ^
+
+ ... there are 7 tokens:
+
+ 1) "ABC"
+ 2) " DEF ' GH"
+ 3) "I"
+ 4) " " (a lone blank)
+ 5) "J"
+ 6) "K L"
+ 7) "^" (passed as is at end of line)
+
+
+ OK, now that you have this background, here's how to call "tokenizer":
+
+ result=tokenizer(flag,token,maxtok,string,white,break,quote,escape,
+ brkused,next,quoted)
+
+ result: 0 if we haven't reached EOS (end of string), and
+ 1 if we have (this is an "int").
+
+ flag: right now, only the low order 3 bits are used.
+ 1 => convert non-quoted tokens to upper case
+ 2 => convert non-quoted tokens to lower case
+ 0 => do not convert non-quoted tokens
+ (this is a "char").
+
+ token: a character string containing the returned next token
+ (this is a "char[]").
+
+ maxtok: the maximum size of "token". characters beyond
+ "maxtok" are truncated (this is an "int").
+
+ string: the string to be parsed (this is a "char[]").
+
+ white: a string of the valid white spaces. example:
+
+ char whitesp[]={" \t"};
+
+ blank and tab will be valid white space (this is
+ a "char[]").
+
+ break: a string of the valid break characters. example:
+
+ char breakch[]={";,"};
+
+ semicolon and comma will be valid break characters
+ (this is a "char[]").
+
+ IMPORTANT: do not use the name "break" as a C
+ variable, as this is a reserved word in C.
+
+ quote: a string of the valid quote characters. an example
+ would be
+
+ char whitesp[]={"'\"");
+
+ (this causes single and double quotes to be valid)
+ note that a token starting with one of these characters
+ needs the same quote character to terminate it.
+
+ for example,
+
+ "ABC '
+
+ is unterminated, but
+
+ "DEF" and 'GHI'
+
+ are properly terminated. note that different quote
+ characters can appear on the same line; only for
+ a given token do the quote characters have to be
+ the same (this is a "char[]").
+
+ escape: the escape character (NOT a string ... only one
+ allowed). use zero if none is desired (this is
+ a "char").
+
+ brkused: the break character used to terminate the current
+ token. if the token was quoted, this will be the
+ quote used. if the token is the last one on the
+ line, this will be zero (this is a pointer to a
+ "char").
+
+ next: this variable points to the first character of the
+ next token. it gets reset by "tokenizer" as it steps
+ through the string. set it to 0 upon initialization,
+ and leave it alone after that. you can change it
+ if you want to jump around in the string or re-parse
+ from the beginning, but be careful (this is a
+ pointer to an "int").
+
+ quoted: set to 1 (true) if the token was quoted and 0 (false)
+ if not. you may need this information (for example:
+ in C, a string with quotes around it is a character
+ string, while one without is an identifier).
+
+ (this is a pointer to a "char").
+*/
+
+/* states */
+
+#define IN_WHITE 0
+#define IN_TOKEN 1
+#define IN_QUOTE 2
+#define IN_OZONE 3
+
+int _p_state; /* current state */
+unsigned _p_flag; /* option flag */
+char _p_curquote; /* current quote char */
+int _p_tokpos; /* current token pos */
+
+/* routine to find character in string ... used only by "tokenizer" */
+
+int sindex(char ch,char *string)
+{
+ char *cp;
+ for(cp=string;*cp;++cp)
+ if(ch==*cp)
+ return (int)(cp-string); /* return postion of character */
+ return -1; /* eol ... no match found */
+}
+
+/* routine to store a character in a string ... used only by "tokenizer" */
+
+void chstore(char *string,int max,char ch)
+{
+ char c;
+ if(_p_tokpos>=0&&_p_tokpos<max-1)
+ {
+ if(_p_state==IN_QUOTE)
+ c=ch;
+ else
+ switch(_p_flag&3)
+ {
+ case 1: /* convert to upper */
+ c=toupper(ch);
+ break;
+
+ case 2: /* convert to lower */
+ c=tolower(ch);
+ break;
+
+ default: /* use as is */
+ c=ch;
+ break;
+ }
+ string[_p_tokpos++]=c;
+ }
+ return;
+}
+
+int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
+ char *white,char *brkchar,char *quote,char eschar,char *brkused,
+ int *next,char *quoted)
+{
+ int qp;
+ char c,nc;
+
+ *brkused=0; /* initialize to null */
+ *quoted=0; /* assume not quoted */
+
+ if(!line[*next]) /* if we're at end of line, indicate such */
+ return 1;
+
+ _p_state=IN_WHITE; /* initialize state */
+ _p_curquote=0; /* initialize previous quote char */
+ _p_flag=inflag; /* set option flag */
+
+ for(_p_tokpos=0;(c=line[*next]);++(*next)) /* main loop */
+ {
+ if((qp=sindex(c,brkchar))>=0) /* break */
+ {
+ switch(_p_state)
+ {
+ case IN_WHITE: /* these are the same here ... */
+ case IN_TOKEN: /* ... just get out */
+ case IN_OZONE: /* ditto */
+ ++(*next);
+ *brkused=brkchar[qp];
+ goto byebye;
+
+ case IN_QUOTE: /* just keep going */
+ chstore(token,tokmax,c);
+ break;
+ }
+ }
+ else if((qp=sindex(c,quote))>=0) /* quote */
+ {
+ switch(_p_state)
+ {
+ case IN_WHITE: /* these are identical, */
+ _p_state=IN_QUOTE; /* change states */
+ _p_curquote=quote[qp]; /* save quote char */
+ *quoted=1; /* set to true as long as something is in quotes */
+ break;
+
+ case IN_QUOTE:
+ if(quote[qp]==_p_curquote) /* same as the beginning quote? */
+ {
+ _p_state=IN_OZONE;
+ _p_curquote=0;
+ }
+ else
+ chstore(token,tokmax,c); /* treat as regular char */
+ break;
+
+ case IN_TOKEN:
+ case IN_OZONE:
+ *brkused=c; /* uses quote as break char */
+ goto byebye;
+ }
+ }
+ else if((qp=sindex(c,white))>=0) /* white */
+ {
+ switch(_p_state)
+ {
+ case IN_WHITE:
+ case IN_OZONE:
+ break; /* keep going */
+
+ case IN_TOKEN:
+ _p_state=IN_OZONE;
+ break;
+
+ case IN_QUOTE:
+ chstore(token,tokmax,c); /* it's valid here */
+ break;
+ }
+ }
+ else if(c==eschar) /* escape */
+ {
+ nc=line[(*next)+1];
+ if(nc==0) /* end of line */
+ {
+ *brkused=0;
+ chstore(token,tokmax,c);
+ ++(*next);
+ goto byebye;
+ }
+ switch(_p_state)
+ {
+ case IN_WHITE:
+ --(*next);
+ _p_state=IN_TOKEN;
+ break;
+
+ case IN_TOKEN:
+ case IN_QUOTE:
+ ++(*next);
+ chstore(token,tokmax,nc);
+ break;
+
+ case IN_OZONE:
+ goto byebye;
+ }
+ }
+ else /* anything else is just a real character */
+ {
+ switch(_p_state)
+ {
+ case IN_WHITE:
+ _p_state=IN_TOKEN; /* switch states */
+
+ case IN_TOKEN: /* these 2 are */
+ case IN_QUOTE: /* identical here */
+ chstore(token,tokmax,c);
+ break;
+
+ case IN_OZONE:
+ goto byebye;
+ }
+ }
+ } /* end of main loop */
+
+byebye:
+ token[_p_tokpos]=0; /* make sure token ends with EOS */
+
+ return 0;
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/iptcutil/test.iptc b/tiff/contrib/iptcutil/test.iptc
new file mode 100644
index 0000000..a260562
--- /dev/null
+++ b/tiff/contrib/iptcutil/test.iptc
Binary files differ
diff --git a/tiff/contrib/iptcutil/test.txt b/tiff/contrib/iptcutil/test.txt
new file mode 100644
index 0000000..d518100
--- /dev/null
+++ b/tiff/contrib/iptcutil/test.txt
@@ -0,0 +1,32 @@
+2#0="&#0;&#2;"
+2#120#Caption="Chairman of the US House Judiciary Committee, Henry Hyde,R-IL, makes his opening statement during impeachment hearings 11 December on Capitol Hill in Washington, DC. The committee is debating the articles of impechment and my take a vote on the impeachment of US President BIll Clinton on charges that he obstucted justice, lied and abused the power of his office as early as today. AFP PHOTO Paul J. RICHARDS&#13;"
+2#122#Caption Writer="kb/lt"
+2#100#Country Code="USA"
+2#105#Headline="Old fart squeezing two fingers."
+2#30#Release Date="19981211"
+2#35#Release Time="000000+0000"
+2#40#Special Instructions="This is a test. This is only a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890"
+2#80#Byline="PAUL J. RICHARDS"
+2#85#Byline Title="STF"
+2#110#Credit="AFP"
+2#65#Originating Program="MacDesk Reporter"
+2#115#Source="AFP"
+2#5#Image Name="US-HYDE"
+2#55#Created Date="19981211"
+2#90#City="WASHINGTON"
+2#95#Province State="DC"
+2#101#Country="UNITED STATES"
+2#103#Original Transmission Reference="DCA03"
+2#15#Category="POL"
+2#20#Supplemental Category="GOVERNMENT"
+2#10#Priority="5"
+2#25#Keyword="fart"
+2#25#Keyword="squeezing"
+2#25#Keyword="old"
+2#25#Keyword="fingers"
+2#75#Object Cycle="a"
+2#60#Created Time="000000+0000"
+2#70#Program Version="2.0.3"
+2#130="3S"
+2#135="GB"
+2#231="Kaya A. Hoffmann 12/14/98 12:00:44 PM Copy To : Selects - \\KINYANI\Selects&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;"
diff --git a/tiff/contrib/mac-cw/Makefile.am b/tiff/contrib/mac-cw/Makefile.am
new file mode 100644
index 0000000..827fa31
--- /dev/null
+++ b/tiff/contrib/mac-cw/Makefile.am
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h
+
diff --git a/tiff/contrib/mac-cw/Makefile.in b/tiff/contrib/mac-cw/Makefile.in
new file mode 100644
index 0000000..51e5478
--- /dev/null
+++ b/tiff/contrib/mac-cw/Makefile.in
@@ -0,0 +1,420 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mac-cw
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mac-cw/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/mac-cw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/mac-cw/Makefile.script b/tiff/contrib/mac-cw/Makefile.script
new file mode 100644
index 0000000..85614c8
--- /dev/null
+++ b/tiff/contrib/mac-cw/Makefile.script
@@ -0,0 +1,72 @@
+
+(* You must manually set the top-level PATHNAME here; everything else is automatic *)
+
+set PATHNAME to "ritter:tiff-v3.4beta028:"
+set PRINTING to "NO"
+
+set MKG3STATES to PATHNAME & "mkg3states.mw"
+set LIBTIFF to PATHNAME & "libtiff-68K.mw"
+set TIFFINFO to PATHNAME & "tiffinfo.mw"
+
+with timeout of 60000 seconds
+ tell application "MW C/C++ 68K 1.2.2"
+
+ activate
+
+
+ (* Create tif_fax3sm.c file *)
+ Create Project {file MKG3STATES}
+ Add Files {"mkg3states.c", "mkg3_main.c", "getopt.c"}
+ Add Files {"MacOS.lib"} To Segment 2
+ Add Files {"ANSI (4i/8d) C.68K.Lib"} To Segment 3
+ Add Files {"SIOUX.68K.Lib"} To Segment 4
+ Add Files {"MathLib68K (4i/8d).Lib"} To Segment 5
+
+ Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"mac_main.h"}
+ Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+ Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+ Set Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+ Set Preferences To {Project Type:0, File Name:"mkg3states", File Creator:"????", File Type:"APPL"}
+
+ Make Project
+ Run Project
+ Remove Binaries
+ Close Project
+
+
+ (* Create LIBTIFF *)
+ Create Project {file LIBTIFF}
+ Add Files {"tif_apple.c", "tif_aux.c", "tif_close.c", "tif_codec.c", "tif_compress.c", "tif_dumpmode.c", "tif_error.c", "tif_flush.c", "tif_lzw.c", "tif_next.c", "tif_open.c", "tif_packbits.c"}
+ Add Files {"tif_fax3.c"} To Segment 2
+ Add Files {"tif_dirinfo.c", "tif_dir.c", "tif_dirwrite.c", "tif_dirread.c"} To Segment 3
+ Add Files {"tif_predict.c", "tif_print.c", "tif_read.c", "tif_strip.c", "tif_swab.c", "tif_thunder.c", "tif_tile.c", "tif_version.c", "tif_zip.c", "tif_jpeg.c", "tif_warning.c", "tif_write.c"} To Segment 4
+ Add Files {"tif_fax3sm.c"} To Segment 5
+ Add Files {"tif_getimage.c"} To Segment 6
+
+ Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"MacHeaders68K"}
+ Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+ Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+ Set Preferences To {MacsBug Symbols:2, Generate SYM File:true, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+ Set Preferences To {Project Type:2, File Name:"libtiff-68K", File Creator:"????", File Type:"APPL"}
+ Make Project
+ Close Project
+
+ Create Project {file TIFFINFO}
+ Add Files {"tiffinfo.c", "mac_main.c", "getopt.c"}
+ Add Files {"MacOS.lib"} To Segment 2
+ Add Files {"ANSI (4i/8d) C.68K.Lib"} To Segment 3
+ Add Files {"SIOUX.68K.Lib"} To Segment 4
+ Add Files {"MathLib68K (4i/8d).Lib"} To Segment 5
+ Add Files {"libtiff-68K"} To Segment 6
+
+ Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"mac_main.h"}
+ Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+ Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+ Set Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+ Set Preferences To {Project Type:0, File Name:"tiffinfo", File Creator:"????", File Type:"APPL"}
+
+ Make Project
+ Close Project
+
+ end tell
+end timeout
diff --git a/tiff/contrib/mac-cw/README b/tiff/contrib/mac-cw/README
new file mode 100644
index 0000000..a973469
--- /dev/null
+++ b/tiff/contrib/mac-cw/README
@@ -0,0 +1,18 @@
+----------------------------------------------------
+Build instructions for LIBTIFF - CodeWarrior (6.1):
+----------------------------------------------------
+
+In this directory you will find a Makefile.script Applescript
+file, which should be run in order to build the libtiff code
+using MetroWerks CodeWarrior.
+
+Refer to the "metrowerks.note" instructions on building the
+library for 68k and PowerPC native code, as well as building
+some of the libtiff tools, which are rather unix-like, but
+at least give an example of how to link everything together.
+
+ Questions, comments, bug reports to Niles Ritter
+ (ndr@tazboy.jpl.nasa.gov). Sam Leffler takes no responsibility
+ for the viability of this stuff.
+
+ -Niles.
diff --git a/tiff/contrib/mac-cw/mac_main.c b/tiff/contrib/mac-cw/mac_main.c
new file mode 100644
index 0000000..66b5a83
--- /dev/null
+++ b/tiff/contrib/mac-cw/mac_main.c
@@ -0,0 +1,27 @@
+/*
+ * mac_main.c -- The REAL entry point which
+ * calls the tools main code. For the tools
+ * the symbol "main" has been #defined to "tool_main"
+ * so that this entry point may be used to access
+ * the user-input first.
+ */
+
+#undef main
+
+int
+main()
+{
+ int argc;
+ char **argv;
+
+ argc=ccommand(&argv);
+
+ return tool_main(argc,argv); // Call the tool "main()" routine
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/mac-cw/mac_main.h b/tiff/contrib/mac-cw/mac_main.h
new file mode 100644
index 0000000..5a5facb
--- /dev/null
+++ b/tiff/contrib/mac-cw/mac_main.h
@@ -0,0 +1,19 @@
+/*
+ * mac_main.h -- redefines main entry point
+ */
+
+#ifndef _mac_main_h
+#define _mac_main_h
+
+#undef main
+#define main tool_main
+
+#endif /* _mac_main_h */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/mac-cw/metrowerks.note b/tiff/contrib/mac-cw/metrowerks.note
new file mode 100644
index 0000000..9917cfd
--- /dev/null
+++ b/tiff/contrib/mac-cw/metrowerks.note
@@ -0,0 +1,84 @@
+----------------------------------------------------
+Build instructions for LIBTIFF - CodeWarrior (6.1):
+----------------------------------------------------
+
+Note: there is a bug in CW earlier than 6.1 which will generate
+16-bit offset link errors for any projects using libtiff; you must
+download the CodeWarrior 6.1 patch located at:
+
+ ftp://ftp.metrowerks.com/pub/updates/metro-patches-61.hqx
+
+unpack the archive, insert the files and recompile the libraries
+using the AppleScript provided.
+
+
+1. Make sure that the directory containing these files is under
+ the "contrib" directory of the tiff folder; otherwise, some
+ access path preferences will need to be updated.
+
+2. The instructions below are for the 68k platform build.
+ A similar script can be put together for the PPC version,
+ or you can just directly convert the projects. Be sure to
+ use the native libraries as well. NOTE: if anyone cooks
+ up an equivalent script for PPC, send it to me and I'll include
+ it with the rest of the package.
+
+3. Open the file Makefile.script with an AppleScript Editor
+ and change the PATHNAME variable to point to your
+ top-level TIFF directory
+
+4. Run the Script. It will do the following things:
+
+ 4a. Prompt you for the current location of the CodeWarrior 68K
+ program.
+
+ 4b. Create the source file "tif_fax3sm.c":
+
+ i) Build the project CW project mkg3states.cw. It will
+ produce a small program called mkg3states. Only a
+ 68k version is provided, since you only have to run
+ this code once, and it only takes a few seconds.
+
+ ii) Run the built mkg3states program:
+
+ The program will temporarily take over ALL of the CPU, so
+ don't panic. After a few seconds it will produce a file called
+ "tif_fax3sm.c".
+
+ 4c. Build the library project libtiff-68K.mw, producing library
+ called libtiff-68K.
+
+ 4d. Build program project tiffinfo.mw; it will produce a
+ program called tiffinfo, which can dump the tiff tags of
+ a named file. Passing in no arguments will dump a help file
+ for the program. It is unix-flavored, but hey, it works.
+
+5 When the script finishes, you will have a usable libtiff-68K
+ library, a passable "tiffinfo" program, and the projects used
+ to build them. Note that to get tiffinfo to work I have put
+ an include file in the project that redefines main(), and
+ then have a mac_main.c program that calls ccommand() first
+ and passes that to the actual main code. A real mac app,
+ of course, would never use this stuff at all...
+
+ . The tiffinfo.mw project may be used as a template to build
+ most of the other libtiff tools, or your own code. When
+ modifying a copy of the project, you will most likely need
+ to update the "Access Paths" directory if it is moved out of
+ the contrib folder.
+
+6. If you are going to create a project from scratch, be sure
+ to set up the preferences with
+
+ 4-byte ints
+ 8-byte doubles
+ Far Code/Far Data
+ Large Linking model
+
+ and everything should work fine. If the console-style error
+ reports bother you, you can always override the error and
+ warning mechanism with TIFFSetErrorHandler to do something
+ more Mac-like.
+
+Questions, comments to Niles Ritter (ndr@tazboy.jpl.nasa.gov).
+
diff --git a/tiff/contrib/mac-cw/mkg3_main.c b/tiff/contrib/mac-cw/mkg3_main.c
new file mode 100644
index 0000000..0faea07
--- /dev/null
+++ b/tiff/contrib/mac-cw/mkg3_main.c
@@ -0,0 +1,21 @@
+/*
+ * mkg3_main.c -- passes fake arguments into main
+ */
+
+#undef main
+
+int
+main()
+{
+ static char *argv[4] = {
+ "mkg3states", "-c", "const", "tif_fax3sm.c" };
+
+ return tool_main(4,argv); // Call the tool "main()" routine
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/mac-cw/version.h b/tiff/contrib/mac-cw/version.h
new file mode 100644
index 0000000..ee4a5e4
--- /dev/null
+++ b/tiff/contrib/mac-cw/version.h
@@ -0,0 +1,11 @@
+#define VERSION \
+"LIBTIFF, Version 3.4beta028 \n"\
+"Copyright (c) 1988-1995 Sam Leffler\n"\
+"Copyright (c) 1991-1996 Silicon Graphics, Inc."
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/mac-mpw/BUILD.mpw b/tiff/contrib/mac-mpw/BUILD.mpw
new file mode 100644
index 0000000..7abf83a
--- /dev/null
+++ b/tiff/contrib/mac-mpw/BUILD.mpw
@@ -0,0 +1,47 @@
+# BUILD.mpw:
+#
+# Full build for Apple Macintosh Programmer's Workshop (MPW).
+#
+# This is an executable MPW script which creates various
+# utilities, sets up the MPW makefiles and runs the builds.
+# This script should be run at the top level TIFF directory with:
+#
+# directory :::
+# :contrib:mac-mpw:BUILD.mpw
+#
+# NOTE: The full build requires that MPW have at least 6 MB
+# allocated to it to compile the CCITT Fax codec tables. To
+# deactivate CCITT compression edit the file :contrib:mac:libtiff.make
+# first and follow the directions for disabling Fax decoding.
+#
+# All TIFF tools are built as MPW tools, executable from the
+# MPW shell or other compatible tool server.
+#
+# Written by: Niles Ritter (ndr@tazboy.jpl.nasa.gov).
+#
+
+echo "############# Full Scratch Build for MPW #############"
+
+# Create the ascii->mpw translation tool; this is used to
+# convert standard ASCII files into ones using the special
+# MPW characters, which don't live comfortably in unix tar files.
+#
+echo "######## Creating ASCII->MPW translator ########"
+set contrib ':contrib:mac-mpw:'
+directory {contrib}
+createmake -tool mactrans mactrans.c > dev:null
+make -f mactrans.make | streamedit -e "/CSANELib/||/Math/||/ToolLibs/ del" > mactrans.bld
+execute mactrans.bld > dev:null
+delete -y mactrans.make mactrans.bld mactrans.c.o || set status 0
+directory ::: #An mpw trick for going up two levels
+
+# Create the top-level Makefile and run it
+echo "######## Creating Makefile ########"
+catenate {contrib}top.make | {contrib}mactrans > Makefile
+
+echo "######## Running Makefile ########"
+make > build.mpw
+execute build.mpw
+echo "############# MPW Build Complete #############"
+exit 0
+
diff --git a/tiff/contrib/mac-mpw/Makefile.am b/tiff/contrib/mac-mpw/Makefile.am
new file mode 100644
index 0000000..fd1e663
--- /dev/null
+++ b/tiff/contrib/mac-mpw/Makefile.am
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make
+
diff --git a/tiff/contrib/mac-mpw/Makefile.in b/tiff/contrib/mac-mpw/Makefile.in
new file mode 100644
index 0000000..9aced32
--- /dev/null
+++ b/tiff/contrib/mac-mpw/Makefile.in
@@ -0,0 +1,420 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mac-mpw
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mac-mpw/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/mac-mpw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/mac-mpw/README b/tiff/contrib/mac-mpw/README
new file mode 100644
index 0000000..053b0d0
--- /dev/null
+++ b/tiff/contrib/mac-mpw/README
@@ -0,0 +1,20 @@
+######################
+About contrib:mac-mpw:
+######################
+
+This directory contains all of the utilities and makefile source
+to build the LIBTIFF library and tools from the MPW Shell. The
+file BUILD.mpw in this directory is an executable script
+which uses all of these files to create the MPW makefiles and
+run them.
+
+The <file>.make files are not MPW makefiles as such,
+but are when run through the "mactrans" program, which turns
+the ascii "%nn" metacharacters into the standard weird MPW
+make characters.
+
+This translation trick is necessary to protect the files when
+they are put into unix tarfiles, which tend to mangle the
+special characters.
+
+ --Niles Ritter (ndr@tazboy.jpl.nasa.gov)
diff --git a/tiff/contrib/mac-mpw/libtiff.make b/tiff/contrib/mac-mpw/libtiff.make
new file mode 100644
index 0000000..ee5296e
--- /dev/null
+++ b/tiff/contrib/mac-mpw/libtiff.make
@@ -0,0 +1,202 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.3.1 and MPW C 3.2.4
+#
+# Note: This file must be run through "mactrans" before it can
+# be recognized by MPW as a valid makefile. The problem is that MPW
+# uses special non-ASCII characters, which tend to get mangled when stored
+# in unix tar files, etc. "mactrans" is built as part of the TIFF MPW build.
+#
+#
+
+DEPTH = ::
+
+# FAX Options: If you do not wish to include the FAX options, uncomment
+# the first four definitions and comment out the next four
+# definitions. Note that to build programs with the FAX libraries you
+# have to include "-model far" in your compile and link statements.
+#
+# Also, to build the fax code (including the tif_fax3sm.c file, which is
+# created by the MPW tool "mkg3states", also built below), you will
+# need to size the MPW program up to about 6 megabytes or so.
+
+#FAX_OPTIONS =
+#FAX_OBJECTS =
+#FAX_SOURCES = tif_fax3.c
+#FAX_CONFIG =
+
+FAX_OPTIONS = -model far
+FAX_OBJECTS = tif_fax3.c.o tif_fax3sm.c.o
+FAX_SOURCES = tif_fax3.c tif_fax3sm.c
+FAX_CONFIG = -d CCITT_SUPPORT
+
+NULL=
+
+RM = delete -y -i
+COPTS =
+
+LIBPORT=::port:libport.o
+
+#
+.c.o %c4 .c
+ {C} -model far {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+
+CONF_LIBRARY= %b6
+ -d HAVE_IEEEFP=1 %b6
+ -d BSDTYPES
+
+CONF_COMPRESSION= %b6
+ {FAX_CONFIG} %b6
+ -d COMPRESSION_SUPPORT %b6
+ -d PACKBITS_SUPPORT %b6
+ -d LZW_SUPPORT %b6
+ -d THUNDER_SUPPORT %b6
+ -d NEXT_SUPPORT
+
+CFLAGS= {FAX_OPTIONS} {IPATH} {CONF_LIBRARY} {CONF_COMPRESSION}
+
+INCS= tiff.h tiffio.h
+
+SRCS= %b6
+ {FAX_SOURCES} %b6
+ tif_apple.c %b6
+ tif_aux.c %b6
+ tif_close.c %b6
+ tif_codec.c %b6
+ tif_compress.c %b6
+ tif_dir.c %b6
+ tif_dirinfo.c %b6
+ tif_dirread.c %b6
+ tif_dirwrite.c %b6
+ tif_dumpmode.c %b6
+ tif_error.c %b6
+ tif_getimage.c %b6
+ tif_jpeg.c %b6
+ tif_flush.c %b6
+ tif_lzw.c %b6
+ tif_next.c %b6
+ tif_open.c %b6
+ tif_packbits.c %b6
+ tif_predict.c %b6
+ tif_print.c %b6
+ tif_read.c %b6
+ tif_swab.c %b6
+ tif_strip.c %b6
+ tif_thunder.c %b6
+ tif_tile.c %b6
+ tif_version.c %b6
+ tif_warning.c %b6
+ tif_write.c %b6
+ tif_zip.c %b6
+ {NULL}
+
+OBJS= %b6
+ {FAX_OBJECTS} %b6
+ tif_apple.c.o %b6
+ tif_aux.c.o %b6
+ tif_close.c.o %b6
+ tif_codec.c.o %b6
+ tif_compress.c.o %b6
+ tif_dir.c.o %b6
+ tif_dirinfo.c.o %b6
+ tif_dirread.c.o %b6
+ tif_dirwrite.c.o %b6
+ tif_dumpmode.c.o %b6
+ tif_error.c.o %b6
+ tif_getimage.c.o %b6
+ tif_jpeg.c.o %b6
+ tif_flush.c.o %b6
+ tif_lzw.c.o %b6
+ tif_next.c.o %b6
+ tif_open.c.o %b6
+ tif_packbits.c.o %b6
+ tif_predict.c.o %b6
+ tif_print.c.o %b6
+ tif_read.c.o %b6
+ tif_swab.c.o %b6
+ tif_strip.c.o %b6
+ tif_thunder.c.o %b6
+ tif_tile.c.o %b6
+ tif_version.c.o %b6
+ tif_warning.c.o %b6
+ tif_write.c.o %b6
+ tif_zip.c.o %b6
+ {NULL}
+
+ALL=libtiff.o
+
+all %c4 {ALL}
+
+libtiff.o %c4 {OBJS}
+ Lib {OBJS} -o libtiff.o
+
+
+{OBJS} %c4 tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
+
+#
+# The finite state machine tables used by the G3/G4 decoders
+# are generated by the mkg3states program. On systems without
+# make these rules have to be manually carried out.
+#
+tif_fax3sm.c %c4 mkg3states tif_fax3.h
+ {RM} tif_fax3sm.c || set status 0
+ :mkg3states -c const tif_fax3sm.c
+
+mkg3states.c.o %c4 mkg3states.c
+ C -model far mkg3states.c -o mkg3states.c.o
+
+mkg3states %c4%c4 mkg3states.c.o
+ Link -model far -d -c 'MPS ' -t MPST %b6
+ mkg3states.c.o %b6
+ {LIBPORT} %b6
+ "{CLibraries}"StdClib.o %b6
+ "{Libraries}"Stubs.o %b6
+ "{Libraries}"Runtime.o %b6
+ "{Libraries}"Interface.o %b6
+ -o mkg3states
+
+ALPHA = "{DEPTH}dist:tiff.alpha"
+VERSION = "{DEPTH}VERSION"
+
+version.h %c4 {VERSION} {ALPHA}
+ Set VERSION1 `catenate {VERSION}`
+ Set VERSION2 "{VERSION1}`streamedit -e "1 rep /%a5%c5 %c5 (%c5)%a81/ %a81" {ALPHA}`"
+ delete -y -i version.h || set status 0
+ echo '#define VERSION "LIBTIFF, Version' {VERSION2} '\nCopyright (c) 1988-1995 Sam Leffler\nCopyright (c) 1991-1995 Silicon Graphics, Inc."' >version.h
+
+tif_version.c.o %c4 version.h
+
+clean %c4
+ {RM} {ALL} || set status 0
+ {RM} {OBJS} || set status 0
+ {RM} mkg3states || set status 0
+ {RM} mkg3states.c.o || set status 0
+ {RM} tif_fax3sm.c%c5 || set status 0
+ {RM} version.h || set status 0
+
diff --git a/tiff/contrib/mac-mpw/mactrans.c b/tiff/contrib/mac-mpw/mactrans.c
new file mode 100644
index 0000000..d35373e
--- /dev/null
+++ b/tiff/contrib/mac-mpw/mactrans.c
@@ -0,0 +1,63 @@
+/*
+ * mactrans.c -- Hack filter used to generate MPW files
+ * with special characters from pure ASCII, denoted "%nn"
+ * where nn is hex. (except for "%%", which is literal '%').
+ *
+ * calling sequence:
+ *
+ * catenate file | mactrans [-toascii | -fromascii] > output
+ *
+ * Written by: Niles Ritter.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+void to_ascii(void);
+void from_ascii(void);
+
+main(int argc, char *argv[])
+{
+ if (argc<2 || argv[1][1]=='f') from_ascii();
+ else to_ascii();
+ exit (0);
+}
+
+void from_ascii(void)
+{
+ char c;
+ int d;
+ while ((c=getchar())!=EOF)
+ {
+ if (c!='%' || (c=getchar())=='%') putchar(c);
+ else
+ {
+ ungetc(c,stdin);
+ scanf("%2x",&d);
+ *((unsigned char *)&c) = d;
+ putchar(c);
+ }
+ }
+}
+
+void to_ascii(void)
+{
+ char c;
+ int d;
+ while ((c=getchar())!=EOF)
+ {
+ if (isascii(c)) putchar (c);
+ else
+ {
+ d = *((unsigned char *)&c);
+ printf("%%%2x",d);
+ }
+ }
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/mac-mpw/port.make b/tiff/contrib/mac-mpw/port.make
new file mode 100644
index 0000000..492c527
--- /dev/null
+++ b/tiff/contrib/mac-mpw/port.make
@@ -0,0 +1,53 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1995 Sam Leffler
+# Copyright (c) 1995 Silicon Graphics, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+DEPTH= ::
+SRCDIR= :
+
+NULL =
+CC = C
+AR = Lib
+AROPTS =
+RM= delete -y
+
+IPATH = -I {DEPTH} -I {SRCDIR}
+COPTS =
+OPTIMIZER=
+CFLAGS = {COPTS} {OPTIMIZER} {IPATH}
+
+CFILES =
+OBJECTS = getopt.c.o
+TARGETS = libport.o
+
+.c.o %c4 .c
+ {CC} -model far {COptions} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+all %c4 {TARGETS}
+
+libport.o %c4 {OBJECTS}
+ {AR} {OBJECTS} -o libport.o
+
+clean %c4
+ {RM} {TARGETS} {OBJECTS} || set status 0
diff --git a/tiff/contrib/mac-mpw/tools.make b/tiff/contrib/mac-mpw/tools.make
new file mode 100644
index 0000000..13b14e4
--- /dev/null
+++ b/tiff/contrib/mac-mpw/tools.make
@@ -0,0 +1,138 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Stanford and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4
+#
+COPTS = -model far
+
+.c.o %c4 .c
+ {C} {COPTS} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+RM = delete -y -i
+
+CONF_LIBRARY= %b6
+ -d USE_CONST=0 %b6
+ -d BSDTYPES
+NULL=
+
+IPATH= -I ::libtiff
+
+CFLAGS= -w -m {IPATH} {CONF_LIBRARY}
+
+LIBPORT= ::port:libport.o
+
+LOptions= -model far -w -srt -d -c 'MPS ' -t MPST
+
+LIBTIFF= ::libtiff:libtiff.o
+
+LIBS= {LIBTIFF} %b6
+ {LIBPORT} %b6
+ "{CLibraries}"CSANELib.o %b6
+ "{CLibraries}"Math.o %b6
+ "{CLibraries}"StdClib.o %b6
+ "{Libraries}"Stubs.o %b6
+ "{Libraries}"Runtime.o %b6
+ "{Libraries}"Interface.o %b6
+ "{Libraries}"ToolLibs.o %b6
+ {NULL}
+
+SRCS= %b6
+ pal2rgb.c %b6
+ ras2tiff.c %b6
+ thumbnail.c %b6
+ tiff2bw.c %b6
+ tiff2ps.c %b6
+ tiffcmp.c %b6
+ tiffcp.c %b6
+ tiffdither.c %b6
+ tiffdump.c %b6
+ tiffinfo.c %b6
+ tiffmedian.c %b6
+ {NULL}
+
+MACHALL=ras2tiff
+
+ALL= %b6
+ tiffinfo %b6
+ tiffcmp %b6
+ tiffcp %b6
+ tiffdump %b6
+ tiffmedian %b6
+ tiff2bw %b6
+ tiffdither %b6
+ tiff2ps %b6
+ pal2rgb %b6
+ gif2tiff %b6
+ {MACHALL}
+
+all %c4 {ALL}
+
+tiffinfo %c4 tiffinfo.c.o {LIBTIFF}
+ Link {LOptions} tiffinfo.c.o {LIBS} -o tiffinfo
+
+tiffcmp %c4 tiffcmp.c.o {LIBTIFF}
+ Link {LOptions} tiffcmp.c.o {LIBS} -o tiffcmp
+
+tiffcp %c4 tiffcp.c.o {LIBTIFF}
+ Link {LOptions} tiffcp.c.o {LIBS} -o tiffcp
+
+tiffdump %c4 tiffdump.c.o {LIBTIFF}
+ Link {LOptions} tiffdump.c.o {LIBS} -o tiffdump
+
+tiffmedian %c4 tiffmedian.c.o {LIBTIFF}
+ Link {LOptions} tiffmedian.c.o {LIBS} -o tiffmedian
+
+tiff2ps %c4 tiff2ps.c.o {LIBTIFF}
+ Link {LOptions} tiff2ps.c.o {LIBS} -o tiff2ps
+
+# junky stuff...
+# convert RGB image to B&W
+tiff2bw %c4 tiff2bw.c.o {LIBTIFF}
+ Link {LOptions} tiff2bw.c.o {LIBS} -o tiff2bw
+
+# convert B&W image to bilevel w/ FS dithering
+tiffdither %c4 tiffdither.c.o {LIBTIFF}
+ Link {LOptions} tiffdither.c.o {LIBS} -o tiffdither
+
+# GIF converter
+gif2tiff %c4 gif2tiff.c.o {LIBTIFF}
+ Link {LOptions} gif2tiff.c.o {LIBS} -o gif2tiff
+
+# convert Palette image to RGB
+pal2rgb %c4 pal2rgb.c.o {LIBTIFF}
+ Link {LOptions} pal2rgb.c.o {LIBS} -o pal2rgb
+
+# Sun rasterfile converter
+ras2tiff %c4 ras2tiff.c.o {LIBTIFF}
+ Link {LOptions} ras2tiff.c.o {LIBS} -o ras2tiff
+
+# generate thumbnail images from fax
+thumbnail %c4 thumbnail.c.o {LIBTIFF}
+ Link {LOptions} thumbnail.c.o {LIBS} -o thumbnail
+
+clean %c4
+ {RM} {ALL} %c5.c.o ycbcr
diff --git a/tiff/contrib/mac-mpw/top.make b/tiff/contrib/mac-mpw/top.make
new file mode 100644
index 0000000..5a6a29b
--- /dev/null
+++ b/tiff/contrib/mac-mpw/top.make
@@ -0,0 +1,133 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Stanford and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4
+#
+#
+# Written by: Niles D. Ritter
+#
+
+RM= delete -y -i
+PORT=:port:
+LIBTIFF=:libtiff:
+TOOLS=:tools:
+CONTRIB=:contrib:mac-mpw:
+
+MACTRANS="{CONTRIB}mactrans"
+
+NULL=
+
+MAKEFILES = %b6
+ {PORT}Makefile %b6
+ {LIBTIFF}Makefile %b6
+ {TOOLS}Makefile %b6
+ {NULL}
+
+all %c4 PORT LIBTIFF TOOLS
+
+MAKEFILES %c4 {MAKEFILES}
+TOOLS %c4 LIBTIFF
+
+LIBTIFF %c4 PORT
+
+# Create the port routines
+PORT %c4 {PORT}Makefile
+ directory {PORT}
+ (make || set status 0) > build.mpw
+ set echo 1
+ execute build.mpw
+ set echo 0
+ {RM} build.mpw || set status 0
+ directory ::
+
+# Create the port routines
+LIBTIFF %c4 {LIBTIFF}Makefile
+ directory {LIBTIFF}
+ (make || set status 0) > build.mpw
+ set echo 1
+ execute build.mpw
+ set echo 0
+ {RM} build.mpw || set status 0
+ directory ::
+
+# Create the tools
+TOOLS %c4 {TOOLS}Makefile
+ directory {TOOLS}
+ (make || set status 0) > build.mpw
+ set echo 1
+ execute build.mpw
+ set echo 0
+ {RM} build.mpw || set status 0
+ directory ::
+
+# Makefile dependencies
+{PORT}Makefile %c4 {CONTRIB}port.make
+ catenate {CONTRIB}port.make | {MACTRANS} > {PORT}Makefile
+
+{LIBTIFF}Makefile %c4 {CONTRIB}libtiff.make
+ catenate {CONTRIB}libtiff.make | {MACTRANS} > {LIBTIFF}Makefile
+
+{TOOLS}Makefile %c4 {CONTRIB}tools.make
+ catenate {CONTRIB}tools.make | {MACTRANS} > {TOOLS}Makefile
+
+
+clean %c4 clean.port clean.contrib clean.libtiff clean.tools clean.make
+
+clean.port %c4
+ directory {PORT}
+ (make clean || set status 0) > purge
+ purge
+ {RM} purge || set status 0
+ {RM} Makefile || set status 0
+ {RM} build.mpw || set status 0
+ cd ::
+
+clean.contrib %c4
+ {RM} {MACTRANS} || set status 0
+
+clean.libtiff %c4
+ directory {LIBTIFF}
+ (make clean || set status 0) > purge
+ purge
+ {RM} purge || set status 0
+ {RM} Makefile || set status 0
+ {RM} build.mpw || set status 0
+ cd ::
+
+clean.tools %c4
+ directory {TOOLS}
+ (make clean || set status 0) > purge
+ purge
+ {RM} purge || set status 0
+ {RM} Makefile || set status 0
+ {RM} build.mpw || set status 0
+ cd ::
+
+clean.make %c4
+ {RM} {MAKEFILES} || set status 0
+ {RM} build.mpw || set status 0
+
diff --git a/tiff/contrib/mfs/Makefile.am b/tiff/contrib/mfs/Makefile.am
new file mode 100644
index 0000000..9a398c5
--- /dev/null
+++ b/tiff/contrib/mfs/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README mfs_file.c
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff \ No newline at end of file
diff --git a/tiff/contrib/mfs/Makefile.in b/tiff/contrib/mfs/Makefile.in
new file mode 100644
index 0000000..e7e7850
--- /dev/null
+++ b/tiff/contrib/mfs/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mfs
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README mfs_file.c
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mfs/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/mfs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/mfs/README b/tiff/contrib/mfs/README
new file mode 100644
index 0000000..6f9befb
--- /dev/null
+++ b/tiff/contrib/mfs/README
@@ -0,0 +1,37 @@
+Date: Mon, 23 Jun 1997 13:30:48 +0200
+To: <sam@cthulhu.engr.sgi.com>
+
+From: "Mike Johnson" <mikehunt@swipnet.se>
+Subject: libtiff - Thanks
+
+Return-Path: mikehunt@swipnet.se
+Delivery-Date: Mon, 23 Jun 1997 06:53:39 -0700
+
+Hi Sam,
+
+I noticed in the README from libtiff that you would like to know about
+what people have done with libtiff, so I thought I would drop you a
+line.
+
+We have used libtiff to create and convert TIFF images of financial
+documents which are sent from and to major document processing systems
+in Sweden and Denmark.
+
+I would like to express my deep gratitude to yourself and Sillicon
+Graphics for making this excellent library available for public use.
+There is obviously a lot of work that has gone in to libtiff and the
+quality of the code and documentation is an example to others.
+
+One thing that libtiff did not do was work on a memory area rather than
+files. In my applications I had already read a TIFF or other format
+file in to memory and did not want to waste I/O writing it out again
+for libtiff's benefit. I therefore constructed a set of functions to
+pass up to TIFFClientOpen to simulate a file in memory. I have attached
+my mfs (memory file system) source code for you to use or junk, as you
+see fit. :-)
+
+Once again, thanks very much for making my life simpler.
+
+Best Regards,
+
+Mike Johnson.
diff --git a/tiff/contrib/mfs/mfs_file.c b/tiff/contrib/mfs/mfs_file.c
new file mode 100644
index 0000000..6675e2a
--- /dev/null
+++ b/tiff/contrib/mfs/mfs_file.c
@@ -0,0 +1,586 @@
+/*
+--------------------------------------------------------------------------------
+- Module : mem_file.c
+- Description : A general purpose library for manipulating a memory area
+- as if it were a file.
+- mfs_ stands for memory file system.
+- Author : Mike Johnson - Banctec AB 03/07/96
+-
+--------------------------------------------------------------------------------
+*/
+
+/*
+
+Copyright (c) 1996 Mike Johnson
+Copyright (c) 1996 BancTec AB
+
+Permission to use, copy, modify, distribute, and sell this software
+for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Mike Johnson and BancTec may not be used in any advertising or
+publicity relating to the software.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+IN NO EVENT SHALL MIKE JOHNSON OR BANCTEC BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+OF THIS SOFTWARE.
+
+*/
+
+
+/*
+--------------------------------------------------------------------------------
+- Includes
+--------------------------------------------------------------------------------
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+--------------------------------------------------------------------------------
+- Definitions
+--------------------------------------------------------------------------------
+*/
+
+#define MAX_BUFFS 20
+#define FALSE 0
+#define TRUE 1
+
+/*
+--------------------------------------------------------------------------------
+- Globals
+--------------------------------------------------------------------------------
+*/
+
+static char *buf[MAX_BUFFS]; /* Memory for each open buf */
+static long buf_off[MAX_BUFFS]; /* File pointer for each buf */
+static long buf_size[MAX_BUFFS]; /* Count of bytes allocated for each buf */
+static long fds[MAX_BUFFS]; /* File descriptor status */
+static int buf_mode[MAX_BUFFS]; /* Mode of buffer (r, w, a) */
+
+static int library_init_done = FALSE;
+
+
+/*
+--------------------------------------------------------------------------------
+- Function prototypes
+--------------------------------------------------------------------------------
+*/
+
+int mfs_open (void *ptr, int size, char *mode);
+int mfs_lseek (int fd, int offset, int whence);
+int mfs_read (int fd, void *buf, int size);
+int mfs_write (int fd, void *buf, int size);
+int mfs_size (int fd);
+int mfs_map (int fd, char **addr, size_t *len);
+int mfs_unmap (int fd);
+int mfs_close (int fd);
+static int extend_mem_file (int fd, int size);
+static void mem_init ();
+
+/*
+--------------------------------------------------------------------------------
+- Function code
+--------------------------------------------------------------------------------
+*/
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_open ()
+-
+- Arguments : Pointer to allocated buffer, initial size of buffer,
+- mode spec (r, w, a)
+-
+- Returns : File descriptor or -1 if error.
+-
+- Description : Register this area of memory (which has been allocated
+- and has a file read into it) under the mem_file library.
+- A file descriptor is returned which can the be passed
+- back to TIFFClientOpen and used as if it was a disk
+- based fd.
+- If the call is for mode 'w' then pass (void *)NULL as
+- the buffer and zero size and the library will
+- allocate memory for you.
+- If the mode is append then pass (void *)NULL and size
+- zero or with a valid address.
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_open (void *buffer, int size, char *mode)
+{
+ int ret, i;
+ void *tmp;
+
+ if (library_init_done == FALSE)
+ {
+ mem_init ();
+ library_init_done = TRUE;
+ }
+
+ ret = -1;
+
+ /* Find a free fd */
+
+ for (i = 0; i < MAX_BUFFS; i++)
+ {
+ if (fds[i] == -1)
+ {
+ ret = i;
+ break;
+ }
+ }
+
+ if (i == MAX_BUFFS) /* No more free descriptors */
+ {
+ ret = -1;
+ errno = EMFILE;
+ }
+
+ if (ret >= 0 && *mode == 'r')
+ {
+ if (buffer == (void *)NULL)
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+ else
+ {
+ buf[ret] = (char *)buffer;
+ buf_size[ret] = size;
+ buf_off[ret] = 0;
+ }
+ }
+ else if (ret >= 0 && *mode == 'w')
+ {
+
+ if (buffer != (void *)NULL)
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+
+ else
+ {
+ tmp = malloc (0); /* Get a pointer */
+ if (tmp == (void *)NULL)
+ {
+ ret = -1;
+ errno = EDQUOT;
+ }
+ else
+ {
+ buf[ret] = (char *)tmp;
+ buf_size[ret] = 0;
+ buf_off[ret] = 0;
+ }
+ }
+ }
+ else if (ret >= 0 && *mode == 'a')
+ {
+ if (buffer == (void *) NULL) /* Create space for client */
+ {
+ tmp = malloc (0); /* Get a pointer */
+ if (tmp == (void *)NULL)
+ {
+ ret = -1;
+ errno = EDQUOT;
+ }
+ else
+ {
+ buf[ret] = (char *)tmp;
+ buf_size[ret] = 0;
+ buf_off[ret] = 0;
+ }
+ }
+ else /* Client has file read in already */
+ {
+ buf[ret] = (char *)buffer;
+ buf_size[ret] = size;
+ buf_off[ret] = 0;
+ }
+ }
+ else /* Some other invalid combination of parameters */
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+
+ if (ret != -1)
+ {
+ fds[ret] = 0;
+ buf_mode[ret] = *mode;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_lseek ()
+-
+- Arguments : File descriptor, offset, whence
+-
+- Returns : as per man lseek (2)
+-
+- Description : Does the same as lseek (2) except on a memory based file.
+- Note: the memory area will be extended if the caller
+- attempts to seek past the current end of file (memory).
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_lseek (int fd, int offset, int whence)
+{
+ int ret;
+ long test_off;
+
+ if (fds[fd] == -1) /* Not open */
+ {
+ ret = -1;
+ errno = EBADF;
+ }
+ else if (offset < 0 && whence == SEEK_SET)
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+ else
+ {
+ switch (whence)
+ {
+ case SEEK_SET:
+ if (offset > buf_size[fd])
+ extend_mem_file (fd, offset);
+ buf_off[fd] = offset;
+ ret = offset;
+ break;
+
+ case SEEK_CUR:
+ test_off = buf_off[fd] + offset;
+
+ if (test_off < 0)
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+ else
+ {
+ if (test_off > buf_size[fd])
+ extend_mem_file (fd, test_off);
+ buf_off[fd] = test_off;
+ ret = test_off;
+ }
+ break;
+
+ case SEEK_END:
+ test_off = buf_size[fd] + offset;
+
+ if (test_off < 0)
+ {
+ ret = -1;
+ errno = EINVAL;
+ }
+ else
+ {
+ if (test_off > buf_size[fd])
+ extend_mem_file (fd, test_off);
+ buf_off[fd] = test_off;
+ ret = test_off;
+ }
+ break;
+
+ default:
+ errno = EINVAL;
+ ret = -1;
+ break;
+ }
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_read ()
+-
+- Arguments : File descriptor, buffer, size
+-
+- Returns : as per man read (2)
+-
+- Description : Does the same as read (2) except on a memory based file.
+- Note: An attempt to read past the end of memory currently
+- allocated to the file will return 0 (End Of File)
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_read (int fd, void *clnt_buf, int size)
+{
+ int ret;
+
+ if (fds[fd] == -1 || buf_mode[fd] != 'r')
+ {
+ /* File is either not open, or not opened for read */
+
+ ret = -1;
+ errno = EBADF;
+ }
+ else if (buf_off[fd] + size > buf_size[fd])
+ {
+ ret = 0; /* EOF */
+ }
+ else
+ {
+ memcpy (clnt_buf, (void *) (buf[fd] + buf_off[fd]), size);
+ buf_off[fd] = buf_off[fd] + size;
+ ret = size;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_write ()
+-
+- Arguments : File descriptor, buffer, size
+-
+- Returns : as per man write (2)
+-
+- Description : Does the same as write (2) except on a memory based file.
+- Note: the memory area will be extended if the caller
+- attempts to write past the current end of file (memory).
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_write (int fd, void *clnt_buf, int size)
+{
+ int ret;
+
+ if (fds[fd] == -1 || buf_mode[fd] == 'r')
+ {
+ /* Either the file is not open or it is opened for reading only */
+
+ ret = -1;
+ errno = EBADF;
+ }
+ else if (buf_mode[fd] == 'w')
+ {
+ /* Write */
+
+ if (buf_off[fd] + size > buf_size[fd])
+ {
+ extend_mem_file (fd, buf_off[fd] + size);
+ buf_size[fd] = (buf_off[fd] + size);
+ }
+
+ memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
+ buf_off[fd] = buf_off[fd] + size;
+
+ ret = size;
+ }
+ else
+ {
+ /* Append */
+
+ if (buf_off[fd] != buf_size[fd])
+ buf_off[fd] = buf_size[fd];
+
+ extend_mem_file (fd, buf_off[fd] + size);
+ buf_size[fd] += size;
+
+ memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
+ buf_off[fd] = buf_off[fd] + size;
+
+ ret = size;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_size ()
+-
+- Arguments : File descriptor
+-
+- Returns : integer file size
+-
+- Description : This function returns the current size of the file in bytes.
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_size (int fd)
+{
+ int ret;
+
+ if (fds[fd] == -1) /* Not open */
+ {
+ ret = -1;
+ errno = EBADF;
+ }
+ else
+ ret = buf_size[fd];
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_map ()
+-
+- Arguments : File descriptor, ptr to address, ptr to length
+-
+- Returns : Map status (succeeded or otherwise)
+-
+- Description : This function tells the client where the file is mapped
+- in memory and what size the mapped area is. It is provided
+- to satisfy the MapProc function in libtiff. It pretends
+- that the file has been mmap (2)ped.
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_map (int fd, char **addr, size_t *len)
+{
+ int ret;
+
+ if (fds[fd] == -1) /* Not open */
+ {
+ ret = -1;
+ errno = EBADF;
+ }
+ else
+ {
+ *addr = buf[fd];
+ *len = buf_size[fd];
+ ret = 0;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_unmap ()
+-
+- Arguments : File descriptor
+-
+- Returns : UnMap status (succeeded or otherwise)
+-
+- Description : This function does nothing as the file is always
+- in memory.
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_unmap (int fd)
+{
+ return (0);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mfs_close ()
+-
+- Arguments : File descriptor
+-
+- Returns : close status (succeeded or otherwise)
+-
+- Description : Close the open memory file. (Make fd available again.)
+-
+--------------------------------------------------------------------------------
+*/
+
+int mfs_close (int fd)
+{
+ int ret;
+
+ if (fds[fd] == -1) /* Not open */
+ {
+ ret = -1;
+ errno = EBADF;
+ }
+ else
+ {
+ fds[fd] = -1;
+ ret = 0;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : extend_mem_file ()
+-
+- Arguments : File descriptor, length to extend to.
+-
+- Returns : 0 - All OK, -1 - realloc () failed.
+-
+- Description : Increase the amount of memory allocated to a file.
+-
+--------------------------------------------------------------------------------
+*/
+
+static int extend_mem_file (int fd, int size)
+{
+ void *new_mem;
+ int ret;
+
+ if ((new_mem = realloc (buf[fd], size)) == (void *) NULL)
+ ret = -1;
+ else
+ {
+ buf[fd] = (char *) new_mem;
+ ret = 0;
+ }
+
+ return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+- Function : mem_init ()
+-
+- Arguments : None
+-
+- Returns : void
+-
+- Description : Initialise the library.
+-
+--------------------------------------------------------------------------------
+*/
+
+static void mem_init ()
+{
+ int i;
+
+ for (i = 0; i < MAX_BUFFS; i++)
+ {
+ fds[i] = -1;
+ buf[i] = (char *)NULL;
+ buf_size[i] = 0;
+ buf_off[i] = 0;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/pds/Makefile.am b/tiff/contrib/pds/Makefile.am
new file mode 100644
index 0000000..2ead6a7
--- /dev/null
+++ b/tiff/contrib/pds/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/pds/Makefile.in b/tiff/contrib/pds/Makefile.in
new file mode 100644
index 0000000..bc5134b
--- /dev/null
+++ b/tiff/contrib/pds/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/pds
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/pds/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/pds/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/pds/README b/tiff/contrib/pds/README
new file mode 100644
index 0000000..b9abc6b
--- /dev/null
+++ b/tiff/contrib/pds/README
@@ -0,0 +1,90 @@
+Date: Fri, 01 Aug 1997 20:14:52 MDT
+To: Sam Leffler <sam@cthulhu.engr.sgi.com>
+
+From: "Conrad J. Poelman (WSAT)" <poelmanc@plk.af.mil>
+Subject: Potential TIFF library additions
+
+Delivery-Date: Fri, 01 Aug 1997 19:21:06 -0700
+
+Sam,
+
+You probably don't remember me, but I sent in a couple of bug fixes
+regarding the TIFF library about a 16 months ago or so...
+
+I just wanted to send you two other additions that I have made to our
+local version of the TIFF library in hopes that you will want to
+incorporate them into your next major release of the TIFF library.
+(These additions are based on TIFF version 3.4beta31, but they sit on
+top of the library so they shouldn't be much trouble to incorporate them
+into any more recent version.) They are internally documented to a
+reasonable extent and we've been successfully using them in our code
+here for over a year. If you think they would make good additions to the
+TIFF library, I'd be happy to clean them up more, document them more,
+and/or integrate them with the latest version of the TIFF library, but I
+figured I'd see if you were interested in using them before I went to
+all that trouble.
+
+TIFF Image Iterator
+-------------------
+Your ReadRGBA() routine works well for reading many different formats
+(TILED, STIP, compressed or not, etc.) of the most basic types of data
+(RGB, 8-bit greyscale, 8-bit colormapped) into an SGI-style data array,
+and serves as a good template for users with other needs. I used it as
+an exmaple of how to make an iterator which, rather than fill a data
+array, calls an arbitrary user-supplied callback function for each
+"chunk" of data - that "chunk" might be a strip or a tile, and might
+have one sample-per-pixel or two, and might be 8-bit data or 16-bit or
+24-bit. The callback function can do whatever it wants with the data -
+store it in a big array, convert it to RGBA, or draw it directly to the
+screen. I was able to use this iterator to read 16-bit greyscale and 32-
+and 64-bit floating point data, which wasn't possible with ReadRGBA().
+
+I have tested this routine with 8- and 16-bit greyscale data as well as
+with 32- and 64-bit floating point data. I believe nearly all of our
+data is organized in strips, so actually I'd appreciate it if you had
+some tiled images that I could test it with.
+
+It should certainly be possible and would be cleanest to reimplement
+ReadRGBA() in terms of the image iterator, but I haven't done that.
+
+
+Private Sub-Directory Read/Write
+--------------------------------
+TIFF-PL is a Phillips Laboratory extension to the TIFF tags that allows
+us to store satellite imaging-specific information in a TIFF format,
+such as the satellite's trajectory, the imaging time, etc. In order to
+give us the flexibility to modify the tag definitions without getting
+approval from the TIFF committee every time, we were given only three
+TIFF tags - a PL signature, a PL version number, and PL directory
+offset, which lists the position in the file at which to find a private
+sub-directory of tags-value pairs. So I wrote two routines:
+TIFFWritePrivateDataSubDirectory(), which takes a list of tags and a
+"get" function and writes the tag values into the TIFF file, returning
+the offset within the file at which it wrote the directory; and
+TIFFReadPrivateDataSubDirectory(), which takes an offset, a list of
+tags, and a "set" function and reads all the data from the private
+directory. The functions themselves are pretty simple. (The files are
+huge because I had to basically copy all of the tif_dirread.c and
+tif_dirwrite.c files in order to access the various fetching routines
+which were all declared static and therefore inaccessible in the TIFF
+library.)
+
+
+I'm including the four source files (tif_imgiter.h, tif_imgiter.c,
+tif_pdsdirread.c, tif_pdsdirwrite.c) in case you want to take a look at
+them. I can also send you some sample code that uses them if you like.
+If you're interested in having them incorporated into the standard TIFF
+library, I'd be happy to do that integration and clean up and document
+the routines. (For example, I've already realized that instead of
+limiting the SEP callback function to three bands (R,G,B) it should take
+an array to enable the handling of n-banded multi-spectral data...) If
+not, I'll just leave them as they are, since they work fine for us now.
+
+Holler if you have any questions.
+
+-- Conrad
+__________________________________________________________________
+ Capt Conrad J. Poelman PL/WSAT (Phillips Laboratory)
+ 505-846-4347 3550 Aberdeen Ave SE
+ (FAX) 505-846-4374 Kirtland AFB, NM 87117-5776
+
diff --git a/tiff/contrib/pds/tif_imageiter.c b/tiff/contrib/pds/tif_imageiter.c
new file mode 100644
index 0000000..6140f96
--- /dev/null
+++ b/tiff/contrib/pds/tif_imageiter.c
@@ -0,0 +1,525 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_imageiter.c,v 1.3.2.1 2010-06-08 18:50:41 bfriesen Exp $ */
+
+/*
+ * Copyright (c) 1991-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Written by Conrad J. Poelman, PL/WSAT, Kirtland AFB, NM on 26 Mar 96.
+ *
+ * This file contains code to allow a calling program to "iterate" over each
+ * pixels in an image as it is read from the file. The iterator takes care of
+ * reading strips versus (possibly clipped) tiles, decoding the information
+ * according to the decoding method, and so on, so that calling program can
+ * ignore those details. The calling program does, however, need to be
+ * conscious of the type of the pixel data that it is receiving.
+ *
+ * For reasons of efficiency, the callback function actually gets called for
+ * "blocks" of pixels rather than for individual pixels. The format of the
+ * callback arguments is given below.
+ *
+ * This code was taken from TIFFReadRGBAImage() in tif_getimage.c of the original
+ * TIFF distribution, and simplified and generalized to provide this general
+ * iteration capability. Those routines could certainly be re-implemented in terms
+ * of a TIFFImageIter if desired.
+ *
+ */
+#include "tiffiop.h"
+#include "tif_imageiter.h"
+#include <assert.h>
+#include <stdio.h>
+
+static int gtTileContig(TIFFImageIter*, void *udata, uint32, uint32);
+static int gtTileSeparate(TIFFImageIter*, void *udata, uint32, uint32);
+static int gtStripContig(TIFFImageIter*, void *udata, uint32, uint32);
+static int gtStripSeparate(TIFFImageIter*, void *udata, uint32, uint32);
+
+static const char photoTag[] = "PhotometricInterpretation";
+
+static int
+isCCITTCompression(TIFF* tif)
+{
+ uint16 compress;
+ TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+ return (compress == COMPRESSION_CCITTFAX3 ||
+ compress == COMPRESSION_CCITTFAX4 ||
+ compress == COMPRESSION_CCITTRLE ||
+ compress == COMPRESSION_CCITTRLEW);
+}
+
+int
+TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
+{
+ uint16* sampleinfo;
+ uint16 extrasamples;
+ uint16 planarconfig;
+ int colorchannels;
+
+ img->tif = tif;
+ img->stoponerr = stop;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
+ img->alpha = 0;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
+ TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
+ &extrasamples, &sampleinfo);
+ if (extrasamples == 1)
+ switch (sampleinfo[0]) {
+ case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
+ case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
+ img->alpha = sampleinfo[0];
+ break;
+ }
+ colorchannels = img->samplesperpixel - extrasamples;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
+ if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
+ switch (colorchannels) {
+ case 1:
+ if (isCCITTCompression(tif))
+ img->photometric = PHOTOMETRIC_MINISWHITE;
+ else
+ img->photometric = PHOTOMETRIC_MINISBLACK;
+ break;
+ case 3:
+ img->photometric = PHOTOMETRIC_RGB;
+ break;
+ default:
+ sprintf(emsg, "Missing needed %s tag", photoTag);
+ return (0);
+ }
+ }
+ switch (img->photometric) {
+ case PHOTOMETRIC_PALETTE:
+ if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
+ &img->redcmap, &img->greencmap, &img->bluecmap)) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Missing required \"Colormap\" tag");
+ return (0);
+ }
+ /* fall thru... */
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+/* This should work now so skip the check - BSR
+ if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1) {
+ sprintf(emsg,
+ "Sorry, can not handle contiguous data with %s=%d, and %s=%d",
+ photoTag, img->photometric,
+ "Samples/pixel", img->samplesperpixel);
+ return (0);
+ }
+ */
+ break;
+ case PHOTOMETRIC_YCBCR:
+ if (planarconfig != PLANARCONFIG_CONTIG) {
+ sprintf(emsg, "Sorry, can not handle YCbCr images with %s=%d",
+ "Planarconfiguration", planarconfig);
+ return (0);
+ }
+ /* It would probably be nice to have a reality check here. */
+ { uint16 compress;
+ TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+ if (compress == COMPRESSION_JPEG && planarconfig == PLANARCONFIG_CONTIG) {
+ /* can rely on libjpeg to convert to RGB */
+ /* XXX should restore current state on exit */
+ TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+ img->photometric = PHOTOMETRIC_RGB;
+ }
+ }
+ break;
+ case PHOTOMETRIC_RGB:
+ if (colorchannels < 3) {
+ sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
+ "Color channels", colorchannels);
+ return (0);
+ }
+ break;
+ case PHOTOMETRIC_SEPARATED: {
+ uint16 inkset;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
+ if (inkset != INKSET_CMYK) {
+ sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+ "InkSet", inkset);
+ return (0);
+ }
+ if (img->samplesperpixel != 4) {
+ sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+ "Samples/pixel", img->samplesperpixel);
+ return (0);
+ }
+ break;
+ }
+ default:
+ sprintf(emsg, "Sorry, can not handle image with %s=%d",
+ photoTag, img->photometric);
+ return (0);
+ }
+ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
+
+ TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
+ switch (img->orientation) {
+ case ORIENTATION_BOTRIGHT:
+ case ORIENTATION_RIGHTBOT: /* XXX */
+ case ORIENTATION_LEFTBOT: /* XXX */
+ TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
+ img->orientation = ORIENTATION_BOTLEFT;
+ /* fall thru... */
+ case ORIENTATION_BOTLEFT:
+ break;
+ case ORIENTATION_TOPRIGHT:
+ case ORIENTATION_RIGHTTOP: /* XXX */
+ case ORIENTATION_LEFTTOP: /* XXX */
+ default:
+ TIFFWarning(TIFFFileName(tif), "using top-left orientation");
+ img->orientation = ORIENTATION_TOPLEFT;
+ /* fall thru... */
+ case ORIENTATION_TOPLEFT:
+ break;
+ }
+
+ img->isContig =
+ !(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);
+ if (img->isContig) {
+ img->get = TIFFIsTiled(tif) ? gtTileContig : gtStripContig;
+ } else {
+ img->get = TIFFIsTiled(tif) ? gtTileSeparate : gtStripSeparate;
+ }
+ return (1);
+}
+
+int
+TIFFImageIterGet(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+ if (img->get == NULL) {
+ TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
+ return (0);
+ }
+ if (img->callback.any == NULL) {
+ TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
+ "No \"put\" routine setupl; probably can not handle image format");
+ return (0);
+ }
+ return (*img->get)(img, udata, w, h);
+}
+
+TIFFImageIterEnd(TIFFImageIter* img)
+{
+ /* Nothing to free... ? */
+}
+
+/*
+ * Read the specified image into an ABGR-format raster.
+ */
+int
+TIFFReadImageIter(TIFF* tif,
+ uint32 rwidth, uint32 rheight, uint8* raster, int stop)
+{
+ char emsg[1024];
+ TIFFImageIter img;
+ int ok;
+
+ if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
+ /* XXX verify rwidth and rheight against width and height */
+ ok = TIFFImageIterGet(&img, raster, rwidth, img.height);
+ TIFFImageIterEnd(&img);
+ } else {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+ ok = 0;
+ }
+ return (ok);
+}
+
+
+/*
+ * Get an tile-organized image that has
+ * PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ * SamplesPerPixel == 1
+ */
+static int
+gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+ TIFF* tif = img->tif;
+ ImageIterTileContigRoutine callback = img->callback.contig;
+ uint16 orientation;
+ uint32 col, row;
+ uint32 tw, th;
+ u_char* buf;
+ int32 fromskew;
+ uint32 nrow;
+
+ buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
+ if (buf == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+ return (0);
+ }
+ TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+ TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+ orientation = img->orientation;
+ for (row = 0; row < h; row += th) {
+ nrow = (row + th > h ? h - row : th);
+ for (col = 0; col < w; col += tw) {
+ if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && img->stoponerr)
+ break;
+ if (col + tw > w) {
+ /*
+ * Tile is clipped horizontally. Calculate
+ * visible portion and skewing factors.
+ */
+ uint32 npix = w - col;
+ fromskew = tw - npix;
+ (*callback)(img, udata, col, row, npix, nrow, fromskew, buf);
+ } else {
+ (*callback)(img, udata, col, row, tw, nrow, 0, buf);
+ }
+ }
+ }
+ _TIFFfree(buf);
+ return (1);
+}
+
+/*
+ * Get an tile-organized image that has
+ * SamplesPerPixel > 1
+ * PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */
+static int
+gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+ TIFF* tif = img->tif;
+ ImageIterTileSeparateRoutine callback = img->callback.separate;
+ uint16 orientation;
+ uint32 col, row;
+ uint32 tw, th;
+ u_char* buf;
+ u_char* r;
+ u_char* g;
+ u_char* b;
+ u_char* a;
+ tsize_t tilesize;
+ int32 fromskew;
+ int alpha = img->alpha;
+ uint32 nrow;
+
+ tilesize = TIFFTileSize(tif);
+ buf = (u_char*) _TIFFmalloc(4*tilesize);
+ if (buf == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+ return (0);
+ }
+ r = buf;
+ g = r + tilesize;
+ b = g + tilesize;
+ a = b + tilesize;
+ if (!alpha)
+ memset(a, 0xff, tilesize);
+ TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+ TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+ orientation = img->orientation;
+ for (row = 0; row < h; row += th) {
+ nrow = (row + th > h ? h - row : th);
+ for (col = 0; col < w; col += tw) {
+ if (TIFFReadTile(tif, r, col, row,0,0) < 0 && img->stoponerr)
+ break;
+ if (TIFFReadTile(tif, g, col, row,0,1) < 0 && img->stoponerr)
+ break;
+ if (TIFFReadTile(tif, b, col, row,0,2) < 0 && img->stoponerr)
+ break;
+ if (alpha && TIFFReadTile(tif,a,col,row,0,3) < 0 && img->stoponerr)
+ break;
+ if (col + tw > w) {
+ /*
+ * Tile is clipped horizontally. Calculate
+ * visible portion and skewing factors.
+ */
+ uint32 npix = w - col;
+ fromskew = tw - npix;
+ (*callback)(img, udata, col, row, npix, nrow, fromskew, r, g, b, a);
+ } else {
+ (*callback)(img, udata, col, row, tw, nrow, 0, r, g, b, a);
+ }
+ }
+ }
+ _TIFFfree(buf);
+ return (1);
+}
+
+/*
+ * Get a strip-organized image that has
+ * PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ * SamplesPerPixel == 1
+ */
+static int
+gtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+ TIFF* tif = img->tif;
+ ImageIterTileContigRoutine callback = img->callback.contig;
+ uint16 orientation;
+ uint32 row, nrow;
+ u_char* buf;
+ uint32 rowsperstrip;
+ uint32 imagewidth = img->width;
+ tsize_t scanline;
+ int32 fromskew;
+
+ buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
+ if (buf == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
+ return (0);
+ }
+ orientation = img->orientation;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+ scanline = TIFFScanlineSize(tif);
+ fromskew = (w < imagewidth ? imagewidth - w : 0);
+ for (row = 0; row < h; row += rowsperstrip) {
+ nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
+ if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+ buf, nrow*scanline) < 0 && img->stoponerr)
+ break;
+ (*callback)(img, udata, 0, row, w, nrow, fromskew, buf);
+ }
+ _TIFFfree(buf);
+ return (1);
+}
+
+/*
+ * Get a strip-organized image with
+ * SamplesPerPixel > 1
+ * PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */
+static int
+gtStripSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+ TIFF* tif = img->tif;
+ ImageIterTileSeparateRoutine callback = img->callback.separate;
+ uint16 orientation;
+ u_char *buf;
+ u_char *r, *g, *b, *a;
+ uint32 row, nrow;
+ tsize_t scanline;
+ uint32 rowsperstrip;
+ uint32 imagewidth = img->width;
+ tsize_t stripsize;
+ int32 fromskew;
+ int alpha = img->alpha;
+
+ stripsize = TIFFStripSize(tif);
+ r = buf = (u_char *)_TIFFmalloc(4*stripsize);
+ if (buf == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+ return (0);
+ }
+ g = r + stripsize;
+ b = g + stripsize;
+ a = b + stripsize;
+ if (!alpha)
+ memset(a, 0xff, stripsize);
+ orientation = img->orientation;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+ scanline = TIFFScanlineSize(tif);
+ fromskew = (w < imagewidth ? imagewidth - w : 0);
+ for (row = 0; row < h; row += rowsperstrip) {
+ nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
+ if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+ r, nrow*scanline) < 0 && img->stoponerr)
+ break;
+ if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 1),
+ g, nrow*scanline) < 0 && img->stoponerr)
+ break;
+ if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 2),
+ b, nrow*scanline) < 0 && img->stoponerr)
+ break;
+ if (alpha &&
+ (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 3),
+ a, nrow*scanline) < 0 && img->stoponerr))
+ break;
+ (*callback)(img, udata, 0, row, w, nrow, fromskew, r, g, b, a);
+ }
+ _TIFFfree(buf);
+ return (1);
+}
+
+DECLAREContigCallbackFunc(TestContigCallback)
+{
+ printf("Contig Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
+ x, y, w, h, fromskew);
+}
+
+
+DECLARESepCallbackFunc(TestSepCallback)
+{
+ printf("Sep Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
+ x, y, w, h, fromskew);
+}
+
+
+#ifdef MAIN
+main(int argc, char **argv)
+{
+ char emsg[1024];
+ TIFFImageIter img;
+ int ok;
+ int stop = 1;
+
+ TIFF *tif;
+ unsigned long nx, ny;
+ unsigned short BitsPerSample, SamplesPerPixel;
+ int isColorMapped, isPliFile;
+ unsigned char *ColorMap;
+ unsigned char *data;
+
+ if (argc < 2) {
+ fprintf(stderr,"usage: %s tiff_file\n",argv[0]);
+ exit(1);
+ }
+ tif = (TIFF *)PLIGetImage(argv[1], (void *) &data, &ColorMap,
+ &nx, &ny, &BitsPerSample, &SamplesPerPixel,
+ &isColorMapped, &isPliFile);
+ if (tif != NULL) {
+
+ if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
+ /* Here need to set data and callback function! */
+ if (img.isContig) {
+ img.callback = TestContigCallback;
+ } else {
+ img.callback = TestSepCallback;
+ }
+ ok = TIFFImageIterGet(&img, NULL, img.width, img.height);
+ TIFFImageIterEnd(&img);
+ } else {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+ }
+ }
+
+}
+#endif
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/pds/tif_imageiter.h b/tiff/contrib/pds/tif_imageiter.h
new file mode 100644
index 0000000..e7dbe46
--- /dev/null
+++ b/tiff/contrib/pds/tif_imageiter.h
@@ -0,0 +1,64 @@
+typedef struct _TIFFImageIter TIFFImageIter;
+
+/* The callback function is called for each "block" of image pixel data after
+ it has been read from the file and decoded. This image pixel data is in the
+ buffer pp, and this data represents the image pixels from (x,y) to
+ (x+w,y+h). It is stored in pixel format, so each pixel contains
+ img->samplesperpixel consecutive samples each containing img->bitspersample
+ bits of data. The array pp is ordered in h consecutive rows of w+fromskew
+ pixels each. */
+typedef void (*ImageIterTileContigRoutine)
+ (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+ unsigned char*);
+#define DECLAREContigCallbackFunc(name) \
+static void name(\
+ TIFFImageIter* img, \
+ void* user_data, \
+ uint32 x, uint32 y, \
+ uint32 w, uint32 h, \
+ int32 fromskew, \
+ u_char* pp \
+)
+
+typedef void (*ImageIterTileSeparateRoutine)
+ (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+ unsigned char*, unsigned char*, unsigned char*, unsigned char*);
+#define DECLARESepCallbackFunc(name) \
+static void name(\
+ TIFFImageIter* img, \
+ void* user_data, \
+ uint32 x, uint32 y, \
+ uint32 w, uint32 h,\
+ int32 fromskew, \
+ u_char* r, u_char* g, u_char* b, u_char* a\
+)
+
+struct _TIFFImageIter {
+ TIFF* tif; /* image handle */
+ int stoponerr; /* stop on read error */
+ int isContig; /* data is packed/separate */
+ int alpha; /* type of alpha data present */
+ uint32 width; /* image width */
+ uint32 height; /* image height */
+ uint16 bitspersample; /* image bits/sample */
+ uint16 samplesperpixel; /* image samples/pixel */
+ uint16 orientation; /* image orientation */
+ uint16 photometric; /* image photometric interp */
+ uint16* redcmap; /* colormap pallete */
+ uint16* greencmap;
+ uint16* bluecmap;
+ /* get image data routine */
+ int (*get)(TIFFImageIter*, void *udata, uint32, uint32);
+ union {
+ void (*any)(TIFFImageIter*);
+ ImageIterTileContigRoutine contig;
+ ImageIterTileSeparateRoutine separate;
+ } callback; /* fn to exec for each block */
+};
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/pds/tif_pdsdirread.c b/tiff/contrib/pds/tif_pdsdirread.c
new file mode 100644
index 0000000..3d01311
--- /dev/null
+++ b/tiff/contrib/pds/tif_pdsdirread.c
@@ -0,0 +1,1131 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirread.c,v 1.3.2.1 2010-06-08 18:50:41 bfriesen Exp $ */
+
+/*
+ * Copyright (c) 1988-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c( 1996 USAF Phillips Laboratory
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * These routines written by Conrad J. Poelman on a single late-night of
+ * March 20-21, 1996.
+ *
+ * The entire purpose of this file is to provide a single external function,
+ * TIFFReadPrivateDataSubDirectory(). This function is intended for use in reading a
+ * private subdirectory from a TIFF file into a private structure. The
+ * actual writing of data into the structure is handled by the setFieldFn(),
+ * which is passed to TIFFReadPrivateDataSubDirectory() as a parameter. The idea is to
+ * enable any application wishing to store private subdirectories to do so
+ * easily using this function, without modifying the TIFF library.
+ *
+ * The astute observer will notice that only two functions are at all different
+ * from the original tif_dirread.c file: TIFFReadPrivateDataSubDirectory() and
+ * TIFFFetchNormalSubTag(). All the other stuff that makes this file so huge
+ * is only necessary because all of those functions are declared static in
+ * tif_dirread.c, so we have to totally duplicate them in order to use them.
+ *
+ * Oh, also note the bug fix in TIFFFetchFloat().
+ *
+ */
+
+#include "tiffiop.h"
+
+#define IGNORE 0 /* tag placeholder used below */
+
+#if HAVE_IEEEFP
+#define TIFFCvtIEEEFloatToNative(tif, n, fp)
+#define TIFFCvtIEEEDoubleToNative(tif, n, dp)
+#else
+extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);
+extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);
+#endif
+
+static void EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);
+static void MissingRequired(TIFF*, const char*);
+static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);
+static tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);
+static tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);
+static float TIFFFetchRational(TIFF*, TIFFDirEntry*);
+static int TIFFFetchNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
+ int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
+static int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, int*);
+static int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);
+static int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);
+static int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);
+static int TIFFFetchExtraSamples(TIFF*, TIFFDirEntry*);
+static int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);
+static float TIFFFetchFloat(TIFF*, TIFFDirEntry*);
+static int TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);
+static int TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);
+static int TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);
+static int TIFFFetchShortPair(TIFF*, TIFFDirEntry*);
+#if STRIPCHOP_SUPPORT
+static void ChopUpSingleUncompressedStrip(TIFF*);
+#endif
+
+static char *
+CheckMalloc(TIFF* tif, tsize_t n, const char* what)
+{
+ char *cp = (char*)_TIFFmalloc(n);
+ if (cp == NULL)
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space %s", what);
+ return (cp);
+}
+
+/* Just as was done with TIFFWritePrivateDataSubDirectory(), here we implement
+ TIFFReadPrivateDataSubDirectory() which takes an offset into the TIFF file,
+ a TIFFFieldInfo structure specifying the types of the various tags,
+ and a function to use to set individual tags when they are encountered.
+ The data is read from the file, translated using the TIFF library's
+ built-in machine-independent conversion functions, and filled into
+ private subdirectory structure.
+
+ This code was written by copying the original TIFFReadDirectory() function
+ from tif_dirread.c and paring it down to what is needed for this.
+
+ It is the caller's responsibility to allocate and initialize the internal
+ structure that setFieldFn() will be writing into. If this function is being
+ called more than once before closing the file, the caller also must be
+ careful to free data in the structure before re-initializing.
+
+ It is also the caller's responsibility to verify the presence of
+ any required fields after reading the directory in.
+*/
+
+
+int
+TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
+ TIFFFieldInfo *field_info,
+ int (*setFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+ register TIFFDirEntry* dp;
+ register int n;
+ register TIFFDirectory* td;
+ TIFFDirEntry* dir;
+ int iv;
+ long v;
+ double dv;
+ const TIFFFieldInfo* fip;
+ int fix;
+ uint16 dircount;
+ uint32 nextdiroff;
+ char* cp;
+ int diroutoforderwarning = 0;
+
+ /* Skipped part about checking for directories or compression data. */
+
+ if (!isMapped(tif)) {
+ if (!SeekOK(tif, pdir_offset)) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Seek error accessing TIFF private subdirectory");
+ return (0);
+ }
+ if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Can not read TIFF private subdirectory count");
+ return (0);
+ }
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabShort(&dircount);
+ dir = (TIFFDirEntry *)CheckMalloc(tif,
+ dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");
+ if (dir == NULL)
+ return (0);
+ if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not read TIFF private subdirectory");
+ goto bad;
+ }
+ /*
+ * Read offset to next directory for sequential scans.
+ */
+ (void) ReadOK(tif, &nextdiroff, sizeof (uint32));
+ } else {
+ toff_t off = pdir_offset;
+
+ if (off + sizeof (short) > tif->tif_size) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Can not read TIFF private subdirectory count");
+ return (0);
+ } else
+ _TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
+ off += sizeof (uint16);
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabShort(&dircount);
+ dir = (TIFFDirEntry *)CheckMalloc(tif,
+ dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");
+ if (dir == NULL)
+ return (0);
+ if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not read TIFF private subdirectory");
+ goto bad;
+ } else
+ _TIFFmemcpy(dir, tif->tif_base + off,
+ dircount*sizeof (TIFFDirEntry));
+ off += dircount* sizeof (TIFFDirEntry);
+ if (off + sizeof (uint32) < tif->tif_size)
+ _TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));
+ }
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabLong(&nextdiroff);
+
+ /*
+ * Setup default value and then make a pass over
+ * the fields to check type and tag information,
+ * and to extract info required to size data
+ * structures. A second pass is made afterwards
+ * to read in everthing not taken in the first pass.
+ */
+ td = &tif->tif_dir;
+
+ for (fip = field_info, dp = dir, n = dircount;
+ n > 0; n--, dp++) {
+ if (tif->tif_flags & TIFF_SWAB) {
+ TIFFSwabArrayOfShort(&dp->tdir_tag, 2);
+ TIFFSwabArrayOfLong(&dp->tdir_count, 2);
+ }
+ /*
+ * Find the field information entry for this tag.
+ */
+ /*
+ * Silicon Beach (at least) writes unordered
+ * directory tags (violating the spec). Handle
+ * it here, but be obnoxious (maybe they'll fix it?).
+ */
+ if (dp->tdir_tag < fip->field_tag) {
+ if (!diroutoforderwarning) {
+ TIFFWarning(tif->tif_name,
+ "invalid TIFF private subdirectory; tags are not sorted in ascending order");
+ diroutoforderwarning = 1;
+ }
+ fip = field_info; /* O(n^2) */
+ }
+
+ while (fip->field_tag && fip->field_tag < dp->tdir_tag)
+ fip++;
+ if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {
+ TIFFWarning(tif->tif_name,
+ "unknown field with tag %d (0x%x) in private subdirectory ignored",
+ dp->tdir_tag, dp->tdir_tag);
+ dp->tdir_tag = IGNORE;
+ fip = field_info;/* restart search */
+ continue;
+ }
+ /*
+ * Null out old tags that we ignore.
+ */
+
+ /* Not implemented yet, since FIELD_IGNORE is specific to
+ the main directories. Could pass this in too... */
+ if (0 /* && fip->field_bit == FIELD_IGNORE */) {
+ ignore:
+ dp->tdir_tag = IGNORE;
+ continue;
+ }
+
+ /*
+ * Check data type.
+ */
+
+ while (dp->tdir_type != (u_short)fip->field_type) {
+ if (fip->field_type == TIFF_ANY) /* wildcard */
+ break;
+ fip++;
+ if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {
+ TIFFWarning(tif->tif_name,
+ "wrong data type %d for \"%s\"; tag ignored",
+ dp->tdir_type, fip[-1].field_name);
+ goto ignore;
+ }
+ }
+ /*
+ * Check count if known in advance.
+ */
+ if (fip->field_readcount != TIFF_VARIABLE) {
+ uint32 expected = (fip->field_readcount == TIFF_SPP) ?
+ (uint32) td->td_samplesperpixel :
+ (uint32) fip->field_readcount;
+ if (!CheckDirCount(tif, dp, expected))
+ goto ignore;
+ }
+
+ /* Now read in and process data from field. */
+ if (!TIFFFetchNormalSubTag(tif, dp, fip, setFieldFn))
+ goto bad;
+
+ }
+
+ if (dir)
+ _TIFFfree(dir);
+ return (1);
+bad:
+ if (dir)
+ _TIFFfree(dir);
+ return (0);
+}
+
+static void
+EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+{
+ register TIFFDirEntry *dp;
+ register TIFFDirectory *td = &tif->tif_dir;
+ uint16 i;
+
+ if (td->td_stripbytecount)
+ _TIFFfree(td->td_stripbytecount);
+ td->td_stripbytecount = (uint32*)
+ CheckMalloc(tif, td->td_nstrips * sizeof (uint32),
+ "for \"StripByteCounts\" array");
+ if (td->td_compression != COMPRESSION_NONE) {
+ uint32 space = (uint32)(sizeof (TIFFHeader)
+ + sizeof (uint16)
+ + (dircount * sizeof (TIFFDirEntry))
+ + sizeof (uint32));
+ toff_t filesize = TIFFGetFileSize(tif);
+ uint16 n;
+
+ /* calculate amount of space used by indirect values */
+ for (dp = dir, n = dircount; n > 0; n--, dp++) {
+ uint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
+ if (cc > sizeof (uint32))
+ space += cc;
+ }
+ space = (filesize - space) / td->td_samplesperpixel;
+ for (i = 0; i < td->td_nstrips; i++)
+ td->td_stripbytecount[i] = space;
+ /*
+ * This gross hack handles the case were the offset to
+ * the last strip is past the place where we think the strip
+ * should begin. Since a strip of data must be contiguous,
+ * it's safe to assume that we've overestimated the amount
+ * of data in the strip and trim this number back accordingly.
+ */
+ i--;
+ if (td->td_stripoffset[i] + td->td_stripbytecount[i] > filesize)
+ td->td_stripbytecount[i] =
+ filesize - td->td_stripoffset[i];
+ } else {
+ uint32 rowbytes = TIFFScanlineSize(tif);
+ uint32 rowsperstrip = td->td_imagelength / td->td_nstrips;
+ for (i = 0; i < td->td_nstrips; i++)
+ td->td_stripbytecount[i] = rowbytes*rowsperstrip;
+ }
+ TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
+ if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
+ td->td_rowsperstrip = td->td_imagelength;
+}
+
+static void
+MissingRequired(TIFF* tif, const char* tagname)
+{
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "TIFF directory is missing required \"%s\" field", tagname);
+}
+
+/*
+ * Check the count field of a directory
+ * entry against a known value. The caller
+ * is expected to skip/ignore the tag if
+ * there is a mismatch.
+ */
+static int
+CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
+{
+ if (count != dir->tdir_count) {
+ TIFFWarning(tif->tif_name,
+ "incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
+ dir->tdir_count, count);
+ return (0);
+ }
+ return (1);
+}
+
+/*
+ * Fetch a contiguous directory item.
+ */
+static tsize_t
+TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+ int w = TIFFDataWidth(dir->tdir_type);
+ tsize_t cc = dir->tdir_count * w;
+
+ if (!isMapped(tif)) {
+ if (!SeekOK(tif, dir->tdir_offset))
+ goto bad;
+ if (!ReadOK(tif, cp, cc))
+ goto bad;
+ } else {
+ if (dir->tdir_offset + cc > tif->tif_size)
+ goto bad;
+ _TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);
+ }
+ if (tif->tif_flags & TIFF_SWAB) {
+ switch (dir->tdir_type) {
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+ break;
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ case TIFF_FLOAT:
+ TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+ break;
+ case TIFF_DOUBLE:
+ TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+ break;
+ }
+ }
+ return (cc);
+bad:
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error fetching data for field \"%s\"",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+ return ((tsize_t) 0);
+}
+
+/*
+ * Fetch an ASCII item from the file.
+ */
+static tsize_t
+TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+ if (dir->tdir_count <= 4) {
+ uint32 l = dir->tdir_offset;
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabLong(&l);
+ _TIFFmemcpy(cp, &l, dir->tdir_count);
+ return (1);
+ }
+ return (TIFFFetchData(tif, dir, cp));
+}
+
+/*
+ * Convert numerator+denominator to float.
+ */
+static int
+cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
+{
+ if (denom == 0) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "%s: Rational with zero denominator (num = %lu)",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
+ return (0);
+ } else {
+ if (dir->tdir_type == TIFF_RATIONAL)
+ *rv = ((float)num / (float)denom);
+ else
+ *rv = ((float)(int32)num / (float)(int32)denom);
+ return (1);
+ }
+}
+
+/*
+ * Fetch a rational item from the file
+ * at offset off and return the value
+ * as a floating point number.
+ */
+static float
+TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)
+{
+ uint32 l[2];
+ float v;
+
+ return (!TIFFFetchData(tif, dir, (char *)l) ||
+ !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);
+}
+
+/*
+ * Fetch a single floating point value
+ * from the offset field and return it
+ * as a native float.
+ */
+static float
+TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)
+{
+ /* This appears to be a flagrant bug in the TIFF library, yet I
+ actually don't understand how it could have ever worked the old
+ way. Look at the comments in my new code and you'll understand. */
+#if (0)
+ float v = (float)
+ TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
+ TIFFCvtIEEEFloatToNative(tif, 1, &v);
+#else
+ float v;
+ /* This is a little bit tricky - if we just cast the uint32 to a float,
+ C will perform a numerical conversion, which is not what we want.
+ We want to take the actual bit pattern in the uint32 and interpret
+ it as a float. Thus we cast a uint32 * into a float * and then
+ dereference to get v. */
+ uint32 l = (uint32)
+ TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
+ v = * (float *) &l;
+ TIFFCvtIEEEFloatToNative(tif, 1, &v);
+#endif
+ return (v);
+
+}
+
+/*
+ * Fetch an array of BYTE or SBYTE values.
+ */
+static int
+TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+ if (dir->tdir_count <= 4) {
+ /*
+ * Extract data from offset field.
+ */
+ if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+ switch (dir->tdir_count) {
+ case 4: v[3] = dir->tdir_offset & 0xff;
+ case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;
+ case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;
+ case 1: v[0] = dir->tdir_offset >> 24;
+ }
+ } else {
+ switch (dir->tdir_count) {
+ case 4: v[3] = dir->tdir_offset >> 24;
+ case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;
+ case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;
+ case 1: v[0] = dir->tdir_offset & 0xff;
+ }
+ }
+ return (1);
+ } else
+ return (TIFFFetchData(tif, dir, (char*) v) != 0); /* XXX */
+}
+
+/*
+ * Fetch an array of SHORT or SSHORT values.
+ */
+static int
+TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+ if (dir->tdir_count <= 2) {
+ if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+ switch (dir->tdir_count) {
+ case 2: v[1] = dir->tdir_offset & 0xffff;
+ case 1: v[0] = dir->tdir_offset >> 16;
+ }
+ } else {
+ switch (dir->tdir_count) {
+ case 2: v[1] = dir->tdir_offset >> 16;
+ case 1: v[0] = dir->tdir_offset & 0xffff;
+ }
+ }
+ return (1);
+ } else
+ return (TIFFFetchData(tif, dir, (char *)v) != 0);
+}
+
+/*
+ * Fetch a pair of SHORT or BYTE values.
+ */
+static int
+TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
+{
+ uint16 v[2];
+ int ok = 0;
+
+ switch (dir->tdir_type) {
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ ok = TIFFFetchShortArray(tif, dir, v);
+ break;
+ case TIFF_BYTE:
+ case TIFF_SBYTE:
+ ok = TIFFFetchByteArray(tif, dir, v);
+ break;
+ }
+ if (ok)
+ TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
+ return (ok);
+}
+
+/*
+ * Fetch an array of LONG or SLONG values.
+ */
+static int
+TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)
+{
+ if (dir->tdir_count == 1) {
+ v[0] = dir->tdir_offset;
+ return (1);
+ } else
+ return (TIFFFetchData(tif, dir, (char*) v) != 0);
+}
+
+/*
+ * Fetch an array of RATIONAL or SRATIONAL values.
+ */
+static int
+TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+ int ok = 0;
+ uint32* l;
+
+ l = (uint32*)CheckMalloc(tif,
+ dir->tdir_count*TIFFDataWidth(dir->tdir_type),
+ "to fetch array of rationals");
+ if (l) {
+ if (TIFFFetchData(tif, dir, (char *)l)) {
+ uint32 i;
+ for (i = 0; i < dir->tdir_count; i++) {
+ ok = cvtRational(tif, dir,
+ l[2*i+0], l[2*i+1], &v[i]);
+ if (!ok)
+ break;
+ }
+ }
+ _TIFFfree((char *)l);
+ }
+ return (ok);
+}
+
+/*
+ * Fetch an array of FLOAT values.
+ */
+static int
+TIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+
+ if (dir->tdir_count == 1) {
+ v[0] = *(float*) &dir->tdir_offset;
+ TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+ return (1);
+ } else if (TIFFFetchData(tif, dir, (char*) v)) {
+ TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+ return (1);
+ } else
+ return (0);
+}
+
+/*
+ * Fetch an array of DOUBLE values.
+ */
+static int
+TIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+ if (TIFFFetchData(tif, dir, (char*) v)) {
+ TIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);
+ return (1);
+ } else
+ return (0);
+}
+
+/*
+ * Fetch an array of ANY values. The actual values are
+ * returned as doubles which should be able hold all the
+ * types. Yes, there really should be an tany_t to avoid
+ * this potential non-portability ... Note in particular
+ * that we assume that the double return value vector is
+ * large enough to read in any fundamental type. We use
+ * that vector as a buffer to read in the base type vector
+ * and then convert it in place to double (from end
+ * to front of course).
+ */
+static int
+TIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+ int i;
+
+ switch (dir->tdir_type) {
+ case TIFF_BYTE:
+ case TIFF_SBYTE:
+ if (!TIFFFetchByteArray(tif, dir, (uint16*) v))
+ return (0);
+ if (dir->tdir_type == TIFF_BYTE) {
+ uint16* vp = (uint16*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ } else {
+ int16* vp = (int16*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ }
+ break;
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ if (!TIFFFetchShortArray(tif, dir, (uint16*) v))
+ return (0);
+ if (dir->tdir_type == TIFF_SHORT) {
+ uint16* vp = (uint16*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ } else {
+ int16* vp = (int16*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ }
+ break;
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ if (!TIFFFetchLongArray(tif, dir, (uint32*) v))
+ return (0);
+ if (dir->tdir_type == TIFF_LONG) {
+ uint32* vp = (uint32*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ } else {
+ int32* vp = (int32*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ }
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ if (!TIFFFetchRationalArray(tif, dir, (float*) v))
+ return (0);
+ { float* vp = (float*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ }
+ break;
+ case TIFF_FLOAT:
+ if (!TIFFFetchFloatArray(tif, dir, (float*) v))
+ return (0);
+ { float* vp = (float*) v;
+ for (i = dir->tdir_count-1; i >= 0; i--)
+ v[i] = vp[i];
+ }
+ break;
+ case TIFF_DOUBLE:
+ return (TIFFFetchDoubleArray(tif, dir, (double*) v));
+ default:
+ /* TIFF_NOTYPE */
+ /* TIFF_ASCII */
+ /* TIFF_UNDEFINED */
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Cannot read TIFF_ANY type %d for field \"%s\"",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+ return (0);
+ }
+ return (1);
+}
+
+
+/*
+ * Fetch a tag that is not handled by special case code.
+ */
+/* The standard function TIFFFetchNormalTag() could definitely be replaced
+ with a simple call to this function, just adding TIFFSetField() as the
+ last argument. */
+static int
+TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
+ int (*setFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+ static char mesg[] = "to fetch tag value";
+ int ok = 0;
+
+ if (dp->tdir_count > 1) { /* array of values */
+ char* cp = NULL;
+
+ switch (dp->tdir_type) {
+ case TIFF_BYTE:
+ case TIFF_SBYTE:
+ /* NB: always expand BYTE values to shorts */
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (uint16), mesg);
+ ok = cp && TIFFFetchByteArray(tif, dp, (uint16*) cp);
+ break;
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (uint16), mesg);
+ ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);
+ break;
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (uint32), mesg);
+ ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (float), mesg);
+ ok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);
+ break;
+ case TIFF_FLOAT:
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (float), mesg);
+ ok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);
+ break;
+ case TIFF_DOUBLE:
+ cp = CheckMalloc(tif,
+ dp->tdir_count * sizeof (double), mesg);
+ ok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);
+ break;
+ case TIFF_ASCII:
+ case TIFF_UNDEFINED: /* bit of a cheat... */
+ /*
+ * Some vendors write strings w/o the trailing
+ * NULL byte, so always append one just in case.
+ */
+ cp = CheckMalloc(tif, dp->tdir_count+1, mesg);
+ if (ok = (cp && TIFFFetchString(tif, dp, cp)))
+ cp[dp->tdir_count] = '\0'; /* XXX */
+ break;
+ }
+ if (ok) {
+ ok = (fip->field_passcount ?
+ (*setFieldFn)(tif, dp->tdir_tag, dp->tdir_count, cp)
+ : (*setFieldFn)(tif, dp->tdir_tag, cp));
+ }
+ if (cp != NULL)
+ _TIFFfree(cp);
+ } else if (CheckDirCount(tif, dp, 1)) { /* singleton value */
+ switch (dp->tdir_type) {
+ case TIFF_BYTE:
+ case TIFF_SBYTE:
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ /*
+ * If the tag is also acceptable as a LONG or SLONG
+ * then (*setFieldFn) will expect an uint32 parameter
+ * passed to it (through varargs). Thus, for machines
+ * where sizeof (int) != sizeof (uint32) we must do
+ * a careful check here. It's hard to say if this
+ * is worth optimizing.
+ *
+ * NB: We use TIFFFieldWithTag here knowing that
+ * it returns us the first entry in the table
+ * for the tag and that that entry is for the
+ * widest potential data type the tag may have.
+ */
+ { TIFFDataType type = fip->field_type;
+ if (type != TIFF_LONG && type != TIFF_SLONG) {
+ uint16 v = (uint16)
+ TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+ ok = (fip->field_passcount ?
+ (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+ : (*setFieldFn)(tif, dp->tdir_tag, v));
+ break;
+ }
+ }
+ /* fall thru... */
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ { uint32 v32 =
+ TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+ ok = (fip->field_passcount ?
+ (*setFieldFn)(tif, dp->tdir_tag, 1, &v32)
+ : (*setFieldFn)(tif, dp->tdir_tag, v32));
+ }
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ case TIFF_FLOAT:
+ { float v = (dp->tdir_type == TIFF_FLOAT ?
+ TIFFFetchFloat(tif, dp)
+ : TIFFFetchRational(tif, dp));
+ ok = (fip->field_passcount ?
+ (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+ : (*setFieldFn)(tif, dp->tdir_tag, v));
+ }
+ break;
+ case TIFF_DOUBLE:
+ { double v;
+ ok = (TIFFFetchDoubleArray(tif, dp, &v) &&
+ (fip->field_passcount ?
+ (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+ : (*setFieldFn)(tif, dp->tdir_tag, v))
+ );
+ }
+ break;
+ case TIFF_ASCII:
+ case TIFF_UNDEFINED: /* bit of a cheat... */
+ { char c[2];
+ if (ok = (TIFFFetchString(tif, dp, c) != 0)) {
+ c[1] = '\0'; /* XXX paranoid */
+ ok = (*setFieldFn)(tif, dp->tdir_tag, c);
+ }
+ }
+ break;
+ }
+ }
+ return (ok);
+}
+
+/* Everything after this is exactly duplicated from the standard tif_dirread.c
+ file, necessitated by the fact that they are declared static there so
+ we can't call them!
+*/
+#define NITEMS(x) (sizeof (x) / sizeof (x[0]))
+/*
+ * Fetch samples/pixel short values for
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, int* pl)
+{
+ int samples = tif->tif_dir.td_samplesperpixel;
+ int status = 0;
+
+ if (CheckDirCount(tif, dir, (uint32) samples)) {
+ uint16 buf[10];
+ uint16* v = buf;
+
+ if (samples > NITEMS(buf))
+ v = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+ if (TIFFFetchShortArray(tif, dir, v)) {
+ int i;
+ for (i = 1; i < samples; i++)
+ if (v[i] != v[0]) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Cannot handle different per-sample values for field \"%s\"",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+ goto bad;
+ }
+ *pl = v[0];
+ status = 1;
+ }
+ bad:
+ if (v != buf)
+ _TIFFfree((char*) v);
+ }
+ return (status);
+}
+
+/*
+ * Fetch samples/pixel ANY values for
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
+{
+ int samples = (int) tif->tif_dir.td_samplesperpixel;
+ int status = 0;
+
+ if (CheckDirCount(tif, dir, (uint32) samples)) {
+ double buf[10];
+ double* v = buf;
+
+ if (samples > NITEMS(buf))
+ v = (double*) _TIFFmalloc(samples * sizeof (double));
+ if (TIFFFetchAnyArray(tif, dir, v)) {
+ int i;
+ for (i = 1; i < samples; i++)
+ if (v[i] != v[0]) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Cannot handle different per-sample values for field \"%s\"",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+ goto bad;
+ }
+ *pl = v[0];
+ status = 1;
+ }
+ bad:
+ if (v != buf)
+ _TIFFfree(v);
+ }
+ return (status);
+}
+#undef NITEMS
+
+/*
+ * Fetch a set of offsets or lengths.
+ * While this routine says "strips",
+ * in fact it's also used for tiles.
+ */
+static int
+TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
+{
+ register uint32* lp;
+ int status;
+
+ if (!CheckDirCount(tif, dir, (uint32) nstrips))
+ return (0);
+ /*
+ * Allocate space for strip information.
+ */
+ if (*lpp == NULL &&
+ (*lpp = (uint32 *)CheckMalloc(tif,
+ nstrips * sizeof (uint32), "for strip array")) == NULL)
+ return (0);
+ lp = *lpp;
+ if (dir->tdir_type == (int)TIFF_SHORT) {
+ /*
+ * Handle uint16->uint32 expansion.
+ */
+ uint16* dp = (uint16*) CheckMalloc(tif,
+ dir->tdir_count* sizeof (uint16), "to fetch strip tag");
+ if (dp == NULL)
+ return (0);
+ if (status = TIFFFetchShortArray(tif, dir, dp)) {
+ register uint16* wp = dp;
+ while (nstrips-- > 0)
+ *lp++ = *wp++;
+ }
+ _TIFFfree((char*) dp);
+ } else
+ status = TIFFFetchLongArray(tif, dir, lp);
+ return (status);
+}
+
+#define NITEMS(x) (sizeof (x) / sizeof (x[0]))
+/*
+ * Fetch and set the ExtraSamples tag.
+ */
+static int
+TIFFFetchExtraSamples(TIFF* tif, TIFFDirEntry* dir)
+{
+ uint16 buf[10];
+ uint16* v = buf;
+ int status;
+
+ if (dir->tdir_count > NITEMS(buf))
+ v = (uint16*) _TIFFmalloc(dir->tdir_count * sizeof (uint16));
+ if (dir->tdir_type == TIFF_BYTE)
+ status = TIFFFetchByteArray(tif, dir, v);
+ else
+ status = TIFFFetchShortArray(tif, dir, v);
+ if (status)
+ status = TIFFSetField(tif, dir->tdir_tag, dir->tdir_count, v);
+ if (v != buf)
+ _TIFFfree((char*) v);
+ return (status);
+}
+#undef NITEMS
+
+#ifdef COLORIMETRY_SUPPORT
+/*
+ * Fetch and set the RefBlackWhite tag.
+ */
+static int
+TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)
+{
+ static char mesg[] = "for \"ReferenceBlackWhite\" array";
+ char* cp;
+ int ok;
+
+ if (dir->tdir_type == TIFF_RATIONAL)
+ return (1/*TIFFFetchNormalTag(tif, dir) just so linker won't complain - this part of the code is never used anyway */);
+ /*
+ * Handle LONG's for backward compatibility.
+ */
+ cp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32), mesg);
+ if (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) {
+ float* fp = (float*)
+ CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg);
+ if (ok = (fp != NULL)) {
+ uint32 i;
+ for (i = 0; i < dir->tdir_count; i++)
+ fp[i] = (float)((uint32*) cp)[i];
+ ok = TIFFSetField(tif, dir->tdir_tag, fp);
+ _TIFFfree((char*) fp);
+ }
+ }
+ if (cp)
+ _TIFFfree(cp);
+ return (ok);
+}
+#endif
+
+#if STRIPCHOP_SUPPORT
+/*
+ * Replace a single strip (tile) of uncompressed data by
+ * multiple strips (tiles), each approximately 8Kbytes.
+ * This is useful for dealing with large images or
+ * for dealing with machines with a limited amount
+ * memory.
+ */
+static void
+ChopUpSingleUncompressedStrip(TIFF* tif)
+{
+ register TIFFDirectory *td = &tif->tif_dir;
+ uint32 bytecount = td->td_stripbytecount[0];
+ uint32 offset = td->td_stripoffset[0];
+ tsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;
+ tstrip_t strip, nstrips, rowsperstrip;
+ uint32* newcounts;
+ uint32* newoffsets;
+
+ /*
+ * Make the rows hold at least one
+ * scanline, but fill 8k if possible.
+ */
+ if (rowbytes > 8192) {
+ stripbytes = rowbytes;
+ rowsperstrip = 1;
+ } else {
+ rowsperstrip = 8192 / rowbytes;
+ stripbytes = rowbytes * rowsperstrip;
+ }
+ /* never increase the number of strips in an image */
+ if (rowsperstrip >= td->td_rowsperstrip)
+ return;
+ nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);
+ newcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+ "for chopped \"StripByteCounts\" array");
+ newoffsets = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+ "for chopped \"StripOffsets\" array");
+ if (newcounts == NULL || newoffsets == NULL) {
+ /*
+ * Unable to allocate new strip information, give
+ * up and use the original one strip information.
+ */
+ if (newcounts != NULL)
+ _TIFFfree(newcounts);
+ if (newoffsets != NULL)
+ _TIFFfree(newoffsets);
+ return;
+ }
+ /*
+ * Fill the strip information arrays with
+ * new bytecounts and offsets that reflect
+ * the broken-up format.
+ */
+ for (strip = 0; strip < nstrips; strip++) {
+ if (stripbytes > bytecount)
+ stripbytes = bytecount;
+ newcounts[strip] = stripbytes;
+ newoffsets[strip] = offset;
+ offset += stripbytes;
+ bytecount -= stripbytes;
+ }
+ /*
+ * Replace old single strip info with multi-strip info.
+ */
+ td->td_stripsperimage = td->td_nstrips = nstrips;
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+ _TIFFfree(td->td_stripbytecount);
+ _TIFFfree(td->td_stripoffset);
+ td->td_stripbytecount = newcounts;
+ td->td_stripoffset = newoffsets;
+}
+#endif /* STRIPCHOP_SUPPORT */
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/pds/tif_pdsdirwrite.c b/tiff/contrib/pds/tif_pdsdirwrite.c
new file mode 100644
index 0000000..eb71d42
--- /dev/null
+++ b/tiff/contrib/pds/tif_pdsdirwrite.c
@@ -0,0 +1,971 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirwrite.c,v 1.3.2.1 2010-06-08 18:50:41 bfriesen Exp $ */
+
+/* When writing data to TIFF files, it is often useful to store application-
+ specific data in a private TIFF directory so that the tags don't need to
+ be registered and won't conflict with other people's user-defined tags.
+ One needs to have a registered public tag which contains some amount of
+ raw data. That raw data, however, is interpreted at an independent,
+ separate, private tiff directory. This file provides some routines which
+ will be useful for converting that data from its raw binary form into
+ the proper form for your application.
+*/
+
+/*
+ * Copyright (c) 1988-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c( 1996 USAF Phillips Laboratory
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * These routines written by Conrad J. Poelman on a single late-night of
+ * March 20-21, 1996.
+ *
+ * The entire purpose of this file is to provide a single external function,
+ * TIFFWritePrivateDataSubDirectory(). This function is intended for use
+ * in writing a private subdirectory structure into a TIFF file. The
+ * actual reading of data from the structure is handled by the getFieldFn(),
+ * which is passed to TIFFWritePrivateDataSubDirectory() as a parameter. The
+ * idea is to enable any application wishing to read private subdirectories to
+ * do so easily using this function, without modifying the TIFF library.
+ *
+ * The astute observer will notice that only two functions are at all different
+ * from the original tif_dirwrite.c file: TIFFWritePrivateDataSubDirectory()and
+ * TIFFWriteNormalSubTag(). All the other stuff that makes this file so huge
+ * is only necessary because all of those functions are declared static in
+ * tif_dirwrite.c, so we have to totally duplicate them in order to use them.
+ *
+ * Oh, also please note the bug-fix in the routine TIFFWriteNormalSubTag(),
+ * which equally should be applied to TIFFWriteNormalTag().
+ *
+ */
+#include "tiffiop.h"
+
+#if HAVE_IEEEFP
+#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
+#define TIFFCvtNativeToIEEEDouble(tif, n, dp)
+#else
+extern void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);
+extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
+#endif
+
+static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
+static int TIFFWriteNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
+ int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
+static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
+static int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
+static int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
+static int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
+static int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);
+static int TIFFWriteShortArray(TIFF*,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint16*);
+static int TIFFWriteLongArray(TIFF *,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint32*);
+static int TIFFWriteRationalArray(TIFF *,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+static int TIFFWriteFloatArray(TIFF *,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+static int TIFFWriteDoubleArray(TIFF *,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+static int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);
+static int TIFFWriteAnyArray(TIFF*,
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+#ifdef COLORIMETRY_SUPPORT
+static int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);
+#endif
+static int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);
+static int TIFFLinkDirectory(TIFF*);
+
+#define WriteRationalPair(type, tag1, v1, tag2, v2) { \
+ if (!TIFFWriteRational(tif, type, tag1, dir, v1)) \
+ goto bad; \
+ if (!TIFFWriteRational(tif, type, tag2, dir+1, v2)) \
+ goto bad; \
+ dir++; \
+}
+#define TIFFWriteRational(tif, type, tag, dir, v) \
+ TIFFWriteRationalArray((tif), (type), (tag), (dir), 1, &(v))
+#ifndef TIFFWriteRational
+static int TIFFWriteRational(TIFF*,
+ TIFFDataType, ttag_t, TIFFDirEntry*, float);
+#endif
+
+/* This function will write an entire directory to the disk, and return the
+ offset value indicating where in the file it wrote the beginning of the
+ directory structure. This is NOT the same as the offset value before
+ calling this function, because some of the fields may have caused various
+ data items to be written out BEFORE writing the directory structure.
+
+ This code was basically written by ripping of the TIFFWriteDirectory()
+ code and generalizing it, using RPS's TIFFWritePliIfd() code for
+ inspiration. My original goal was to make this code general enough that
+ the original TIFFWriteDirectory() could be rewritten to just call this
+ function with the appropriate field and field-accessing arguments.
+
+ However, now I realize that there's a lot of code that gets executed for
+ the main, standard TIFF directories that does not apply to special
+ private subdirectories, so such a reimplementation for the sake of
+ eliminating redundant or duplicate code is probably not possible,
+ unless we also pass in a Main flag to indiciate which type of handling
+ to do, which would be kind of a hack. I've marked those places where I
+ changed or ripped out code which would have to be re-inserted to
+ generalize this function. If it can be done in a clean and graceful way,
+ it would be a great way to generalize the TIFF library. Otherwise, I'll
+ just leave this code here where it duplicates but remains on top of and
+ hopefully mostly independent of the main TIFF library.
+
+ The caller will probably want to free the sub directory structure after
+ returning from this call, since otherwise once written out, the user
+ is likely to forget about it and leave data lying around.
+*/
+toff_t
+TIFFWritePrivateDataSubDirectory(TIFF* tif,
+ uint32 pdir_fieldsset[], int pdir_fields_last,
+ TIFFFieldInfo *field_info,
+ int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+ uint16 dircount;
+ uint32 diroff, nextdiroff;
+ ttag_t tag;
+ uint32 nfields;
+ tsize_t dirsize;
+ char* data;
+ TIFFDirEntry* dir;
+ u_long b, *fields, fields_size;
+ toff_t directory_offset;
+ TIFFFieldInfo* fip;
+
+ /*
+ * Deleted out all of the encoder flushing and such code from here -
+ * not necessary for subdirectories.
+ */
+
+ /* Finish writing out any image data. */
+ TIFFFlushData(tif);
+
+ /*
+ * Size the directory so that we can calculate
+ * offsets for the data items that aren't kept
+ * in-place in each field.
+ */
+ nfields = 0;
+ for (b = 0; b <= pdir_fields_last; b++)
+ if (FieldSet(pdir_fieldsset, b))
+ /* Deleted code to make size of first 4 tags 2
+ instead of 1. */
+ nfields += 1;
+ dirsize = nfields * sizeof (TIFFDirEntry);
+ data = (char*) _TIFFmalloc(dirsize);
+ if (data == NULL) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Cannot write private subdirectory, out of space");
+ return (0);
+ }
+ /*
+ * Place directory in data section of the file. If there isn't one
+ * yet, place it at the end of the file. The directory is treated as
+ * data, so we don't link it into the directory structure at all.
+ */
+ if (tif->tif_dataoff == 0)
+ tif->tif_dataoff =(TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
+ diroff = tif->tif_dataoff;
+ tif->tif_dataoff = (toff_t)(
+ diroff + sizeof (uint16) + dirsize + sizeof (toff_t));
+ if (tif->tif_dataoff & 1)
+ tif->tif_dataoff++;
+ (void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
+ /*tif->tif_curdir++;*/
+ dir = (TIFFDirEntry*) data;
+ /*
+ * Setup external form of directory
+ * entries and write data items.
+ */
+ /*
+ * We make a local copy of the fieldsset here so that we don't mess
+ * up the original one when we call ResetFieldBit(). But I'm not sure
+ * why the original code calls ResetFieldBit(), since we're already
+ * going through the fields in order...
+ *
+ * fields_size is the number of uint32's we will need to hold the
+ * bit-mask for all of the fields. If our highest field number is
+ * 100, then we'll need 100 / (8*4)+1 == 4 uint32's to hold the
+ * fieldset.
+ *
+ * Unlike the original code, we allocate fields dynamically based
+ * on the requested pdir_fields_last value, allowing private
+ * data subdirectories to contain more than the built-in code's limit
+ * of 95 tags in a directory.
+ */
+ fields_size = pdir_fields_last / (8*sizeof(uint32)) + 1;
+ fields = _TIFFmalloc(fields_size*sizeof(uint32));
+ _TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32));
+
+ /* Deleted "write out extra samples tag" code here. */
+
+ /* Deleted code for checking a billion little special cases for the
+ * standard TIFF tags. Should add a general mechanism for overloading
+ * write function for each field, just like Brian kept telling me!!!
+ */
+ for (fip = field_info; fip->field_tag; fip++) {
+ /* Deleted code to check for FIELD_IGNORE!! */
+ if (/* fip->field_bit == FIELD_IGNORE || */
+ !FieldSet(fields, fip->field_bit))
+ continue;
+ if (!TIFFWriteNormalSubTag(tif, dir, fip, getFieldFn))
+ goto bad;
+ dir++;
+ ResetFieldBit(fields, fip->field_bit);
+ }
+
+ /* Now we've written all of the referenced data, and are about to
+ write the main directory structure, so grab the tif_dataoff value
+ now so we can remember where we wrote the directory. */
+ directory_offset = tif->tif_dataoff;
+
+ /*
+ * Write directory.
+ */
+ dircount = (uint16) nfields;
+ /* Deleted code to link to the next directory - we set it to zero! */
+ nextdiroff = 0;
+ if (tif->tif_flags & TIFF_SWAB) {
+ /*
+ * The file's byte order is opposite to the
+ * native machine architecture. We overwrite
+ * the directory information with impunity
+ * because it'll be released below after we
+ * write it to the file. Note that all the
+ * other tag construction routines assume that
+ * we do this byte-swapping; i.e. they only
+ * byte-swap indirect data.
+ */
+ for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {
+ TIFFSwabArrayOfShort(&dir->tdir_tag, 2);
+ TIFFSwabArrayOfLong(&dir->tdir_count, 2);
+ }
+ dircount = (uint16) nfields;
+ TIFFSwabShort(&dircount);
+ TIFFSwabLong(&nextdiroff);
+ }
+
+ (void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
+ if (!WriteOK(tif, &dircount, sizeof (dircount))) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory count");
+ goto bad;
+ }
+ if (!WriteOK(tif, data, dirsize)) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory contents");
+ goto bad;
+ }
+ if (!WriteOK(tif, &nextdiroff, sizeof (nextdiroff))) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory link");
+ goto bad;
+ }
+ tif->tif_dataoff += sizeof(dircount) + dirsize + sizeof(nextdiroff);
+
+ _TIFFfree(data);
+ _TIFFfree(fields);
+ tif->tif_flags &= ~TIFF_DIRTYDIRECT;
+
+#if (0)
+ /* This stuff commented out because I don't think we want it for
+ subdirectories, but I could be wrong. */
+ (*tif->tif_cleanup)(tif);
+
+ /*
+ * Reset directory-related state for subsequent
+ * directories.
+ */
+ TIFFDefaultDirectory(tif);
+ tif->tif_curoff = 0;
+ tif->tif_row = (uint32) -1;
+ tif->tif_curstrip = (tstrip_t) -1;
+#endif
+
+ return (directory_offset);
+bad:
+ _TIFFfree(data);
+ _TIFFfree(fields);
+ return (0);
+}
+#undef WriteRationalPair
+
+/*
+ * Process tags that are not special cased.
+ */
+/* The standard function TIFFWriteNormalTag() could definitely be replaced
+ with a simple call to this function, just adding TIFFGetField() as the
+ last argument. */
+static int
+TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
+ int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+ u_short wc = (u_short) fip->field_writecount;
+
+ dir->tdir_tag = fip->field_tag;
+ dir->tdir_type = (u_short) fip->field_type;
+ dir->tdir_count = wc;
+#define WRITEF(x,y) x(tif, fip->field_type, fip->field_tag, dir, wc, y)
+ switch (fip->field_type) {
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ if (wc > 1) {
+ uint16* wp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &wp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &wp);
+ if (!WRITEF(TIFFWriteShortArray, wp))
+ return (0);
+ } else {
+ uint16 sv;
+ (*getFieldFn)(tif, fip->field_tag, &sv);
+ dir->tdir_offset =
+ TIFFInsertData(tif, dir->tdir_type, sv);
+ }
+ break;
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ if (wc > 1) {
+ uint32* lp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &lp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &lp);
+ if (!WRITEF(TIFFWriteLongArray, lp))
+ return (0);
+ } else {
+ /* XXX handle LONG->SHORT conversion */
+ (*getFieldFn)(tif, fip->field_tag, &dir->tdir_offset);
+ }
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ if (wc > 1) {
+ float* fp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &fp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &fp);
+ if (!WRITEF(TIFFWriteRationalArray, fp))
+ return (0);
+ } else {
+ float fv;
+ (*getFieldFn)(tif, fip->field_tag, &fv);
+ if (!WRITEF(TIFFWriteRationalArray, &fv))
+ return (0);
+ }
+ break;
+ case TIFF_FLOAT:
+ if (wc > 1) {
+ float* fp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &fp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &fp);
+ if (!WRITEF(TIFFWriteFloatArray, fp))
+ return (0);
+ } else {
+ float fv;
+ (*getFieldFn)(tif, fip->field_tag, &fv);
+ if (!WRITEF(TIFFWriteFloatArray, &fv))
+ return (0);
+ }
+ break;
+ case TIFF_DOUBLE:
+ /* Hey - I think this is a bug, or at least a "gross
+ inconsistency", in the TIFF library. Look at the original
+ TIFF library code below within the "#if (0) ... #else".
+ Just from the type of *dp, you can see that this code
+ expects TIFFGetField() to be handed a double ** for
+ any TIFF_DOUBLE tag, even for the constant wc==1 case.
+ This is totally inconsistent with other fields (like
+ TIFF_FLOAT, above) and is also inconsistent with the
+ TIFFSetField() function for TIFF_DOUBLEs, which expects
+ to be passed a single double by value for the wc==1 case.
+ (See the handling of TIFFFetchNormalTag() in tif_dirread.c
+ for an example.) Maybe this function was written before
+ TIFFWriteDoubleArray() was written, not that that's an
+ excuse. Anyway, the new code below is a trivial modification
+ of the TIFF_FLOAT code above. The fact that even single
+ doubles get written out in the data segment and get an
+ offset value stored is irrelevant here - that is all
+ handled by TIFFWriteDoubleArray(). */
+#if (0)
+ { double* dp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &dp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &dp);
+ TIFFCvtNativeToIEEEDouble(tif, wc, dp);
+ if (!TIFFWriteData(tif, dir, (char*) dp))
+ return (0);
+ }
+#else
+ if (wc > 1) {
+ double* dp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &dp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &dp);
+ if (!WRITEF(TIFFWriteDoubleArray, dp))
+ return (0);
+ } else {
+ double dv;
+ (*getFieldFn)(tif, fip->field_tag, &dv);
+ if (!WRITEF(TIFFWriteDoubleArray, &dv))
+ return (0);
+ }
+#endif
+ break;
+ case TIFF_ASCII:
+ { char* cp;
+ (*getFieldFn)(tif, fip->field_tag, &cp);
+ dir->tdir_count = (uint32) (strlen(cp) + 1);
+ if (!TIFFWriteByteArray(tif, dir, cp))
+ return (0);
+ }
+ break;
+ case TIFF_UNDEFINED:
+ { char* cp;
+ if (wc == (u_short) TIFF_VARIABLE) {
+ (*getFieldFn)(tif, fip->field_tag, &wc, &cp);
+ dir->tdir_count = wc;
+ } else
+ (*getFieldFn)(tif, fip->field_tag, &cp);
+ if (!TIFFWriteByteArray(tif, dir, cp))
+ return (0);
+ }
+ break;
+ }
+ return (1);
+}
+#undef WRITEF
+
+/* Everything after this is exactly duplicated from the standard tif_dirwrite.c
+ file, necessitated by the fact that they are declared static there so
+ we can't call them!
+*/
+/*
+ * Setup a directory entry with either a SHORT
+ * or LONG type according to the value.
+ */
+static void
+TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)
+{
+ dir->tdir_tag = tag;
+ dir->tdir_count = 1;
+ if (v > 0xffffL) {
+ dir->tdir_type = (short) TIFF_LONG;
+ dir->tdir_offset = v;
+ } else {
+ dir->tdir_type = (short) TIFF_SHORT;
+ dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);
+ }
+}
+#undef MakeShortDirent
+
+#ifndef TIFFWriteRational
+/*
+ * Setup a RATIONAL directory entry and
+ * write the associated indirect value.
+ */
+static int
+TIFFWriteRational(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, float v)
+{
+ return (TIFFWriteRationalArray(tif, type, tag, dir, 1, &v));
+}
+#endif
+
+#define NITEMS(x) (sizeof (x) / sizeof (x[0]))
+/*
+ * Setup a directory entry that references a
+ * samples/pixel array of SHORT values and
+ * (potentially) write the associated indirect
+ * values.
+ */
+static int
+TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+ uint16 buf[10], v;
+ uint16* w = buf;
+ int i, status, samples = tif->tif_dir.td_samplesperpixel;
+
+ if (samples > NITEMS(buf))
+ w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+ TIFFGetField(tif, tag, &v);
+ for (i = 0; i < samples; i++)
+ w[i] = v;
+ status = TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, samples, w);
+ if (w != buf)
+ _TIFFfree((char*) w);
+ return (status);
+}
+
+/*
+ * Setup a directory entry that references a samples/pixel array of ``type''
+ * values and (potentially) write the associated indirect values. The source
+ * data from TIFFGetField() for the specified tag must be returned as double.
+ */
+static int
+TIFFWritePerSampleAnys(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)
+{
+ double buf[10], v;
+ double* w = buf;
+ int i, status;
+ int samples = (int) tif->tif_dir.td_samplesperpixel;
+
+ if (samples > NITEMS(buf))
+ w = (double*) _TIFFmalloc(samples * sizeof (double));
+ TIFFGetField(tif, tag, &v);
+ for (i = 0; i < samples; i++)
+ w[i] = v;
+ status = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);
+ if (w != buf)
+ _TIFFfree(w);
+ return (status);
+}
+#undef NITEMS
+
+/*
+ * Setup a pair of shorts that are returned by
+ * value, rather than as a reference to an array.
+ */
+static int
+TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+ uint16 v[2];
+
+ TIFFGetField(tif, tag, &v[0], &v[1]);
+ return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));
+}
+
+/*
+ * Setup a directory entry for an NxM table of shorts,
+ * where M is known to be 2**bitspersample, and write
+ * the associated indirect data.
+ */
+static int
+TIFFWriteShortTable(TIFF* tif,
+ ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)
+{
+ uint32 i, off;
+
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) TIFF_SHORT;
+ /* XXX -- yech, fool TIFFWriteData */
+ dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);
+ off = tif->tif_dataoff;
+ for (i = 0; i < n; i++)
+ if (!TIFFWriteData(tif, dir, (char *)table[i]))
+ return (0);
+ dir->tdir_count *= n;
+ dir->tdir_offset = off;
+ return (1);
+}
+
+/*
+ * Write/copy data associated with an ASCII or opaque tag value.
+ */
+static int
+TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+ if (dir->tdir_count > 4) {
+ if (!TIFFWriteData(tif, dir, cp))
+ return (0);
+ } else
+ _TIFFmemcpy(&dir->tdir_offset, cp, dir->tdir_count);
+ return (1);
+}
+
+/*
+ * Setup a directory entry of an array of SHORT
+ * or SSHORT and write the associated indirect values.
+ */
+static int
+TIFFWriteShortArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16* v)
+{
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ if (n <= 2) {
+ if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+ dir->tdir_offset = (uint32) ((long) v[0] << 16);
+ if (n == 2)
+ dir->tdir_offset |= v[1] & 0xffff;
+ } else {
+ dir->tdir_offset = v[0] & 0xffff;
+ if (n == 2)
+ dir->tdir_offset |= (long) v[1] << 16;
+ }
+ return (1);
+ } else
+ return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of LONG
+ * or SLONG and write the associated indirect values.
+ */
+static int
+TIFFWriteLongArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint32* v)
+{
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ if (n == 1) {
+ dir->tdir_offset = v[0];
+ return (1);
+ } else
+ return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of RATIONAL
+ * or SRATIONAL and write the associated indirect values.
+ */
+static int
+TIFFWriteRationalArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+{
+ uint32 i;
+ uint32* t;
+ int status;
+
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ t = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));
+ for (i = 0; i < n; i++) {
+ float fv = v[i];
+ int sign = 1;
+ uint32 den;
+
+ if (fv < 0) {
+ if (type == TIFF_RATIONAL) {
+ TIFFWarning(tif->tif_name,
+ "\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL",
+ _TIFFFieldWithTag(tif,tag)->field_name, v);
+ fv = 0;
+ } else
+ fv = -fv, sign = -1;
+ }
+ den = 1L;
+ if (fv > 0) {
+ while (fv < 1L<<(31-3) && den < 1L<<(31-3))
+ fv *= 1<<3, den *= 1L<<3;
+ }
+ t[2*i+0] = sign * (fv + 0.5);
+ t[2*i+1] = den;
+ }
+ status = TIFFWriteData(tif, dir, (char *)t);
+ _TIFFfree((char*) t);
+ return (status);
+}
+
+static int
+TIFFWriteFloatArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+{
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ TIFFCvtNativeToIEEEFloat(tif, n, v);
+ if (n == 1) {
+ dir->tdir_offset = *(uint32*) &v[0];
+ return (1);
+ } else
+ return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+static int
+TIFFWriteDoubleArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+{
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ TIFFCvtNativeToIEEEDouble(tif, n, v);
+ return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Write an array of ``type'' values for a specified tag (i.e. this is a tag
+ * which is allowed to have different types, e.g. SMaxSampleType).
+ * Internally the data values are represented as double since a double can
+ * hold any of the TIFF tag types (yes, this should really be an abstract
+ * type tany_t for portability). The data is converted into the specified
+ * type in a temporary buffer and then handed off to the appropriate array
+ * writer.
+ */
+static int
+TIFFWriteAnyArray(TIFF* tif,
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+{
+ char buf[10 * sizeof(double)];
+ char* w = buf;
+ int i, status = 0;
+
+ if (n * TIFFDataWidth(type) > sizeof buf)
+ w = (char*) _TIFFmalloc(n * TIFFDataWidth(type));
+ switch (type) {
+ case TIFF_BYTE:
+ { unsigned char* bp = (unsigned char*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (unsigned char) v[i];
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+ goto out;
+ }
+ break;
+ case TIFF_SBYTE:
+ { signed char* bp = (signed char*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (signed char) v[i];
+ dir->tdir_tag = tag;
+ dir->tdir_type = (short) type;
+ dir->tdir_count = n;
+ if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+ goto out;
+ }
+ break;
+ case TIFF_SHORT:
+ { uint16* bp = (uint16*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (uint16) v[i];
+ if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+ goto out;
+ }
+ break;
+ case TIFF_SSHORT:
+ { int16* bp = (int16*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (int16) v[i];
+ if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+ goto out;
+ }
+ break;
+ case TIFF_LONG:
+ { uint32* bp = (uint32*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (uint32) v[i];
+ if (!TIFFWriteLongArray(tif, type, tag, dir, n, bp))
+ goto out;
+ }
+ break;
+ case TIFF_SLONG:
+ { int32* bp = (int32*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (int32) v[i];
+ if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32*) bp))
+ goto out;
+ }
+ break;
+ case TIFF_FLOAT:
+ { float* bp = (float*) w;
+ for (i = 0; i < n; i++)
+ bp[i] = (float) v[i];
+ if (!TIFFWriteFloatArray(tif, type, tag, dir, n, bp))
+ goto out;
+ }
+ break;
+ case TIFF_DOUBLE:
+ return (TIFFWriteDoubleArray(tif, type, tag, dir, n, v));
+ default:
+ /* TIFF_NOTYPE */
+ /* TIFF_ASCII */
+ /* TIFF_UNDEFINED */
+ /* TIFF_RATIONAL */
+ /* TIFF_SRATIONAL */
+ goto out;
+ }
+ status = 1;
+ out:
+ if (w != buf)
+ _TIFFfree(w);
+ return (status);
+}
+
+#ifdef COLORIMETRY_SUPPORT
+static int
+TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)
+{
+ TIFFDirectory* td = &tif->tif_dir;
+ tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);
+ uint16** tf = td->td_transferfunction;
+ int ncols;
+
+ /*
+ * Check if the table can be written as a single column,
+ * or if it must be written as 3 columns. Note that we
+ * write a 3-column tag if there are 2 samples/pixel and
+ * a single column of data won't suffice--hmm.
+ */
+ switch (td->td_samplesperpixel - td->td_extrasamples) {
+ default: if (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }
+ case 2: if (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }
+ case 1: case 0: ncols = 1;
+ }
+ return (TIFFWriteShortTable(tif,
+ TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));
+}
+#endif
+
+/*
+ * Write a contiguous directory item.
+ */
+static int
+TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+ tsize_t cc;
+
+ if (tif->tif_flags & TIFF_SWAB) {
+ switch (dir->tdir_type) {
+ case TIFF_SHORT:
+ case TIFF_SSHORT:
+ TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+ break;
+ case TIFF_LONG:
+ case TIFF_SLONG:
+ case TIFF_FLOAT:
+ TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+ break;
+ case TIFF_RATIONAL:
+ case TIFF_SRATIONAL:
+ TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+ break;
+ case TIFF_DOUBLE:
+ TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+ break;
+ }
+ }
+ dir->tdir_offset = tif->tif_dataoff;
+ cc = dir->tdir_count * TIFFDataWidth(dir->tdir_type);
+ if (SeekOK(tif, dir->tdir_offset) &&
+ WriteOK(tif, cp, cc)) {
+ tif->tif_dataoff += (cc + 1) & ~1;
+ return (1);
+ }
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing data for field \"%s\"",
+ _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+ return (0);
+}
+
+/*
+ * Link the current directory into the
+ * directory chain for the file.
+ */
+static int
+TIFFLinkDirectory(TIFF* tif)
+{
+ static const char module[] = "TIFFLinkDirectory";
+ uint32 nextdir;
+ uint32 diroff;
+
+ tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
+ diroff = (uint32) tif->tif_diroff;
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabLong(&diroff);
+#if SUBIFD_SUPPORT
+ if (tif->tif_flags & TIFF_INSUBIFD) {
+ (void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);
+ if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "%s: Error writing SubIFD directory link",
+ tif->tif_name);
+ return (0);
+ }
+ /*
+ * Advance to the next SubIFD or, if this is
+ * the last one configured, revert back to the
+ * normal directory linkage.
+ */
+ if (--tif->tif_nsubifd)
+ tif->tif_subifdoff += sizeof (diroff);
+ else
+ tif->tif_flags &= ~TIFF_INSUBIFD;
+ return (1);
+ }
+#endif
+ if (tif->tif_header.tiff_diroff == 0) {
+ /*
+ * First directory, overwrite offset in header.
+ */
+ tif->tif_header.tiff_diroff = (uint32) tif->tif_diroff;
+#define HDROFF(f) ((toff_t) &(((TIFFHeader*) 0)->f))
+ (void) TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
+ if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing TIFF header");
+ return (0);
+ }
+ return (1);
+ }
+ /*
+ * Not the first directory, search to the last and append.
+ */
+ nextdir = tif->tif_header.tiff_diroff;
+ do {
+ uint16 dircount;
+
+ if (!SeekOK(tif, nextdir) ||
+ !ReadOK(tif, &dircount, sizeof (dircount))) {
+ TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
+ return (0);
+ }
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabShort(&dircount);
+ (void) TIFFSeekFile(tif,
+ dircount * sizeof (TIFFDirEntry), SEEK_CUR);
+ if (!ReadOK(tif, &nextdir, sizeof (nextdir))) {
+ TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link");
+ return (0);
+ }
+ if (tif->tif_flags & TIFF_SWAB)
+ TIFFSwabLong(&nextdir);
+ } while (nextdir != 0);
+ (void) TIFFSeekFile(tif, -(toff_t) sizeof (nextdir), SEEK_CUR);
+ if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+ TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
+ return (0);
+ }
+ return (1);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/ras/Makefile.am b/tiff/contrib/ras/Makefile.am
new file mode 100644
index 0000000..c80acd0
--- /dev/null
+++ b/tiff/contrib/ras/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README ras2tif.c tif2ras.c
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/ras/Makefile.in b/tiff/contrib/ras/Makefile.in
new file mode 100644
index 0000000..a994bcb
--- /dev/null
+++ b/tiff/contrib/ras/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/ras
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README ras2tif.c tif2ras.c
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/ras/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/ras/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/ras/README b/tiff/contrib/ras/README
new file mode 100644
index 0000000..f87bfde
--- /dev/null
+++ b/tiff/contrib/ras/README
@@ -0,0 +1,10 @@
+Sun May 19 22:28:16 PDT 1991
+
+These programs are from Patrick Naughton (naughton@wind.sun.com).
+I've tried to update them to reflect changes to the library, but
+I am unable to verify that they operate properly, because they
+require the Sun pixrect library.
+
+Please contact Patrick directly if you have questions/problems.
+
+ Sam
diff --git a/tiff/contrib/ras/ras2tif.c b/tiff/contrib/ras/ras2tif.c
new file mode 100644
index 0000000..c44b313
--- /dev/null
+++ b/tiff/contrib/ras/ras2tif.c
@@ -0,0 +1,254 @@
+#ifndef lint
+static char sccsid[] = "@(#)ras2tif.c 1.2 90/03/06";
+#endif
+/*-
+ * ras2tif.c - Converts from a Sun Rasterfile to a Tagged Image File.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind. The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof. In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ * Patrick J. Naughton
+ * Sun Microsystems
+ * 2550 Garcia Ave, MS 14-40
+ * Mountain View, CA 94043
+ * (415) 336-1080
+ *
+ * Revision History:
+ * 11-Jan-89: Created.
+ * 06-Mar-90: fix bug in SCALE() macro.
+ * got rid of xres and yres, (they weren't working anyways).
+ * fixed bpsl calculation.
+ * 25-Nov-99: y2k fix (year as 1900 + tm_year) <mike@onshore.com>
+ *
+ * Description:
+ * This program takes a Sun Rasterfile [see rasterfile(5)] as input and
+ * writes a MicroSoft/Aldus "Tagged Image File Format" image or "TIFF" file.
+ * The input file may be standard input, but the output TIFF file must be a
+ * real file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define SCALE(x) (((x)*((1L<<16)-1))/255)
+
+boolean Verbose = False;
+boolean dummyinput = False;
+char *pname; /* program name (used for error messages) */
+
+void
+error(s1, s2)
+ char *s1,
+ *s2;
+{
+ fprintf(stderr, s1, pname, s2);
+ exit(1);
+}
+
+void
+usage()
+{
+ error("usage: %s -[vq] [-|rasterfile] TIFFfile\n", NULL);
+}
+
+
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *inf = NULL;
+ char *outf = NULL;
+ FILE *fp;
+ int depth,
+ i;
+ long row;
+ TIFF *tif;
+ Pixrect *pix; /* The Sun Pixrect */
+ colormap_t Colormap; /* The Pixrect Colormap */
+ u_short red[256],
+ green[256],
+ blue[256];
+ struct tm *ct;
+ struct timeval tv;
+ long width,
+ height;
+ long rowsperstrip;
+ int year;
+ short photometric;
+ short samplesperpixel;
+ short bitspersample;
+ int bpsl;
+ static char *version = "ras2tif 1.0";
+ static char *datetime = "1990:01:01 12:00:00";
+
+ gettimeofday(&tv, (struct timezone *) NULL);
+ ct = localtime(&tv.tv_sec);
+ year=1900 + ct->tm_year;
+ sprintf(datetime, "%04d:%02d:%02d %02d:%02d:%02d",
+ year, ct->tm_mon + 1, ct->tm_mday,
+ ct->tm_hour, ct->tm_min, ct->tm_sec);
+
+ setbuf(stderr, NULL);
+ pname = argv[0];
+
+ while (--argc) {
+ if ((++argv)[0][0] == '-') {
+ switch (argv[0][1]) {
+ case 'v':
+ Verbose = True;
+ break;
+ case 'q':
+ usage();
+ break;
+ case '\0':
+ if (inf == NULL)
+ dummyinput = True;
+ else
+ usage();
+ break;
+ default:
+ fprintf(stderr, "%s: illegal option -%c.\n", pname,
+ argv[0][1]);
+ exit(1);
+ }
+ } else if (inf == NULL && !dummyinput) {
+ inf = argv[0];
+ } else if (outf == NULL)
+ outf = argv[0];
+ else
+ usage();
+ }
+
+ if (outf == NULL)
+ error("%s: can't write output file to a stream.\n", NULL);
+
+ if (dummyinput || inf == NULL) {
+ inf = "Standard Input";
+ fp = stdin;
+ } else if ((fp = fopen(inf, "r")) == NULL)
+ error("%s: %s couldn't be opened.\n", inf);
+
+ if (Verbose)
+ fprintf(stderr, "Reading rasterfile from %s...", inf);
+
+ pix = pr_load(fp, &Colormap);
+ if (pix == NULL)
+ error("%s: %s is not a raster file.\n", inf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ if (Verbose)
+ fprintf(stderr, "Writing %s...", outf);
+
+ tif = TIFFOpen(outf, "w");
+
+ if (tif == NULL)
+ error("%s: error opening TIFF file %s", outf);
+
+ width = pix->pr_width;
+ height = pix->pr_height;
+ depth = pix->pr_depth;
+
+ switch (depth) {
+ case 1:
+ samplesperpixel = 1;
+ bitspersample = 1;
+ photometric = PHOTOMETRIC_MINISBLACK;
+ break;
+ case 8:
+ samplesperpixel = 1;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_PALETTE;
+ break;
+ case 24:
+ samplesperpixel = 3;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_RGB;
+ break;
+ case 32:
+ samplesperpixel = 4;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_RGB;
+ break;
+ default:
+ error("%s: bogus depth: %d\n", depth);
+ }
+
+ bpsl = ((depth * width + 15) >> 3) & ~1;
+ rowsperstrip = (8 * 1024) / bpsl;
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);
+ TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
+ TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, inf);
+ TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "converted Sun rasterfile");
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+ TIFFSetField(tif, TIFFTAG_STRIPBYTECOUNTS, height / rowsperstrip);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_SOFTWARE, version);
+ TIFFSetField(tif, TIFFTAG_DATETIME, datetime);
+
+ memset(red, 0, sizeof(red));
+ memset(green, 0, sizeof(green));
+ memset(blue, 0, sizeof(blue));
+ if (depth == 8) {
+ TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+ for (i = 0; i < Colormap.length; i++) {
+ red[i] = SCALE(Colormap.map[0][i]);
+ green[i] = SCALE(Colormap.map[1][i]);
+ blue[i] = SCALE(Colormap.map[2][i]);
+ }
+ }
+ if (Verbose)
+ fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+
+ for (row = 0; row < height; row++)
+ if (TIFFWriteScanline(tif,
+ (u_char *) mprd_addr(mpr_d(pix), 0, row),
+ row, 0) < 0) {
+ fprintf("failed a scanline write (%d)\n", row);
+ break;
+ }
+ TIFFFlushData(tif);
+ TIFFClose(tif);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ pr_destroy(pix);
+
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/ras/tif2ras.c b/tiff/contrib/ras/tif2ras.c
new file mode 100644
index 0000000..b665aed
--- /dev/null
+++ b/tiff/contrib/ras/tif2ras.c
@@ -0,0 +1,344 @@
+#ifndef lint
+static char id[] = "$Id: tif2ras.c,v 1.2.2.1 2010-06-08 18:50:41 bfriesen Exp $";
+#endif
+/*-
+ * tif2ras.c - Converts from a Tagged Image File Format image to a Sun Raster.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind. The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof. In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ * Patrick J. Naughton
+ * Sun Microsystems
+ * 2550 Garcia Ave, MS 14-40
+ * Mountain View, CA 94043
+ * (415) 336-1080
+ *
+ * Revision History:
+ * 10-Jan-89: Created.
+ * 06-Mar-90: Change to byte encoded rasterfiles.
+ * fix bug in call to ReadScanline().
+ * fix bug in CVT() macro.
+ * fix assignment of td, (missing &).
+ *
+ * Description:
+ * This program takes a MicroSoft/Aldus "Tagged Image File Format" image or
+ * "TIFF" file as input and writes a Sun Rasterfile [see rasterfile(5)]. The
+ * output file may be standard output, but the input TIFF file must be a real
+ * file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define CVT(x) (((x) * 255) / ((1L<<16)-1))
+
+boolean Verbose = False;
+char *pname; /* program name (used for error messages) */
+
+void
+error(s1, s2)
+ char *s1,
+ *s2;
+{
+ fprintf(stderr, s1, pname, s2);
+ exit(1);
+}
+
+void
+usage()
+{
+ error("usage: %s -[vq] TIFFfile [rasterfile]\n", NULL);
+}
+
+
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *inf = NULL;
+ char *outf = NULL;
+ FILE *fp;
+ long width,
+ height;
+ int depth,
+ numcolors;
+ register TIFF *tif;
+ TIFFDirectory *td;
+ register u_char *inp,
+ *outp;
+ register int col,
+ i;
+ register long row;
+ u_char *Map = NULL;
+ u_char *buf;
+ short bitspersample;
+ short samplesperpixel;
+ short photometric;
+ u_short *redcolormap,
+ *bluecolormap,
+ *greencolormap;
+
+ Pixrect *pix; /* The Sun Pixrect */
+ colormap_t Colormap; /* The Pixrect Colormap */
+ u_char red[256],
+ green[256],
+ blue[256];
+
+ setbuf(stderr, NULL);
+ pname = argv[0];
+
+ while (--argc) {
+ if ((++argv)[0][0] == '-')
+ switch (argv[0][1]) {
+ case 'v':
+ Verbose = True;
+ break;
+ case 'q':
+ usage();
+ break;
+ default:
+ fprintf(stderr, "%s: illegal option -%c.\n", pname,
+ argv[0][1]);
+ exit(1);
+ }
+ else if (inf == NULL)
+ inf = argv[0];
+ else if (outf == NULL)
+ outf = argv[0];
+ else
+ usage();
+
+ }
+
+ if (inf == NULL)
+ error("%s: can't read input file from a stream.\n", NULL);
+
+ if (Verbose)
+ fprintf(stderr, "Reading %s...", inf);
+
+ tif = TIFFOpen(inf, "r");
+
+ if (tif == NULL)
+ error("%s: error opening TIFF file %s", inf);
+
+ if (Verbose)
+ TIFFPrintDirectory(tif, stderr, True, False, False);
+ TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+ if (bitspersample > 8)
+ error("%s: can't handle more than 8-bits per sample\n", NULL);
+
+ TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+ switch (samplesperpixel) {
+ case 1:
+ if (bitspersample == 1)
+ depth = 1;
+ else
+ depth = 8;
+ break;
+ case 3:
+ case 4:
+ depth = 24;
+ break;
+ default:
+ error("%s: only handle 1-channel gray scale or 3-channel color\n");
+ }
+
+ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
+
+ if (Verbose)
+ fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+ if (Verbose)
+ fprintf(stderr, "%d bits/sample, %d samples/pixel, ",
+ bitspersample, samplesperpixel);
+
+ pix = mem_create(width, height, depth);
+ if (pix == (Pixrect *) NULL)
+ error("%s: can't allocate memory for output pixrect...\n", NULL);
+
+ numcolors = (1 << bitspersample);
+
+ TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
+ if (numcolors == 2) {
+ if (Verbose)
+ fprintf(stderr, "monochrome ");
+ Colormap.type = RMT_NONE;
+ Colormap.length = 0;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+ } else {
+ switch (photometric) {
+ case PHOTOMETRIC_MINISBLACK:
+ if (Verbose)
+ fprintf(stderr, "%d graylevels (min=black), ", numcolors);
+ Map = (u_char *) malloc(numcolors * sizeof(u_char));
+ for (i = 0; i < numcolors; i++)
+ Map[i] = (255 * i) / numcolors;
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+ break;
+ case PHOTOMETRIC_MINISWHITE:
+ if (Verbose)
+ fprintf(stderr, "%d graylevels (min=white), ", numcolors);
+ Map = (u_char *) malloc(numcolors * sizeof(u_char));
+ for (i = 0; i < numcolors; i++)
+ Map[i] = 255 - ((255 * i) / numcolors);
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+ break;
+ case PHOTOMETRIC_RGB:
+ if (Verbose)
+ fprintf(stderr, "truecolor ");
+ Colormap.type = RMT_NONE;
+ Colormap.length = 0;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+ break;
+ case PHOTOMETRIC_PALETTE:
+ if (Verbose)
+ fprintf(stderr, "colormapped ");
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ memset(red, 0, sizeof(red));
+ memset(green, 0, sizeof(green));
+ memset(blue, 0, sizeof(blue));
+ TIFFGetField(tif, TIFFTAG_COLORMAP,
+ &redcolormap, &greencolormap, &bluecolormap);
+ for (i = 0; i < numcolors; i++) {
+ red[i] = (u_char) CVT(redcolormap[i]);
+ green[i] = (u_char) CVT(greencolormap[i]);
+ blue[i] = (u_char) CVT(bluecolormap[i]);
+ }
+ Colormap.map[0] = red;
+ Colormap.map[1] = green;
+ Colormap.map[2] = blue;
+ break;
+ case PHOTOMETRIC_MASK:
+ error("%s: Don't know how to handle PHOTOMETRIC_MASK\n");
+ break;
+ case PHOTOMETRIC_DEPTH:
+ error("%s: Don't know how to handle PHOTOMETRIC_DEPTH\n");
+ break;
+ default:
+ error("%s: unknown photometric (cmap): %d\n", photometric);
+ }
+ }
+
+ buf = (u_char *) malloc(TIFFScanlineSize(tif));
+ if (buf == NULL)
+ error("%s: can't allocate memory for scanline buffer...\n", NULL);
+
+ for (row = 0; row < height; row++) {
+ if (TIFFReadScanline(tif, buf, row, 0) < 0)
+ error("%s: bad data read on line: %d\n", row);
+ inp = buf;
+ outp = (u_char *) mprd_addr(mpr_d(pix), 0, row);
+ switch (photometric) {
+ case PHOTOMETRIC_RGB:
+ if (samplesperpixel == 4)
+ for (col = 0; col < width; col++) {
+ *outp++ = *inp++; /* Blue */
+ *outp++ = *inp++; /* Green */
+ *outp++ = *inp++; /* Red */
+ inp++; /* skip alpha channel */
+ }
+ else
+ for (col = 0; col < width; col++) {
+ *outp++ = *inp++; /* Blue */
+ *outp++ = *inp++; /* Green */
+ *outp++ = *inp++; /* Red */
+ }
+ break;
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ switch (bitspersample) {
+ case 1:
+ for (col = 0; col < ((width + 7) / 8); col++)
+ *outp++ = *inp++;
+ break;
+ case 2:
+ for (col = 0; col < ((width + 3) / 4); col++) {
+ *outp++ = (*inp >> 6) & 3;
+ *outp++ = (*inp >> 4) & 3;
+ *outp++ = (*inp >> 2) & 3;
+ *outp++ = *inp++ & 3;
+ }
+ break;
+ case 4:
+ for (col = 0; col < width / 2; col++) {
+ *outp++ = *inp >> 4;
+ *outp++ = *inp++ & 0xf;
+ }
+ break;
+ case 8:
+ for (col = 0; col < width; col++)
+ *outp++ = *inp++;
+ break;
+ default:
+ error("%s: bad bits/sample: %d\n", bitspersample);
+ }
+ break;
+ case PHOTOMETRIC_PALETTE:
+ memcpy(outp, inp, width);
+ break;
+ default:
+ error("%s: unknown photometric (write): %d\n", photometric);
+ }
+ }
+
+ free((char *) buf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ if (outf == NULL || strcmp(outf, "Standard Output") == 0) {
+ outf = "Standard Output";
+ fp = stdout;
+ } else {
+ if (!(fp = fopen(outf, "w")))
+ error("%s: %s couldn't be opened for writing.\n", outf);
+ }
+
+ if (Verbose)
+ fprintf(stderr, "Writing rasterfile in %s...", outf);
+
+ if (pr_dump(pix, fp, &Colormap, RT_BYTE_ENCODED, 0) == PIX_ERR)
+ error("%s: error writing Sun Rasterfile: %s\n", outf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ pr_destroy(pix);
+
+ if (fp != stdout)
+ fclose(fp);
+
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/stream/Makefile.am b/tiff/contrib/stream/Makefile.am
new file mode 100644
index 0000000..e98ae33
--- /dev/null
+++ b/tiff/contrib/stream/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README tiffstream.cpp tiffstream.h
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/stream/Makefile.in b/tiff/contrib/stream/Makefile.in
new file mode 100644
index 0000000..2ab998b
--- /dev/null
+++ b/tiff/contrib/stream/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/stream
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README tiffstream.cpp tiffstream.h
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/stream/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/stream/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/stream/README b/tiff/contrib/stream/README
new file mode 100644
index 0000000..df9e43e
--- /dev/null
+++ b/tiff/contrib/stream/README
@@ -0,0 +1,30 @@
+Subject: tiff stream interface (contrib)
+Date: Thu, 30 Mar 2000 10:48:51 -0800
+From: "Avi Bleiweiss" <avi@shutterfly.com>
+To: <warmerda@home.com>, <mike@onshore.com>
+
+Here at Shutterfly we have augmented the file based tiff library to support
+C++ streams. The implementation is an adaptor class, which takes any C++
+stream from the user and in return it deposits i/o operation method pointers
+(e.g. read, write, seek and close) into the tiff's library client state.
+
+The class TiffStream has an overloaded factory method - makeFileStream -
+which takes the C++ stream as an argument, calls TIFFClientOpen and returns
+a tiff handle. The class retains the tiff handle in its local state and
+provides a helper function (getTiffHandle) to query the handle at any time.
+Additional helper method - getStreamSize - provides the stream size to the
+user. The implementation assumes client responsibility to delete the stream
+object. The class calls TIFFClose at destruction time.
+
+Attached are a definition (tiffstream.h) and an implementation
+(tiffstream.cpp) files of the TiffStream class. No changes are required to
+the tiff core piece and the class sits on top of the library. The code is
+fairly tested at this point and is used internally in Shutterfly imaging
+software. The code is portable across WindowsNT/Linux/Solaris.
+
+We at Shutterfly believe this software has benefits to the larger community
+of tiff library users and would like to contribute this software to be part
+of the tiff distributed package. Let me know of any issue.
+
+Thanks
+Avi
diff --git a/tiff/contrib/stream/tiffstream.cpp b/tiff/contrib/stream/tiffstream.cpp
new file mode 100644
index 0000000..ffff687
--- /dev/null
+++ b/tiff/contrib/stream/tiffstream.cpp
@@ -0,0 +1,238 @@
+// tiff stream interface class implementation
+
+#include "tiffstream.h"
+
+const char* TiffStream::m_name = "TiffStream";
+
+TiffStream::TiffStream()
+{
+ m_tif = NULL;
+
+
+ m_inStream = NULL;
+ m_outStream = NULL;
+ m_ioStream = NULL;
+
+ m_streamLength = 0;
+
+ m_this = reinterpret_cast<thandle_t>(this);
+};
+
+TiffStream::~TiffStream()
+{
+ if(m_tif != NULL) TIFFClose(m_tif);
+}
+
+TIFF*
+TiffStream::makeFileStream(istream* str)
+{
+ m_inStream = str;
+ m_outStream = NULL;
+ m_ioStream = NULL;
+ m_streamLength = getSize(m_this);
+
+ m_tif = TIFFClientOpen(m_name,
+ "r",
+ m_this,
+ read,
+ write,
+ seek,
+ close,
+ size,
+ map,
+ unmap);
+ return m_tif;
+}
+
+TIFF*
+TiffStream::makeFileStream(ostream* str)
+{
+ m_inStream = NULL;
+ m_outStream = str;
+ m_ioStream = NULL;
+ m_streamLength = getSize(m_this);
+
+ m_tif = TIFFClientOpen(m_name,
+ "w",
+ m_this,
+ read,
+ write,
+ seek,
+ close,
+ size,
+ map,
+ unmap);
+ return m_tif;
+}
+
+TIFF*
+TiffStream::makeFileStream(iostream* str)
+{
+ m_inStream = NULL;
+ m_outStream = NULL;
+ m_ioStream = str;
+ m_streamLength = getSize(m_this);
+
+ m_tif = TIFFClientOpen(m_name,
+ "r+w",
+ m_this,
+ read,
+ write,
+ seek,
+ close,
+ size,
+ map,
+ unmap);
+ return m_tif;
+}
+
+tsize_t
+TiffStream::read(thandle_t fd, tdata_t buf, tsize_t size)
+{
+ istream* istr;
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ if(ts->m_inStream != NULL) {
+ istr = ts->m_inStream;
+ } else if(ts->m_ioStream != NULL) {
+ istr = ts->m_ioStream;
+ }
+
+ int remain = ts->m_streamLength - ts->tell(fd);
+ int actual = remain < size ? remain : size;
+ istr->read(reinterpret_cast<char*>(buf), actual);
+ return istr->gcount();
+}
+
+tsize_t
+TiffStream::write(thandle_t fd, tdata_t buf, tsize_t size)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ ostream* ostr;
+ if(ts->m_outStream != NULL) {
+ ostr = ts->m_outStream;
+ } else if(ts->m_ioStream != NULL) {
+ ostr = ts->m_ioStream;
+ }
+
+ streampos start = ostr->tellp();
+ ostr->write(reinterpret_cast<const char*>(buf), size);
+ return ostr->tellp() - start;
+}
+
+toff_t
+TiffStream::seek(thandle_t fd, toff_t offset, int origin)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ if(ts->seekInt(fd, offset, origin) == true) return offset;
+ else return -1;
+}
+
+int
+TiffStream::close(thandle_t fd)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ if(ts->m_inStream != NULL) {
+ ts->m_inStream = NULL;
+ return 0;
+ } else if(ts->m_outStream != NULL) {
+ ts->m_outStream = NULL;
+ return 0;
+ } else if(ts->m_ioStream != NULL) {
+ ts->m_ioStream = NULL;
+ return 0;
+ }
+ return -1;
+}
+
+toff_t
+TiffStream::size(thandle_t fd)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ return ts->getSize(fd);
+}
+
+int
+TiffStream::map(thandle_t fd, tdata_t* phase, toff_t* psize)
+{
+ return 0;
+}
+
+void
+TiffStream::unmap(thandle_t fd, tdata_t base, tsize_t size)
+{
+}
+
+unsigned int
+TiffStream::getSize(thandle_t fd)
+{
+ if(!isOpen(fd)) return 0;
+
+ unsigned int pos = tell(fd);
+ seekInt(fd, 0, end);
+ unsigned int size = tell(fd);
+ seekInt(fd, pos, beg);
+
+ return size;
+}
+
+unsigned int
+TiffStream::tell(thandle_t fd)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ if(ts->m_inStream != NULL) {
+ return ts->m_inStream->tellg();
+ } else if(ts->m_outStream != NULL) {
+ return ts->m_outStream->tellp();
+ } else if(ts->m_ioStream != NULL) {
+ return ts->m_ioStream->tellg();
+ }
+ return 0;
+}
+
+bool
+TiffStream::seekInt(thandle_t fd, unsigned int offset, int origin)
+{
+ if(!isOpen(fd)) return false;
+
+ ios::seek_dir org;
+ switch(origin) {
+ case beg:
+ org = ios::beg;
+ break;
+ case cur:
+ org = ios::cur;
+ break;
+ case end:
+ org = ios::end;
+ break;
+ }
+
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ if(ts->m_inStream != NULL) {
+ ts->m_inStream->seekg(offset, org);
+ return true;
+ } else if(ts->m_outStream != NULL) {
+ ts->m_outStream->seekp(offset, org);
+ return true;
+ } else if(ts->m_ioStream != NULL) {
+ ts->m_ioStream->seekg(offset, org);
+ ts->m_ioStream->seekp(offset, org);
+ return true;
+ }
+ return false;
+}
+
+bool
+TiffStream::isOpen(thandle_t fd)
+{
+ TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+ return (ts->m_inStream != NULL ||
+ ts->m_outStream != NULL ||
+ ts->m_ioStream != NULL);
+}/*
+ * Local Variables:
+ * mode: c++
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/stream/tiffstream.h b/tiff/contrib/stream/tiffstream.h
new file mode 100644
index 0000000..815a1a5
--- /dev/null
+++ b/tiff/contrib/stream/tiffstream.h
@@ -0,0 +1,69 @@
+// tiff stream interface class definition
+
+#ifndef _TIFF_STREAM_H_
+#define _TIFF_STREAM_H_
+
+#include <iostream.h>
+
+#include "tiffio.h"
+
+class TiffStream {
+
+public:
+ // ctor/dtor
+ TiffStream();
+ ~TiffStream();
+
+public:
+ enum SeekDir {
+ beg,
+ cur,
+ end,
+ };
+
+public:
+ // factory methods
+ TIFF* makeFileStream(iostream* str);
+ TIFF* makeFileStream(istream* str);
+ TIFF* makeFileStream(ostream* str);
+
+public:
+ // tiff client methods
+ static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
+ static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
+ static toff_t seek(thandle_t fd, toff_t offset, int origin);
+ static toff_t size(thandle_t fd);
+ static int close(thandle_t fd);
+ static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
+ static void unmap(thandle_t fd, tdata_t base, tsize_t size);
+
+public:
+ // query method
+ TIFF* getTiffHandle() const { return m_tif; }
+ unsigned int getStreamLength() { return m_streamLength; }
+
+private:
+ // internal methods
+ unsigned int getSize(thandle_t fd);
+ unsigned int tell(thandle_t fd);
+ bool seekInt(thandle_t fd, unsigned int offset, int origin);
+ bool isOpen(thandle_t fd);
+
+private:
+ thandle_t m_this;
+ TIFF* m_tif;
+ static const char* m_name;
+ istream* m_inStream;
+ ostream* m_outStream;
+ iostream* m_ioStream;
+ int m_streamLength;
+
+};
+
+#endif // _TIFF_STREAM_H_/*
+ * Local Variables:
+ * mode: c++
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/tags/Makefile.am b/tiff/contrib/tags/Makefile.am
new file mode 100644
index 0000000..cab05ff
--- /dev/null
+++ b/tiff/contrib/tags/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/tags/Makefile.in b/tiff/contrib/tags/Makefile.in
new file mode 100644
index 0000000..3b380ac
--- /dev/null
+++ b/tiff/contrib/tags/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/tags
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/tags/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/tags/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/tags/README b/tiff/contrib/tags/README
new file mode 100644
index 0000000..73c6c21
--- /dev/null
+++ b/tiff/contrib/tags/README
@@ -0,0 +1,132 @@
+
+NOTE: Sept/2004
+
+The following described approach to managing tag extensions has been
+mostly superceeded since libtiff 3.6.0. The described approach requires
+internal knowledge of the libtiff API and tends to be very fragile
+in the face of libtiff upgrades.
+
+Please read over the html/addingtags.html in preference to the below
+described approach.
+
+
+
+==================================
+
+Client module for adding to LIBTIFF tagset
+-------------------------------------------
+ Author: Niles Ritter
+
+
+
+
+In the past, users of the "libtiff" package had to modify the
+source code of the library if they required additional private tags
+or codes not recognized by libtiff. Thus, whenever
+a new revision of libtiff came out the client would have to
+perform modifications to six or seven different files to re-install
+their tags.
+
+The latest versions of libtiff now provide client software new routines,
+giving them the opportunity to install private extensions at runtime,
+rather than compile-time. This means that the client may encapsulate
+all of their private tags into a separate module, which need only
+be recompiled when new versions of libtiff are released; no manual
+editing of files is required.
+
+How it works
+------------
+
+The mechanism for overriding the tag access has been enabled with
+a single new routine, which has the following calling sequence:
+
+ TIFFExtendProc old_extender;
+
+ old_extender = TIFFSetTagExtender(tag_extender);
+
+which must be called prior to opening or creating TIFF files.
+
+This routine sets a static pointer to the user-specified function
+<tag_extender>, which in turn is called by TIFFDefaultDirectory(),
+just after the usual TIFFSetField() and TIFFGetField() methods
+are defined, and just before the compression tag is set. It also
+returns a pointer to the previously-defined value of the tag-extender,
+so that multiple clients may be installed.
+
+The TIFFExtendProc method that you define should be used to override
+the TIFF file's "vsetfield" and "vgetfield" methods, so that you
+can trap your new, private tags, and install their values into
+a private directory structure. For your convienience, a new pointer
+has also been added to the "TIFF" file structure:
+
+ tidata_t tif_clientdir; /* client TIFF directory */
+
+into which you may install whatever private directory structures you like.
+You should also override the tag-printing method from within your
+"vsetfield" method, to permit the symbolic printing of your new tags.
+
+
+Example Client Code:
+--------------------
+
+An example module has been provided as a template for installing
+your own tags into a client tag extender. The module is called
+"xtif_dir.c", and defines all of the interface routines, tag field
+access, tag printing, etc. for most purpose.
+
+To see how the client module operates, there are three "fake"
+tags currently installed. If you use the existing makefile you can
+build them with:
+
+ make all -f Makefile.gcc !or Makefile.mpw
+ maketif
+ listtif
+
+This will build two example programs called "maketif" and "listtif"
+and then run them. These programs do nothing more than create a small
+file called "newtif.tif", install the fake tags, and then list them out
+using TIFFPrintDirectory().
+
+Installing Private Tags
+-----------------------
+
+To use this module for installing your own tags, edit each of the files
+
+ xtif_dir.c
+ xtiffio.h
+ xtiffiop.h
+
+and search for the string "XXX". At these locations the comments
+will direct you how to install your own tag values, define their
+types, etc. Three examples tags are currently installed, demonstrating
+how to implement multi-valued tags, single-valued tags, and ASCII tags.
+The examples are not valid, registered tags, so you must replace them with
+your own.
+
+To test the routines, also edit the test programs "maketif.c" and
+"listtif.c" and replace the portions of the code that set the
+private tag values and list them.
+
+Once you have edited these files, you may build the client module
+with the Makefile provided, and run the test programs.
+
+To use these files in your own code, the "xtif_dir.c" module defines
+replacement routines for the standard "TIFFOpen()" "TIFFFdOpen",
+and "TIFFClose()" routines, called XTIFFOpen, XTIFFFdOpen and XTIFFClose.
+You must use these routines in order to have the extended tag handlers
+installed. Once installed, the standard TIFFGetField() and TIFFSetField
+routines may be used as before.
+
+Adding Extended Tags to "tools"
+-------------------------------
+To create an extended-tag savvy "tiffinfo" program or other utility, you may
+simply recompile and link the tools to your "libxtiff" library, adding
+
+ -DTIFFOpen=XTIFFOpen -DTIFFClose=XTIFFClose -DTIFFFdOpen=XTIFFFdOpen
+
+to the compile statement.
+
+Bugs, Comments Etc:
+------------------
+ Send all reports and suggestions to ndr@tazboy.jpl.nasa.gov
+ (Niles Ritter).
diff --git a/tiff/contrib/tags/listtif.c b/tiff/contrib/tags/listtif.c
new file mode 100644
index 0000000..605de84
--- /dev/null
+++ b/tiff/contrib/tags/listtif.c
@@ -0,0 +1,39 @@
+/*
+ * listtif.c -- lists a tiff file.
+ */
+
+#include "xtiffio.h"
+#include <stdlib.h>
+
+void main(int argc,char *argv[])
+{
+ char *fname="newtif.tif";
+ int flags;
+
+ TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
+
+ if (argc>1) fname=argv[1];
+
+ tif=XTIFFOpen(fname,"r");
+ if (!tif) goto failure;
+
+ /* We want the double array listed */
+ flags = TIFFPRINT_MYMULTIDOUBLES;
+
+ TIFFPrintDirectory(tif,stdout,flags);
+ XTIFFClose(tif);
+ exit (0);
+
+failure:
+ printf("failure in listtif\n");
+ if (tif) XTIFFClose(tif);
+ exit (-1);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/tags/maketif.c b/tiff/contrib/tags/maketif.c
new file mode 100644
index 0000000..e965201
--- /dev/null
+++ b/tiff/contrib/tags/maketif.c
@@ -0,0 +1,77 @@
+/*
+ * maketif.c -- creates a little TIFF file, with
+ * the XTIFF extended tiff example tags.
+ */
+
+#include <stdlib.h>
+#include "xtiffio.h"
+
+
+void SetUpTIFFDirectory(TIFF *tif);
+void WriteImage(TIFF *tif);
+
+#define WIDTH 20
+#define HEIGHT 20
+
+void main()
+{
+ TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
+
+ tif=XTIFFOpen("newtif.tif","w");
+ if (!tif) goto failure;
+
+ SetUpTIFFDirectory(tif);
+ WriteImage(tif);
+
+ XTIFFClose(tif);
+ exit (0);
+
+failure:
+ printf("failure in maketif\n");
+ if (tif) XTIFFClose(tif);
+ exit (-1);
+}
+
+
+void SetUpTIFFDirectory(TIFF *tif)
+{
+ double mymulti[6]={0.0,1.0,2.0, 3.1415926, 5.0,1.0};
+ uint32 mysingle=3456;
+ char *ascii="This file was produced by Steven Spielberg. NOT";
+
+ TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);
+ TIFFSetField(tif,TIFFTAG_IMAGELENGTH,HEIGHT);
+ TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE);
+ TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_MINISBLACK);
+ TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
+ TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8);
+ TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,20);
+
+ /* Install the extended TIFF tag examples */
+ TIFFSetField(tif,TIFFTAG_EXAMPLE_MULTI,6,mymulti);
+ TIFFSetField(tif,TIFFTAG_EXAMPLE_SINGLE,mysingle);
+ TIFFSetField(tif,TIFFTAG_EXAMPLE_ASCII,ascii);
+}
+
+
+void WriteImage(TIFF *tif)
+{
+ int i;
+ char buffer[WIDTH];
+
+ memset(buffer,0,sizeof(buffer));
+ for (i=0;i<HEIGHT;i++)
+ if (!TIFFWriteScanline(tif, buffer, i, 0))
+ TIFFErrorExt(tif->tif_clientdata, "WriteImage","failure in WriteScanline\n");
+}
+
+
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/tags/xtif_dir.c b/tiff/contrib/tags/xtif_dir.c
new file mode 100644
index 0000000..e67a6ab
--- /dev/null
+++ b/tiff/contrib/tags/xtif_dir.c
@@ -0,0 +1,350 @@
+/*
+ * xtif_dir.c
+ *
+ * Extended TIFF Directory Tag Support.
+ *
+ * You may use this file as a template to add your own
+ * extended tags to the library. Only the parts of the code
+ * marked with "XXX" require modification. Three example tags
+ * are shown; you should replace them with your own.
+ *
+ * Author: Niles D. Ritter
+ */
+
+#include "xtiffiop.h"
+#include <stdio.h>
+
+/* Tiff info structure.
+ *
+ * Entry format:
+ * { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM,
+ * OkToChange, PassDirCountOnSet, AsciiName }
+ *
+ * For ReadCount, WriteCount, -1 = unknown; used for mult-valued
+ * tags and ASCII.
+ */
+
+static const TIFFFieldInfo xtiffFieldInfo[] = {
+
+ /* XXX Replace these example tags with your own extended tags */
+ { TIFFTAG_EXAMPLE_MULTI, -1,-1, TIFF_DOUBLE, FIELD_EXAMPLE_MULTI,
+ TRUE, TRUE, "MyMultivaluedTag" },
+ { TIFFTAG_EXAMPLE_SINGLE, 1, 1, TIFF_LONG, FIELD_EXAMPLE_SINGLE,
+ TRUE, FALSE, "MySingleLongTag" },
+ { TIFFTAG_EXAMPLE_ASCII, -1,-1, TIFF_ASCII, FIELD_EXAMPLE_ASCII,
+ TRUE, FALSE, "MyAsciiTag" },
+};
+#define N(a) (sizeof (a) / sizeof (a[0]))
+
+
+static void
+_XTIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
+{
+ xtiff *xt = XTIFFDIR(tif);
+ XTIFFDirectory *xd = &xt->xtif_dir;
+ int i,num;
+
+ /* call the inherited method */
+ if (PARENT(xt,printdir))
+ (PARENT(xt,printdir))(tif,fd,flags);
+
+ /* XXX Add field printing here. Replace the three example
+ * tags implemented below with your own.
+ */
+
+ fprintf(fd,"--My Example Tags--\n");
+
+ /* Our first example tag may have a lot of values, so we
+ * will only print them out if the TIFFPRINT_MYMULTIDOUBLES
+ * flag is passed into the print method.
+ */
+ if (TIFFFieldSet(tif,FIELD_EXAMPLE_MULTI))
+ {
+ fprintf(fd, " My Multi-Valued Doubles:");
+ if (flags & TIFFPRINT_MYMULTIDOUBLES)
+ {
+ double *value = xd->xd_example_multi;
+
+ num = xd->xd_num_multi;
+ fprintf(fd,"(");
+ for (i=0;i<num;i++) fprintf(fd, " %lg", *value++);
+ fprintf(fd,")\n");
+ } else
+ fprintf(fd, "(present)\n");
+ }
+
+ if (TIFFFieldSet(tif,FIELD_EXAMPLE_SINGLE))
+ {
+ fprintf(fd, " My Single Long Tag: %lu\n", xd->xd_example_single);
+ }
+
+ if (TIFFFieldSet(tif,FIELD_EXAMPLE_ASCII))
+ {
+ _TIFFprintAsciiTag(fd,"My ASCII Tag",
+ xd->xd_example_ascii);
+ }
+}
+
+static int
+_XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+ xtiff *xt = XTIFFDIR(tif);
+ XTIFFDirectory* xd = &xt->xtif_dir;
+ int status = 1;
+ uint32 v32=0;
+ int i=0, v=0;
+ va_list ap1 = ap;
+
+ /* va_start is called by the calling routine */
+
+ switch (tag) {
+ /*
+ * XXX put your extended tags here; replace the implemented
+ * example tags with your own.
+ */
+ case TIFFTAG_EXAMPLE_MULTI:
+ /* multi-valued tags need to store the count as well */
+ xd->xd_num_multi = (uint16) va_arg(ap, int);
+ _TIFFsetDoubleArray(&xd->xd_example_multi, va_arg(ap, double*),
+ (long) xd->xd_num_multi);
+ break;
+ case TIFFTAG_EXAMPLE_SINGLE:
+ xd->xd_example_single = va_arg(ap, uint32);
+ break;
+ case TIFFTAG_EXAMPLE_ASCII:
+ _TIFFsetString(&xd->xd_example_ascii, va_arg(ap, char*));
+ break;
+ default:
+ /* call the inherited method */
+ return (PARENT(xt,vsetfield))(tif,tag,ap);
+ break;
+ }
+ if (status) {
+ /* we have to override the print method here,
+ * after the compression tags have gotten to it.
+ * This makes sense because the only time we would
+ * need the extended print method is if an extended
+ * tag is set by the reader.
+ */
+ if (!(xt->xtif_flags & XTIFFP_PRINT))
+ {
+ PARENT(xt,printdir) = TIFFMEMBER(tif,printdir);
+ TIFFMEMBER(tif,printdir) = _XTIFFPrintDirectory;
+ xt->xtif_flags |= XTIFFP_PRINT;
+ }
+ TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
+ tif->tif_flags |= TIFF_DIRTYDIRECT;
+ }
+ va_end(ap);
+ return (status);
+badvalue:
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d: Bad value for \"%s\"", v,
+ _TIFFFieldWithTag(tif, tag)->field_name);
+ va_end(ap);
+ return (0);
+badvalue32:
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Bad value for \"%s\"", v32,
+ _TIFFFieldWithTag(tif, tag)->field_name);
+ va_end(ap);
+ return (0);
+}
+
+
+static int
+_XTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+ xtiff *xt = XTIFFDIR(tif);
+ XTIFFDirectory* xd = &xt->xtif_dir;
+
+ switch (tag) {
+ /*
+ * XXX put your extended tags here; replace the implemented
+ * example tags with your own.
+ */
+ case TIFFTAG_EXAMPLE_MULTI:
+ *va_arg(ap, uint16*) = xd->xd_num_multi;
+ *va_arg(ap, double**) = xd->xd_example_multi;
+ break;
+ case TIFFTAG_EXAMPLE_ASCII:
+ *va_arg(ap, char**) = xd->xd_example_ascii;
+ break;
+ case TIFFTAG_EXAMPLE_SINGLE:
+ *va_arg(ap, uint32*) = xd->xd_example_single;
+ break;
+ default:
+ /* return inherited method */
+ return (PARENT(xt,vgetfield))(tif,tag,ap);
+ break;
+ }
+ return (1);
+}
+
+#define CleanupField(member) { \
+ if (xd->member) { \
+ _TIFFfree(xd->member); \
+ xd->member = 0; \
+ } \
+}
+/*
+ * Release storage associated with a directory.
+ */
+static void
+_XTIFFFreeDirectory(xtiff* xt)
+{
+ XTIFFDirectory* xd = &xt->xtif_dir;
+
+ /*
+ * XXX - Purge all Your allocated memory except
+ * for the xtiff directory itself. This includes
+ * all fields that require a _TIFFsetXXX call in
+ * _XTIFFVSetField().
+ */
+
+ CleanupField(xd_example_multi);
+ CleanupField(xd_example_ascii);
+
+}
+#undef CleanupField
+
+static void _XTIFFLocalDefaultDirectory(TIFF *tif)
+{
+ xtiff *xt = XTIFFDIR(tif);
+ XTIFFDirectory* xd = &xt->xtif_dir;
+
+ /* Install the extended Tag field info */
+ _TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
+
+ /*
+ * free up any dynamically allocated arrays
+ * before the new directory is read in.
+ */
+
+ _XTIFFFreeDirectory(xt);
+ _TIFFmemset(xt,0,sizeof(xtiff));
+
+ /* Override the tag access methods */
+
+ PARENT(xt,vsetfield) = TIFFMEMBER(tif,vsetfield);
+ TIFFMEMBER(tif,vsetfield) = _XTIFFVSetField;
+ PARENT(xt,vgetfield) = TIFFMEMBER(tif,vgetfield);
+ TIFFMEMBER(tif,vgetfield) = _XTIFFVGetField;
+
+ /*
+ * XXX Set up any default values here.
+ */
+
+ xd->xd_example_single = 234;
+}
+
+
+
+/**********************************************************************
+ * Nothing below this line should need to be changed.
+ **********************************************************************/
+
+static TIFFExtendProc _ParentExtender;
+
+/*
+ * This is the callback procedure, and is
+ * called by the DefaultDirectory method
+ * every time a new TIFF directory is opened.
+ */
+
+static void
+_XTIFFDefaultDirectory(TIFF *tif)
+{
+ xtiff *xt;
+
+ /* Allocate Directory Structure if first time, and install it */
+ if (!(tif->tif_flags & XTIFF_INITIALIZED))
+ {
+ xt = _TIFFmalloc(sizeof(xtiff));
+ if (!xt)
+ {
+ /* handle memory allocation failure here ! */
+ return;
+ }
+ _TIFFmemset(xt,0,sizeof(xtiff));
+ /*
+ * Install into TIFF structure.
+ */
+ TIFFMEMBER(tif,clientdir) = (tidata_t)xt;
+ tif->tif_flags |= XTIFF_INITIALIZED; /* dont do this again! */
+ }
+
+ /* set up our own defaults */
+ _XTIFFLocalDefaultDirectory(tif);
+
+ /* Since an XTIFF client module may have overridden
+ * the default directory method, we call it now to
+ * allow it to set up the rest of its own methods.
+ */
+
+ if (_ParentExtender)
+ (*_ParentExtender)(tif);
+
+}
+
+/*
+ * XTIFF Initializer -- sets up the callback
+ * procedure for the TIFF module.
+ */
+
+static
+void _XTIFFInitialize(void)
+{
+ static first_time=1;
+
+ if (! first_time) return; /* Been there. Done that. */
+ first_time = 0;
+
+ /* Grab the inherited method and install */
+ _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
+}
+
+
+/*
+ * Public File I/O Routines.
+ */
+TIFF*
+XTIFFOpen(const char* name, const char* mode)
+{
+ /* Set up the callback */
+ _XTIFFInitialize();
+
+ /* Open the file; the callback will set everything up
+ */
+ return TIFFOpen(name, mode);
+}
+
+TIFF*
+XTIFFFdOpen(int fd, const char* name, const char* mode)
+{
+ /* Set up the callback */
+ _XTIFFInitialize();
+
+ /* Open the file; the callback will set everything up
+ */
+ return TIFFFdOpen(fd, name, mode);
+}
+
+
+void
+XTIFFClose(TIFF *tif)
+{
+ xtiff *xt = XTIFFDIR(tif);
+
+ /* call inherited function first */
+ TIFFClose(tif);
+
+ /* Free up extended allocated memory */
+ _XTIFFFreeDirectory(xt);
+ _TIFFfree(xt);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/tags/xtiffio.h b/tiff/contrib/tags/xtiffio.h
new file mode 100644
index 0000000..e8600df
--- /dev/null
+++ b/tiff/contrib/tags/xtiffio.h
@@ -0,0 +1,59 @@
+/*
+ * xtiffio.h -- Public interface to Extended TIFF tags
+ *
+ * This is a template for defining a client module
+ * which supports tag extensions to the standard libtiff
+ * set. Only portions of the code marked "XXX" need to
+ * be changed to support your tag set.
+ *
+ * written by: Niles D. Ritter
+ */
+
+#ifndef __xtiffio_h
+#define __xtiffio_h
+
+#include "tiffio.h"
+
+/*
+ * XXX Define your private Tag names and values here
+ */
+
+/* These tags are not valid, but are provided for example */
+#define TIFFTAG_EXAMPLE_MULTI 61234
+#define TIFFTAG_EXAMPLE_SINGLE 61235
+#define TIFFTAG_EXAMPLE_ASCII 61236
+
+/*
+ * XXX Define Printing method flags. These
+ * flags may be passed in to TIFFPrintDirectory() to
+ * indicate that those particular field values should
+ * be printed out in full, rather than just an indicator
+ * of whether they are present or not.
+ */
+#define TIFFPRINT_MYMULTIDOUBLES 0x80000000
+
+/**********************************************************************
+ * Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern TIFF* XTIFFOpen(const char* name, const char* mode);
+extern TIFF* XTIFFFdOpen(int fd, const char* name, const char* mode);
+extern void XTIFFClose(TIFF *tif);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __xtiffio_h */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/tags/xtiffiop.h b/tiff/contrib/tags/xtiffiop.h
new file mode 100644
index 0000000..9d534a8
--- /dev/null
+++ b/tiff/contrib/tags/xtiffiop.h
@@ -0,0 +1,72 @@
+/*
+ * Private Extended TIFF library interface.
+ *
+ * uses private LIBTIFF interface.
+ *
+ * The portions of this module marked "XXX" should be
+ * modified to support your tags instead.
+ *
+ * written by: Niles D. Ritter
+ *
+ */
+
+#ifndef __xtiffiop_h
+#define __xtiffiop_h
+
+#include "tiffiop.h"
+#include "xtiffio.h"
+
+/**********************************************************************
+ * User Configuration
+ **********************************************************************/
+
+/* XXX - Define number of your extended tags here */
+#define NUM_XFIELD 3
+#define XFIELD_BASE (FIELD_LAST-NUM_XFIELD)
+
+/* XXX - Define your Tag Fields here */
+#define FIELD_EXAMPLE_MULTI (XFIELD_BASE+0)
+#define FIELD_EXAMPLE_SINGLE (XFIELD_BASE+1)
+#define FIELD_EXAMPLE_ASCII (XFIELD_BASE+2)
+
+
+/* XXX - Define Private directory tag structure here */
+struct XTIFFDirectory {
+ uint16 xd_num_multi; /* dir-count for the multi tag */
+ double* xd_example_multi;
+ uint32 xd_example_single;
+ char* xd_example_ascii;
+};
+typedef struct XTIFFDirectory XTIFFDirectory;
+
+/**********************************************************************
+ * Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+struct xtiff {
+ TIFF *xtif_tif; /* parent TIFF pointer */
+ uint32 xtif_flags;
+#define XTIFFP_PRINT 0x00000001
+ XTIFFDirectory xtif_dir; /* internal rep of current directory */
+ TIFFVSetMethod xtif_vsetfield; /* inherited tag set routine */
+ TIFFVGetMethod xtif_vgetfield; /* inherited tag get routine */
+ TIFFPrintMethod xtif_printdir; /* inherited dir print method */
+};
+typedef struct xtiff xtiff;
+
+
+#define PARENT(xt,pmember) ((xt)->xtif_ ## pmember)
+#define TIFFMEMBER(tf,pmember) ((tf)->tif_ ## pmember)
+#define XTIFFDIR(tif) ((xtiff *)TIFFMEMBER(tif,clientdir))
+
+/* Extended TIFF flags */
+#define XTIFF_INITIALIZED 0x80000000
+
+#endif /* __xtiffiop_h */
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/win_dib/Makefile.am b/tiff/contrib/win_dib/Makefile.am
new file mode 100644
index 0000000..aaf846f
--- /dev/null
+++ b/tiff/contrib/win_dib/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff \ No newline at end of file
diff --git a/tiff/contrib/win_dib/Makefile.in b/tiff/contrib/win_dib/Makefile.in
new file mode 100644
index 0000000..c2f0f0d
--- /dev/null
+++ b/tiff/contrib/win_dib/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/win_dib
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/win_dib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/win_dib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ 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-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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.
+.NOEXPORT:
diff --git a/tiff/contrib/win_dib/Makefile.w95 b/tiff/contrib/win_dib/Makefile.w95
new file mode 100644
index 0000000..3f461ef
--- /dev/null
+++ b/tiff/contrib/win_dib/Makefile.w95
@@ -0,0 +1,134 @@
+# $Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.w95,v 1.2 1994/11/28
+06:13:31 sam Exp $
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
+# Copyright (c) 1991, 1992 Silicon Graphics, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+# This Makefile is for use with microsoft nmake version 1.50 and
+# Microsoft 32-bit C/C++ Compiler 9.00
+#
+DESTDIR=.
+#
+IPATH= -I.
+CONF_LIBRARY=$(NULL)
+COPTS= -Oxa -DBSDTYPES -Zd
+CFLAGS= $(COPTS) $(CONF_LIBRARY)
+#
+INCS= tiff.h tiffio.h
+SRCS= tif_aux.c \
+ tif_close.c \
+ tif_codec.c \
+ tif_compress.c \
+ tif_dir.c \
+ tif_dirinfo.c \
+ tif_dirread.c \
+ tif_dirwrite.c \
+ tif_dumpmode.c \
+ tif_error.c \
+ tif_getimage.c \
+ tif_jpeg.c \
+ tif_flush.c \
+ tif_lzw.c \
+ tif_next.c \
+ tif_open.c \
+ tif_packbits.c \
+ tif_predict \
+ tif_print.c \
+ tif_read.c \
+ tif_swab.c \
+ tif_strip.c \
+ tif_thunder.c \
+ tif_tile.c \
+ tif_version.c \
+ tif_warning.c \
+ tif_write.c \
+ tif_win32.c
+
+
+OBJS= tif_aux.obj \
+ tif_close.obj \
+ tif_codec.obj \
+ tif_compress.obj \
+ tif_dir.obj \
+ tif_dirinfo.obj \
+ tif_dirread.obj \
+ tif_dirwrite.obj \
+ tif_dumpmode.obj \
+ tif_error.obj \
+ tif_getimage.obj \
+ tif_jpeg.obj \
+ tif_flush.obj \
+ tif_lzw.obj \
+ tif_next.obj \
+ tif_open.obj \
+ tif_packbits.obj \
+ tif_predict.obj \
+ tif_print.obj \
+ tif_read.obj \
+ tif_swab.obj \
+ tif_strip.obj \
+ tif_thunder.obj \
+ tif_tile.obj \
+ tif_version.obj \
+ tif_warning.obj \
+ tif_write.obj \
+ tif_win32.obj
+
+
+
+ALL= libtiff.lib
+
+all: $(ALL)
+
+%.obj : %.c
+ $(CC) $(CFLAGS) -c $*.c
+
+
+#.INCLUDE .IGNORE : depend
+
+libtiff.lib: $(OBJS)
+ - del libtiff.lib
+ lib /OUT:libtiff.lib $(OBJS)
+
+
+#To include fax3 support, you need to modify mkg3states.c so it could run
+#under windows 95 or NT. This application make the file g3state.h.
+#after that, you have to add to the build script : tif_fax3.c and tif_fax3.obj
+#and define CCITT_SUPPORT in the file tifconf.h
+
+#$(OBJS): tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
+#tif_fax3.obj: tif_fax3.c g3states.h t4.h tif_fax3.h
+
+#g3states.h: mkg3states.c t4.h
+# $(CC) $(CFLAGS) mkg3states.c
+# mkg3states -c > g3states.h
+
+
+clean:
+ del *.obj
+ del mkg3stat
+ del g3states.h
+
+tags: $(SRCS)
+ $(CTAGS) $(SRCS)
diff --git a/tiff/contrib/win_dib/README.Tiffile b/tiff/contrib/win_dib/README.Tiffile
new file mode 100644
index 0000000..82c6e5c
--- /dev/null
+++ b/tiff/contrib/win_dib/README.Tiffile
@@ -0,0 +1,31 @@
+Frank,
+
+I attached a file that uses RGBA interface (tif_getimage.c) to read a tiff
+file and convert to a DIB. It's advantage is that it is easy to read *any*
+tiff file suported by libtiff and easily convert it to a DIB. The disadvantage
+is that bilevel (B&W) bitmaps (and all other non-rgba images) are also
+converted to RGBA, thus taking up 32x as much memory as needed (4 bytes per
+pixel, rather than 1 bit). I read tiff files, but don't need to
+write them. And my files are typically small, so the overhead is mostly
+inconsequential. But for bilevel images, I overrode the get() and put()
+routines of the RGBA interface to just copy the data from the input raster
+to the output raster, rather than expanding out to full 32 bit format. It
+would be nice if there were a simple way to handle all palletized images,
+but that would take more custom routines, and it's not that important to me.
+
+Usage:
+
+ m_pDIB = (PBITMAPINFOHEADER)::ReadTIFF(pathName);
+ if (m_pDIB != 0) {
+ m_format = IMAGETYPE_TIF;
+ }
+
+This is intended as Win32, but the modifications for new get() and put()
+routines may be independent of platform.
+
+Thanks for your work supporting the forum and the library!
+
+Regards,
+
+Mark James
+mark@james.net
diff --git a/tiff/contrib/win_dib/README.tiff2dib b/tiff/contrib/win_dib/README.tiff2dib
new file mode 100644
index 0000000..3e6075f
--- /dev/null
+++ b/tiff/contrib/win_dib/README.tiff2dib
@@ -0,0 +1,51 @@
+
+Date: 04 Dec 95 10:34:23 EST
+From: Philippe <100423.3705@compuserve.com>
+To: TIFF/sam Leffler <sam@cthulhu.engr.sgi.com>
+Subject: TIFF library and Windows 95
+Message-Id: <951204153422_100423.3705_BHG101-1@CompuServe.COM>
+
+Sam,
+
+First, let me thanks all of you how have worked
+on that great TIFF library !
+
+Here is some information that may help someone.
+
+I build the library under Windows 95 as a 32-bit library.
+The contribution of Scott Wagner (tif_win32.c) worked fine, but
+the makefile "makefile.msc" was unsable because it was
+written for DOS or Windows 3.1 and all the files names
+are limited to 8 characters.
+
+Here is the makefile I used : makefile.w95
+
+Also, I had to disable fax3 support because I wasn't able
+to build (as it is) the tool "mkg3states" to generate the include
+file "g3states.h".
+This source file must be modify to be build under Windows 95.
+
+To build the library under Windows 95 with Visual C++ 2.0,
+I had to :
+
+- undefine CCITT_SUPPORT in "tiffconf.h"
+
+- create the file version.h with this line :
+ #define VERSION "3.4beta024"
+
+- build the makefile "makefile.w95"
+
+I also join the source file "tif2dib.c" that I created,
+it contain the function LoadTIFFinDIB that load
+a TIFF file and build a memory DIB with it and return the
+HANDLE (HDIB) of the memory bloc containing this DIB.
+Since DIB is the "natural" bitmap format for Windows 3.1, 95 and NT,
+this function sould be usefull for some Windows 95 (or NT) developer.
+
+
+Sorry for my approximate english ...
+
+Regards,
+
+Philippe Tenenhaus 100423.3705@compuserve.com
+Paris
diff --git a/tiff/contrib/win_dib/Tiffile.cpp b/tiff/contrib/win_dib/Tiffile.cpp
new file mode 100644
index 0000000..9d958b1
--- /dev/null
+++ b/tiff/contrib/win_dib/Tiffile.cpp
@@ -0,0 +1,449 @@
+#include "StdAfx.h"
+
+//#define STRICT
+#include <windows.h>
+#include <windowsx.h>
+#include <commdlg.h>
+#include <stdlib.h> // MAX_ constants
+#include "diblib.h"
+
+/*--------------------------------------------------------------------
+ READ TIFF
+ Load the TIFF data from the file into memory. Return
+ a pointer to a valid DIB (or NULL for errors).
+ Uses the TIFFRGBA interface to libtiff.lib to convert
+ most file formats to a useable form. We just keep the 32 bit
+ form of the data to display, rather than optimizing for the
+ display.
+
+ Main entry points:
+
+ int ChkTIFF ( LPCTSTR lpszPath )
+ PVOID ReadTIFF ( LPCTSTR lpszPath )
+
+ RETURN
+ A valid DIB pointer for success; NULL for failure.
+
+ --------------------------------------------------------------------*/
+
+#include "TiffLib/tiff.h"
+#include "TiffLib/tiffio.h"
+#include <assert.h>
+#include <stdio.h>
+
+
+// piggyback some data on top of the RGBA Image
+struct TIFFDibImage {
+ TIFFRGBAImage tif;
+ int dibinstalled;
+} ;
+
+
+HANDLE LoadTIFFinDIB(LPCTSTR lpFileName);
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster) ;
+
+static void
+MyWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+ // ignore all warnings (unused tags, etc)
+ return;
+}
+
+static void
+MyErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+ return;
+}
+
+// Turn off the error and warning handlers to check if a valid file.
+// Necessary because of the way that the Doc loads images and restart files.
+int ChkTIFF ( LPCTSTR lpszPath )
+{
+ int rtn = 0;
+
+ TIFFErrorHandler eh;
+ TIFFErrorHandler wh;
+
+ eh = TIFFSetErrorHandler(NULL);
+ wh = TIFFSetWarningHandler(NULL);
+
+ TIFF* tif = TIFFOpen(lpszPath, "r");
+ if (tif) {
+ rtn = 1;
+ TIFFClose(tif);
+ }
+
+ TIFFSetErrorHandler(eh);
+ TIFFSetWarningHandler(wh);
+
+ return rtn;
+}
+
+void DibInstallHack(TIFFDibImage* img) ;
+
+PVOID ReadTIFF ( LPCTSTR lpszPath )
+{
+ void* pDIB = 0;
+ TIFFErrorHandler wh;
+
+ wh = TIFFSetWarningHandler(MyWarningHandler);
+
+ if (ChkTIFF(lpszPath)) {
+ TIFF* tif = TIFFOpen(lpszPath, "r");
+ if (tif) {
+ char emsg[1024];
+
+ if (TIFFRGBAImageOK(tif, emsg)) {
+ TIFFDibImage img;
+ char emsg[1024];
+
+ if (TIFFRGBAImageBegin(&img.tif, tif, -1, emsg)) {
+ size_t npixels;
+ uint32* raster;
+
+ DibInstallHack(&img);
+
+ npixels = img.tif.width * img.tif.height;
+ raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
+ if (raster != NULL) {
+ if (TIFFRGBAImageGet(&img.tif, raster, img.tif.width, img.tif.height)) {
+ pDIB = TIFFRGBA2DIB(&img, raster);
+ }
+ }
+ _TIFFfree(raster);
+ }
+ TIFFRGBAImageEnd(&img.tif);
+ }
+ else {
+ TRACE("Unable to open image(%s): %s\n", lpszPath, emsg );
+ }
+ TIFFClose(tif);
+ }
+ }
+
+ TIFFSetWarningHandler(wh);
+
+ return pDIB;
+}
+
+
+
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)
+{
+ void* pDIB = 0;
+ TIFFRGBAImage* img = &dib->tif;
+
+ uint32 imageLength;
+ uint32 imageWidth;
+ uint16 BitsPerSample;
+ uint16 SamplePerPixel;
+ uint32 RowsPerStrip;
+ uint16 PhotometricInterpretation;
+
+ BITMAPINFOHEADER bi;
+ int dwDIBSize ;
+
+ TIFFGetField(img->tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
+ TIFFGetField(img->tif, TIFFTAG_IMAGELENGTH, &imageLength);
+ TIFFGetField(img->tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
+ TIFFGetField(img->tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
+ TIFFGetField(img->tif, TIFFTAG_SAMPLESPERPIXEL, &SamplePerPixel);
+ TIFFGetField(img->tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
+
+ if ( BitsPerSample == 1 && SamplePerPixel == 1 && dib->dibinstalled ) { // bilevel
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = imageWidth;
+ bi.biHeight = imageLength;
+ bi.biPlanes = 1; // always
+ bi.biBitCount = 1;
+ bi.biCompression = BI_RGB;
+ bi.biSizeImage = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
+ bi.biXPelsPerMeter = 0;
+ bi.biYPelsPerMeter = 0;
+ bi.biClrUsed = 0; // must be zero for RGB compression (none)
+ bi.biClrImportant = 0; // always
+
+ // Get the size of the DIB
+ dwDIBSize = GetDIBSize( &bi );
+
+ // Allocate for the BITMAPINFO structure and the color table.
+ pDIB = GlobalAllocPtr( GHND, dwDIBSize );
+ if (pDIB == 0) {
+ return( NULL );
+ }
+
+ // Copy the header info
+ *((BITMAPINFOHEADER*)pDIB) = bi;
+
+ // Get a pointer to the color table
+ RGBQUAD *pRgbq = (RGBQUAD *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
+
+ pRgbq[0].rgbRed = 0;
+ pRgbq[0].rgbBlue = 0;
+ pRgbq[0].rgbGreen = 0;
+ pRgbq[0].rgbReserved = 0;
+ pRgbq[1].rgbRed = 255;
+ pRgbq[1].rgbBlue = 255;
+ pRgbq[1].rgbGreen = 255;
+ pRgbq[1].rgbReserved = 255;
+
+ // Pointers to the bits
+ //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
+ //
+ // In the BITMAPINFOHEADER documentation, it appears that
+ // there should be no color table for 32 bit images, but
+ // experience shows that the image is off by 3 words if it
+ // is not included. So here it is.
+ PVOID pbiBits = GetDIBImagePtr((BITMAPINFOHEADER*)pDIB); //(LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
+
+ int sizeWords = bi.biSizeImage/4;
+ RGBQUAD* rgbDib = (RGBQUAD*)pbiBits;
+ long* rgbTif = (long*)raster;
+
+ _TIFFmemcpy(pbiBits, raster, bi.biSizeImage);
+ }
+
+ // For now just always default to the RGB 32 bit form. // save as 32 bit for simplicity
+ else if ( true /*BitsPerSample == 8 && SamplePerPixel == 3*/ ) { // 24 bit color
+
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = imageWidth;
+ bi.biHeight = imageLength;
+ bi.biPlanes = 1; // always
+ bi.biBitCount = 32;
+ bi.biCompression = BI_RGB;
+ bi.biSizeImage = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
+ bi.biXPelsPerMeter = 0;
+ bi.biYPelsPerMeter = 0;
+ bi.biClrUsed = 0; // must be zero for RGB compression (none)
+ bi.biClrImportant = 0; // always
+
+ // Get the size of the DIB
+ dwDIBSize = GetDIBSize( &bi );
+
+ // Allocate for the BITMAPINFO structure and the color table.
+ pDIB = GlobalAllocPtr( GHND, dwDIBSize );
+ if (pDIB == 0) {
+ return( NULL );
+ }
+
+ // Copy the header info
+ *((BITMAPINFOHEADER*)pDIB) = bi;
+
+ // Get a pointer to the color table
+ RGBQUAD *pRgbq = (RGBQUAD *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
+
+ // Pointers to the bits
+ //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
+ //
+ // In the BITMAPINFOHEADER documentation, it appears that
+ // there should be no color table for 32 bit images, but
+ // experience shows that the image is off by 3 words if it
+ // is not included. So here it is.
+ PVOID pbiBits = (LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
+
+ int sizeWords = bi.biSizeImage/4;
+ RGBQUAD* rgbDib = (RGBQUAD*)pbiBits;
+ long* rgbTif = (long*)raster;
+
+ // Swap the byte order while copying
+ for ( int i = 0 ; i < sizeWords ; ++i )
+ {
+ rgbDib[i].rgbRed = TIFFGetR(rgbTif[i]);
+ rgbDib[i].rgbBlue = TIFFGetB(rgbTif[i]);
+ rgbDib[i].rgbGreen = TIFFGetG(rgbTif[i]);
+ rgbDib[i].rgbReserved = 0;
+ }
+ }
+
+ return pDIB;
+}
+
+
+
+
+///////////////////////////////////////////////////////////////
+//
+// Hacked from tif_getimage.c in libtiff in v3.5.7
+//
+//
+typedef unsigned char u_char;
+
+
+#define DECLAREContigPutFunc(name) \
+static void name(\
+ TIFFRGBAImage* img, \
+ uint32* cp, \
+ uint32 x, uint32 y, \
+ uint32 w, uint32 h, \
+ int32 fromskew, int32 toskew, \
+ u_char* pp \
+)
+
+#define DECLARESepPutFunc(name) \
+static void name(\
+ TIFFRGBAImage* img,\
+ uint32* cp,\
+ uint32 x, uint32 y, \
+ uint32 w, uint32 h,\
+ int32 fromskew, int32 toskew,\
+ u_char* r, u_char* g, u_char* b, u_char* a\
+)
+
+DECLAREContigPutFunc(putContig1bitTile);
+static int getStripContig1Bit(TIFFRGBAImage* img, uint32* uraster, uint32 w, uint32 h);
+
+//typdef struct TIFFDibImage {
+// TIFFRGBAImage tif;
+// dibinstalled;
+//} TIFFDibImage ;
+
+void DibInstallHack(TIFFDibImage* dib) {
+ TIFFRGBAImage* img = &dib->tif;
+ dib->dibinstalled = false;
+ switch (img->photometric) {
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ switch (img->bitspersample) {
+ case 1:
+ img->put.contig = putContig1bitTile;
+ img->get = getStripContig1Bit;
+ dib->dibinstalled = true;
+ break;
+ }
+ break;
+ }
+}
+
+/*
+ * 1-bit packed samples => 1-bit
+ *
+ * Override to just copy the data
+ */
+DECLAREContigPutFunc(putContig1bitTile)
+{
+ int samplesperpixel = img->samplesperpixel;
+
+ (void) y;
+ fromskew *= samplesperpixel;
+ int wb = WIDTHBYTES(w);
+ u_char* ucp = (u_char*)cp;
+
+ /* Conver 'w' to bytes from pixels (rounded up) */
+ w = (w+7)/8;
+
+ while (h-- > 0) {
+ _TIFFmemcpy(ucp, pp, w);
+ /*
+ for (x = wb; x-- > 0;) {
+ *cp++ = rgbi(Map[pp[0]], Map[pp[1]], Map[pp[2]]);
+ pp += samplesperpixel;
+ }
+ */
+ ucp += (wb + toskew);
+ pp += (w + fromskew);
+ }
+}
+
+/*
+ * Hacked from the tif_getimage.c file.
+ */
+static uint32
+setorientation(TIFFRGBAImage* img, uint32 h)
+{
+ TIFF* tif = img->tif;
+ uint32 y;
+
+ switch (img->orientation) {
+ case ORIENTATION_BOTRIGHT:
+ case ORIENTATION_RIGHTBOT: /* XXX */
+ case ORIENTATION_LEFTBOT: /* XXX */
+ TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
+ img->orientation = ORIENTATION_BOTLEFT;
+ /* fall thru... */
+ case ORIENTATION_BOTLEFT:
+ y = 0;
+ break;
+ case ORIENTATION_TOPRIGHT:
+ case ORIENTATION_RIGHTTOP: /* XXX */
+ case ORIENTATION_LEFTTOP: /* XXX */
+ default:
+ TIFFWarning(TIFFFileName(tif), "using top-left orientation");
+ img->orientation = ORIENTATION_TOPLEFT;
+ /* fall thru... */
+ case ORIENTATION_TOPLEFT:
+ y = h-1;
+ break;
+ }
+ return (y);
+}
+
+/*
+ * Get a strip-organized image that has
+ * PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ * SamplesPerPixel == 1
+ *
+ * Hacked from the tif_getimage.c file.
+ *
+ * This is set up to allow us to just copy the data to the raster
+ * for 1-bit bitmaps
+ */
+static int
+getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+ TIFF* tif = img->tif;
+ tileContigRoutine put = img->put.contig;
+ uint16 orientation;
+ uint32 row, y, nrow, rowstoread;
+ uint32 pos;
+ u_char* buf;
+ uint32 rowsperstrip;
+ uint32 imagewidth = img->width;
+ tsize_t scanline;
+ int32 fromskew, toskew;
+ tstrip_t strip;
+ tsize_t stripsize;
+ u_char* braster = (u_char*)raster; // byte wide raster
+ uint32 wb = WIDTHBYTES(w);
+ int ret = 1;
+
+ buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
+ if (buf == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
+ return (0);
+ }
+ y = setorientation(img, h);
+ orientation = img->orientation;
+ toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);
+ TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+ scanline = TIFFScanlineSize(tif);
+ fromskew = (w < imagewidth ? imagewidth - w : 0)/8;
+ for (row = 0; row < h; row += nrow)
+ {
+ rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
+ nrow = (row + rowstoread > h ? h - row : rowstoread);
+ strip = TIFFComputeStrip(tif,row+img->row_offset, 0);
+ stripsize = ((row + img->row_offset)%rowsperstrip + nrow) * scanline;
+ if (TIFFReadEncodedStrip(tif, strip, buf, stripsize ) < 0
+ && img->stoponerr)
+ {
+ ret = 0;
+ break;
+ }
+
+ pos = ((row + img->row_offset) % rowsperstrip) * scanline;
+ (*put)(img, (uint32*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);
+ y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
+ }
+ _TIFFfree(buf);
+ return (ret);
+}
+
+/*
+ * Local Variables:
+ * mode: c++
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/win_dib/tiff2dib.c b/tiff/contrib/win_dib/tiff2dib.c
new file mode 100644
index 0000000..475ef30
--- /dev/null
+++ b/tiff/contrib/win_dib/tiff2dib.c
@@ -0,0 +1,379 @@
+/*************************************************************************
+ *
+ * Source file for Windows 95/Win32.
+ *
+ * The function LoadTIFFinDIB in this source file let you load
+ * a TIFF file and build a memory DIB with it and return the
+ * HANDLE (HDIB) of the memory bloc containing the DIB.
+ *
+ * Example :
+ *
+ * HDIB hDIB;
+ * hDIB = LoadTIFFinDIB("sample.tif");
+ *
+ *
+ * To build this source file you must include the TIFF library
+ * in your project.
+ *
+ * 4/12/95 Philippe Tenenhaus 100423.3705@compuserve.com
+ *
+ ************************************************************************/
+
+
+#include "tiffio.h"
+
+#define HDIB HANDLE
+#define IS_WIN30_DIB(lpbi) ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
+#define CVT(x) (((x) * 255L) / ((1L<<16)-1))
+
+static HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);
+static LPSTR FindDIBBits(LPSTR lpDIB);
+static WORD PaletteSize(LPSTR lpDIB);
+static WORD DIBNumColors(LPSTR lpDIB);
+static int checkcmap(int n, uint16* r, uint16* g, uint16* b);
+
+
+
+/*************************************************************************
+ *
+ * HDIB LoadTIFFinDIB(LPSTR lpFileName)
+ *
+ * Parameter:
+ *
+ * LPSTR lpDIB - File name of a tiff imag
+ *
+ * Return Value:
+ *
+ * LPSTR - HANDLE of a DIB
+ *
+ * Description:
+ *
+ * This function load a TIFF file and build a memory DIB with it
+ * and return the HANDLE (HDIB) of the memory bloc containing
+ * the DIB.
+ *
+ * 4/12/95 Philippe Tenenhaus 100423.3705@compuserve.com
+ *
+ ************************************************************************/
+
+HDIB LoadTIFFinDIB(LPSTR lpFileName)
+{
+ TIFF *tif;
+ unsigned long imageLength;
+ unsigned long imageWidth;
+ unsigned int BitsPerSample;
+ unsigned long LineSize;
+ unsigned int SamplePerPixel;
+ unsigned long RowsPerStrip;
+ int PhotometricInterpretation;
+ long nrow;
+ unsigned long row;
+ char *buf;
+ LPBITMAPINFOHEADER lpDIB;
+ HDIB hDIB;
+ char *lpBits;
+ HGLOBAL hStrip;
+ int i,l;
+ int Align;
+
+ tif = TIFFOpen(lpFileName, "r");
+
+ if (!tif)
+ goto TiffOpenError;
+
+ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength);
+ TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
+ TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
+ TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
+ TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
+
+ LineSize = TIFFScanlineSize(tif); //Number of byte in ine line
+
+ SamplePerPixel = (int) (LineSize/imageWidth);
+
+ //Align = Number of byte to add at the end of each line of the DIB
+ Align = 4 - (LineSize % 4);
+ if (Align == 4) Align = 0;
+
+
+ //Create a new DIB
+ hDIB = CreateDIB((DWORD) imageWidth, (DWORD) imageLength, (WORD)
+(BitsPerSample*SamplePerPixel));
+ lpDIB = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
+ if (!lpDIB)
+ goto OutOfDIBMemory;
+
+ if (lpDIB)
+ lpBits = FindDIBBits((LPSTR) lpDIB);
+
+ //In the tiff file the lines are save from up to down
+ //In a DIB the lines must be save from down to up
+ if (lpBits)
+ {
+ lpBits = FindDIBBits((LPSTR) lpDIB);
+ lpBits+=((imageWidth*SamplePerPixel)+Align)*(imageLength-1);
+ //now lpBits pointe on the bottom line
+
+ hStrip = GlobalAlloc(GHND,TIFFStripSize(tif));
+ buf = GlobalLock(hStrip);
+
+ if (!buf)
+ goto OutOfBufMemory;
+
+ //PhotometricInterpretation = 2 image is RGB
+ //PhotometricInterpretation = 3 image have a color palette
+ if (PhotometricInterpretation == 3)
+ {
+ uint16* red;
+ uint16* green;
+ uint16* blue;
+ int16 i;
+ LPBITMAPINFO lpbmi;
+ int Palette16Bits;
+
+ TIFFGetField(tif, TIFFTAG_COLORMAP, &red, &green, &blue);
+
+ //Is the palette 16 or 8 bits ?
+ if (checkcmap(1<<BitsPerSample, red, green, blue) == 16)
+ Palette16Bits = TRUE;
+ else
+ Palette16Bits = FALSE;
+
+ lpbmi = (LPBITMAPINFO)lpDIB;
+
+ //load the palette in the DIB
+ for (i = (1<<BitsPerSample)-1; i >= 0; i--)
+ {
+ if (Palette16Bits)
+ {
+ lpbmi->bmiColors[i].rgbRed =(BYTE) CVT(red[i]);
+ lpbmi->bmiColors[i].rgbGreen = (BYTE) CVT(green[i]);
+ lpbmi->bmiColors[i].rgbBlue = (BYTE) CVT(blue[i]);
+ }
+ else
+ {
+ lpbmi->bmiColors[i].rgbRed = (BYTE) red[i];
+ lpbmi->bmiColors[i].rgbGreen = (BYTE) green[i];
+ lpbmi->bmiColors[i].rgbBlue = (BYTE) blue[i];
+ }
+ }
+
+ }
+
+ //read the tiff lines and save them in the DIB
+ //with RGB mode, we have to change the order of the 3 samples RGB
+<=> BGR
+ for (row = 0; row < imageLength; row += RowsPerStrip)
+ {
+ nrow = (row + RowsPerStrip > imageLength ? imageLength - row :
+RowsPerStrip);
+ if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+ buf, nrow*LineSize)==-1)
+ {
+ goto TiffReadError;
+ }
+ else
+ {
+ for (l = 0; l < nrow; l++)
+ {
+ if (SamplePerPixel == 3)
+ for (i=0;i< (int) (imageWidth);i++)
+ {
+ lpBits[i*SamplePerPixel+0]=buf[l*LineSize+i*Sample
+PerPixel+2];
+ lpBits[i*SamplePerPixel+1]=buf[l*LineSize+i*Sample
+PerPixel+1];
+ lpBits[i*SamplePerPixel+2]=buf[l*LineSize+i*Sample
+PerPixel+0];
+ }
+ else
+ memcpy(lpBits, &buf[(int) (l*LineSize)], (int)
+imageWidth*SamplePerPixel);
+
+ lpBits-=imageWidth*SamplePerPixel+Align;
+
+ }
+ }
+ }
+ GlobalUnlock(hStrip);
+ GlobalFree(hStrip);
+ GlobalUnlock(hDIB);
+ TIFFClose(tif);
+ }
+
+ return hDIB;
+
+ OutOfBufMemory:
+
+ TiffReadError:
+ GlobalUnlock(hDIB);
+ GlobalFree(hStrip);
+ OutOfDIBMemory:
+ TIFFClose(tif);
+ TiffOpenError:
+ return (HANDLE) 0;
+
+
+}
+
+
+static int checkcmap(int n, uint16* r, uint16* g, uint16* b)
+{
+ while (n-- > 0)
+ if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+ return (16);
+
+ return (8);
+}
+
+
+
+/*************************************************************************
+ * All the following functions were created by microsoft, they are
+ * parts of the sample project "wincap" given with the SDK Win32.
+ *
+ * Microsoft says that :
+ *
+ * You have a royalty-free right to use, modify, reproduce and
+ * distribute the Sample Files (and/or any modified version) in
+ * any way you find useful, provided that you agree that
+ * Microsoft has no warranty obligations or liability for any
+ * Sample Application Files which are modified.
+ *
+ ************************************************************************/
+
+HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount)
+{
+ BITMAPINFOHEADER bi; // bitmap header
+ LPBITMAPINFOHEADER lpbi; // pointer to BITMAPINFOHEADER
+ DWORD dwLen; // size of memory block
+ HDIB hDIB;
+ DWORD dwBytesPerLine; // Number of bytes per scanline
+
+
+ // Make sure bits per pixel is valid
+ if (wBitCount <= 1)
+ wBitCount = 1;
+ else if (wBitCount <= 4)
+ wBitCount = 4;
+ else if (wBitCount <= 8)
+ wBitCount = 8;
+ else if (wBitCount <= 24)
+ wBitCount = 24;
+ else
+ wBitCount = 4; // set default value to 4 if parameter is bogus
+
+ // initialize BITMAPINFOHEADER
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = dwWidth; // fill in width from parameter
+ bi.biHeight = dwHeight; // fill in height from parameter
+ bi.biPlanes = 1; // must be 1
+ bi.biBitCount = wBitCount; // from parameter
+ bi.biCompression = BI_RGB;
+ bi.biSizeImage = (dwWidth*dwHeight*wBitCount)/8; //0; // 0's here
+mean "default"
+ bi.biXPelsPerMeter = 2834; //0;
+ bi.biYPelsPerMeter = 2834; //0;
+ bi.biClrUsed = 0;
+ bi.biClrImportant = 0;
+
+ // calculate size of memory block required to store the DIB. This
+ // block should be big enough to hold the BITMAPINFOHEADER, the color
+ // table, and the bits
+
+ dwBytesPerLine = (((wBitCount * dwWidth) + 31) / 32 * 4);
+ dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
+
+ // alloc memory block to store our bitmap
+ hDIB = GlobalAlloc(GHND, dwLen);
+
+ // major bummer if we couldn't get memory block
+ if (!hDIB)
+ {
+ return NULL;
+ }
+
+ // lock memory and get pointer to it
+ lpbi = (VOID FAR *)GlobalLock(hDIB);
+
+ // use our bitmap info structure to fill in first part of
+ // our DIB with the BITMAPINFOHEADER
+ *lpbi = bi;
+
+ // Since we don't know what the colortable and bits should contain,
+ // just leave these blank. Unlock the DIB and return the HDIB.
+
+ GlobalUnlock(hDIB);
+
+ /* return handle to the DIB */
+ return hDIB;
+}
+
+
+LPSTR FAR FindDIBBits(LPSTR lpDIB)
+{
+ return (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB));
+}
+
+
+WORD FAR PaletteSize(LPSTR lpDIB)
+{
+ /* calculate the size required by the palette */
+ if (IS_WIN30_DIB (lpDIB))
+ return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));
+ else
+ return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));
+}
+
+
+WORD DIBNumColors(LPSTR lpDIB)
+{
+ WORD wBitCount; // DIB bit count
+
+ /* If this is a Windows-style DIB, the number of colors in the
+ * color table can be less than the number of bits per pixel
+ * allows for (i.e. lpbi->biClrUsed can be set to some value).
+ * If this is the case, return the appropriate value.
+ */
+
+ if (IS_WIN30_DIB(lpDIB))
+ {
+ DWORD dwClrUsed;
+
+ dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;
+ if (dwClrUsed)
+ return (WORD)dwClrUsed;
+ }
+
+ /* Calculate the number of colors in the color table based on
+ * the number of bits per pixel for the DIB.
+ */
+ if (IS_WIN30_DIB(lpDIB))
+ wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;
+ else
+ wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;
+
+ /* return number of colors based on bits per pixel */
+ switch (wBitCount)
+ {
+ case 1:
+ return 2;
+
+ case 4:
+ return 16;
+
+ case 8:
+ return 256;
+
+ default:
+ return 0;
+ }
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */