]> git.saurik.com Git - wxWidgets.git/blame - src/tiff/tiffcomp.h
final revision
[wxWidgets.git] / src / tiff / tiffcomp.h
CommitLineData
b47c832e
RR
1/* $Header$ */
2
3/*
4 * Copyright (c) 1990-1997 Sam Leffler
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6 *
1dba7b4c 7 * Permission to use, copy, modify, distribute, and sell this software and
b47c832e
RR
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.
1dba7b4c
WS
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 *
b47c832e
RR
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,
1dba7b4c
WS
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
b47c832e
RR
24 * OF THIS SOFTWARE.
25 */
26
27#ifndef _COMPAT_
1dba7b4c 28#define _COMPAT_
b47c832e
RR
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
ed1f7187 54#if (defined(__MWERKS__) && !defined(__MACH__)) || defined(THINK_C)
b47c832e
RR
55#include <unix.h>
56#include <math.h>
57#endif
4ded51f2 58
b47c832e
RR
59#include <stdio.h>
60
4d4e1be2 61#if defined(__PPCC__) || ( defined(__SC__) && !defined(__DMC__) ) || defined(__MRC__)
b47c832e
RR
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 */
4d4e1be2 82#if defined(__MWERKS__) || defined(THINK_C) || defined(__PPCC__) || ( defined(__SC__) && !defined(__DMC__) ) || defined(__MRC__)
b47c832e
RR
83#include <stdlib.h>
84#define BSDTYPES
85#define HAVE_UNISTD_H 0
00cb87b4
VZ
86#elif (defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) || defined(_WIN32)) && !defined(unix)
87#define BSDTYPES
b47c832e
RR
88#elif defined(OS2_16) || defined(OS2_32)
89#define BSDTYPES
28ceed83
MW
90#elif defined(__MSDOS__)
91#define BSDTYPES
b47c832e
RR
92#elif defined(__acornriscos)
93#include <stdlib.h>
94#define BSDTYPES
95#define HAVE_UNISTD_H 0
96#elif defined(VMS)
97#define HAVE_UNISTD_H 0
98#else
99#define HAVE_UNISTD_H 1
100#endif
101
102/*
103 * The library uses the ANSI C/POSIX SEEK_*
104 * definitions that should be defined in unistd.h
105 * (except on system where they are in stdio.h and
106 * there is no unistd.h).
107 */
108#if !defined(SEEK_SET) && HAVE_UNISTD_H
109#include <unistd.h>
110#endif
111
112/*
113 * The library uses memset, memcpy, and memcmp.
114 * ANSI C and System V define these in string.h.
115 */
116#include <string.h>
117
118/*
119 * The BSD typedefs are used throughout the library.
120 * If your system doesn't have them in <sys/types.h>,
121 * then define BSDTYPES in your Makefile.
122 */
123#if defined(BSDTYPES)
00cb87b4
VZ
124# ifndef _BSDTYPES_DEFINED
125# ifndef __u_char_defined
b47c832e
RR
126typedef unsigned char u_char;
127typedef unsigned short u_short;
128typedef unsigned int u_int;
129typedef unsigned long u_long;
00cb87b4
VZ
130# define __u_char_defined
131# endif /* __u_char_defined */
132# define _BSDTYPES_DEFINED
133# endif /* _BSDTYPES_DEFINED */
134#endif /* BSDTYPES */
b47c832e
RR
135
136/*
137 * dblparam_t is the type that a double precision
138 * floating point value will have on the parameter
139 * stack (when coerced by the compiler).
140 */
141/* Note: on MacPowerPC "extended" is undefined. So only use it for 68K-Macs */
4d4e1be2 142#if ( defined(__SC__) && !defined(__DMC__) ) || defined(THINK_C)
b47c832e
RR
143typedef extended dblparam_t;
144#else
145typedef double dblparam_t;
146#endif
147
148/*
149 * If your compiler supports inline functions, then
150 * set INLINE appropriately to get the known hotspots
151 * in the library expanded inline.
152 */
153#if defined(__GNUC__)
154#if defined(__STRICT_ANSI__)
155#define INLINE __inline__
156#else
157#define INLINE inline
158#endif
159#else /* !__GNUC__ */
160#define INLINE
161#endif
162
163/*
164 * GLOBALDATA is a macro that is used to define global variables
165 * private to the library. We use this indirection to hide
166 * brain-damage in VAXC (and GCC) under VAX/VMS. In these
167 * environments the macro places the variable in a non-shareable
168 * program section, which ought to be done by default (sigh!)
169 *
170 * Apparently DEC are aware of the problem as this behaviour is the
171 * default under VMS on AXP.
172 *
173 * The GNU C variant is untested.
174 */
175#if defined(VAX) && defined(VMS)
176#if defined(VAXC)
177#define GLOBALDATA(TYPE,NAME) extern noshare TYPE NAME
178#endif
179#if defined(__GNUC__)
180#define GLOBALDATA(TYPE,NAME) extern TYPE NAME \
181 asm("_$$PsectAttributes_NOSHR$$" #NAME)
182#endif
183#else /* !VAX/VMS */
184#define GLOBALDATA(TYPE,NAME) extern TYPE NAME
185#endif
186
187#if defined(__acornriscos)
188/*
189 * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
190 * on C alone. For that reason, the relevant functions are
191 * implemented in tif_acorn.c, and the elements from the header
192 * file are included here.
193 */
194#if defined(__cplusplus)
195#include <osfcn.h>
196#else
197#define O_RDONLY 0
198#define O_WRONLY 1
199#define O_RDWR 2
200#define O_APPEND 8
201#define O_CREAT 0x200
202#define O_TRUNC 0x400
203typedef long off_t;
204extern int open(const char *name, int flags, int mode);
205extern int close(int fd);
206extern int write(int fd, const char *buf, int nbytes);
207extern int read(int fd, char *buf, int nbytes);
208extern off_t lseek(int fd, off_t offset, int whence);
209extern int creat(const char *path, int mode);
210#endif /* __cplusplus */
211#endif /* __acornriscos */
212
213/* Bit and byte order, the default is MSB to LSB */
214#ifdef VMS
215#undef HOST_FILLORDER
216#undef HOST_BIGENDIAN
217#define HOST_FILLORDER FILLORDER_LSB2MSB
218#define HOST_BIGENDIAN 0
219#endif
220
1dba7b4c
WS
221#ifndef LINKAGEMODE
222 #define LINKAGEMODE
223#endif
b47c832e
RR
224
225#endif /* _COMPAT_ */