libtiff: v3.4beta037 release

From 0db24a4dc6b63cb897d1179d5e0a639707ab6868 Mon Sep 17 00:00:00 2001
From: Sam Leffler <[EMAIL REDACTED]>
Date: Mon, 1 Sep 1997 03:22:05 +0100
Subject: [PATCH] v3.4beta037 release

---
 COPYRIGHT                       |    4 +-
 Makefile.in                     |   75 +-
 README                          |    6 +-
 TODO                            |    2 +-
 config.site                     |    6 +-
 configure                       |   10 +-
 contrib/dosdjgpp/Makefile.lib   |    2 +-
 contrib/dosdjgpp/Makefile.tools |    2 +-
 contrib/dosdjgpp/Makefile.top   |    2 +-
 contrib/mfs/README              |   37 +
 contrib/mfs/mfs_file.c          |  579 +++++++++++++
 contrib/pds/README              |   90 ++
 contrib/pds/tif_imageiter.c     |  518 +++++++++++
 contrib/pds/tif_imageiter.h     |   57 ++
 contrib/pds/tif_pdsdirread.c    | 1124 ++++++++++++++++++++++++
 contrib/pds/tif_pdsdirwrite.c   |  964 +++++++++++++++++++++
 contrib/ras/README              |   10 +
 contrib/winnt/README.console    |  182 ++++
 dist/newalpha                   |    2 +-
 dist/newversion                 |    2 +-
 dist/tiff.alpha                 |    2 +-
 dist/tiff.spec                  |    6 +-
 html/Makefile.in                |    6 +-
 html/build.html                 |   21 +-
 html/contrib.html               |   36 +-
 html/document.html              |   28 +-
 html/images.html                |   16 +-
 html/index.html                 |   20 +-
 html/internals.html             |   43 +-
 html/libtiff.html               |   19 +-
 html/misc.html                  |   29 +-
 html/support.html               |   36 +-
 html/tools.html                 |   12 +-
 libtiff/Makefile.in             |   12 +-
 libtiff/Makefile.lcc            |    6 +-
 libtiff/mkg3states.c            |    6 +-
 libtiff/mkspans.c               |    6 +-
 libtiff/mkversion.c             |    6 +-
 libtiff/t4.h                    |    6 +-
 libtiff/tif_acorn.c             |    6 +-
 libtiff/tif_apple.c             |    6 +-
 libtiff/tif_atari.c             |    6 +-
 libtiff/tif_aux.c               |    6 +-
 libtiff/tif_close.c             |    6 +-
 libtiff/tif_codec.c             |   13 +-
 libtiff/tif_compress.c          |    6 +-
 libtiff/tif_dir.c               |   71 +-
 libtiff/tif_dir.h               |   11 +-
 libtiff/tif_dirinfo.c           |   20 +-
 libtiff/tif_dirread.c           |    6 +-
 libtiff/tif_dirwrite.c          |   28 +-
 libtiff/tif_dumpmode.c          |    6 +-
 libtiff/tif_error.c             |    6 +-
 libtiff/tif_fax3.c              |    6 +-
 libtiff/tif_fax3.h              |    6 +-
 libtiff/tif_flush.c             |    6 +-
 libtiff/tif_getimage.c          |   58 +-
 libtiff/tif_jpeg.c              |    6 +-
 libtiff/tif_luv.c               | 1428 +++++++++++++++++++++++++++++++
 libtiff/tif_lzw.c               |    6 +-
 libtiff/tif_msdos.c             |    6 +-
 libtiff/tif_next.c              |    6 +-
 libtiff/tif_open.c              |    6 +-
 libtiff/tif_packbits.c          |    6 +-
 libtiff/tif_pixarlog.c          |   37 +-
 libtiff/tif_predict.c           |   15 +-
 libtiff/tif_predict.h           |    6 +-
 libtiff/tif_print.c             |   27 +-
 libtiff/tif_read.c              |    8 +-
 libtiff/tif_strip.c             |    6 +-
 libtiff/tif_swab.c              |    6 +-
 libtiff/tif_thunder.c           |    6 +-
 libtiff/tif_tile.c              |    6 +-
 libtiff/tif_unix.c              |    6 +-
 libtiff/tif_version.c           |    6 +-
 libtiff/tif_vms.c               |    6 +-
 libtiff/tif_warning.c           |    6 +-
 libtiff/tif_win3.c              |    8 +-
 libtiff/tif_win32.c             |   61 +-
 libtiff/tif_write.c             |   24 +-
 libtiff/tif_zip.c               |   17 +-
 libtiff/tiff.h                  |   19 +-
 libtiff/tiffcomp.h              |    6 +-
 libtiff/tiffconf.h              |    8 +-
 libtiff/tiffio.h                |    7 +-
 libtiff/tiffiop.h               |   22 +-
 libtiff/uvcode.h                |  173 ++++
 man/Makefile.in                 |    6 +-
 man/TIFFClose.3t                |    6 +-
 man/TIFFError.3t                |    6 +-
 man/TIFFFlush.3t                |    6 +-
 man/TIFFGetField.3t             |    9 +-
 man/TIFFOpen.3t                 |    6 +-
 man/TIFFPrintDirectory.3t       |    6 +-
 man/TIFFRGBAImage.3t            |    6 +-
 man/TIFFReadDirectory.3t        |    6 +-
 man/TIFFReadEncodedStrip.3t     |    6 +-
 man/TIFFReadEncodedTile.3t      |    6 +-
 man/TIFFReadRGBAImage.3t        |    6 +-
 man/TIFFReadRawStrip.3t         |    6 +-
 man/TIFFReadRawTile.3t          |    6 +-
 man/TIFFReadScanline.3t         |    6 +-
 man/TIFFReadTile.3t             |    6 +-
 man/TIFFSetDirectory.3t         |    6 +-
 man/TIFFSetField.3t             |   20 +-
 man/TIFFWarning.3t              |    6 +-
 man/TIFFWriteDirectory.3t       |    6 +-
 man/TIFFWriteEncodedStrip.3t    |    6 +-
 man/TIFFWriteEncodedTile.3t     |    6 +-
 man/TIFFWriteRawStrip.3t        |    6 +-
 man/TIFFWriteRawTile.3t         |    6 +-
 man/TIFFWriteScanline.3t        |    6 +-
 man/TIFFbuffer.3t               |    2 +-
 man/TIFFcodec.3t                |    2 +-
 man/TIFFmemory.3t               |    2 +-
 man/TIFFquery.3t                |    6 +-
 man/TIFFsize.3t                 |    6 +-
 man/TIFFstrip.3t                |    6 +-
 man/TIFFswab.3t                 |    6 +-
 man/TIFFtile.3t                 |    6 +-
 man/fax2ps.1                    |    6 +-
 man/fax2tiff.1                  |    6 +-
 man/gif2tiff.1                  |    6 +-
 man/libtiff.3t                  |   75 +-
 man/pal2rgb.1                   |    6 +-
 man/ppm2tiff.1                  |    6 +-
 man/ras2tiff.1                  |    6 +-
 man/rgb2ycbcr.1                 |    6 +-
 man/sgi2tiff.1                  |    6 +-
 man/thumbnail.1                 |    6 +-
 man/tiff2bw.1                   |    6 +-
 man/tiff2ps.1                   |    6 +-
 man/tiffcmp.1                   |    6 +-
 man/tiffcp.1                    |    6 +-
 man/tiffdither.1                |    6 +-
 man/tiffdump.1                  |    6 +-
 man/tiffgt.1                    |    6 +-
 man/tiffinfo.1                  |    6 +-
 man/tiffmedian.1                |    6 +-
 man/tiffsplit.1                 |    6 +-
 man/tiffsv.1                    |    6 +-
 port/Makefile.in                |    6 +-
 port/install.sh.in              |    6 +-
 tools/Makefile.in               |    6 +-
 tools/Makefile.lcc              |    6 +-
 tools/fax2ps.c                  |    6 +-
 tools/fax2tiff.c                |    6 +-
 tools/gif2tiff.c                |   13 +-
 tools/pal2rgb.c                 |    6 +-
 tools/ppm2tiff.c                |    6 +-
 tools/ras2tiff.c                |    6 +-
 tools/rasterfile.h              |    2 +-
 tools/rgb2ycbcr.c               |    6 +-
 tools/sgi2tiff.c                |    6 +-
 tools/sgigt.c                   |   18 +-
 tools/sgisv.c                   |    6 +-
 tools/thumbnail.c               |    6 +-
 tools/tiff2bw.c                 |    6 +-
 tools/tiff2ps.c                 |   55 +-
 tools/tiffcmp.c                 |    6 +-
 tools/tiffcp.c                  |   71 +-
 tools/tiffdither.c              |    6 +-
 tools/tiffdump.c                |    8 +-
 tools/tiffinfo.c                |    6 +-
 tools/tiffmedian.c              |    9 +-
 tools/tiffsplit.c               |    6 +-
 166 files changed, 6170 insertions(+), 725 deletions(-)
 create mode 100644 contrib/mfs/README
 create mode 100644 contrib/mfs/mfs_file.c
 create mode 100644 contrib/pds/README
 create mode 100644 contrib/pds/tif_imageiter.c
 create mode 100644 contrib/pds/tif_imageiter.h
 create mode 100644 contrib/pds/tif_pdsdirread.c
 create mode 100644 contrib/pds/tif_pdsdirwrite.c
 create mode 100644 contrib/ras/README
 create mode 100644 contrib/winnt/README.console
 create mode 100644 libtiff/tif_luv.c
 create mode 100644 libtiff/uvcode.h

