summaryrefslogtreecommitdiff
path: root/tiff/contrib/tags
diff options
context:
space:
mode:
Diffstat (limited to 'tiff/contrib/tags')
-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
8 files changed, 1178 insertions, 0 deletions
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:
+ */