tiffcomp.h
Upload User: kairuinn
Upload Date: 2009-02-07
Package Size: 2922k
Code Size: 6k
Category:

Graph program

Development Platform:

Visual C++

  1. /* $Header: /cvsroot/osrs/libtiff/libtiff/tiffcomp.h,v 1.3 2000/11/13 14:23:53 warmerda Exp $ */
  2. /*
  3.  * Copyright (c) 1990-1997 Sam Leffler
  4.  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and 
  7.  * its documentation for any purpose is hereby granted without fee, provided
  8.  * that (i) the above copyright notices and this permission notice appear in
  9.  * all copies of the software and related documentation, and (ii) the names of
  10.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  11.  * publicity relating to the software without the specific, prior written
  12.  * permission of Sam Leffler and Silicon Graphics.
  13.  * 
  14.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  15.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  16.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  17.  * 
  18.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23.  * OF THIS SOFTWARE.
  24.  */
  25. #ifndef _COMPAT_
  26. #define _COMPAT_
  27. /*
  28.  * This file contains a hodgepodge of definitions and
  29.  * declarations that are needed to provide compatibility
  30.  * between the native system and the base implementation
  31.  * that the library assumes.
  32.  *
  33.  * NB: This file is a mess.
  34.  */
  35. /*
  36.  * Setup basic type definitions and function declaratations.
  37.  */
  38. /*
  39.  * Simplify Acorn RISC OS identifier (to avoid confusion with Acorn RISC iX
  40.  * and with defunct Unix Risc OS)
  41.  * No need to specify __arm - hey, Acorn might port the OS, no problem here!
  42.  */
  43. #ifdef __acornriscos
  44. #undef __acornriscos
  45. #endif
  46. #if defined(__acorn) && defined(__riscos)
  47. #define __acornriscos
  48. #endif
  49. #if defined(__MWERKS__) || defined(THINK_C)
  50. #include <unix.h>
  51. #include <math.h>
  52. #endif
  53. #include <stdio.h>
  54. #if defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
  55. #include <types.h>
  56. #elif !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acornriscos) && !defined(applec)
  57. #include <sys/types.h>
  58. #endif
  59. #if defined(VMS)
  60. #include <file.h>
  61. #include <unixio.h>
  62. #elif !defined(__acornriscos)
  63. #include <fcntl.h>
  64. #endif
  65. /*
  66.  * This maze of checks controls defines or not the
  67.  * target system has BSD-style typdedefs declared in
  68.  * an include file and/or whether or not to include
  69.  * <unistd.h> to get the SEEK_* definitions.  Some
  70.  * additional includes are also done to pull in the
  71.  * appropriate definitions we're looking for.
  72.  */
  73. #if defined(__MWERKS__) || defined(THINK_C) || defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
  74. #include <stdlib.h>
  75. #define BSDTYPES
  76. #define HAVE_UNISTD_H 0
  77. #elif (defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) || defined(_WIN32)) && !defined(unix)
  78. #define BSDTYPES
  79. #elif defined(OS2_16) || defined(OS2_32)
  80. #define BSDTYPES
  81. #elif defined(__acornriscos)
  82. #include <stdlib.h>
  83. #define BSDTYPES
  84. #define HAVE_UNISTD_H 0
  85. #elif defined(VMS)
  86. #define HAVE_UNISTD_H 0
  87. #else
  88. #define HAVE_UNISTD_H 1
  89. #endif
  90. /*
  91.  * The library uses the ANSI C/POSIX SEEK_*
  92.  * definitions that should be defined in unistd.h
  93.  * (except on system where they are in stdio.h and
  94.  * there is no unistd.h).
  95.  */
  96. #if !defined(SEEK_SET) && HAVE_UNISTD_H
  97. #include <unistd.h>
  98. #endif
  99. /*
  100.  * The library uses memset, memcpy, and memcmp.
  101.  * ANSI C and System V define these in string.h.
  102.  */
  103. #include <string.h>
  104. /*
  105.  * The BSD typedefs are used throughout the library.
  106.  * If your system doesn't have them in <sys/types.h>,
  107.  * then define BSDTYPES in your Makefile.
  108.  */
  109. #if defined(BSDTYPES)
  110. typedef unsigned char u_char;
  111. typedef unsigned short u_short;
  112. typedef unsigned int u_int;
  113. typedef unsigned long u_long;
  114. #endif
  115. /*
  116.  * dblparam_t is the type that a double precision
  117.  * floating point value will have on the parameter
  118.  * stack (when coerced by the compiler).
  119.  */
  120. /* Note: on MacPowerPC "extended" is undefined. So only use it for 68K-Macs */
  121. #if defined(__SC__) || defined(THINK_C)
  122. typedef extended dblparam_t;
  123. #else
  124. typedef double dblparam_t;
  125. #endif
  126. /*
  127.  * If your compiler supports inline functions, then
  128.  * set INLINE appropriately to get the known hotspots
  129.  * in the library expanded inline.
  130.  */
  131. #if defined(__GNUC__)
  132. #if defined(__STRICT_ANSI__)
  133. #define INLINE __inline__
  134. #else
  135. #define INLINE inline
  136. #endif
  137. #else /* !__GNUC__ */
  138. #define INLINE
  139. #endif
  140. /*
  141.  * GLOBALDATA is a macro that is used to define global variables
  142.  * private to the library.  We use this indirection to hide
  143.  * brain-damage in VAXC (and GCC) under VAX/VMS.  In these
  144.  * environments the macro places the variable in a non-shareable
  145.  * program section, which ought to be done by default (sigh!)
  146.  *
  147.  * Apparently DEC are aware of the problem as this behaviour is the
  148.  * default under VMS on AXP.
  149.  *
  150.  * The GNU C variant is untested.
  151.  */
  152. #if defined(VAX) && defined(VMS)
  153. #if defined(VAXC)
  154. #define GLOBALDATA(TYPE,NAME) extern noshare TYPE NAME
  155. #endif
  156. #if defined(__GNUC__)
  157. #define GLOBALDATA(TYPE,NAME) extern TYPE NAME 
  158. asm("_$$PsectAttributes_NOSHR$$" #NAME)
  159. #endif
  160. #else /* !VAX/VMS */
  161. #define GLOBALDATA(TYPE,NAME) extern TYPE NAME
  162. #endif
  163. #if defined(__acornriscos)
  164. /*
  165.  * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
  166.  * on C alone. For that reason, the relevant functions are
  167.  * implemented in tif_acorn.c, and the elements from the header
  168.  * file are included here.
  169.  */
  170. #if defined(__cplusplus)
  171. #include <osfcn.h>
  172. #else
  173. #define O_RDONLY 0
  174. #define O_WRONLY 1
  175. #define O_RDWR 2
  176. #define O_APPEND 8
  177. #define O_CREAT 0x200
  178. #define O_TRUNC 0x400
  179. typedef long off_t;
  180. extern int open(const char *name, int flags, int mode);
  181. extern int close(int fd);
  182. extern int write(int fd, const char *buf, int nbytes);
  183. extern int read(int fd, char *buf, int nbytes);
  184. extern off_t lseek(int fd, off_t offset, int whence);
  185. extern int creat(const char *path, int mode);
  186. #endif /* __cplusplus */
  187. #endif /* __acornriscos */
  188. /* Bit and byte order, the default is MSB to LSB */
  189. #ifdef VMS
  190. #undef HOST_FILLORDER
  191. #undef HOST_BIGENDIAN
  192. #define HOST_FILLORDER FILLORDER_LSB2MSB
  193. #define HOST_BIGENDIAN 0
  194. #endif
  195. #endif /* _COMPAT_ */