diff --git a/COPYRIGHT b/COPYRIGHT
index b9fc9fe2..82821861 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (c) 1988-1996 Sam Leffler
-Copyright (c) 1991-1996 Silicon Graphics, Inc.
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 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
diff --git a/Makefile.in b/Makefile.in
index 6389aef0..10c5b56a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,12 +1,12 @@
 #! smake
-#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.58 1997/02/21 01:20:19 sam Exp $
+#	$Header: /d1/sam/tiff/RCS/Makefile.in,v 1.62 1997/08/29 23:24:06 sam Exp $
 #
 # @WARNING@
 #
 # Tag Image File Format Library
 #
-# Copyright (c) 1988-1996 Sam Leffler
-# Copyright (c) 1991-1996 Silicon Graphics, Inc.
+# Copyright (c) 1988-1997 Sam Leffler
+# Copyright (c) 1991-1997 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
@@ -131,6 +131,7 @@ TIFFFILES=\
 	    libtiff/tiffconf.h			\
 	    libtiff/tiffio.h			\
 	    libtiff/tiffiop.h			\
+	    libtiff/uvcode.h			\
 	    libtiff/mkg3states.c		\
 	    libtiff/mkspans.c			\
 	    libtiff/mkversion.c			\
@@ -153,6 +154,7 @@ TIFFFILES=\
 	    libtiff/tif_flush.c			\
 	    libtiff/tif_getimage.c		\
 	    libtiff/tif_jpeg.c			\
