00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #if !defined(CSDEF_FRIEND)
00020 #error You are not allowed to include this file! Use cssysdef.h instead.
00021 #endif
00022
00023 #ifndef __CS_CSDEF_H__
00024 #define __CS_CSDEF_H__
00025
00026 #include "platform.h"
00027 #include "cstypes.h"
00028
00029 #include <stdio.h>
00030 #include <stdlib.h>
00031 #include <math.h>
00032 #include <time.h>
00033 #include <signal.h>
00034 #include <errno.h>
00035 #include <string.h>
00036 #include <assert.h>
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef TRUE
00046 #define TRUE 1
00047 #endif
00048
00049
00050 #ifndef FALSE
00051 #define FALSE 0
00052 #endif
00053
00054 #ifndef MIN
00055 #define MIN(a,b) ((a)<(b)?(a):(b))
00056 #endif
00057
00058 #ifndef MAX
00059 #define MAX(a,b) ((a)>(b)?(a):(b))
00060 #endif
00061
00062 #ifndef ABS
00063 #define ABS(x) ((x)<0?-(x):(x))
00064 #endif
00065
00066 #ifndef SIGN
00067 #define SIGN(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
00068 #endif
00069
00070 #ifndef PI
00071 #define PI 3.1415926535897932385f
00072 #endif
00073 #ifndef HALF_PI
00074 #define HALF_PI (PI / 2.0f)
00075 #endif
00076 #ifndef TWO_PI
00077 #define TWO_PI (PI * 2.0f)
00078 #endif
00079
00080 #undef EPSILON
00081 #define EPSILON 0.001f
00082 #undef SMALL_EPSILON
00083 #define SMALL_EPSILON 0.000001f
00084 #undef SMALL_EPSILON_D
00085 #define SMALL_EPSILON_D 0.000000000001f
00086
00087
00088
00089 #if defined(CS_USE_OLD_STYLE_CASTS)
00090 #define CS_CAST(C,T,V) ((T)(V))
00091 #else
00092 #define CS_CAST(C,T,V) (C<T>(V))
00093 #endif
00094
00095 #define STATIC_CAST(T,V) CS_CAST(static_cast,T,V)
00096 #define DYNAMIC_CAST(T,V) CS_CAST(dynamic_cast,T,V)
00097 #define REINTERPRET_CAST(T,V) CS_CAST(reinterpret_cast,T,V)
00098 #define CONST_CAST(T,V) CS_CAST(const_cast,T,V)
00099
00100
00101
00102 #if defined(CS_USE_FAKE_EXPLICIT_KEYWORD)
00103 #define explicit
00104 #endif
00105
00106
00107 #define SMALL_Z 0.01f
00108
00109 #endif // __CS_CSDEF_H__