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
63 # define COMPILING_ON_MSDOS 1
64 # define COMPILING_ON_WINDOWS 1
65 # if defined(__cplusplus)
66 # define IMPLEMENT_BOOL_AS_INT 1 /* VC++ doesn't have 'bool' (yet) */
69 /* The '(defined(__sparc) && defined(P_tmpdir) */
70 /* && !defined(__svr4__))' is to detect gcc on SunOS. */
71 /* C++ compilers don't have to define __STDC__ */
72 #if (defined(__sparc) && defined(P_tmpdir))
73 # if defined(__svr4__)
74 # define COMPILING_ON_SOLARIS
76 # define COMPILING_ON_SUNOS
80 # define COMPILING_ON_HPUX
84 * The following typedefs may need alteration for obscure host machines.
86 #if defined(__alpha) && defined(__osf__) /* =========================== */
87 /* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
89 typedef unsigned int unsigned32
;
90 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
91 /* new code. Currently only used within 'ncc'. */
92 typedef long int IPtr
;
93 typedef unsigned long int UPtr
;
95 #else /* all hosts except alpha under OSF ============================= */
97 typedef long int int32
;
98 typedef unsigned long int unsigned32
;
99 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
100 /* new code. Currently only used within 'ncc'. */
102 #define UPtr unsigned32
103 #endif /* ============================================================= */
105 typedef short int int16
;
106 typedef unsigned short int unsigned16
;
107 typedef signed char int8
;
108 typedef unsigned char unsigned8
;
110 /* The following code defines the 'bool' type to be 'int' under C */
111 /* and real 'bool' under C++. It also avoids warnings such as */
112 /* C++ keyword 'bool' used as identifier. It can be overridden by */
113 /* defining IMPLEMENT_BOOL_AS_ENUM or IMPLEMENT_BOOL_AS_INT. */
116 #ifdef IMPLEMENT_BOOL_AS_ENUM
117 enum _bool
{ _false
, _true
};
118 # define _bool enum _bool
119 #elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
126 # if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
127 # define bool _bool /* avoids "'bool' is reserved word" warning */
132 # define false _false
137 #undef TRUE /* some OSF headers define as 1 */
139 #undef FALSE /* some OSF headers define as 1 */
142 /* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
143 typedef unsigned8 uint8
;
144 typedef unsigned16 uint16
;
145 typedef unsigned32 uint32
;
147 typedef unsigned Uint
;
148 typedef unsigned8 Uint8
;
149 typedef unsigned16 Uint16
;
150 typedef unsigned32 Uint32
;
152 #ifdef ALPHA_TASO_SHORT_ON_OSF /* was __alpha && __osf. */
153 /* The following sets ArgvType for 64-bit pointers so that */
154 /* DEC Unix (OSF) cc can be used with the -xtaso_short compiler option */
155 /* to force pointers to be 32-bit. Not currently used since most/all */
156 /* ARM tools accept 32 or 64 bit pointers transparently. See IPtr. */
157 #pragma pointer_size (save)
158 #pragma pointer_size (long)
159 typedef char *ArgvType
;
160 #pragma pointer_size (restore)
162 typedef char *ArgvType
;
168 #define ROL_32(val, n) \
169 ((((unsigned32)(val) << (n)) | ((unsigned32)(val) >> (32-(n)))) & 0xFFFFFFFFL)
170 #define ROR_32(val, n) \
171 ((((unsigned32)(val) >> (n)) | ((unsigned32)(val) << (32-(n)))) & 0xFFFFFFFFL)
173 #ifdef COMPILING_ON_UNIX
174 # define FOPEN_WB "w"
175 # define FOPEN_RB "r"
176 # define FOPEN_RWB "r+"
177 # ifndef __STDC__ /* caveat RISCiX... */
178 # define remove(file) unlink(file) /* a horrid hack, but probably best? */
181 # define FOPEN_WB "wb"
182 # define FOPEN_RB "rb"
183 # define FOPEN_RWB "rb+"
187 # define FILENAME_MAX 256
190 #if (!defined(__STDC__) && !defined(__cplusplus) && !defined(_MSC_VER)) || \
191 defined(COMPILING_ON_SUNOS)
192 /* Use bcopy rather than memmove, as memmove is not available. */
193 /* There does not seem to be a header for bcopy. */
194 void bcopy(const char *src
, char *dst
, int length
);
195 # define memmove(d,s,l) bcopy(s,d,l)
197 /* BSD/SUN don't have strtoul(), but then strtol() doesn't barf on */
198 /* overflow as required by ANSI... This bodge is horrid. */
199 # define strtoul(s, ptr, base) strtol(s, ptr, base)
201 /* strtod is present in the C-library but is not in stdlib.h */
202 extern double strtod(const char *str
, char **ptr
);
205 /* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
207 # define EXIT_SUCCESS 0
210 # define EXIT_FAILURE 1
214 #define IGNORE(x) (x = x) /* Silence compiler warnings for unused arguments */
217 /* Define endian-ness of host */
219 #if defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
220 (defined(__alpha) && defined(__osf__))
221 # define HOST_ENDIAN_LITTLE
222 #elif defined(__sparc) || defined(macintosh)
223 # define HOST_ENDIAN_BIG
225 # define HOST_ENDIAN_UNKNOWN
This page took 0.033504 seconds and 4 git commands to generate.