+	    libtiff/tif_luv.c			\
 	    libtiff/tif_lzw.c			\
 	    libtiff/tif_msdos.c			\
 	    libtiff/tif_next.c			\
@@ -315,22 +317,69 @@ CONTRIBFILES=\
 		contrib/dbs/xtiff/patchlevel.h	\
 		contrib/dbs/xtiff/xtiff.c	\
 		contrib/dbs/xtiff/xtifficon.h	\
-	contrib/ras/ras2tif.c			\
-	contrib/ras/tif2ras.c			\
+	contrib/ras/README			\
+	    contrib/ras/ras2tif.c		\
+	    contrib/ras/tif2ras.c		\
 	contrib/vms/libtiff/makevms.com		\
 	    contrib/vms/libtiff/tiff.opt	\
 	    contrib/vms/libtiff/tiffshraxp.opt	\
 	    contrib/vms/libtiff/tiffshrvax.opt	\
 	    contrib/vms/libtiff/tiffvec.mar	\
 	    contrib/vms/tools/makevms.com	\
-	contrib/tags				\
-	contrib/mac-mpw				\
-	contrib/acorn				\
-	contrib/win32				\
-	contrib/win95				\
-	contrib/winnt				\
-	contrib/mac-cw				\
-	contrib/dosdjgpp			\
+	contrib/tags/README			\
+	    contrib/tags/Makefile.gcc		\
+	    contrib/tags/Makefile.mpw		\
+	    contrib/tags/listtif.c		\
+	    contrib/tags/maketif.c		\
+	    contrib/tags/xtif_dir.c		\
+	    contrib/tags/xtiffio.h		\
+	    contrib/tags/xtiffiop.h		\
+	contrib/mac-mpw/README			\
+	    contrib/mac-mpw/BUILD.mpw		\
+	    contrib/mac-mpw/libtiff.make	\
+	    contrib/mac-mpw/mactrans.c		\
+	    contrib/mac-mpw/port.make		\
+	    contrib/mac-mpw/tools.make		\
+	    contrib/mac-mpw/top.make		\
+	contrib/acorn/ReadMe			\
+	    contrib/acorn/Makefile		\
+	    contrib/acorn/SetVars		\
+	    contrib/acorn/cleanlib		\
+	    contrib/acorn/convert		\
+	    contrib/acorn/install		\
+	contrib/win32/README			\
+	    contrib/win32/dllshell.c		\
+	    contrib/win32/libtiff.def		\
+	contrib/win95/README			\
+	    contrib/win95/Makefile.w95		\
+	    contrib/win95/tiff2dib.c		\
+	contrib/winnt/README			\
+	    contrib/winnt/README.console	\
+	    contrib/winnt/fax3sm.c		\
+	    contrib/winnt/libtiff.def		\
+	    contrib/winnt/libtiff.mak		\
+	    contrib/winnt/libtiff.vcp		\
+	    contrib/winnt/version.h		\
+	contrib/mac-cw/README			\
+	    contrib/mac-cw/Makefile.script	\
+	    contrib/mac-cw/mac_main.c		\
+	    contrib/mac-cw/mac_main.h		\
+	    contrib/mac-cw/metrowerks.note	\
+	    contrib/mac-cw/mkg3_main.c		\
+	    contrib/mac-cw/version.h		\
+	contrib/dosdjgpp/README			\
+	    contrib/dosdjgpp/Makefile.lib	\
+	    contrib/dosdjgpp/Makefile.tools	\
+	    contrib/dosdjgpp/Makefile.top	\
+	    contrib/dosdjgpp/conf.bat		\
+	    contrib/dosdjgpp/port.h		\
+	contrib/mfs/README			\
+	    contrib/mfs/mfs_file.c		\
+	contrib/pds/README			\
+	    contrib/pds/tif_imageiter.c		\
+	    contrib/pds/tif_imageiter.h		\
+	    contrib/pds/tif_pdsdirread.c	\
+	    contrib/pds/tif_pdsdirwrite.c	\
 	${NULL}
 DISTFILES=\
 	${TIFFFILES}				\
