]> git.saurik.com Git - wxWidgets.git/blob - src/tiff/tiffcomp.h
2.4 -> 2.5; build in another directory than source one; mention --disable-shared
[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 #ifdef __MACH__
56 #include <sys/types.h>
57 #else
58 #include <unix.h>
59 #include <math.h>
60 #endif
61 #endif
62
63 #include <stdio.h>
64
65 #if defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
66 #include <types.h>
67 #elif !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acornriscos) && !defined(applec)
68 #include <sys/types.h>
69 #endif
70
71 #if defined(VMS)
72 #include <file.h>
73 #include <unixio.h>
74 #elif !defined(__acornriscos)
75 #include <fcntl.h>
76 #endif
77
78 /*
79 * This maze of checks controls defines or not the
80 * target system has BSD-style typdedefs declared in
81 * an include file and/or whether or not to include
82 * <unistd.h> to get the SEEK_* definitions. Some
83 * additional includes are also done to pull in the
84 * appropriate definitions we're looking for.
85 */
86 #if defined(__MWERKS__) || defined(THINK_C) || defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
87 #include <stdlib.h>
88 #define BSDTYPES
89 #define HAVE_UNISTD_H 0
90 #elif defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
91 #define BSDTYPES
92 #elif defined(__DJGPP__)
93 #define BSDTYPES
94 #elif defined(OS2_16) || defined(OS2_32)
95 #define BSDTYPES
96 #elif defined(__acornriscos)
97 #include <stdlib.h>
98 #define BSDTYPES
99 #define HAVE_UNISTD_H 0
100 #elif defined(VMS)
101 #define HAVE_UNISTD_H 0
102 #else
103 #define HAVE_UNISTD_H 1
104 #endif
105
106 /*
107 * The library uses the ANSI C/POSIX SEEK_*
108 * definitions that should be defined in unistd.h
109 * (except on system where they are in stdio.h and
110 * there is no unistd.h).
111 */
112 #if !defined(SEEK_SET) && HAVE_UNISTD_H
113 #include <unistd.h>
114 #endif
115
116 /*
117 * The library uses memset, memcpy, and memcmp.
118 * ANSI C and System V define these in string.h.
119 */
120 #include <string.h>
121
122 /*
123 * The BSD typedefs are used throughout the library.
124 * If your system doesn't have them in <sys/types.h>,
125 * then define BSDTYPES in your Makefile.
126 */
127 #if defined(BSDTYPES)
128 typedef unsigned char u_char;
129 typedef unsigned short u_short;
130 typedef unsigned int u_int;
131 typedef unsigned long u_long;
132 #endif
133
134 /*
135 * dblparam_t is the type that a double precision
136 * floating point value will have on the parameter
137 * stack (when coerced by the compiler).
138 */
139 /* Note: on MacPowerPC "extended" is undefined. So only use it for 68K-Macs */
140 #if defined(__SC__) || defined(THINK_C)
141 typedef extended dblparam_t;
142 #else
143 typedef double dblparam_t;
144 #endif
145
146 /*
147 * If your compiler supports inline functions, then
148 * set INLINE appropriately to get the known hotspots
149 * in the library expanded inline.
150 */
151 #if defined(__GNUC__)
152 #if defined(__STRICT_ANSI__)
153 #define INLINE __inline__
154 #else
155 #define INLINE inline
156 #endif
157 #else /* !__GNUC__ */
158 #define INLINE
159 #endif
160
161 /*
162 * GLOBALDATA is a macro that is used to define global variables
163 * private to the library. We use this indirection to hide
164 * brain-damage in VAXC (and GCC) under VAX/VMS. In these
165 * environments the macro places the variable in a non-shareable
166 * program section, which ought to be done by default (sigh!)
167 *
168 * Apparently DEC are aware of the problem as this behaviour is the
169 * default under VMS on AXP.
170 *
171 * The GNU C variant is untested.
172 */
173 #if defined(VAX) && defined(VMS)
174 #if defined(VAXC)
175 #define GLOBALDATA(TYPE,NAME) extern noshare TYPE NAME
176 #endif
177 #if defined(__GNUC__)
178 #define GLOBALDATA(TYPE,NAME) extern TYPE NAME \
179 asm("_$$PsectAttributes_NOSHR$$" #NAME)
180 #endif
181 #else /* !VAX/VMS */
182 #define GLOBALDATA(TYPE,NAME) extern TYPE NAME
183 #endif
184
185 #if defined(__acornriscos)
186 /*
187 * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
188 * on C alone. For that reason, the relevant functions are
189 * implemented in tif_acorn.c, and the elements from the header
190 * file are included here.
191 */
192 #if defined(__cplusplus)
193 #include <osfcn.h>
194 #else
195 #define O_RDONLY 0
196 #define O_WRONLY 1
197 #define O_RDWR 2
198 #define O_APPEND 8
199 #define O_CREAT 0x200
200 #define O_TRUNC 0x400
201 typedef long off_t;
202 extern int open(const char *name, int flags, int mode);
203 extern int close(int fd);
204 extern int write(int fd, const char *buf, int nbytes);
205 extern int read(int fd, char *buf, int nbytes);
206 extern off_t lseek(int fd, off_t offset, int whence);
207 extern int creat(const char *path, int mode);
208 #endif /* __cplusplus */
209 #endif /* __acornriscos */
210
211 /* Bit and byte order, the default is MSB to LSB */
212 #ifdef VMS
213 #undef HOST_FILLORDER
214 #undef HOST_BIGENDIAN
215 #define HOST_FILLORDER FILLORDER_LSB2MSB
216 #define HOST_BIGENDIAN 0
217 #endif
218
219
220 #endif /* _COMPAT_ */