1 /*************************************************************************
3 * $Id: triodef.h,v 1.35 2009/09/20 11:37:14 breese Exp $
5 * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
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.
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.
16 ************************************************************************/
18 #ifndef TRIO_TRIODEF_H
19 #define TRIO_TRIODEF_H
21 /*************************************************************************
22 * Compiler support detection
26 # define TRIO_COMPILER_GCC
29 #if defined(__SUNPRO_CC)
30 # define TRIO_COMPILER_SUNPRO __SUNPRO_CC
32 # if defined(__SUNPRO_C)
33 # define TRIO_COMPILER_SUNPRO __SUNPRO_C
37 #if defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
38 # define TRIO_COMPILER_XLC
40 # if defined(_AIX) && !defined(__GNUC__)
41 # define TRIO_COMPILER_XLC /* Workaround for old xlc */
45 #if defined(__DECC) || defined(__DECCXX)
46 # define TRIO_COMPILER_DECC
48 # if defined(__osf__) && defined(__LANGUAGE_C__) && !defined(__GNUC__)
49 # define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
53 #if defined(__HP_aCC) || defined(__HP_cc)
54 # define TRIO_COMPILER_HP
57 #if defined(sgi) || defined(__sgi)
58 # define TRIO_COMPILER_MIPSPRO
62 # define TRIO_COMPILER_MSVC
65 #if defined(__BORLANDC__)
66 # define TRIO_COMPILER_BCB
69 /*************************************************************************
70 * Platform support detection
73 #if defined(VMS) || defined(__VMS)
74 # define TRIO_PLATFORM_VMS
77 #if defined(unix) || defined(__unix) || defined(__unix__)
78 # define TRIO_PLATFORM_UNIX
81 #if defined(TRIO_COMPILER_XLC) || defined(_AIX)
82 # define TRIO_PLATFORM_UNIX
85 #if defined(TRIO_COMPILER_DECC) || defined(__osf___)
86 # if !defined(TRIO_PLATFORM_VMS)
87 # define TRIO_PLATFORM_UNIX
91 #if defined(__NetBSD__)
92 # define TRIO_PLATFORM_UNIX
96 # define TRIO_PLATFORM_UNIX
97 # define TRIO_PLATFORM_LYNX
100 #if defined(__APPLE__) && defined(__MACH__)
101 # define TRIO_PLATFORM_UNIX
105 # define TRIO_PLATFORM_UNIX
106 # define TRIO_PLATFORM_QNX
109 #if defined(__CYGWIN__)
110 # define TRIO_PLATFORM_UNIX
113 #if defined(AMIGA) && defined(TRIO_COMPILER_GCC)
114 # define TRIO_PLATFORM_UNIX
117 #if defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
118 # define TRIO_PLATFORM_WIN32
121 #if defined(_WIN32_WCE)
122 # define TRIO_PLATFORM_WINCE
125 #if defined(mpeix) || defined(__mpexl)
126 # define TRIO_PLATFORM_MPEIX
130 # define TRIO_PLATFORM_AIX
134 # define TRIO_PLATFORM_HPUX
137 #if defined(sun) || defined(__sun__)
138 # if defined(__SVR4) || defined(__svr4__)
139 # define TRIO_PLATFORM_SOLARIS
141 # define TRIO_PLATFORM_SUNOS
145 /*************************************************************************
146 * Standards support detection
149 #if defined(__STDC__) \
150 || defined(_MSC_EXTENSIONS) \
151 || defined(TRIO_COMPILER_BCB)
152 # define PREDEF_STANDARD_C89
154 #if defined(__STDC_VERSION__)
155 # define PREDEF_STANDARD_C90
157 #if (__STDC_VERSION__ - 0 >= 199409L)
158 # define PREDEF_STANDARD_C94
160 #if (__STDC_VERSION__ - 0 >= 199901L)
161 # define PREDEF_STANDARD_C99
163 #if defined(TRIO_COMPILER_SUNPRO) && (TRIO_COMPILER_SUNPRO >= 0x420)
164 # if !defined(PREDEF_STANDARD_C94)
165 # define PREDEF_STANDARD_C94
169 #if defined(__cplusplus)
170 # define PREDEF_STANDARD_CXX
172 #if __cplusplus - 0 >= 199711L
173 # define PREDEF_STANDARD_CXX89
176 #if defined(TRIO_PLATFORM_UNIX)
180 #if defined(_POSIX_VERSION)
181 # define PREDEF_STANDARD_POSIX _POSIX_VERSION
182 # if (_POSIX_VERSION >= 199506L)
183 # define PREDEF_STANDARD_POSIX_1996
187 #if (_XOPEN_VERSION - 0 >= 3) || defined(_XOPEN_XPG3)
188 # define PREDEF_STANDARD_XPG3
190 #if (_XOPEN_VERSION - 0 >= 4) || defined(_XOPEN_XPG4)
191 # define PREDEF_STANDARD_XPG4
193 #if (_XOPEN_VERSION - 0 > 4) \
194 || (defined(_XOPEN_UNIX) && (_XOPEN_VERSION - 0 == 4))
195 # define PREDEF_STANDARD_UNIX95
197 #if (_XOPEN_VERSION - 0 >= 500)
198 # define PREDEF_STANDARD_UNIX98
200 #if (_XOPEN_VERSION - 0 >= 600)
201 # define PREDEF_STANDARD_UNIX03
204 /*************************************************************************
208 #if !defined(TRIO_PUBLIC)
211 #if !defined(TRIO_PRIVATE)
212 # define TRIO_PRIVATE static
215 #if !(defined(PREDEF_STANDARD_C89) || defined(PREDEF_STANDARD_CXX))
216 # define TRIO_COMPILER_ANCIENT
219 #if defined(TRIO_COMPILER_ANCIENT)
221 # define TRIO_VOLATILE
223 typedef double trio_long_double_t;
224 typedef char * trio_pointer_t;
225 # define TRIO_SUFFIX_LONG(x) x
226 # define TRIO_PROTO(x) ()
228 # define TRIO_ARGS1(list,a1) list a1;
229 # define TRIO_ARGS2(list,a1,a2) list a1; a2;
230 # define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
231 # define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
232 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
233 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
234 # define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) list a1; a2; a3; a4; a5; a6; a7;
235 # define TRIO_VARGS2(list,a1,a2) list a1; a2
236 # define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
237 # define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
238 # define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
239 # define TRIO_VA_DECL va_dcl
240 # define TRIO_VA_START(x,y) va_start(x)
241 # define TRIO_VA_END(x) va_end(x)
243 # define TRIO_CONST const
244 # define TRIO_VOLATILE volatile
245 # define TRIO_SIGNED signed
246 typedef long double trio_long_double_t;
247 typedef void * trio_pointer_t;
248 # define TRIO_SUFFIX_LONG(x) x ## L
249 # define TRIO_PROTO(x) x
250 # define TRIO_NOARGS void
251 # define TRIO_ARGS1(list,a1) (a1)
252 # define TRIO_ARGS2(list,a1,a2) (a1,a2)
253 # define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
254 # define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
255 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
256 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
257 # define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) (a1,a2,a3,a4,a5,a6,a7)
258 # define TRIO_VARGS2 TRIO_ARGS2
259 # define TRIO_VARGS3 TRIO_ARGS3
260 # define TRIO_VARGS4 TRIO_ARGS4
261 # define TRIO_VARGS5 TRIO_ARGS5
262 # define TRIO_VA_DECL ...
263 # define TRIO_VA_START(x,y) va_start(x,y)
264 # define TRIO_VA_END(x) va_end(x)
267 #if defined(PREDEF_STANDARD_C99) || defined(PREDEF_STANDARD_CXX)
268 # define TRIO_INLINE inline
270 # if defined(TRIO_COMPILER_GCC)
271 # define TRIO_INLINE __inline__
273 # if defined(TRIO_COMPILER_MSVC)
274 # define TRIO_INLINE _inline
276 # if defined(TRIO_COMPILER_BCB)
277 # define TRIO_INLINE __inline
280 #if !defined(TRIO_INLINE)
284 /*************************************************************************
288 #if defined(TRIO_PLATFORM_VMS)
290 * Computations done with constants at compile time can trigger these
291 * even when compiling with IEEE enabled.
293 # pragma message disable (UNDERFLOW, FLOATOVERFL)
295 # if (__CRTL_VER < 80210001)
297 * Although the compiler supports C99 language constructs, the C
298 * run-time library does not contain all C99 functions.
300 # if defined(PREDEF_STANDARD_C99)
301 # undef PREDEF_STANDARD_C99
307 * Not all preprocessors supports the LL token.
309 #if defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
311 # define TRIO_COMPILER_SUPPORTS_LL
314 #if defined(__CYGWIN__)
316 * Cygwin defines the macros for hosted C99, but does not support certain
317 * long double math functions.
319 # include <cygwin/version.h>
320 # define TRIO_CYGWIN_VERSION_API CYGWIN_VERSION_API_MAJOR * 1000 + \
321 CYGWIN_VERSION_API_MINOR
323 * Please change the version number below when the Cygwin API supports
324 * long double math functions (powl, fmodl, etc.)
326 # if TRIO_CYGWIN_VERSION_API < 99999999
327 # define TRIO_NO_FLOORL 1
328 # define TRIO_NO_CEILL 1
329 # define TRIO_NO_POWL 1
330 # define TRIO_NO_FMODL 1
331 # define TRIO_NO_LOG10L 1
335 #endif /* TRIO_TRIODEF_H */