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 #ifdef unix /* A temporary sop to older compilers */
33 # ifndef __unix /* (good for long-term portability?) */
39 /* Generic unix -- hopefully a split into other variants will not be */
40 /* needed. However, beware the 'bsd' test above and safe_toupper etc. */
41 /* which cope with backwards (pre-posix/X/open) unix compatility. */
42 # define COMPILING_ON_UNIX 1
45 # define COMPILING_ON_WIN32 1
46 # if !defined(__CYGWIN32__)
47 # define COMPILING_ON_WINDOWS 1
51 # define COMPILING_ON_WINDOWS_CONSOLE 1
52 # define COMPILING_ON_WINDOWS 1
55 # define COMPILING_ON_MSDOS 1
56 # define COMPILING_ON_WINDOWS 1
57 # if defined(__cplusplus)
58 # define IMPLEMENT_BOOL_AS_INT 1 /* VC++ doesn't have 'bool' (yet) */
61 /* The '(defined(__sparc) && defined(P_tmpdir) */
62 /* && !defined(__svr4__))' is to detect gcc on SunOS. */
63 /* C++ compilers don't have to define __STDC__ */
64 #if (defined(__sparc) && defined(P_tmpdir))
65 # if defined(__svr4__)
66 # define COMPILING_ON_SOLARIS
68 # define COMPILING_ON_SUNOS
72 # define COMPILING_ON_HPUX
76 * The following typedefs may need alteration for obscure host machines.
78 #if defined(__alpha) && defined(__osf__) /* =========================== */
79 /* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
81 typedef unsigned int unsigned32
;
82 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
83 /* new code. Currently only used within 'ncc'. */
84 typedef long int IPtr
;
85 typedef unsigned long int UPtr
;
87 #else /* all hosts except alpha under OSF ============================= */
89 typedef long int int32
;
90 typedef unsigned long int unsigned32
;
91 /* IPtr and UPtr are 'ints of same size as pointer'. Do not use in */
92 /* new code. Currently only used within 'ncc'. */
94 #define UPtr unsigned32
95 #endif /* ============================================================= */
97 typedef short int int16
;
98 typedef unsigned short int unsigned16
;
99 typedef signed char int8
;
100 typedef unsigned char unsigned8
;
102 /* The following code defines the 'bool' type to be 'int' under C */
103 /* and real 'bool' under C++. It also avoids warnings such as */
104 /* C++ keyword 'bool' used as identifier. It can be overridden by */
105 /* defining IMPLEMENT_BOOL_AS_ENUM or IMPLEMENT_BOOL_AS_INT. */
108 #ifdef IMPLEMENT_BOOL_AS_ENUM
109 enum _bool
{ _false
, _true
};
110 # define _bool enum _bool
111 #elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
118 # if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
119 # define bool _bool /* avoids "'bool' is reserved word" warning */
124 # define false _false
129 #undef TRUE /* some OSF headers define as 1 */
131 #undef FALSE /* some OSF headers define as 1 */
134 /* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
135 typedef unsigned8 uint8
;
136 typedef unsigned16 uint16
;
137 typedef unsigned32 uint32
;
139 typedef unsigned Uint
;
140 typedef unsigned8 Uint8
;
141 typedef unsigned16 Uint16
;
142 typedef unsigned32 Uint32
;
144 #ifdef ALPHA_TASO_SHORT_ON_OSF /* was __alpha && __osf. */
145 /* The following sets ArgvType for 64-bit pointers so that */
146 /* DEC Unix (OSF) cc can be used with the -xtaso_short compiler option */
147 /* to force pointers to be 32-bit. Not currently used since most/all */
148 /* ARM tools accept 32 or 64 bit pointers transparently. See IPtr. */
149 #pragma pointer_size (save)
150 #pragma pointer_size (long)
151 typedef char *ArgvType
;
152 #pragma pointer_size (restore)
154 typedef char *ArgvType
;
160 #define ROL_32(val, n) \
161 ((((unsigned32)(val) << (n)) | ((unsigned32)(val) >> (32-(n)))) & 0xFFFFFFFFL)
162 #define ROR_32(val, n) \
163 ((((unsigned32)(val) >> (n)) | ((unsigned32)(val) << (32-(n)))) & 0xFFFFFFFFL)
165 #ifdef COMPILING_ON_UNIX
166 # define FOPEN_WB "w"
167 # define FOPEN_RB "r"
168 # define FOPEN_RWB "r+"
169 # ifndef __STDC__ /* caveat RISCiX... */
170 # define remove(file) unlink(file) /* a horrid hack, but probably best? */
173 # define FOPEN_WB "wb"
174 # define FOPEN_RB "rb"
175 # define FOPEN_RWB "rb+"
179 # define FILENAME_MAX 256
182 #if (!defined(__STDC__) && !defined(__cplusplus) && !defined(_MSC_VER)) || \
183 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.034452 seconds and 4 git commands to generate.