libtiff: v3.4beta028 release

From 98ce01d4275de67a73e57548172d9a35caa84b92 Mon Sep 17 00:00:00 2001
From: Sam Leffler <[EMAIL REDACTED]>
Date: Wed, 10 Jan 1996 20:37:08 +0000
Subject: [PATCH] v3.4beta028 release

---
 COPYRIGHT                  |    4 +-
 Makefile.in                |   10 +-
 README                     |    6 +-
 config.guess               |    2 +-
 config.site                |    6 +-
 configure                  |   53 +-
 contrib/win95/Makefile.w95 |  134 +++
 contrib/win95/README       |   50 +
 contrib/win95/tiff2dib.c   |  372 +++++++
 contrib/winnt/README       |   26 +
 contrib/winnt/fax3sm.c     | 1046 +++++++++++++++++++
 contrib/winnt/libtiff.def  |   72 ++
 contrib/winnt/libtiff.mak  | 1947 ++++++++++++++++++++++++++++++++++++
 contrib/winnt/libtiff.vcp  |  Bin 0 -> 17408 bytes
 contrib/winnt/version.h    |    1 +
 dist/newversion            |    6 +-
 dist/tiff.alpha            |    2 +-
 dist/tiff.spec             |    6 +-
 html/Makefile.in           |    6 +-
 html/index.html            |    4 +-
 libtiff/Makefile.acorn     |  112 +++
 libtiff/Makefile.in        |   10 +-
 libtiff/Makefile.lcc       |    6 +-
 libtiff/Makefile.msc       |    6 +-
 libtiff/mkg3states.c       |    6 +-
 libtiff/mkspans.c          |    6 +-
 libtiff/mkversion.c        |   10 +-
 libtiff/t4.h               |    6 +-
 libtiff/tif_acorn.c        |  519 ++++++++++
 libtiff/tif_apple.c        |    6 +-
 libtiff/tif_atari.c        |    6 +-
 libtiff/tif_aux.c          |    6 +-
 libtiff/tif_close.c        |    6 +-
 libtiff/tif_codec.c        |   20 +-
 libtiff/tif_compress.c     |   44 +-
 libtiff/tif_dir.c          |   58 +-
 libtiff/tif_dir.h          |   17 +-
 libtiff/tif_dirinfo.c      |    6 +-
 libtiff/tif_dirread.c      |    9 +-
 libtiff/tif_dirwrite.c     |    8 +-
 libtiff/tif_dumpmode.c     |    6 +-
 libtiff/tif_error.c        |    6 +-
 libtiff/tif_fax3.c         |   75 +-
 libtiff/tif_fax3.h         |    6 +-
 libtiff/tif_flush.c        |    6 +-
 libtiff/tif_getimage.c     |    6 +-
 libtiff/tif_jpeg.c         |   15 +-
 libtiff/tif_lzw.c          |    6 +-
 libtiff/tif_msdos.c        |    6 +-
 libtiff/tif_next.c         |    6 +-
 libtiff/tif_open.c         |  149 ++-
 libtiff/tif_packbits.c     |    6 +-
 libtiff/tif_predict.c      |    6 +-
 libtiff/tif_predict.h      |    6 +-
 libtiff/tif_print.c        |    6 +-
 libtiff/tif_read.c         |    6 +-
 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         |    6 +-
 libtiff/tif_win32.c        |    6 +-
 libtiff/tif_write.c        |    6 +-
 libtiff/tif_zip.c          |    6 +-
 libtiff/tiff.h             |   19 +-
 libtiff/tiffcomp.h         |    6 +-
 libtiff/tiffconf.h         |    6 +-
 libtiff/tiffio.h           |    6 +-
 libtiff/tiffiop.h          |   13 +-
 man/TIFFOpen.3t            |  101 +-
 man/libtiff.3t             |    5 +-
 man/tiffcp.1               |   18 +-
 port/Makefile.in           |    6 +-
 port/install.sh.in         |    6 +-
 tools/Makefile.in          |    6 +-
 tools/Makefile.lcc         |    6 +-
 tools/fax2ps.c             |   11 +-
 tools/fax2tiff.c           |    6 +-
 tools/gif2tiff.c           |    6 +-
 tools/pal2rgb.c            |    6 +-
 tools/ppm2tiff.c           |    6 +-
 tools/ras2tiff.c           |    8 +-
 tools/rgb2ycbcr.c          |    6 +-
 tools/sgi2tiff.c           |    6 +-
 tools/sgigt.c              |    6 +-
 tools/sgisv.c              |    6 +-
 tools/thumbnail.c          |    6 +-
 tools/tiff2bw.c            |    6 +-
 tools/tiff2ps.c            |    6 +-
 tools/tiffcmp.c            |    6 +-
 tools/tiffcp.c             |  180 ++--
 tools/tiffdither.c         |    6 +-
 tools/tiffdump.c           |   11 +-
 tools/tiffinfo.c           |    6 +-
 tools/tiffsplit.c          |    6 +-
 99 files changed, 5058 insertions(+), 449 deletions(-)
 create mode 100644 contrib/win95/Makefile.w95
 create mode 100644 contrib/win95/README
 create mode 100644 contrib/win95/tiff2dib.c
 create mode 100644 contrib/winnt/README
 create mode 100644 contrib/winnt/fax3sm.c
 create mode 100644 contrib/winnt/libtiff.def
 create mode 100644 contrib/winnt/libtiff.mak
 create mode 100644 contrib/winnt/libtiff.vcp
 create mode 100644 contrib/winnt/version.h
 create mode 100755 libtiff/Makefile.acorn
 create mode 100755 libtiff/tif_acorn.c

