* rdi-share/configure, rdi-share/aclocal.m4: Regenerated using
[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
a8016339
AC
32/* A temporary sop to older compilers */
33#if defined (__NetBSD__) || defined (unix)
c906108c
SS
34# ifndef __unix /* (good for long-term portability?) */
35# define __unix 1
36# endif
37#endif
38
a8016339 39#if defined(__unix)
c906108c
SS
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
44#endif
45#if defined(_WIN32)
46# define COMPILING_ON_WIN32 1
a3efda28 47# if !defined(__CYGWIN__)
c906108c
SS
48# define COMPILING_ON_WINDOWS 1
49# endif
50#endif
51#if defined(_CONSOLE)
52# define COMPILING_ON_WINDOWS_CONSOLE 1
53# define COMPILING_ON_WINDOWS 1
54#endif
c906108c
SS
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
61# else
62# define COMPILING_ON_SUNOS
63# endif
64#endif
65#ifdef __hppa
66# define COMPILING_ON_HPUX
67#endif
68
69/*
70 * The following typedefs may need alteration for obscure host machines.
71 */
72#if defined(__alpha) && defined(__osf__) /* =========================== */
73/* Under OSF the alpha has 64-bit pointers and 64-bit longs. */
74typedef int int32;
75typedef 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'. */
78typedef long int IPtr;
79typedef unsigned long int UPtr;
80
81#else /* all hosts except alpha under OSF ============================= */
82
83typedef long int int32;
84typedef 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'. */
87#define IPtr int32
88#define UPtr unsigned32
89#endif /* ============================================================= */
90
91typedef short int int16;
92typedef unsigned short int unsigned16;
93typedef signed char int8;
94typedef unsigned char unsigned8;
95
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. */
100#undef _bool
101
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)
106# define _bool int
107# define _false 0
108# define _true 1
109#endif
110
111#ifdef _bool
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 */
114# else
095778a0
NC
115# ifndef bool
116 typedef _bool bool;
117# endif
c906108c
SS
118# endif
119# define true _true
120# define false _false
121#endif
122
123#define YES true
124#define NO false
125#undef TRUE /* some OSF headers define as 1 */
126#define TRUE true
127#undef FALSE /* some OSF headers define as 1 */
128#define FALSE false
129
130/* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
131typedef unsigned8 uint8;
132typedef unsigned16 uint16;
133typedef unsigned32 uint32;
134
135typedef unsigned Uint;
136typedef unsigned8 Uint8;
137typedef unsigned16 Uint16;
138typedef unsigned32 Uint32;
139
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)
147typedef char *ArgvType;
148#pragma pointer_size (restore)
149#else
150typedef char *ArgvType;
151#endif
152
153/*
154 * Rotate macros
155 */
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)
160
61c82a3b 161#if 0
c906108c
SS
162#ifdef COMPILING_ON_UNIX
163# define FOPEN_WB "w"
164# define FOPEN_RB "r"
165# define FOPEN_RWB "r+"
166# ifndef __STDC__ /* caveat RISCiX... */
167# define remove(file) unlink(file) /* a horrid hack, but probably best? */
168# endif
169#else
170# define FOPEN_WB "wb"
171# define FOPEN_RB "rb"
172# define FOPEN_RWB "rb+"
173#endif
61c82a3b 174#endif
c906108c
SS
175
176#ifndef FILENAME_MAX
177# define FILENAME_MAX 256
178#endif
179
cb90e81a 180#if (!defined(__STDC__) && !defined(__cplusplus)) || defined(COMPILING_ON_SUNOS)
c906108c
SS
181/* Use bcopy rather than memmove, as memmove is not available. */
182/* There does not seem to be a header for bcopy. */
183void bcopy(const char *src, char *dst, int length);
184# define memmove(d,s,l) bcopy(s,d,l)
185
186/* BSD/SUN don't have strtoul(), but then strtol() doesn't barf on */
187/* overflow as required by ANSI... This bodge is horrid. */
188# define strtoul(s, ptr, base) strtol(s, ptr, base)
189
190/* strtod is present in the C-library but is not in stdlib.h */
191extern double strtod(const char *str, char **ptr);
192#endif
193
194/* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
195#ifndef EXIT_SUCCESS
196# define EXIT_SUCCESS 0
197#endif
198#ifndef EXIT_FAILURE
199# define EXIT_FAILURE 1
200#endif
201
202#ifndef IGNORE
203#define IGNORE(x) (x = x) /* Silence compiler warnings for unused arguments */
204#endif
205
206/* Define endian-ness of host */
207
208#if defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
209 (defined(__alpha) && defined(__osf__))
210# define HOST_ENDIAN_LITTLE
211#elif defined(__sparc) || defined(macintosh)
212# define HOST_ENDIAN_BIG
213#else
214# define HOST_ENDIAN_UNKNOWN
215#endif
216
217#endif
218
42c466d7 219/* Needs to be supplied by the host. */
3bd3f01e 220extern void Fail (const char *, ...);
42c466d7 221
c906108c 222/* end of host.h */
This page took 0.462024 seconds and 4 git commands to generate.