* gnu-regex.c: Eliminate obsolete check for _MSC_VER.
[deliverable/binutils-gdb.git] / gdb / rdi-share / host.h
CommitLineData
c906108c
SS
1/*
2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
3 *
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
6 * software.
7 */
8
9
10#ifndef _host_LOADED
11#define _host_LOADED 1
12
13#include <stdio.h>
14#include <stddef.h>
15#include <stdlib.h>
16
17#ifndef SEEK_SET
18# define SEEK_SET 0
19#endif
20#ifndef SEEK_CUR
21# define SEEK_CUR 1
22#endif
23#ifndef SEEK_END
24# define SEEK_END 2
25#endif
26
27/* The following for the benefit of compiling on SunOS */
28#ifndef offsetof
29# define offsetof(T, member) ((char *)&(((T *)0)->member) - (char *)0)
30#endif
31
32/* If under Cygwin, provide backwards compatibility with older
33 Cygwin compilers that don't define the current cpp define. */
34#ifdef __CYGWIN32__
35#ifndef __CYGWIN__
36#define __CYGWIN__
37#endif
38#endif
39
40#ifdef unix /* A temporary sop to older compilers */
41# ifndef __unix /* (good for long-term portability?) */
42# define __unix 1
43# endif
44#endif
45
46#ifdef __unix
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
51#endif
52#if defined(_WIN32)
53# define COMPILING_ON_WIN32 1
54# if !defined(__CYGWIN32__)
55# define COMPILING_ON_WINDOWS 1
56# endif
57#endif
58#if defined(_CONSOLE)
59# define COMPILING_ON_WINDOWS_CONSOLE 1
60# define COMPILING_ON_WINDOWS 1
61#endif
c906108c
SS
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
68# else
69# define COMPILING_ON_SUNOS
70# endif
71#endif
72#ifdef __hppa
73# define COMPILING_ON_HPUX
74#endif
75
76/*
77 * The following typedefs may need alteration for obscure host machines.
78 */
79#if defined(__alpha) && defined(__osf__) /* =========================== */
80/* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
81typedef int int32;
82typedef 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'. */
85typedef long int IPtr;
86typedef unsigned long int UPtr;
87
88#else /* all hosts except alpha under OSF ============================= */
89
90typedef long int int32;
91typedef 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'. */
94#define IPtr int32
95#define UPtr unsigned32
96#endif /* ============================================================= */
97
98typedef short int int16;
99typedef unsigned short int unsigned16;
100typedef signed char int8;
101typedef unsigned char unsigned8;
102
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. */
107#undef _bool
108
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)
113# define _bool int
114# define _false 0
115# define _true 1
116#endif
117
118#ifdef _bool
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 */
121# else
122 typedef _bool bool;
123# endif
124# define true _true
125# define false _false
126#endif
127
128#define YES true
129#define NO false
130#undef TRUE /* some OSF headers define as 1 */
131#define TRUE true
132#undef FALSE /* some OSF headers define as 1 */
133#define FALSE false
134
135/* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
136typedef unsigned8 uint8;
137typedef unsigned16 uint16;
138typedef unsigned32 uint32;
139
140typedef unsigned Uint;
141typedef unsigned8 Uint8;
142typedef unsigned16 Uint16;
143typedef unsigned32 Uint32;
144
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)
152typedef char *ArgvType;
153#pragma pointer_size (restore)
154#else
155typedef char *ArgvType;
156#endif
157
158/*
159 * Rotate macros
160 */
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)
165
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? */
172# endif
173#else
174# define FOPEN_WB "wb"
175# define FOPEN_RB "rb"
176# define FOPEN_RWB "rb+"
177#endif
178
179#ifndef FILENAME_MAX
180# define FILENAME_MAX 256
181#endif
182
0b6a968e 183#if (!defined(__STDC__) && !defined(__cplusplus) || defined(COMPILING_ON_SUNOS)
c906108c
SS
184/* Use bcopy rather than memmove, as memmove is not available. */
185/* There does not seem to be a header for bcopy. */
186void bcopy(const char *src, char *dst, int length);
187# define memmove(d,s,l) bcopy(s,d,l)
188
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)
192
193/* strtod is present in the C-library but is not in stdlib.h */
194extern double strtod(const char *str, char **ptr);
195#endif
196
197/* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
198#ifndef EXIT_SUCCESS
199# define EXIT_SUCCESS 0
200#endif
201#ifndef EXIT_FAILURE
202# define EXIT_FAILURE 1
203#endif
204
205#ifndef IGNORE
206#define IGNORE(x) (x = x) /* Silence compiler warnings for unused arguments */
207#endif
208
209/* Define endian-ness of host */
210
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
216#else
217# define HOST_ENDIAN_UNKNOWN
218#endif
219
220#endif
221
222/* end of host.h */
This page took 0.115114 seconds and 4 git commands to generate.