diff --git a/README b/README
index edeff123..5a806052 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-$Header: /usr/people/sam/tiff/RCS/README,v 1.27 1996/01/10 19:31:42 sam Exp $
+$Header: /d1/sam/tiff/RCS/README,v 1.28 1997/08/29 21:45:14 sam Exp $
 
 TIFF Software Distribution
 --------------------------
@@ -37,8 +37,8 @@ also be interested in knowing about it and, hopefully, be acknowledged.
 
 The legal way of saying that is:
 
-Copyright (c) 1988-1996 Sam Leffler
-Copyright (c) 1991-1996 Silicon Graphics, Inc.
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 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
diff --git a/TODO b/TODO
index 3fd94828..e434fb52 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-#	$Header: /usr/people/sam/tiff/RCS/TODO,v 1.4 1996/02/09 22:09:00 sam Exp $
+#	$Header: /d1/sam/tiff/RCS/TODO,v 1.4 1996/02/09 22:09:00 sam Exp $
 
 o tiffcmp read data by strip/tile instead of scanline
 o YCbCr sampling support
diff --git a/config.site b/config.site
index eafd1da1..3bf150ff 100644
--- a/config.site
+++ b/config.site
@@ -1,9 +1,9 @@
-# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.13 1996/06/05 21:24:33 sam Exp $
+# $Header: /d1/sam/tiff/RCS/config.site,v 1.14 1997/08/29 21:45:16 sam Exp $
 #
 # TIFF Software
 #
-# Copyright (c) 1990-1996 Sam Leffler
-# Copyright (c) 1991-1996 Silicon Graphics, Inc.
+# Copyright (c) 1990-1997 Sam Leffler
+# Copyright (c) 1991-1997 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
diff --git a/configure b/configure
index 5149317f..629461c2 100755
--- a/configure
+++ b/configure
@@ -1,10 +1,10 @@
 #!/bin/sh
-#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.56 1997/01/28 00:39:52 sam Exp $
+#	$Header: /d1/sam/tiff/RCS/configure,v 1.58 1997/08/29 22:30:51 sam Exp $
 #
 # Tag Image File Format (TIFF) Software
 #
