|
csdef.h00001 /* 00002 Copyright (C) 1998-2000 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 #ifndef TRUE 00039 #define TRUE 1 00040 #endif 00041 00042 #ifndef FALSE 00043 #define FALSE 0 00044 #endif 00045 00046 #ifndef MIN 00047 #define MIN(a,b) ((a)<(b)?(a):(b)) 00048 #endif 00049 00050 #ifndef MAX 00051 #define MAX(a,b) ((a)>(b)?(a):(b)) 00052 #endif 00053 00054 #ifndef ABS 00055 #define ABS(x) ((x)<0?-(x):(x)) 00056 #endif 00057 00058 #if !defined(SIGN) 00059 #define SIGN(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) 00060 #endif 00061 00062 #ifndef PI 00063 #define PI 3.1415926535897932385f 00064 #endif 00065 #ifndef HALF_PI 00066 #define HALF_PI (PI / 2.0f) 00067 #endif 00068 #ifndef TWO_PI 00069 #define TWO_PI (PI * 2.0f) 00070 #endif 00071 00072 #undef EPSILON 00073 #define EPSILON 0.001f /* Small value */ 00074 #undef SMALL_EPSILON 00075 #define SMALL_EPSILON 0.000001f /* Very small value */ 00076 #undef SMALL_EPSILON_D 00077 #define SMALL_EPSILON_D 0.000000000001f /* Very, very small value */ 00078 00079 // A macro for defining a constant static table. The default expansion is 00080 // merely `static const'. Typical usage is `CS_STATIC_TABLE Foo[] = {...};', 00081 // which expands to `static const Foo[] = {...};'. Some variants of GCC have 00082 // been known to throw an internal compiler error exception when confronted 00083 // with such an expression. In this case, the platform-specific header file 00084 // may override the definition of CS_STATIC_TABLE with one which works around 00085 // the compiler bug. 00086 #define CS_STATIC_TABLE static const 00087 00088 // Platforms with compilers which only understand old-style C++ casting syntax 00089 // should define CS_USE_OLD_STYLE_CASTS. 00090 #if defined(CS_USE_OLD_STYLE_CASTS) 00091 #define CS_CAST(C,T,V) ((T)(V)) 00092 #else 00093 #define CS_CAST(C,T,V) (C<T>(V)) 00094 #endif 00095 00096 #define STATIC_CAST(T,V) CS_CAST(static_cast,T,V) 00097 #define DYNAMIC_CAST(T,V) CS_CAST(dynamic_cast,T,V) 00098 #define REINTERPRET_CAST(T,V) CS_CAST(reinterpret_cast,T,V) 00099 #define CONST_CAST(T,V) CS_CAST(const_cast,T,V) 00100 00101 // Platforms with compilers which do not understand the new C++ keyword 00102 // `explicit' should define CS_USE_FAKE_EXPLICIT_KEYWORD. 00103 #if defined(CS_USE_FAKE_EXPLICIT_KEYWORD) 00104 #define explicit /* nothing */ 00105 #endif 00106 00107 // The smallest Z at which 3D clipping occurs 00108 #define SMALL_Z 0.01f 00109 00110 #endif // __CS_CSDEF_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |