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_H__
00011 #define __IND_TYPES_H__
00012 
00013 #include <limits.h>
00014 #include <float.h>
00015 
00016 
00017 /******************************************************************************/
00018 /* General-purpose definitions                                                */
00019 /******************************************************************************/
00020 
00021 #ifndef NO_ERROR
00022 #define NO_ERROR        0
00023 #endif
00024 
00025 #ifndef MIN
00026 #define MIN(x,y)        (((x) < (y)) ? (x) : (y))
00027 #endif
00028 #ifndef MAX
00029 #define MAX(x,y)        (((x) > (y)) ? (x) : (y))
00030 #endif
00031 
00032 #ifndef INT_MAX
00033 #error "Warning: INT_MAX undefined; default used"
00034 #define INT_MAX 2147483647
00035 #endif
00036 
00037 #ifndef INT_MIN
00038 #error "Warning: INT_MIN undefined; default used"
00039 #define INT_MIN -2147483647
00040 #endif
00041 
00042 
00043 
00044 /******************************************************************************/
00045 /* C/C++ compatibility                                                        */
00046 /******************************************************************************/
00047 
00053 #ifdef __cplusplus
00054 #define EXTERNAL_C_LINKAGE extern "C"
00055 #else 
00056 #define EXTERNAL_C_LINKAGE
00057 #endif
00058 
00059 
00060 
00061 /******************************************************************************/
00062 /* Platform-independent types                                                 */
00063 /******************************************************************************/
00064 
00065 
00066 /* Cray MPP machines T3D and T3E */
00067 #if     defined(_CRAYMPP)  
00068   typedef char      i8;
00069   typedef short     i32;
00070   typedef int       i64;
00071   typedef float     f32;
00072   typedef double    f64;
00073 #define NO_I16  /* Not supported on Cray MPP */
00074 
00075 
00076 /* Add appropriate definitions for other architectures here */
00077 
00078 
00079 /* Generic 32-bit platform with GCC compiler */
00080 #elif (defined(__GNUC__) && !defined(ANSI_COMPATIBLE))
00081   typedef char      i8;
00082   typedef short     i16;    
00083   typedef long      i32;
00084 #ifndef LONG_LONG_UNAVAILABLE
00085   typedef long long i64;
00086 #endif
00087   typedef float     f32;
00088   typedef double    f64;
00089 
00090 /* Assume generic 32-bit platform with no 64-bit type */
00091 #else   
00092   typedef char      i8;
00093   typedef short     i16;    
00094   typedef long      i32;
00095   typedef float     f32;
00096   typedef double    f64;
00097 #define NO_I64  /* Not supported in ANSI C */
00098 
00099 #endif
00100 
00101 
00102 
00103 /******************************************************************************/
00104 /* Strict ANSI compatibility and/or better cross-platform support             */
00105 /******************************************************************************/
00106 
00107 #ifdef ANSI_COMPATIBLE
00108 #define NO_RINT_AVAILABLE
00109 #define NO_TEMPNAM_AVAIL
00110 #define NO_SNPRINTF_AVAIL
00111 #define NO_STRNCASECMP_AVAIL
00112 #define NO_HYPOT_AVAIL
00113 #define NO_RAND48_AVAIL
00114 #define NO_ASSERT_FUNC_INFO_AVAIL
00115 #define NO_SIGNAL_HANDLING
00116 #define LONG_LONG_UNAVAILABLE
00117 #define LONG_DOUBLE_UNAVAILABLE
00118 //#define EXPLICIT_INSTANTIATION_FOR_STATICS
00119 #endif
00120 
00121 #ifndef ROUND
00122 #define ROUND(a)        (floor((0.5+(a))))
00123 #endif
00124 
00125 
00126 #ifdef NO_TEMPNAM_AVAIL
00127 EXTERNAL_C_LINKAGE char *my_tempnam(const char *dir, const char *pfx);
00128 #define TEMPNAME my_tempnam
00129 #else
00130 #define TEMPNAME tempnam
00131 #endif
00132 
00133 #ifdef NO_SNPRINTF_AVAIL
00134 EXTERNAL_C_LINKAGE int   my_snprintf(char *str, size_t n, const char *format, ...);
00135 #define SNPRINTF my_snprintf
00136 #else
00137 #define SNPRINTF snprintf
00138 #endif
00139 
00140 
00141 /******************************************************************************/
00142 /* Public functions for achieving compatibility                               */
00143 /******************************************************************************/
00144 
00145 int check_ind_types( int warn_if_missing );
00146 int endianness( void );
00147 
00148 #define swap_endian_proto(type) type type ## _swap_endian(type num)
00149 swap_endian_proto(i32);
00150 /* i32 i32_swap_endian(i32 num); */
00151 #ifndef NO_I64
00152 swap_endian_proto(i64);
00153 /* i64 i64_swap_endian(i64 num); */
00154 #endif
00155 
00156 #endif /* __IND_TYPES_H */
00157 

Generated on Mon Jan 20 02:35:44 2003 for RF-LISSOM by doxygen1.3-rc2