Received: by whizzer.wpd.sgi.com (/911001.SGI)
	 id AA06495; Fri, 11 Feb 94 14:49:43 GMT
Received: from sgi.sgi.com by whizzer.wpd.sgi.com via SMTP (/911001.SGI)
	for /usr/people/sam/majordomo/wrapper resend -l tiff -h sgi.sgi.com -f tiff-owner -s -m "-oi -odq -om" tiff-list id AA06488; Fri, 11 Feb 94 06:49:40 -0800
Received: from postman.osf.org by sgi.sgi.com via SMTP (931110.SGI/910110.SGI)
	for tiff-relay@whizzer.wpd.sgi.com id AA15400; Fri, 11 Feb 94 06:49:37 -0800
Received: from woof.osf.org by postman.osf.org (5.64+/OSF 1.0)
	id AA04434; Fri, 11 Feb 94 09:40:37 -0500
Message-Id: <9402111440.AA04434@postman.osf.org>
To: Bjorn Brox <brox@dms.corena.no>
Cc: pingel@daimi.aau.dk (S|ren Pingel Dalsgaard), tiff@sgi.sgi.com
Subject: Re: LibTIFF working on MS-Windows 3.1. 
In-Reply-To: Your message of Fri, 11 Feb 1994 10:39:11 +0100.
             <9402110939.AA24791@senja> 
Date: Fri, 11 Feb 1994 09:40:36 -0500
From: Jie Yao <jyao@osf.org>
Sender: tiff-owner@sgi.sgi.com


On  Fri, 11 Feb 1994 10,  brox@dms.corena.no (Bjorn P. Brox) wrote:
>  
>  > 
>  > Good News! (for some, anyway :-)
>  > 
>  > I have been toying with LibTIFF for a long time, but three days ago I took
>  > a serious look at the problems in generating LZW compressed pictures and
>  > other possible obstructions. My boss i paying me to do so, and then we
>  > though we would let YOU be beta-testers if you would like.
>  > 
>  > The following changes has been made to the library:
>  > 
>  > o Errors and Warnings are reported in MessageBoxes - not via fprintf.
>  
>  You should check what the library offers you!
>  
>  The DEFAULT is to use fprintf.
>  This is a library, not an application.
>  
>  The application using the library are free to define it's own error and
>  warnings functions without modifying the library!
>  RTFM TIFFSetWarningHandler() and TIFFSetErrorHandler() in
>  man/man3/TIFFWarning.3t and man/man3/TIFFError.3t
>  
>  Example below:
>  
>  #include <stdarg.h>     /* ANSI variant of varargs */
>  #include <stdlib.h>
>  
>  ...
>  
>  static void MY_tiffWarningHandler(const char *module, const char *fmt, ...)
>  {
>      char buf[512];
>  
>      va_list args;
>      va_start(args, fmt);
>      vsprintf(buf, (const char *)fmt, args);
>      va_end(args);
>  
>      DisplayMessage(WarnType, buf);
>  }
>  
>  static void MY_tiffErrorHandler(const char *module, const char *fmt, ...)
>  {
>      char buf[512];
>  
>      va_list args;
>      va_start(args, fmt);
>      vsprintf(buf, (const char *)fmt, args);
>      va_end(args);
>  
>      DisplayMessage(ErrType, buf);
>  }
>  
>  main(int argc, char *argv[])
>  {
>      (void)TIFFSetWarningHandler(MY_tiffWarningHandler);
>      (void)TIFFSetErrorHandler(MY_tiffErrorHandler);
>  
>  ...
>  
>  }
>  
>  > 
>  > o TiffPrintDirectory is not available (right now) because it uses fprintf.
>  
>  Wrong again - this is a library.
>  The TiffPrintDirectory is used for debug purpose, and
>  you are free to write your own variant - again without modifying the
>  library.
>  

As I remember, when I try to compile libtiff.dll under win 3, I used _WINDOWS and
_WINDLL. If they are defeined, stdin, stdout, stderr become undefined. I think
Windows 3.1 doesn't have the concept of standard input/output. I think the
right fix for now is simply to put these fprintf's inside #ifndef _WINDOWS. The
more correct way for libtiff to do, I think, is to have these routines set a
variable like TIFFerrno, The library should never report error messages on its
own way. If it fails, return a failure. The application then check the error
number, and report in what ever way it likes. Currently, in the windows 3.1,
we have to set error/warning handler anyway. I think to have them do nothing
would be a good idea.

---
Jie Yao                   jyao@osf.org
Open Software Foundation  uunet!osf.org!jyao


