00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef CLIPPER_SYSDEP
00046 #define CLIPPER_SYSDEP
00047
00048
00049
00050
00051
00052
00053
00054 #if defined(sun) || defined(sgi) || defined(__osf__) || defined(_MSC_VER)
00055 #include <stdlib.h>
00056 #include <string.h>
00057 #include <ctype.h>
00058 #include <math.h>
00059 #ifndef M_PI
00060 #define M_PI 3.14159265358979
00061 #endif
00062 #define rint(x) (floor((x)+0.5))
00063 namespace std { using ::floor; using ::ceil; using ::fabs; using ::fmod; using ::sqrt; using ::sin; using ::cos; using ::tan; using ::asin; using ::acos; using ::atan; using ::sinh; using ::cosh; using ::tanh; using ::atan2; using ::exp; using ::log; using ::pow; }
00064 #else
00065 #include <cmath>
00066 #endif
00067
00068
00069 #if defined(isnan)
00070 #undef isnan
00071 #endif
00072
00073
00074
00075 namespace clipper {
00076 typedef float ftype32;
00077 typedef double ftype64;
00078 typedef int itype32;
00079 typedef unsigned int uitype32;
00080 # define CLIPPER_NAN_MASK_A_32 0x7f800000U
00081 # define CLIPPER_NAN_MASK_B_32 0x007fffffU
00082 # define CLIPPER_NULL_MASK_32 0x7fc00000U
00083 #if defined(__osf__) || defined(__amd64__)
00084 typedef long itype64;
00085 typedef unsigned long uitype64;
00086 # define CLIPPER_NAN_MASK_A_64 0x7ff0000000000000UL
00087 # define CLIPPER_NAN_MASK_B_64 0x000fffffffffffffUL
00088 # define CLIPPER_NULL_MASK_64 0x7ff8000000000000UL
00089 #else
00090 typedef long long itype64;
00091 typedef unsigned long long uitype64;
00092 # define CLIPPER_NAN_MASK_A_64 0x7ff0000000000000ULL
00093 # define CLIPPER_NAN_MASK_B_64 0x000fffffffffffffULL
00094 # define CLIPPER_NULL_MASK_64 0x7ff8000000000000ULL
00095 #endif
00096 }
00097
00098
00099
00100
00101 #ifndef CLIPPER_DISABLE_THREADS
00102
00103 #ifdef __WIN32__
00104
00105 #include <windows.h>
00106 #undef AddAtom
00107 #define CLIPPER_MUTEX_INIT(MUTEX) InitializeCriticalSection(MUTEX)
00108 #define CLIPPER_MUTEX_FREE(MUTEX) DeleteCriticalSection(MUTEX)
00109 #define CLIPPER_MUTEX_LOCK(MUTEX) EnterCriticalSection(MUTEX)
00110 #define CLIPPER_MUTEX_UNLK(MUTEX) LeaveCriticalSection(MUTEX)
00111 #define CLIPPER_MUTEX_TYPE CRITICAL_SECTION
00112 #define CLIPPER_THREAD_EXEC(THREAD,ENTRY,ARG) (THREAD=CreateThread(0,0,(LPTHREAD_START_ROUTINE)ENTRY,(void*)ARG,0,NULL),THREAD!=NULL)
00113 #define CLIPPER_THREAD_JOIN(THREAD) (WaitForSingleObject(THREAD,INFINITE)>=0)
00114 #define CLIPPER_THREAD_TYPE HANDLE
00115 #define CLIPPER_THREAD_ARGTYPE LPVOID
00116 #define CLIPPER_THREAD_RETTYPE DWORD
00117
00118 #else
00119
00120 #include <pthread.h>
00121 #define CLIPPER_MUTEX_INIT(MUTEX) pthread_mutex_init(MUTEX,NULL)
00122 #define CLIPPER_MUTEX_FREE(MUTEX) pthread_mutex_destroy(MUTEX)
00123 #define CLIPPER_MUTEX_LOCK(MUTEX) pthread_mutex_lock(MUTEX)
00124 #define CLIPPER_MUTEX_UNLK(MUTEX) pthread_mutex_unlock(MUTEX)
00125 #define CLIPPER_MUTEX_TYPE pthread_mutex_t
00126 #define CLIPPER_THREAD_EXEC(THREAD,ENTRY,ARG) (pthread_create(&THREAD,NULL,ENTRY,(void*)ARG)==0)
00127 #define CLIPPER_THREAD_JOIN(THREAD) (pthread_join(THREAD,NULL)==0)
00128 #define CLIPPER_THREAD_TYPE pthread_t
00129 #define CLIPPER_THREAD_ARGTYPE void*
00130 #define CLIPPER_THREAD_RETTYPE void*
00131
00132 #endif
00133 #endif
00134
00135
00136 #endif