Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/psx/mednadisc/trio/triodef.h
2 views
1
/*************************************************************************
2
*
3
* $Id$
4
*
5
* Copyright (C) 2001 Bjorn Reese <[email protected]>
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
15
*
16
************************************************************************/
17
18
#ifndef TRIO_TRIODEF_H
19
#define TRIO_TRIODEF_H
20
21
/*************************************************************************
22
* Compiler support detection
23
*/
24
25
#if defined(__GNUC__)
26
# define TRIO_COMPILER_GCC
27
#endif
28
29
#if defined(__SUNPRO_CC)
30
# define TRIO_COMPILER_SUNPRO __SUNPRO_CC
31
#else
32
# if defined(__SUNPRO_C)
33
# define TRIO_COMPILER_SUNPRO __SUNPRO_C
34
# endif
35
#endif
36
37
#if defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
38
# define TRIO_COMPILER_XLC
39
#else
40
# if defined(_AIX) && !defined(__GNUC__)
41
# define TRIO_COMPILER_XLC /* Workaround for old xlc */
42
# endif
43
#endif
44
45
#if defined(__DECC) || defined(__DECCXX)
46
# define TRIO_COMPILER_DECC
47
#else
48
# if defined(__osf__) && defined(__LANGUAGE_C__) && !defined(__GNUC__)
49
# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
50
# endif
51
#endif
52
53
#if defined(__HP_aCC) || defined(__HP_cc)
54
# define TRIO_COMPILER_HP
55
#endif
56
57
#if defined(sgi) || defined(__sgi)
58
# define TRIO_COMPILER_MIPSPRO
59
#endif
60
61
#if defined(_MSC_VER)
62
# define TRIO_COMPILER_MSVC
63
#endif
64
65
#if defined(__BORLANDC__)
66
# define TRIO_COMPILER_BCB
67
#endif
68
69
/*************************************************************************
70
* Platform support detection
71
*/
72
73
#if defined(VMS) || defined(__VMS)
74
# define TRIO_PLATFORM_VMS
75
#endif
76
77
#if defined(unix) || defined(__unix) || defined(__unix__)
78
# define TRIO_PLATFORM_UNIX
79
#endif
80
81
#if defined(TRIO_COMPILER_XLC) || defined(_AIX)
82
# define TRIO_PLATFORM_UNIX
83
#endif
84
85
#if defined(TRIO_COMPILER_DECC) || defined(__osf___)
86
# if !defined(TRIO_PLATFORM_VMS)
87
# define TRIO_PLATFORM_UNIX
88
# endif
89
#endif
90
91
#if defined(__NetBSD__)
92
# define TRIO_PLATFORM_UNIX
93
#endif
94
95
#if defined(__Lynx__)
96
# define TRIO_PLATFORM_UNIX
97
# define TRIO_PLATFORM_LYNX
98
#endif
99
100
#if defined(__APPLE__) && defined(__MACH__)
101
# define TRIO_PLATFORM_UNIX
102
#endif
103
104
#if defined(__QNX__)
105
# define TRIO_PLATFORM_UNIX
106
# define TRIO_PLATFORM_QNX
107
#endif
108
109
#if defined(__CYGWIN__)
110
# define TRIO_PLATFORM_UNIX
111
#endif
112
113
#if defined(AMIGA) && defined(TRIO_COMPILER_GCC)
114
# define TRIO_PLATFORM_UNIX
115
#endif
116
117
#if defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
118
# define TRIO_PLATFORM_WIN32
119
#endif
120
121
#if defined(_WIN32_WCE)
122
# define TRIO_PLATFORM_WINCE
123
#endif
124
125
#if defined(mpeix) || defined(__mpexl)
126
# define TRIO_PLATFORM_MPEIX
127
#endif
128
129
#if defined(_AIX)
130
# define TRIO_PLATFORM_AIX
131
#endif
132
133
#if defined(__hpux)
134
# define TRIO_PLATFORM_HPUX
135
#endif
136
137
#if defined(sun) || defined(__sun__)
138
# if defined(__SVR4) || defined(__svr4__)
139
# define TRIO_PLATFORM_SOLARIS
140
# else
141
# define TRIO_PLATFORM_SUNOS
142
# endif
143
#endif
144
145
#if defined(__powerpc) || defined(__powerpc__) || defined(_ARCH_PPC)
146
# define TRIO_CPU_POWERPC
147
#endif
148
149
#if defined(__sparc) || defined(__sparc__)
150
# define TRIO_CPU_SPARC
151
#endif
152
153
#if defined(__s390x__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
154
# define TRIO_CPU_SYSTEMZ
155
#endif
156
157
/*************************************************************************
158
* Standards support detection
159
*/
160
161
#if defined(__STDC__) \
162
|| defined(_MSC_EXTENSIONS) \
163
|| defined(TRIO_COMPILER_BCB)
164
# define PREDEF_STANDARD_C89
165
#endif
166
#if defined(__STDC_VERSION__)
167
# define PREDEF_STANDARD_C90
168
#endif
169
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199409L)
170
# define PREDEF_STANDARD_C94
171
#endif
172
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
173
# define PREDEF_STANDARD_C99
174
#endif
175
#if defined(TRIO_COMPILER_SUNPRO) && (TRIO_COMPILER_SUNPRO >= 0x420)
176
# if !defined(PREDEF_STANDARD_C94)
177
# define PREDEF_STANDARD_C94
178
# endif
179
#endif
180
181
#if defined(__cplusplus)
182
# define PREDEF_STANDARD_CXX
183
#endif
184
#if defined(__cplusplus) && (__cplusplus >= 199711L)
185
# define PREDEF_STANDARD_CXX89
186
#endif
187
188
#if defined(TRIO_PLATFORM_UNIX)
189
# include <unistd.h>
190
#endif
191
192
#if defined(_POSIX_VERSION)
193
# define PREDEF_STANDARD_POSIX _POSIX_VERSION
194
# if (_POSIX_VERSION >= 199506L)
195
# define PREDEF_STANDARD_POSIX_1996
196
# endif
197
#endif
198
199
#if (_XOPEN_VERSION - 0 >= 3) || defined(_XOPEN_XPG3)
200
# define PREDEF_STANDARD_XPG3
201
#endif
202
#if (_XOPEN_VERSION - 0 >= 4) || defined(_XOPEN_XPG4)
203
# define PREDEF_STANDARD_XPG4
204
#endif
205
#if (_XOPEN_VERSION - 0 > 4) \
206
|| (defined(_XOPEN_UNIX) && (_XOPEN_VERSION - 0 == 4))
207
# define PREDEF_STANDARD_UNIX95
208
#endif
209
#if (_XOPEN_VERSION - 0 >= 500)
210
# define PREDEF_STANDARD_UNIX98
211
#endif
212
#if (_XOPEN_VERSION - 0 >= 600)
213
# define PREDEF_STANDARD_UNIX03
214
#endif
215
216
/*************************************************************************
217
* Generic defines
218
*/
219
220
#if !defined(TRIO_PUBLIC)
221
/* Based on http://gcc.gnu.org/wiki/Visibility */
222
# if defined(TRIO_PLATFORM_WIN32) || defined (__CYGWIN__)
223
# if defined(BUILDING_DLL)
224
# if defined(TRIO_COMPILER_GCC)
225
# define TRIO_PUBLIC __attribute__ ((dllexport))
226
# else
227
# define TRIO_PUBLIC __declspec(dllexport)
228
# endif
229
# else
230
# if defined(TRIO_COMPILER_GCC)
231
# define TRIO_PUBLIC __attribute__ ((dllimport))
232
# else
233
# define TRIO_PUBLIC __declspec(dllimport)
234
# endif
235
# endif
236
# else
237
# if defined(TRIO_COMPILER_GCC) && __GNUC__ >= 4
238
# define TRIO_PUBLIC __attribute__ ((visibility ("default")))
239
# define TRIO_PRIVATE __attribute__ ((visibility ("hidden")))
240
# else
241
# define TRIO_PUBLIC
242
# endif
243
# endif
244
#endif
245
#if !defined(TRIO_PRIVATE)
246
# define TRIO_PRIVATE static
247
#endif
248
249
#if !(defined(PREDEF_STANDARD_C89) || defined(PREDEF_STANDARD_CXX))
250
# define TRIO_COMPILER_ANCIENT
251
#endif
252
253
#if defined(TRIO_COMPILER_ANCIENT)
254
# define TRIO_CONST
255
# define TRIO_VOLATILE
256
# define TRIO_SIGNED
257
typedef double trio_long_double_t;
258
typedef char * trio_pointer_t;
259
# define TRIO_SUFFIX_LONG(x) x
260
# define TRIO_PROTO(x) ()
261
# define TRIO_NOARGS
262
# define TRIO_ARGS1(list,a1) list a1;
263
# define TRIO_ARGS2(list,a1,a2) list a1; a2;
264
# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
265
# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
266
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
267
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
268
# define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) list a1; a2; a3; a4; a5; a6; a7;
269
# define TRIO_ARGS8(list,a1,a2,a3,a4,a5,a6,a7,a8) list a1; a2; a3; a4; a5; a6; a7; a8;
270
# define TRIO_VARGS2(list,a1,a2) list a1; a2
271
# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
272
# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
273
# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
274
# define TRIO_VA_DECL va_dcl
275
# define TRIO_VA_START(x,y) va_start(x)
276
# define TRIO_VA_END(x) va_end(x)
277
#else /* ANSI C */
278
# define TRIO_CONST const
279
# define TRIO_VOLATILE volatile
280
# define TRIO_SIGNED signed
281
typedef long double trio_long_double_t;
282
typedef void * trio_pointer_t;
283
# define TRIO_SUFFIX_LONG(x) x ## L
284
# define TRIO_PROTO(x) x
285
# define TRIO_NOARGS void
286
# define TRIO_ARGS1(list,a1) (a1)
287
# define TRIO_ARGS2(list,a1,a2) (a1,a2)
288
# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
289
# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
290
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
291
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
292
# define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) (a1,a2,a3,a4,a5,a6,a7)
293
# define TRIO_ARGS8(list,a1,a2,a3,a4,a5,a6,a7,a8) (a1,a2,a3,a4,a5,a6,a7,a8)
294
# define TRIO_VARGS2 TRIO_ARGS2
295
# define TRIO_VARGS3 TRIO_ARGS3
296
# define TRIO_VARGS4 TRIO_ARGS4
297
# define TRIO_VARGS5 TRIO_ARGS5
298
# define TRIO_VA_DECL ...
299
# define TRIO_VA_START(x,y) va_start(x,y)
300
# define TRIO_VA_END(x) va_end(x)
301
#endif
302
303
#if defined(PREDEF_STANDARD_C99) || defined(PREDEF_STANDARD_CXX)
304
# define TRIO_INLINE inline
305
#else
306
# if defined(TRIO_COMPILER_GCC)
307
# define TRIO_INLINE __inline__
308
# endif
309
# if defined(TRIO_COMPILER_MSVC)
310
# define TRIO_INLINE _inline
311
# endif
312
# if defined(TRIO_COMPILER_BCB)
313
# define TRIO_INLINE __inline
314
# endif
315
#endif
316
#if !defined(TRIO_INLINE)
317
# define TRIO_INLINE
318
#endif
319
320
/*************************************************************************
321
* Workarounds
322
*/
323
324
#if defined(TRIO_PLATFORM_VMS)
325
/*
326
* Computations done with constants at compile time can trigger these
327
* even when compiling with IEEE enabled.
328
*/
329
# pragma message disable (UNDERFLOW, FLOATOVERFL)
330
331
# if (__CRTL_VER < 80210001)
332
/*
333
* Although the compiler supports C99 language constructs, the C
334
* run-time library does not contain all C99 functions.
335
*/
336
# if defined(PREDEF_STANDARD_C99)
337
# undef PREDEF_STANDARD_C99
338
# endif
339
# endif
340
#endif
341
342
/*
343
* Not all preprocessors supports the LL token.
344
*/
345
#if defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
346
#else
347
# define TRIO_COMPILER_SUPPORTS_LL
348
#endif
349
350
#if defined(__CYGWIN__)
351
/*
352
* Cygwin defines the macros for hosted C99, but does not support certain
353
* long double math functions.
354
*/
355
# include <cygwin/version.h>
356
# define TRIO_CYGWIN_VERSION_API CYGWIN_VERSION_API_MAJOR * 1000 + \
357
CYGWIN_VERSION_API_MINOR
358
/*
359
* Please change the version number below when the Cygwin API supports
360
* long double math functions (powl, fmodl, etc.)
361
*/
362
# if TRIO_CYGWIN_VERSION_API < 99999999
363
# define TRIO_NO_FLOORL 1
364
# define TRIO_NO_CEILL 1
365
# define TRIO_NO_POWL 1
366
# define TRIO_NO_FMODL 1
367
# define TRIO_NO_LOG10L 1
368
# endif
369
#endif
370
371
# if defined(TRIO_CPU_POWERPC) || defined(TRIO_CPU_SPARC) || defined(TRIO_CPU_SYSTEMZ)
372
# define TRIO_DOUBLE_DOUBLE
373
# endif
374
375
#endif /* TRIO_TRIODEF_H */
376
377