Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ind_types.h

Go to the documentation of this file.
00001 
00010 #ifndef __IND_TYPES__
00011 #define __IND_TYPES__
00012 
00013 #include <limits.h>
00014 #include <float.h>
00015 
00016 /******************************************************************************/
00017 /* General-purpose definitions                                                */
00018 /******************************************************************************/
00019 
00020 #ifndef True
00021 #define True            1
00022 #endif
00023 #ifndef False
00024 #define False           0
00025 #endif
00026 
00027 #ifndef Uninitialized
00028 #define Uninitialized  -1
00029 #endif
00030 #ifndef NO_ERROR
00031 #define NO_ERROR        0
00032 #endif
00033 
00034 #ifndef MIN
00035 #define MIN(x,y)        (((x) < (y)) ? (x) : (y))
00036 #endif
00037 #ifndef MAX
00038 #define MAX(x,y)        (((x) > (y)) ? (x) : (y))
00039 #endif
00040 
00041 #ifndef INT_MAX
00042 #error "Warning: INT_MAX undefined; default used"
00043 #define INT_MAX 2147483647
00044 #endif
00045 
00046 #ifndef INT_MIN
00047 #error "Warning: INT_MIN undefined; default used"
00048 #define INT_MIN -2147483647
00049 #endif
00050 
00051 
00052 
00053 /******************************************************************************/
00054 /* C/C++ compatibility                                                        */
00055 /******************************************************************************/
00056 
00062 #ifdef __cplusplus
00063 #define EXTERNAL_C_LINKAGE extern "C"
00064 #else 
00065 #define EXTERNAL_C_LINKAGE
00066 #endif
00067 
00068 
00069 
00070 /******************************************************************************/
00071 /* Platform-independent types                                                 */
00072 /******************************************************************************/
00073 
00074 
00075 /* Cray MPP machines T3D and T3E */
00076 #if     defined(_CRAYMPP)  
00077   typedef char      i8;
00078   typedef short     i32;
00079   typedef int       i64;
00080   typedef float     f32;
00081   typedef double    f64;
00082 #define NO_I16  /* Not supported on Cray MPP */
00083 
00084 
00085 /* Add appropriate definitions for other architectures here */
00086 
00087 
00088 /* Generic 32-bit platform with GCC compiler */
00089 #elif (defined(__GNUC__) && !defined(ANSI_COMPATIBLE))
00090   typedef char      i8;
00091   typedef short     i16;    
00092   typedef long      i32;
00093 #ifndef LONG_LONG_UNAVAILABLE
00094   typedef long long i64;
00095 #endif
00096   typedef float     f32;
00097   typedef double    f64;
00098 
00099 /* Assume generic 32-bit platform with no 64-bit type */
00100 #else   
00101   typedef char      i8;
00102   typedef short     i16;    
00103   typedef long      i32;
00104   typedef float     f32;
00105   typedef double    f64;
00106 #define NO_I64  /* Not supported in ANSI C */
00107 
00108 #endif
00109 
00110 
00111 
00112 /******************************************************************************/
00113 /* Strict ANSI compatibility                                                  */
00114 /******************************************************************************/
00115 
00116 #ifdef ANSI_COMPATIBLE
00117 #define NO_RINT_AVAILABLE
00118 #define NO_TEMPNAM_AVAIL
00119 #define NO_SNPRINTF_AVAIL
00120 #define NO_STRNCASECMP_AVAIL
00121 #define NO_HYPOT_AVAIL
00122 #define NO_SRAND48_AVAIL
00123 #define NO_DRAND48_AVAIL
00124 #define NO_ASSERT_FUNC_INFO_AVAIL
00125 #define NO_SIGNAL_HANDLING
00126 #define LONG_LONG_UNAVAILABLE
00127 #define LONG_DOUBLE_UNAVAILABLE
00128 #endif
00129 
00130 #ifndef ROUND
00131 #define ROUND(a)        (floor((0.5+(a))))
00132 #endif
00133 
00134 #ifdef NO_TEMPNAM_AVAIL
00135 EXTERNAL_C_LINKAGE char *tempnam(const char *dir, const char *pfx);
00136 #endif
00137 
00138 #ifdef NO_SNPRINTF_AVAIL
00139 EXTERNAL_C_LINKAGE int snprintf( char *str, size_t n, const char *format, ...);
00140 #endif
00141 
00142 #ifdef NO_STRNCASECMP_AVAIL
00143 EXTERNAL_C_LINKAGE int strncasecmp(const char *str1, const char *str2, size_t n);
00144 #endif
00145 
00146 #ifdef NO_HYPOT_AVAIL
00147 EXTERNAL_C_LINKAGE double hypot(double x, double y);
00148 #endif
00149 
00150 #ifdef NO_SRAND48_AVAIL
00151 EXTERNAL_C_LINKAGE void srand48(long int seedval);
00152 #endif
00153 
00154 #ifdef NO_DRAND48_AVAIL
00155 EXTERNAL_C_LINKAGE double drand48(void);
00156 #endif
00157 
00158 #ifndef M_E
00159 #define M_E             2.7182818284590452354   /* e */
00160 #endif
00161 #ifndef M_PI
00162 #define M_PI            3.14159265358979323846  /* pi */
00163 #endif
00164 #ifndef M_PI_2
00165 #define M_PI_2          1.57079632679489661923  /* pi/2 */
00166 #endif
00167 #ifndef M_PI_4
00168 #define M_PI_4          0.78539816339744830962  /* pi/4 */
00169 #endif
00170 
00171 /* Add the rest if needed: */
00172 
00173 /*#define       M_1_PI          0.31830988618379067154  * 1/pi */
00174 /*#define       M_2_PI          0.63661977236758134308  * 2/pi */
00175 /*#define       M_2_SQRTPI      1.12837916709551257390  * 2/sqrt(pi) */
00176 /*#define       M_SQRT2         1.41421356237309504880  * sqrt(2) */
00177 /*#define       M_SQRT1_2       0.70710678118654752440  * 1/sqrt(2) */
00178 /*#define       M_LOG2E         1.4426950408889634074   * log 2e */
00179 /*#define       M_LOG10E        0.43429448190325182765  * log 10e */
00180 /*#define       M_LN2           0.69314718055994530942  * log e2 */
00181 /*#define       M_LN10          2.30258509299404568402  * log e10 */
00182 
00183 
00184 
00185 /******************************************************************************/
00186 /* Public functions for achieving compatibility                               */
00187 /******************************************************************************/
00188 
00189 int check_ind_types( int warn_if_missing );
00190 int endianness( void );
00191 
00192 #define swap_endian_proto(type) type type ## _swap_endian(type num)
00193 swap_endian_proto(i32);
00194 /* i32 i32_swap_endian(i32 num); */
00195 #ifndef NO_I64
00196 swap_endian_proto(i64);
00197 /* i64 i64_swap_endian(i64 num); */
00198 #endif
00199 
00200 #endif
00201 

Generated at Mon Aug 21 00:30:54 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000