OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [rdi-share/] [host.h] - Blame information for rev 106

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*
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
62
#ifdef _MSC_VER
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) */
67
#  endif
68
#endif
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
75
#  else
76
#    define COMPILING_ON_SUNOS
77
#  endif
78
#endif
79
#ifdef __hppa
80
#  define COMPILING_ON_HPUX
81
#endif
82
 
83
/*
84
 * The following typedefs may need alteration for obscure host machines.
85
 */
86
#if defined(__alpha) && defined(__osf__) /* =========================== */
87
/* Under OSF the alpha has 64-bit pointers and 64-bit longs.            */
88
typedef                int   int32;
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;
94
 
95
#else /* all hosts except alpha under OSF ============================= */
96
 
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'.                         */
101
#define IPtr int32
102
#define UPtr unsigned32
103
#endif /* ============================================================= */
104
 
105
typedef          short int   int16;
106
typedef unsigned short int   unsigned16;
107
typedef   signed       char  int8;
108
typedef unsigned       char  unsigned8;
109
 
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.            */
114
#undef _bool
115
 
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)
120
#  define _bool int
121
#  define _false 0
122
#  define _true 1
123
#endif
124
 
125
#ifdef _bool
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      */
128
#  else
129
     typedef _bool bool;
130
#  endif
131
#  define true _true
132
#  define false _false
133
#endif
134
 
135
#define YES   true
136
#define NO    false
137
#undef TRUE             /* some OSF headers define as 1                 */
138
#define TRUE  true
139
#undef FALSE            /* some OSF headers define as 1                 */
140
#define FALSE false
141
 
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;
146
 
147
typedef unsigned   Uint;
148
typedef unsigned8  Uint8;
149
typedef unsigned16 Uint16;
150
typedef unsigned32 Uint32;
151
 
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)
161
#else
162
typedef char *ArgvType;
163
#endif
164
 
165
/*
166
 * Rotate macros
167
 */
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)
172
 
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? */
179
#  endif
180
#else
181
#  define FOPEN_WB     "wb"
182
#  define FOPEN_RB     "rb"
183
#  define FOPEN_RWB    "rb+"
184
#endif
185
 
186
#ifndef FILENAME_MAX
187
#  define FILENAME_MAX 256
188
#endif
189
 
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)
196
 
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)
200
 
201
/* strtod is present in the C-library but is not in stdlib.h       */
202
extern double strtod(const char *str, char **ptr);
203
#endif
204
 
205
/* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
206
#ifndef EXIT_SUCCESS
207
#  define EXIT_SUCCESS           0
208
#endif
209
#ifndef EXIT_FAILURE
210
#  define EXIT_FAILURE           1
211
#endif
212
 
213
#ifndef IGNORE
214
#define IGNORE(x) (x = x)  /* Silence compiler warnings for unused arguments */
215
#endif
216
 
217
/* Define endian-ness of host */
218
 
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
224
#else
225
#  define HOST_ENDIAN_UNKNOWN
226
#endif
227
 
228
#endif
229
 
230
/* end of host.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.