diff --git a/COPYRIGHT b/COPYRIGHT
index 78cb834e..b9fc9fe2 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (c) 1988-1995 Sam Leffler
-Copyright (c) 1991-1995 Silicon Graphics, Inc.
+Copyright (c) 1988-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
diff --git a/Makefile.in b/Makefile.in
index b1dd3b3f..14c79064 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,12 +1,12 @@
 #! smake
-#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.37 1995/10/16 22:01:20 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.41 1996/01/10 19:30:44 sam Exp $
 #
 # @WARNING@
 #
 # Tag Image File Format Library
 #
-# Copyright (c) 1988-1995 Sam Leffler
-# Copyright (c) 1991-1995 Silicon Graphics, Inc.
+# Copyright (c) 1988-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
@@ -109,6 +109,7 @@ TIFFFILES=\
 	libtiff/Makefile.in			\
 	    libtiff/Makefile.lcc		\
 	    libtiff/Makefile.msc		\
+	    libtiff/Makefile.acorn		\
 	    libtiff/t4.h			\
 	    libtiff/tiff.h			\
 	    libtiff/tiffcomp.h			\
@@ -118,6 +119,7 @@ TIFFFILES=\
 	    libtiff/mkg3states.c		\
 	    libtiff/mkspans.c			\
 	    libtiff/mkversion.c			\
+	    libtiff/tif_acorn.c			\
 	    libtiff/tif_apple.c			\
 	    libtiff/tif_atari.c			\
 	    libtiff/tif_aux.c			\
@@ -301,6 +303,8 @@ CONTRIBFILES=\
 	contrib/mac-mpw				\
 	contrib/acorn				\
 	contrib/win32				\
+	contrib/win95				\
+	contrib/winnt				\
 	${NULL}
 DISTFILES=\
 	${TIFFFILES}				\
diff --git a/README b/README
index cb680214..edeff123 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-$Header: /usr/people/sam/tiff/RCS/README,v 1.26 1995/07/01 00:57:02 sam Exp $
+$Header: /usr/people/sam/tiff/RCS/README,v 1.27 1996/01/10 19:31:42 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-1995 Sam Leffler
-Copyright (c) 1991-1995 Silicon Graphics, Inc.
+Copyright (c) 1988-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
diff --git a/config.guess b/config.guess
index 595d40fa..1626b108 100755
--- a/config.guess
+++ b/config.guess
@@ -267,7 +267,7 @@ EOF
     i[34]86:BSD/386:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
-    i[34]86:BSD/OS:*:*)
+    *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
diff --git a/config.site b/config.site
index a680210e..54a1b746 100644
--- a/config.site
+++ b/config.site
@@ -1,9 +1,9 @@
-# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.7 1995/10/10 01:03:54 sam Exp $
+# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.8 1996/01/10 19:31:37 sam Exp $
 #
 # TIFF Software
 #
-# Copyright (c) 1990-1995 Sam Leffler
-# Copyright (c) 1991-1995 Silicon Graphics, Inc.
+# Copyright (c) 1990-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
diff --git a/configure b/configure
index 6211ecef..b68f57b6 100755
--- a/configure
+++ b/configure
@@ -1,10 +1,10 @@
 #!/bin/sh
-#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.26 1995/10/15 23:39:31 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.32 1996/01/10 19:31:39 sam Exp $
 #
 # Tag Image File Format (TIFF) Software
 #