-# Copyright (c) 1988-1996 Sam Leffler
-# Copyright (c) 1991-1996 Silicon Graphics, Inc.
+# Copyright (c) 1988-1997 Sam Leffler
+# Copyright (c) 1991-1997 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
@@ -147,7 +147,7 @@ do
     -target|--target)		ac_prev=TARGET;;
     -target=*|--target=*)	TARGET="$ac_optarg" ;;
     -version|--version)
-	echo "This is TIFF configure $Revision: 1.56 $"
+	echo "This is TIFF configure $Revision: 1.58 $"
 	exit 0
 	;;
     -help|--help)		usage; exit 0;;
@@ -1117,12 +1117,12 @@ if [ "$DSO" = auto ]; then
         DSOOPTS='-fpic -shared'
         LIBCOPTS=-fpic
         DSO=HPUX
+	TIFFLIBREF="-Wl,+s,+b${DIR_LIB}"' -L${DEPTH}/libtiff -ltiff'
         ;;		 
     *-hpux*)
 	DSOSUF=sl
 	DSOOPTS='-b'
 	LIBCOPTS="+Z"
-#	LIBPORT="-Wl,+b${DIR_LIB}"
 	DSO=HPUX
 	TIFFLIBREF="-Wl,+s,+b${DIR_LIB}"' -L${DEPTH}/libtiff -ltiff'
 	;;
diff --git a/contrib/dosdjgpp/Makefile.lib b/contrib/dosdjgpp/Makefile.lib
index fd4fa764..f0ccff3f 100644
--- a/contrib/dosdjgpp/Makefile.lib
+++ b/contrib/dosdjgpp/Makefile.lib
@@ -1,4 +1,4 @@
-#       $Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.in,v 1.28 1996/02/09 05:55:00 sam Exp $
+#       $Header: /d1/sam/tiff/contrib/dosdjgpp/RCS/Makefile.lib,v 1.1 1997/08/27 22:39:50 sam Exp $
 #
 # manually derived from Makefile.in for DJGPP v2.x (GNU C for DOS/386).
 #
diff --git a/contrib/dosdjgpp/Makefile.tools b/contrib/dosdjgpp/Makefile.tools
index 68869b77..d4928d62 100644
--- a/contrib/dosdjgpp/Makefile.tools
+++ b/contrib/dosdjgpp/Makefile.tools
@@ -1,4 +1,4 @@
-#	$Header: /usr/people/sam/tiff/tools/RCS/Makefile.in,v 1.17 1996/02/09 05:55:00 sam Exp $
+#	$Header: /d1/sam/tiff/contrib/dosdjgpp/RCS/Makefile.tools,v 1.1 1997/08/27 22:39:50 sam Exp $
 #
 # manually derived from Makefile.in for DJGPP v2.x (GNU C for DOS/386).
 #
diff --git a/contrib/dosdjgpp/Makefile.top b/contrib/dosdjgpp/Makefile.top
index 1d60696e..d6bcee4c 100644
--- a/contrib/dosdjgpp/Makefile.top
+++ b/contrib/dosdjgpp/Makefile.top
@@ -1,5 +1,5 @@
 #! smake
-#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.44 1996/02/09 21:29:19 sam Exp $
+#	$Header: /d1/sam/tiff/contrib/dosdjgpp/RCS/Makefile.top,v 1.1 1997/08/27 22:39:50 sam Exp $
 #
 # manually derived from Makefile.in (though basically nothing remains)
 # for DJGPP v2.x (GNU C for DOS/386).
diff --git a/contrib/mfs/README b/contrib/mfs/README
new file mode 100644
index 00000000..6f9befbc
--- /dev/null
+++ b/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/contrib/mfs/mfs_file.c b/contrib/mfs/mfs_file.c
new file mode 100644
index 00000000..fa408dab
--- /dev/null
+++ b/contrib/mfs/mfs_file.c
@@ -0,0 +1,579 @@
+/*
+--------------------------------------------------------------------------------
+-	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;
+	}
+}
+
diff --git a/contrib/pds/README b/contrib/pds/README
new file mode 100644
index 00000000..b9abc6b3
--- /dev/null
+++ b/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

(Patch may be truncated, please check the link at the top of this post.)