triodef.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  * $Id: triodef.h,v 1.1 2007/06/07 20:07:25 anttimaa Exp $
00004  *
00005  * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
00006  *
00007  * Permission to use, copy, modify, and distribute this software for any
00008  * purpose with or without fee is hereby granted, provided that the above
00009  * copyright notice and this permission notice appear in all copies.
00010  *
00011  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
00012  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00013  * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
00014  * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
00015  *
00016  ************************************************************************/
00017 
00018 #ifndef TRIO_TRIODEF_H
00019 #define TRIO_TRIODEF_H
00020 
00021 /*************************************************************************
00022  * Platform and compiler support detection
00023  */
00024 #if defined(__GNUC__)
00025 # define TRIO_COMPILER_GCC
00026 #elif defined(__SUNPRO_C)
00027 # define TRIO_COMPILER_SUNPRO
00028 #elif defined(__SUNPRO_CC)
00029 # define TRIO_COMPILER_SUNPRO
00030 # define __SUNPRO_C __SUNPRO_CC
00031 #elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
00032 # define TRIO_COMPILER_XLC
00033 #elif defined(_AIX) && !defined(__GNUC__)
00034 # define TRIO_COMPILER_XLC /* Workaround for old xlc */
00035 #elif defined(__DECC) || defined(__DECCXX)
00036 # define TRIO_COMPILER_DECC
00037 #elif defined(__osf__) && defined(__LANGUAGE_C__)
00038 # define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
00039 #elif defined(_MSC_VER)
00040 # define TRIO_COMPILER_MSVC
00041 #elif defined(__BORLANDC__)
00042 # define TRIO_COMPILER_BCB
00043 #endif
00044 
00045 #if defined(VMS) || defined(__VMS)
00046 /*
00047  * VMS is placed first to avoid identifying the platform as Unix
00048  * based on the DECC compiler later on.
00049  */
00050 # define TRIO_PLATFORM_VMS
00051 #elif defined(unix) || defined(__unix) || defined(__unix__)
00052 # define TRIO_PLATFORM_UNIX
00053 #elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
00054 # define TRIO_PLATFORM_UNIX
00055 #elif defined(TRIO_COMPILER_DECC) || defined(__osf___)
00056 # define TRIO_PLATFORM_UNIX
00057 #elif defined(__NetBSD__)
00058 # define TRIO_PLATFORM_UNIX
00059 #elif defined(__Lynx__)
00060 # define TRIO_PLATFORM_UNIX
00061 #elif defined(__QNX__)
00062 # define TRIO_PLATFORM_UNIX
00063 # define TRIO_PLATFORM_QNX
00064 #elif defined(__CYGWIN__)
00065 # define TRIO_PLATFORM_UNIX
00066 #elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
00067 # define TRIO_PLATFORM_UNIX
00068 #elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
00069 # define TRIO_PLATFORM_WIN32
00070 #elif defined(mpeix) || defined(__mpexl)
00071 # define TRIO_PLATFORM_MPEIX
00072 #endif
00073 
00074 #if defined(_AIX)
00075 # define TRIO_PLATFORM_AIX
00076 #elif defined(__hpux)
00077 # define TRIO_PLATFORM_HPUX
00078 #elif defined(sun) || defined(__sun__)
00079 # if defined(__SVR4) || defined(__svr4__)
00080 #  define TRIO_PLATFORM_SOLARIS
00081 # else
00082 #  define TRIO_PLATFORM_SUNOS
00083 # endif
00084 #endif
00085 
00086 #if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
00087 # define TRIO_COMPILER_SUPPORTS_C89
00088 # if defined(__STDC_VERSION__)
00089 #  define TRIO_COMPILER_SUPPORTS_C90
00090 #  if (__STDC_VERSION__ >= 199409L)
00091 #   define TRIO_COMPILER_SUPPORTS_C94
00092 #  endif
00093 #  if (__STDC_VERSION__ >= 199901L)
00094 #   define TRIO_COMPILER_SUPPORTS_C99
00095 #  endif
00096 # elif defined(TRIO_COMPILER_SUNPRO)
00097 #  if (__SUNPRO_C >= 0x420)
00098 #   define TRIO_COMPILER_SUPPORTS_C94
00099 #  endif
00100 # endif
00101 #endif
00102 
00103 #if defined(_XOPEN_SOURCE)
00104 # if defined(_XOPEN_SOURCE_EXTENDED)
00105 #  define TRIO_COMPILER_SUPPORTS_UNIX95
00106 # endif
00107 # if (_XOPEN_VERSION >= 500)
00108 #  define TRIO_COMPILER_SUPPORTS_UNIX98
00109 # endif
00110 # if (_XOPEN_VERSION >= 600)
00111 #  define TRIO_COMPILER_SUPPORTS_UNIX01
00112 # endif
00113 #endif
00114 
00115 /*************************************************************************
00116  * Generic defines
00117  */
00118 
00119 #if !defined(TRIO_PUBLIC)
00120 # define TRIO_PUBLIC
00121 #endif
00122 #if !defined(TRIO_PRIVATE)
00123 # define TRIO_PRIVATE static
00124 #endif
00125 
00126 #if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
00127 # define TRIO_COMPILER_ANCIENT
00128 #endif
00129 
00130 #if defined(TRIO_COMPILER_ANCIENT)
00131 # define TRIO_CONST
00132 # define TRIO_VOLATILE
00133 # define TRIO_SIGNED
00134 typedef double trio_long_double_t;
00135 typedef char * trio_pointer_t;
00136 # define TRIO_SUFFIX_LONG(x) x
00137 # define TRIO_PROTO(x) ()
00138 # define TRIO_NOARGS
00139 # define TRIO_ARGS1(list,a1) list a1;
00140 # define TRIO_ARGS2(list,a1,a2) list a1; a2;
00141 # define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
00142 # define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
00143 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
00144 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
00145 # define TRIO_VARGS2(list,a1,a2) list a1; a2
00146 # define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
00147 # define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
00148 # define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
00149 # define TRIO_VA_DECL va_dcl
00150 # define TRIO_VA_START(x,y) va_start(x)
00151 # define TRIO_VA_END(x) va_end(x)
00152 #else /* ANSI C */
00153 # define TRIO_CONST const
00154 # define TRIO_VOLATILE volatile
00155 # define TRIO_SIGNED signed
00156 typedef long double trio_long_double_t;
00157 typedef void * trio_pointer_t;
00158 # define TRIO_SUFFIX_LONG(x) x ## L
00159 # define TRIO_PROTO(x) x
00160 # define TRIO_NOARGS void
00161 # define TRIO_ARGS1(list,a1) (a1)
00162 # define TRIO_ARGS2(list,a1,a2) (a1,a2)
00163 # define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
00164 # define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
00165 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
00166 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
00167 # define TRIO_VARGS2 TRIO_ARGS2
00168 # define TRIO_VARGS3 TRIO_ARGS3
00169 # define TRIO_VARGS4 TRIO_ARGS4
00170 # define TRIO_VARGS5 TRIO_ARGS5
00171 # define TRIO_VA_DECL ...
00172 # define TRIO_VA_START(x,y) va_start(x,y)
00173 # define TRIO_VA_END(x) va_end(x)
00174 #endif
00175 
00176 #if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
00177 # define TRIO_INLINE inline
00178 #elif defined(TRIO_COMPILER_GCC)
00179 # define TRIO_INLINE __inline__
00180 #elif defined(TRIO_COMPILER_MSVC)
00181 # define TRIO_INLINE _inline
00182 #elif defined(TRIO_COMPILER_BCB)
00183 # define TRIO_INLINE __inline
00184 #else
00185 # define TRIO_INLINE
00186 #endif
00187 
00188 /*************************************************************************
00189  * Workarounds
00190  */
00191 
00192 #if defined(TRIO_PLATFORM_VMS)
00193 /*
00194  * Computations done with constants at compile time can trigger these
00195  * even when compiling with IEEE enabled.
00196  */
00197 # pragma message disable (UNDERFLOW, FLOATOVERFL)
00198 
00199 # if (__CRTL_VER < 80000000)
00200 /*
00201  * Although the compiler supports C99 language constructs, the C
00202  * run-time library does not contain all C99 functions.
00203  *
00204  * This was the case for 70300022. Update the 80000000 value when
00205  * it has been accurately determined what version of the library
00206  * supports C99.
00207  */
00208 #  if defined(TRIO_COMPILER_SUPPORTS_C99)
00209 #   undef TRIO_COMPILER_SUPPORTS_C99
00210 #  endif
00211 # endif
00212 #endif
00213 
00214 /*
00215  * Not all preprocessors supports the LL token.
00216  */
00217 #if defined(TRIO_COMPILER_BCB)
00218 #else
00219 # define TRIO_COMPILER_SUPPORTS_LL
00220 #endif
00221 
00222 #endif /* TRIO_TRIODEF_H */
footer
 SourceForge.net Logo