-# Copyright (c) 1988-1995 Sam Leffler
-# Copyright (c) 1991-1995 Silicon Graphics, Inc.
+# Copyright (c) 1988-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
@@ -85,6 +85,7 @@ Options: [defaults in brackets after descriptions]
   --help                  print this message
   --quiet                 do not print `Using ...' messages
   --verbose		  opposite of --quiet
+  --noninteractive        don't ask any questions
   --version               print the version of autoconf that created configure
   --target=TARGET         configure for TARGET [TARGET=HOST]
   --srcdir=DIR            find the sources in DIR [configure dir or ..]
@@ -93,6 +94,7 @@ EOF
 }
 
 QUIET=no
+NONINTERACTIVE=no
 SITE=
 TARGET=
 SRCDIR=
@@ -130,6 +132,7 @@ do
 	;;
     -quiet|--quiet)		QUIET=yes;;
     -verbose|--verbose)		QUIET=no;;
+    -noninteractive|--noninteractive) NONINTERACTIVE=yes;;
     -site|--site)		ac_prev=SITE;;
     -site=*|--site=*)		SITE="$ac_optarg";;
     -srcdir|--srcdir)		ac_prev=SRCDIR;;
@@ -137,7 +140,7 @@ do
     -target|--target)		ac_prev=TARGET;;
     -target=*|--target=*)	TARGET="$ac_optarg" ;;
     -version|--version)
-	echo "This is TIFF configure $Revision: 1.26 $"
+	echo "This is TIFF configure $Revision: 1.32 $"
 	exit 0
 	;;
     -help|--help)		usage; exit 0;;
@@ -183,14 +186,14 @@ test "$SRCDIR" || {
     done
 }
 if [ ! -r $SRCDIR/VERSION ]; then
-    bitch "Can not locate sources in $SRCDIR."
+    bitch "Cannot locate sources in $SRCDIR."
     kill -1 $$
 fi
 SRCDIR=`echo "$SRCDIR" | sed 's;\([^/]\)/*$;\1;'`
 
 if [ -r ${SRCDIR}/tif_version.c ] ; then
     SRCDIR_IS_LIBTIFF=yes
-    PORDOTH=port.h
+    PORTDOTH=port.h
 else
     SRCDIR_IS_LIBTIFF=no
     PORTDOTH=libtiff/port.h
@@ -227,7 +230,11 @@ Note()
 }
 
 Note ""
-Note "Configuring TIFF Software $VERSION."
+if [ $SRCDIR_IS_LIBTIFF = yes ] ; then
+  Note "Configuring TIFF Software (library only) $VERSION."
+else
+  Note "Configuring TIFF Software $VERSION."
+fi
 Note ""
 
 #
@@ -370,6 +377,9 @@ findHeader()
     esac
     for i in ${DIRS_LIBINC}; do
 	test -r $i/$1 && {
+	    case "$i" in
+	    /*) echo "$i/$1"; return ;;
+	    esac
 	    if [ $SRCDIR_IS_LIBTIFF = yes ]; then
 		echo "$i/$1";
 	    else
@@ -558,14 +568,13 @@ fi
 # in the Makefiles.  If not, we add an explicit define
 # for places where recursive calls are made.
 #
-if [ -z "${SETMAKE:-}" ]; then
-M=
-eval `(cat<<'EOF'
+if [ -z "${SETMAKE-}" ]; then
+    if (cat<<'EOF'
+SHELL=/bin/sh
 all:
-	@echo M="${MAKE}"
+	@if [ -n "${MAKE}" ] ; then echo "make sets make"  ; fi
 EOF
-) | $MAKE -f - 2>&5`
-    if [ "$M" ]; then
+) | $MAKE -f - | grep "make sets make" > /dev/null ; then
 	SETMAKE=
     else
 	Note "Looks like $MAKE does not setup MAKE in Makefiles, will compensate."
@@ -584,7 +593,7 @@ if [ -z "$RANLIB" ]; then
     Note "Warning, no ranlib, assuming it's not needed."
     RANLIB=":"
     $RM dummy.a
-    if $AR rcs dummy.a; then
+    if $AR rcs dummy.a >/dev/null 2>&1; then
        AROPTS=crs
        Note "Looks like ar has an s option to build symbol tables."
     fi
@@ -935,7 +944,7 @@ BuildPortDotH()
     CheckFuncDecl floor 'extern double floor(double);' math.h
     CheckFuncDecl ceil 'extern double ceil(double);' math.h
     CheckFuncDecl exp 'extern double exp(double);' math.h
-    CheckFuncDecl pow 'extern double pow(double);' math.h
+    CheckFuncDecl pow 'extern double pow(double, double);' math.h
     CheckFuncDecl read 'extern int read(int, const void*, unsigned int);' unistd.h
     CheckFuncDecl malloc 'extern void* malloc(size_t);' stdlib.h
     CheckFuncDecl realloc 'extern void* realloc(void*, size_t);' stdlib.h
@@ -946,7 +955,7 @@ BuildPortDotH()
     Note "Done creating $PORTDOTH."
 }
 
-if test -f $PORTDOTH && CheckPortDotH; then
+if [ "$PORT" != no ] && test -f $PORTDOTH && CheckPortDotH; then
     Note ""
     Note "Using previously created $PORTDOTH."
 else
@@ -1381,7 +1390,7 @@ EOF
     fi
 }
 
-if [ $QUIET = no ]; then
+if [ $NONINTERACTIVE = no ] ; then
     ok=skip
     while [ "$ok" != y ] && [ "$ok" != yes ]; do
 	if [ "$ok" != skip ]; then
@@ -1467,12 +1476,12 @@ relativize()
     if [ $SRCDIR_IS_LIBTIFF = no ]; then
 	(for i do
 	    case "$i" in
-	    ./*|../*)	echo "../$i" ;;
-	    *)		echo "$i" ;;
+	    /*)		echo "$i" ;;
+	    *)		echo "../$i" ;;
 	    esac
 	done) | tr '\012' ' '
     else
-	echo "$@"
+	(for i do echo "$i" ; done ) | tr '\012' ' '
     fi
 }
 #
@@ -1483,13 +1492,13 @@ makeIncArgs()
 {
     (for i do
         case "$i" in
-	./*|../*)
+	/*)  echo "-I$i" ;;
+	*)
 	    if [ $SRCDIR_IS_LIBTIFF = yes ]; then
 		echo "-I$i" 
 	    else
 		echo "-I../$i" 
 	    fi ;;
-	*)  echo "-I$i" ;;
         esac
     done) | tr '\012' ' '
 }
diff --git a/contrib/win95/Makefile.w95 b/contrib/win95/Makefile.w95
new file mode 100644
index 00000000..3f461ef5
--- /dev/null
+++ b/contrib/win95/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/contrib/win95/README b/contrib/win95/README
new file mode 100644
index 00000000..edb05d33
--- /dev/null
+++ b/contrib/win95/README
@@ -0,0 +1,50 @@
+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/contrib/win95/tiff2dib.c b/contrib/win95/tiff2dib.c
new file mode 100644
index 00000000..f5d4040f
--- /dev/null
+++ b/contrib/win95/tiff2dib.c
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * 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;
+      }
+}
diff --git a/contrib/winnt/README b/contrib/winnt/README
new file mode 100644
index 00000000..68c64410
--- /dev/null
+++ b/contrib/winnt/README
@@ -0,0 +1,26 @@
+Date: Fri, 10 Nov 1995 13:02:33 -0800
+Message-Id: <199511102102.NAA07993@lido>
+To: tiff@sgi.engr.sgi.com
+Subject: Contribution: libtiff for Windows-nt
+Reply-To: Dave Dyer <ddyer@triple-i.com>
+Sender: owner-tiff@sgi.engr.sgi.com
+Precedence: bulk
+
+
+Since I needed it, and the support for windows-nt versions of libtiff
+is sketchy at best, I packaged up my port of libtiff v3.4beta024 
+to windows-nt.
+
+	ftp://torii.triple-i.com/pub/ddyer/libtiff.tar.gz
+
+this contains "libtiff.mak", a makefile for microsoft visual c++,
+a couple of hand-built .h and .c files (corresponding to those which
+are automatically constructed by unix makefiles) and static libraries
+compiled for intel and dec alpha.
+
+As customary, I make no claims regarding the completeness or
+correctness of these libraries, and accept no responsibily for any
+mishaps you may have as a result of using them.  They work for me.
+
+I hope Sam will copy and incorporate this into the "contrib" section
+of the next libtiff release.
diff --git a/contrib/winnt/fax3sm.c b/contrib/winnt/fax3sm.c
new file mode 100644
index 00000000..1d0f34a3
--- /dev/null
+++ b/contrib/winnt/fax3sm.c
@@ -0,0 +1,1046 @@
+/* WARNING, this file was automatically generated by the
+    mkg3states program */
+#include "tiff.h"
+#include "tif_fax3.h"
+ const  TIFFFaxTabEnt TIFFFaxMainTable[128] = {

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