00001
00002 #ifndef GEOS_PLATFORM_H
00003 #define GEOS_PLATFORM_H
00004
00005
00006
00007
00008
00009 #define HAVE_LONG_INT_64 1
00010
00011
00012
00013
00014
00015
00016
00017
00018 #define HAVE_FINITE 1
00019
00020
00021
00022
00023
00024 #define HAVE_ISNAN 1
00025
00026 #ifdef HAVE_IEEEFP_H
00027 extern "C"
00028 {
00029 #include <ieeefp.h>
00030 }
00031 #endif
00032
00033 #ifdef HAVE_INT64_T_64
00034 extern "C"
00035 {
00036 #include <inttypes.h>
00037 }
00038 #endif
00039
00040 #if defined(__GNUC__) && defined(_WIN32)
00041
00042
00043
00044
00045
00046 #include <float.h>
00047 #endif
00048
00049 #include <limits>
00050
00051
00052
00053
00054 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
00055
00056
00057 #define DoubleInfinity std::numeric_limits<double>::infinity()
00058 #define DoubleNegInfinity -std::numeric_limits<double>::infinity()
00059
00060 #define DoubleMax std::numeric_limits<double>::max()
00061
00062 #ifdef HAVE_INT64_T_64
00063 typedef int64_t int64;
00064 #else
00065 # ifdef HAVE_LONG_LONG_INT_64
00066 typedef long long int int64;
00067 # else
00068 typedef long int int64;
00069 # ifndef HAVE_LONG_INT_64
00070 # define INT64_IS_REALLY32 1
00071 # warning "Could not find 64bit integer definition!"
00072 # endif
00073 # endif
00074 #endif
00075
00076
00077 #if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
00078 # define FINITE(x) (finite(x))
00079 #else
00080 # if defined(_MSC_VER)
00081 # define FINITE(x) _finite(static_cast<double>(x))
00082 # else
00083 # define FINITE(x) (isfinite(x))
00084 # endif
00085 #endif
00086
00087 #if defined(HAVE_ISNAN)
00088 # define ISNAN(x) (isnan(x))
00089 #else
00090 # if defined(_MSC_VER)
00091 # define ISNAN(x) _isnan(x)
00092 # elif defined(__MINGW32__) || defined(__CYGWIN__)
00093
00094 # define ISNAN(x) (std::isnan(x))
00095 # elif defined(__OSX__) || defined(__APPLE__) || \
00096 defined(__NetBSD__) || defined(__DragonFly__) || \
00097 (defined(__sun) && defined(__GNUC__))
00098
00099
00100 # define ISNAN(x) (std::isnan(x))
00101 # elif (defined(__sun) || defined(__sun__)) && defined(__SUNPRO_CC)
00102 # include <math.h>
00103 # define ISNAN(x) (::isnan(x))
00104 # endif
00105 #endif
00106
00107 #ifndef FINITE
00108 #error "Can not compile without finite or isfinite function or macro"
00109 #endif
00110
00111 #ifndef ISNAN
00112 #error "Can not compile without isnan function or macro"
00113 #endif
00114
00115 #endif