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 /* If under Cygwin, provide backwards compatibility with older
33 Cygwin compilers that don't define the current cpp define. */
40 #ifdef unix /* A temporary sop to older compilers */
41 # ifndef __unix /* (good for long-term portability?) */
47 /* Generic unix -- hopefully a split into other variants will not be */
48 /* needed. However, beware the 'bsd' test above and safe_toupper etc. */
49 /* which cope with backwards (pre-posix/X/open) unix compatility. */
50 # define COMPILING_ON_UNIX 1
53 # define COMPILING_ON_WIN32 1
54 # if !defined(__CYGWIN32__)
55 # define COMPILING_ON_WINDOWS 1
59 # define COMPILING_ON_WINDOWS_CONSOLE 1
60 # define COMPILING_ON_WINDOWS 1
62 /* The '(defined(__sparc) && defined(P_tmpdir) */
63 /* && !defined(__svr4__))' is to detect gcc on SunOS. */
64 /* C++ compilers don't have to define __STDC__ */
65 #if (defined(__sparc) && defined(P_tmpdir))
66 # if defined(__svr4__)
67 # define COMPILING_ON_SOLARIS
69 # define COMPILING_ON_SUNOS
73 # define COMPILING_ON_HPUX
77 * The following typedefs may need alteration for obscure host machines.
79 #if defined(__alpha) && defined(__osf__) /* =========================== */
80 /* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
82 typedef unsigned int unsigned32
;
83 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
84 /* new code. Currently only used within 'ncc'. */
85 typedef long int IPtr
;
86 typedef unsigned long int UPtr
;
88 #else /* all hosts except alpha under OSF ============================= */
90 typedef long int int32
;
91 typedef unsigned long int unsigned32
;
92 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
93 /* new code. Currently only used within 'ncc'. */
95 #define UPtr unsigned32
96 #endif /* ============================================================= */
98 typedef short int int16
;
99 typedef unsigned short int unsigned16
;
100 typedef signed char int8
;
101 typedef unsigned char unsigned8
;
103 /* The following code defines the 'bool' type to be 'int' under C */
104 /* and real 'bool' under C++. It also avoids warnings such as */
105 /* C++ keyword 'bool' used as identifier. It can be overridden by */
106 /* defining IMPLEMENT_BOOL_AS_ENUM or IMPLEMENT_BOOL_AS_INT. */
109 #ifdef IMPLEMENT_BOOL_AS_ENUM
110 enum _bool
{ _false
, _true
};
111 # define _bool enum _bool
112 #elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
119 # if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
120 # define bool _bool /* avoids "'bool' is reserved word" warning */
125 # define false _false
130 #undef TRUE /* some OSF headers define as 1 */
132 #undef FALSE /* some OSF headers define as 1 */
135 /* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
136 typedef unsigned8 uint8
;
137 typedef unsigned16 uint16
;
138 typedef unsigned32 uint32
;
140 typedef unsigned Uint
;
141 typedef unsigned8 Uint8
;
142 typedef unsigned16 Uint16
;
143 typedef unsigned32 Uint32
;
145 #ifdef ALPHA_TASO_SHORT_ON_OSF /* was __alpha && __osf. */
146 /* The following sets ArgvType for 64-bit pointers so that */
147 /* DEC Unix (OSF) cc can be used with the -xtaso_short compiler option */
148 /* to force pointers to be 32-bit. Not currently used since most/all */
149 /* ARM tools accept 32 or 64 bit pointers transparently. See IPtr. */
150 #pragma pointer_size (save)
151 #pragma pointer_size (long)
152 typedef char *ArgvType
;
153 #pragma pointer_size (restore)
155 typedef char *ArgvType
;
161 #define ROL_32(val, n) \
162 ((((unsigned32)(val) << (n)) | ((unsigned32)(val) >> (32-(n)))) & 0xFFFFFFFFL)
163 #define ROR_32(val, n) \
164 ((((unsigned32)(val) >> (n)) | ((unsigned32)(val) << (32-(n)))) & 0xFFFFFFFFL)
166 #ifdef COMPILING_ON_UNIX
167 # define FOPEN_WB "w"
168 # define FOPEN_RB "r"
169 # define FOPEN_RWB "r+"
170 # ifndef __STDC__ /* caveat RISCiX... */
171 # define remove(file) unlink(file) /* a horrid hack, but probably best? */
174 # define FOPEN_WB "wb"
175 # define FOPEN_RB "rb"
176 # define FOPEN_RWB "rb+"
180 # define FILENAME_MAX 256
183 #if (!defined(__STDC__) && !defined(__cplusplus) || defined(COMPILING_ON_SUNOS)
184 /* Use bcopy rather than memmove, as memmove is not available. */
185 /* There does not seem to be a header for bcopy. */
186 void bcopy(const char *src
, char *dst
, int length
);
187 # define memmove(d,s,l) bcopy(s,d,l)
189 /* BSD/SUN don't have strtoul(), but then strtol() doesn't barf on */
190 /* overflow as required by ANSI... This bodge is horrid. */
191 # define strtoul(s, ptr, base) strtol(s, ptr, base)
193 /* strtod is present in the C-library but is not in stdlib.h */
194 extern double strtod(const char *str
, char **ptr
);
197 /* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
199 # define EXIT_SUCCESS 0
202 # define EXIT_FAILURE 1
206 #define IGNORE(x) (x = x) /* Silence compiler warnings for unused arguments */
209 /* Define endian-ness of host */
211 #if defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
212 (defined(__alpha) && defined(__osf__))
213 # define HOST_ENDIAN_LITTLE
214 #elif defined(__sparc) || defined(macintosh)
215 # define HOST_ENDIAN_BIG
217 # define HOST_ENDIAN_UNKNOWN
This page took 0.033962 seconds and 4 git commands to generate.