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