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