2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
11 #define _host_LOADED 1
27 /* The following for the benefit of compiling on SunOS */
29 # define offsetof(T, member) ((char *)&(((T *)0)->member) - (char *)0)
32 /* A temporary sop to older compilers */
33 #if defined (__NetBSD__) || defined (unix)
34 # ifndef __unix /* (good for long-term portability?) */
40 /* Generic unix -- hopefully a split into other variants will not be */
41 /* needed. However, beware the 'bsd' test above and safe_toupper etc. */
42 /* which cope with backwards (pre-posix/X/open) unix compatility. */
43 # define COMPILING_ON_UNIX 1
46 # define COMPILING_ON_WIN32 1
47 # if !defined(__CYGWIN__)
48 # define COMPILING_ON_WINDOWS 1
52 # define COMPILING_ON_WINDOWS_CONSOLE 1
53 # define COMPILING_ON_WINDOWS 1
55 /* The '(defined(__sparc) && defined(P_tmpdir) */
56 /* && !defined(__svr4__))' is to detect gcc on SunOS. */
57 /* C++ compilers don't have to define __STDC__ */
58 #if (defined(__sparc) && defined(P_tmpdir))
59 # if defined(__svr4__)
60 # define COMPILING_ON_SOLARIS
62 # define COMPILING_ON_SUNOS
66 # define COMPILING_ON_HPUX
70 * The following typedefs may need alteration for obscure host machines.
72 #if defined(__alpha) && defined(__osf__) /* =========================== */
73 /* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
75 typedef unsigned int unsigned32
;
76 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
77 /* new code. Currently only used within 'ncc'. */
78 typedef long int IPtr
;
79 typedef unsigned long int UPtr
;
81 #else /* all hosts except alpha under OSF ============================= */
83 typedef long int int32
;
84 typedef unsigned long int unsigned32
;
85 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
86 /* new code. Currently only used within 'ncc'. */
88 #define UPtr unsigned32
89 #endif /* ============================================================= */
91 typedef short int int16
;
92 typedef unsigned short int unsigned16
;
93 typedef signed char int8
;
94 typedef unsigned char unsigned8
;
96 /* The following code defines the 'bool' type to be 'int' under C */
97 /* and real 'bool' under C++. It also avoids warnings such as */
98 /* C++ keyword 'bool' used as identifier. It can be overridden by */
99 /* defining IMPLEMENT_BOOL_AS_ENUM or IMPLEMENT_BOOL_AS_INT. */
102 #ifdef IMPLEMENT_BOOL_AS_ENUM
103 enum _bool
{ _false
, _true
};
104 # define _bool enum _bool
105 #elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
112 # if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
113 # define bool _bool /* avoids "'bool' is reserved word" warning */
120 # define false _false
125 #undef TRUE /* some OSF headers define as 1 */
127 #undef FALSE /* some OSF headers define as 1 */
130 /* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
131 typedef unsigned8 uint8
;
132 typedef unsigned16 uint16
;
133 typedef unsigned32 uint32
;
135 typedef unsigned Uint
;
136 typedef unsigned8 Uint8
;
137 typedef unsigned16 Uint16
;
138 typedef unsigned32 Uint32
;
140 #ifdef ALPHA_TASO_SHORT_ON_OSF /* was __alpha && __osf. */
141 /* The following sets ArgvType for 64-bit pointers so that */
142 /* DEC Unix (OSF) cc can be used with the -xtaso_short compiler option */
143 /* to force pointers to be 32-bit. Not currently used since most/all */
144 /* ARM tools accept 32 or 64 bit pointers transparently. See IPtr. */
145 #pragma pointer_size (save)
146 #pragma pointer_size (long)
147 typedef char *ArgvType
;
148 #pragma pointer_size (restore)
150 typedef char *ArgvType
;
156 #define ROL_32(val, n) \
157 ((((unsigned32)(val) << (n)) | ((unsigned32)(val) >> (32-(n)))) & 0xFFFFFFFFL)
158 #define ROR_32(val, n) \
159 ((((unsigned32)(val) >> (n)) | ((unsigned32)(val) << (32-(n)))) & 0xFFFFFFFFL)
161 #ifdef COMPILING_ON_UNIX
162 # define FOPEN_WB "w"
163 # define FOPEN_RB "r"
164 # define FOPEN_RWB "r+"
165 # ifndef __STDC__ /* caveat RISCiX... */
166 # define remove(file) unlink(file) /* a horrid hack, but probably best? */
169 # define FOPEN_WB "wb"
170 # define FOPEN_RB "rb"
171 # define FOPEN_RWB "rb+"
175 # define FILENAME_MAX 256
178 #if (!defined(__STDC__) && !defined(__cplusplus)) || defined(COMPILING_ON_SUNOS)
179 /* Use bcopy rather than memmove, as memmove is not available. */
180 /* There does not seem to be a header for bcopy. */
181 void bcopy(const char *src
, char *dst
, int length
);
182 # define memmove(d,s,l) bcopy(s,d,l)
184 /* BSD/SUN don't have strtoul(), but then strtol() doesn't barf on */
185 /* overflow as required by ANSI... This bodge is horrid. */
186 # define strtoul(s, ptr, base) strtol(s, ptr, base)
188 /* strtod is present in the C-library but is not in stdlib.h */
189 extern double strtod(const char *str
, char **ptr
);
192 /* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
194 # define EXIT_SUCCESS 0
197 # define EXIT_FAILURE 1
201 #define IGNORE(x) (x = x) /* Silence compiler warnings for unused arguments */
204 /* Define endian-ness of host */
206 #if defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
207 (defined(__alpha) && defined(__osf__))
208 # define HOST_ENDIAN_LITTLE
209 #elif defined(__sparc) || defined(macintosh)
210 # define HOST_ENDIAN_BIG
212 # define HOST_ENDIAN_UNKNOWN
This page took 0.034721 seconds and 4 git commands to generate.