summaryrefslogtreecommitdiff
path: root/sdk_hdrs/CWRuntimeFeatures.h
blob: 85c4b4a4b82c4d468e9a0f8cf977bb4ad3722c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*****************************************************************************/
/*  Name......:   CWRuntimeFeatures.h                                        */
/*  Purpose...:   Macros to parameterize your runtime environment based on   */
/*                    platform-specific compiler macros. Target/host         */
/*                    configurations to set host/target values as well as    */
/*                    CW_HOST, CW_HOSTOS, CW_HOST_ENDIAN, CW_LINE_ENDING,    */
/*                    and CW_UNIX_TYPE, which is used to discriminate among  */
/*                    the various UNIX versions.                             */
/*  Info......:   These settings are common enough to factor into a location */
/*                    that can be shared by all components, including those  */
/*                    used internally and those shared externally.           */
/*  Copyright.:   �Copyright 2000 by metrowerks inc. All rights reserved.    */
/*****************************************************************************/

#ifndef CW_RuntimeFeatures_H
#define CW_RuntimeFeatures_H


/*************************
 *  Runtime Definitions  *
 *************************/

  /* host / target processors values used to set HOST macro.  */

#define CW_MC68K            1
#define CW_POWERPC          2
#define CW_INTEL            3
#define CW_MIPS             4
#define CW_SPARC            5
#define CW_PA_RISC          6

  /* host / target operating systems values used to set CW_HOSTOS macro. */

#define	CW_MACOS            1
#define CW_BEWORKS          2
#define CW_UNIX             3
#define CW_MSWIN            4
#define CW_MAGIC            5
#define CW_QNX             11

  /* UNIX specialization values used to set the CW_UNIX_TYPE macro. */

#define CW_SOLARIS         32  /* Base value to support bit manipulation */
#define CW_LINUX           33
#define CW_RHAPSODY        34
#define CW_HPUX            35
#define CW_IRIX            36
#define CW_AIX             37
#define CW_FREEBSD         38

  /* big/little endian values used to set CW_HOST_ENDIAN macro. */

#define CW_ENDIAN_NEUTRAL	0x7fffffff
#define	CW_BIG_ENDIAN		1
#define CW_LITTLE_ENDIAN	2
#define CW_EITHER_ENDIAN	3

/*
** Detemine run-time environment settings based on clues from the
** compile time settings given by specific compilers.
*/
#if defined(__MWERKS__)
  /* Metrowerks Compiler */
  
  #if macintosh && __MC68K__
  
  		/* 68K MacOS */
  	#define	CW_HOST    			CW_MC68K
  	#define	CW_HOSTOS			CW_MACOS
  	#define CW_HOST_ENDIAN		CW_BIG_ENDIAN
  	#define CW_LINE_ENDING		"\r"

  #elif macintosh && __POWERPC__
	
		/* PPC MacOS */
  	#define CW_HOST				CW_POWERPC
  	#define	CW_HOSTOS			CW_MACOS
  	#define CW_HOST_ENDIAN		CW_BIG_ENDIAN
  	#define CW_LINE_ENDING		"\r"

  #elif __INTEL__ && defined(__BEOS__)
  
		/* x86 BeOS */
  	#define	CW_HOST    			CW_INTEL
  	#define	CW_HOSTOS			CW_BEWORKS
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\n"

  #elif __INTEL__ && defined(__QNX__)
  
		/* x86 QNX */
  	#define	CW_HOST    			CW_INTEL
  	#define	CW_HOSTOS			CW_QNX
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\n"
  	
  #elif __INTEL__ && __linux__
  
		/* x86 Linux */
  	#define CW_HOST				CW_INTEL
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_LINUX
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\n"  

  #elif __INTEL__  /* default to Win32 */
  
		/* x86 Assuming Windows */
  	#define	CW_HOST    			CW_INTEL
  	#define	CW_HOSTOS			CW_MSWIN
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\r\n"
  	
  #else
  
  	#error "UNKNOWN CW COMPILER USE"
  	
  #endif

#elif defined(__GNUC__)
  /* GCC/EGCS Compiler */
  
  #if __i386__ && __linux__
  
		/* x86 Linux */
	#define CW_HOST				CW_INTEL
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_LINUX
	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
	#define CW_LINE_ENDING		"\n"
    
  #elif __i386__ && __sun__
  
		/* x86 Solaris */
  	#define CW_HOST				CW_INTEL
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_SOLARIS
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\n"
  	
  #elif __sparc__ && __linux__
  
		/* SPARC Linux */
  	#define CW_HOST				CW_SPARC
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_LINUX
  	#define CW_HOST_ENDIAN		CW_BIG_ENDIAN
  	#define CW_LINE_ENDING		"\n"
  	
  #elif __sparc__ && __sun__
  
		/* SPARC Solaris */
	#define CW_HOST				CW_SPARC
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_SOLARIS
	#define CW_HOST_ENDIAN		CW_BIG_ENDIAN
	#define CW_LINE_ENDING		"\n"
  	
  #elif __i386__ && __BEOS__
  
  		/* x86 BeOS */
  	#define CW_HOST				CW_INTEL
  	#define CW_HOSTOS			CW_BEWORKS
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\n"
  	
  #elif __powerpc__ && __linux__
  
  		/* PPC Linux */
  	#define CW_HOST				CW_POWERPC
  	#define CW_HOSTOS			CW_UNIX
  	#define CW_UNIX_TYPE			CW_LINUX
  	#define CW_HOST_ENDIAN		CW_BIG_ENDIAN
  	#define CW_LINE_ENDING		"\n"
  	
  #else
  
  	#error "UNKNOWN GNU COMPILER USE"
  	
  #endif
  
#elif defined(_MSC_VER)
  /* Microsoft VC Compiler */
  
  #if defined(_M_IX86)
  
		/* x86 Windows */
  	#define CW_HOST				CW_INTEL
  	#define CW_HOSTOS			CW_MSWIN
  	#define CW_HOST_ENDIAN		CW_LITTLE_ENDIAN
  	#define CW_LINE_ENDING		"\r\n"
  	
  #else
  
  	#error "UNKNOWN MSC COMPILER USE"
  	
  #endif

#else

	#error	"UNKNOWN COMPILER"

#endif


#endif /* CW_RuntimeFeatures_H */