Eneboo - Documentación para desarrolladores
|
00001 /************************************************************************* 00002 * 00003 * $Id$ 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(__QNX__) 00060 # define TRIO_PLATFORM_UNIX 00061 # define TRIO_PLATFORM_QNX 00062 #elif defined(__CYGWIN__) 00063 # define TRIO_PLATFORM_UNIX 00064 #elif defined(AMIGA) && defined(TRIO_COMPILER_GCC) 00065 # define TRIO_PLATFORM_UNIX 00066 #elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32) 00067 # define TRIO_PLATFORM_WIN32 00068 #elif defined(mpeix) || defined(__mpexl) 00069 # define TRIO_PLATFORM_MPEIX 00070 #endif 00071 00072 #if defined(_AIX) 00073 # define TRIO_PLATFORM_AIX 00074 #elif defined(__hpux) 00075 # define TRIO_PLATFORM_HPUX 00076 #elif defined(sun) || defined(__sun__) 00077 # if defined(__SVR4) || defined(__svr4__) 00078 # define TRIO_PLATFORM_SOLARIS 00079 # else 00080 # define TRIO_PLATFORM_SUNOS 00081 # endif 00082 #endif 00083 00084 #if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) 00085 # define TRIO_COMPILER_SUPPORTS_C89 00086 # if defined(__STDC_VERSION__) 00087 # define TRIO_COMPILER_SUPPORTS_C90 00088 # if (__STDC_VERSION__ >= 199409L) 00089 # define TRIO_COMPILER_SUPPORTS_C94 00090 # endif 00091 # if (__STDC_VERSION__ >= 199901L) 00092 # define TRIO_COMPILER_SUPPORTS_C99 00093 # endif 00094 # elif defined(TRIO_COMPILER_SUNPRO) 00095 # if (__SUNPRO_C >= 0x420) 00096 # define TRIO_COMPILER_SUPPORTS_C94 00097 # endif 00098 # endif 00099 #endif 00100 00101 #if defined(_XOPEN_SOURCE) 00102 # if defined(_XOPEN_SOURCE_EXTENDED) 00103 # define TRIO_COMPILER_SUPPORTS_UNIX95 00104 # endif 00105 # if (_XOPEN_VERSION >= 500) 00106 # define TRIO_COMPILER_SUPPORTS_UNIX98 00107 # endif 00108 # if (_XOPEN_VERSION >= 600) 00109 # define TRIO_COMPILER_SUPPORTS_UNIX01 00110 # endif 00111 #endif 00112 00113 /************************************************************************* 00114 * Generic defines 00115 */ 00116 00117 #if !defined(TRIO_PUBLIC) 00118 # define TRIO_PUBLIC 00119 #endif 00120 #if !defined(TRIO_PRIVATE) 00121 # define TRIO_PRIVATE static 00122 #endif 00123 00124 #if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus)) 00125 # define TRIO_COMPILER_ANCIENT 00126 #endif 00127 00128 #if defined(TRIO_COMPILER_ANCIENT) 00129 # define TRIO_CONST 00130 # define TRIO_VOLATILE 00131 # define TRIO_SIGNED 00132 typedef double trio_long_double_t; 00133 typedef char * trio_pointer_t; 00134 # define TRIO_SUFFIX_LONG(x) x 00135 # define TRIO_PROTO(x) () 00136 # define TRIO_NOARGS 00137 # define TRIO_ARGS1(list,a1) list a1; 00138 # define TRIO_ARGS2(list,a1,a2) list a1; a2; 00139 # define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3; 00140 # define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4; 00141 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5; 00142 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6; 00143 # define TRIO_VARGS2(list,a1,a2) list a1; a2 00144 # define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3 00145 # define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4 00146 # define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5 00147 # define TRIO_VA_DECL va_dcl 00148 # define TRIO_VA_START(x,y) va_start(x) 00149 # define TRIO_VA_END(x) va_end(x) 00150 #else /* ANSI C */ 00151 # define TRIO_CONST const 00152 # define TRIO_VOLATILE volatile 00153 # define TRIO_SIGNED signed 00154 typedef long double trio_long_double_t; 00155 typedef void * trio_pointer_t; 00156 # define TRIO_SUFFIX_LONG(x) x ## L 00157 # define TRIO_PROTO(x) x 00158 # define TRIO_NOARGS void 00159 # define TRIO_ARGS1(list,a1) (a1) 00160 # define TRIO_ARGS2(list,a1,a2) (a1,a2) 00161 # define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3) 00162 # define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4) 00163 # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5) 00164 # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6) 00165 # define TRIO_VARGS2 TRIO_ARGS2 00166 # define TRIO_VARGS3 TRIO_ARGS3 00167 # define TRIO_VARGS4 TRIO_ARGS4 00168 # define TRIO_VARGS5 TRIO_ARGS5 00169 # define TRIO_VA_DECL ... 00170 # define TRIO_VA_START(x,y) va_start(x,y) 00171 # define TRIO_VA_END(x) va_end(x) 00172 #endif 00173 00174 #if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus) 00175 # define TRIO_INLINE inline 00176 #elif defined(TRIO_COMPILER_GCC) 00177 # define TRIO_INLINE __inline__ 00178 #elif defined(TRIO_COMPILER_MSVC) 00179 # define TRIO_INLINE _inline 00180 #elif defined(TRIO_COMPILER_BCB) 00181 # define TRIO_INLINE __inline 00182 #else 00183 # define TRIO_INLINE 00184 #endif 00185 00186 /************************************************************************* 00187 * Workarounds 00188 */ 00189 00190 #if defined(TRIO_PLATFORM_VMS) 00191 /* 00192 * Computations done with constants at compile time can trigger these 00193 * even when compiling with IEEE enabled. 00194 */ 00195 # pragma message disable (UNDERFLOW, FLOATOVERFL) 00196 00197 # if (__CRTL_VER < 80000000) 00198 /* 00199 * Although the compiler supports C99 language constructs, the C 00200 * run-time library does not contain all C99 functions. 00201 * 00202 * This was the case for 70300022. Update the 80000000 value when 00203 * it has been accurately determined what version of the library 00204 * supports C99. 00205 */ 00206 # if defined(TRIO_COMPILER_SUPPORTS_C99) 00207 # undef TRIO_COMPILER_SUPPORTS_C99 00208 # endif 00209 # endif 00210 #endif 00211 00212 /* 00213 * Not all preprocessors supports the LL token. 00214 */ 00215 #if defined(TRIO_COMPILER_BCB) 00216 #else 00217 # define TRIO_COMPILER_SUPPORTS_LL 00218 #endif 00219 00220 #endif /* TRIO_TRIODEF_H */