00001 #ifndef _KAYDARA_H
00002 #define _KAYDARA_H
00003
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 #define K_KERNEL_VERSION 13000
00041
00042
00043 #define K_NO_PROJECTSETTINGS
00044
00045
00046 #if defined(FB_KERNEL)
00047 #if defined(K_QUICKTIME_PLUGIN)
00048 #define K_NO_FILTER
00049 #define K_NO_PHYSICS
00050 #endif
00051
00052 #define K_CONFIG_MEMORY
00053
00054 #define K_NO_VIEWCUBE
00055 #define K_NO_STEERINGWHEEL
00056 #define K_NO_ASSETMNG
00057 #define K_NO_DECK
00058 #define K_NO_FOLDER
00059 #define K_NO_IMAGEOPERATOR
00060 #define K_NO_MANIPULATOR
00061 #define K_NO_NOTE
00062 #define K_NO_OPTICAL
00063 #define K_NO_RENDERER
00064 #define K_NO_PYTHON
00065 #define K_NO_UI
00066 #define K_DISABLE_UI
00067 #define K_NO_UNDO
00068 #define K_NO_CIP
00069 #define K_NO_STEREO
00070 #define K_NO_HUD
00071 #define K_NO_CGFX_SHADER
00072
00073
00074
00075
00076
00077 #endif
00078
00079 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00080 #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
00081 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00082 #endif
00083 #ifndef _CRT_NONSTDC_NO_WARNINGS
00084 #define _CRT_NONSTDC_NO_WARNINGS 1
00085 #endif
00086 #ifndef _CRT_SECURE_NO_WARNINGS
00087 #define _CRT_SECURE_NO_WARNINGS 1
00088 #endif
00089 #ifndef _CRT_SECURE_NO_DEPRECATE
00090 #define _CRT_SECURE_NO_DEPRECATE 1
00091 #endif
00092 #endif
00093
00094
00095
00096 #define MEMORY_DEBUG
00097
00098
00099
00100 #define KPROFILING_CODE_ENABLE
00101
00102 #if defined(_DEBUG) && !defined(NDEBUG)
00103 #if defined(_MSC_VER) && !defined(_MFC_VER)
00104 #ifdef MEMORY_DEBUG
00105 #undef __cdecl
00106 #define MEMORY_DEBUG_ACTIVE 1
00107 #define _CRTDBG_MAP_ALLOC 1
00108 #include <stdio.h>
00109 #include <string.h>
00110 #include <stdlib.h>
00111 #include <crtdbg.h>
00112 #include <malloc.h>
00113 #include <new>
00114 #include <xdebug>
00115 #include <xlocale>
00116 #include <xiosbase>
00117 #include <xlocnum>
00118 #include <xlocmon>
00119 #include <xtree>
00120
00121 #define KaydaraNew new( _NORMAL_BLOCK, __FILE__, __LINE__)
00122 #ifndef new
00123 #define new KaydaraNew
00124 #endif
00125 #else
00126 #include <malloc.h>
00127 #endif
00128 #endif
00129 #endif
00130
00131 #ifndef FB_KERNEL
00132 #if !defined(K_ENABLE_STREAM_FCURVE)
00133 #define K_ENABLE_STREAM_FCURVE
00134 #endif
00135 #endif
00136
00137 #include <karch/arch.h>
00138 #include <karch/types.h>
00139
00140 #ifndef K_NO_QUICKTIME
00141 #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_MING32) || (defined(KARCH_ENV_MACOSX) && defined(KARCH_ARCH_X64))
00142 #define K_NO_QUICKTIME // No QuickTime implementions for those platforms
00143 #endif
00144 #endif
00145
00146 #ifndef NULL
00147 #if defined __GNUG__
00148 #define NULL (__null)
00149 #else
00150 #ifdef __cplusplus
00151 #define NULL 0
00152 #else
00153 #define NULL ((void *)0)
00154 #endif
00155 #endif
00156 #endif
00157
00158 #if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
00159 #define _MAX_PATH 1024
00160 #endif
00161
00162 #define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
00163
00164 #define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
00165 #define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
00166
00167 #define K_SAFE_FREE_PTR( p ) if( p ){ free( p ); (p) = NULL; }
00168 #define K_SAFE_DELETE_PTR( p ) if( p ){ delete (p); (p) = NULL; }
00169 #define K_SAFE_DELETE_ARRAY_PTR( a ) if( a ){ delete [] (a); (a) = NULL; }
00170
00171 #define K_SAFE_DESTROY_OBJECT( p ) { if( p ){ (p)->Destroy(); (p) = NULL; } }
00172
00173
00174 #ifdef KARCH_ENV_WIN
00175 #define snprintf _snprintf // for stdio.h platform compatibility
00176 #ifndef WIN32_LEAN_AND_MEAN
00177 #define WIN32_LEAN_AND_MEAN // Defined to speed up compilation
00178 #endif
00179 #else
00180 #include <ctype.h>
00181 #include <stdio.h>
00182 #include <string.h>
00183 #include <stdarg.h>
00184 #include <assert.h>
00185 #endif
00186
00187 #if defined(KARCH_DEV_MSC)
00188 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00189
00190
00191
00192 #ifndef stricmp
00193 #define stricmp _stricmp
00194 #endif
00195 #ifndef strnicmp
00196 #define strnicmp _strnicmp
00197 #endif
00198 #ifndef itoa
00199 #define itoa _itoa
00200 #endif
00201 #ifndef getcwd
00202 #define getcwd _getcwd
00203 #endif
00204 #ifndef getpid
00205 #define getpid _getpid
00206 #endif
00207 #ifndef tempnam
00208 #define tempnam _tempnam
00209 #endif
00210 #ifndef fileno
00211 #define fileno _fileno
00212 #endif
00213 #ifndef fdopen
00214 #define fdopen _fdopen
00215 #endif
00216 #endif
00217 #else
00218 #define _MSC_EMULATOR
00219
00220 #if (GCC_VERSION <= 40700) || !defined(__GXX_EXPERIMENTAL_CXX0X__) // override is supported in GCC 4.7 and higher
00221 #define override // Indicates that a method must be an override of a base-class version
00222 #endif
00223
00224 #define sealed // Prevents classes from being used as base classes
00225 #define abstract =0 // Indicates functions or classes are abstract
00226
00227 #if !defined(_TRUNCATE)
00228 #define _TRUNCATE ((size_t)-1)
00229 #endif
00230 inline int strcpy_s( char* dst,size_t bufsize,const char* src )
00231 {
00232 strcpy( dst,src );
00233 return 0;
00234 }
00235 template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
00236 {
00237 return strcpy_s( dst,bufsize,src );
00238 }
00239
00240 inline int strncpy_s( char* dst,size_t bufsize,const char* src,size_t count )
00241 {
00242 strncpy( dst,src,count );
00243 return 0;
00244 }
00245 template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
00246 {
00247 return strncpy_s( dst,bufsize,src,count );
00248 }
00249
00250 inline int vsprintf_s( char *buffer, size_t bufsize, const char *format, va_list args )
00251 {
00252 return vsprintf( buffer,format, args );
00253 }
00254 template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
00255 {
00256 return vsprintf_s( buffer,bufsize,format, args );
00257 }
00258
00259 inline int sprintf_s( char *buffer, size_t bufsize, const char *format, ... )
00260 {
00261 va_list Arguments;
00262 va_start( Arguments, format);
00263 int result = vsprintf_s( buffer,bufsize,format, Arguments );
00264 va_end( Arguments );
00265 return result;
00266 }
00267 template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
00268 {
00269 va_list Arguments;
00270 va_start( Arguments, format);
00271 int result = vsprintf_s( buffer,bufsize,format, Arguments );
00272 va_end( Arguments );
00273 return result;
00274 }
00275
00276 inline int strcat_s( char *dst, size_t bufsize, const char *src )
00277 {
00278 strcat( dst,src );
00279 return 0;
00280 }
00281 template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
00282 {
00283 return strcat_s( dst,bufsize,src );
00284 }
00285
00286 #ifndef strtok_s
00287 #define strtok_s( token,sep,context ) strtok( token,sep )
00288 #endif
00289
00290 #ifndef strncat_s
00291 #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len )
00292 #endif
00293
00294 #ifndef localtime_s
00295 #define localtime_s( _Tm,_Time ) _Tm = localtime( _Time )
00296 #endif
00297
00298 #ifndef _stricmp
00299 #define _stricmp strcasecmp
00300 #endif
00301 #ifndef strcmpi
00302 #define strcmpi strcasecmp
00303 #endif
00304 #ifndef _strcmpi
00305 #define _strcmpi strcasecmp
00306 #endif
00307 #ifndef stricmp
00308 #define stricmp strcasecmp
00309 #endif
00310 #ifndef strncmpi
00311 #define strncmpi strncasecmp
00312 #endif
00313 #ifndef strnicmp
00314 #define strnicmp strncasecmp
00315 #endif
00316
00317 #ifndef _atoi64
00318 #define _atoi64( str ) strtoll( str,NULL,10 )
00319 #endif
00320
00321 #ifndef _isnan
00322 #define _isnan( x ) isnan( x )
00323 #endif
00324
00325 inline char* _itoa(int pValue, char* pString, int pRadix)
00326 {
00327 assert(pRadix==10);
00328 if (pString) sprintf(pString,"%d", pValue);
00329 return pString;
00330 }
00331
00332 #ifndef itoa
00333 #define itoa _itoa
00334 #endif
00335 #endif
00336
00337 #if defined(KARCH_ENV_LINUX)
00338 #include <malloc.h>
00339 #endif
00340
00341 #if defined(KARCH_ENV_MACOSX)
00342 #include <stdlib.h>
00343 #endif
00344
00345
00346 #if defined(KARCH_DEV_MSC) && !defined(KARCH_DEV_INTEL)
00347 #pragma warning(disable : 4097) // warning C4097: typedef-name 'ClassType' used as synonym for class-name 'KTextTag'
00348 #pragma warning(disable : 4100) // warning C4100: '?' : unreferenced formal parameter
00349 #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union (Level 4) portability
00350 #pragma warning(disable : 4244) // conversion from 'const double' to 'float', possible loss of data
00351 #pragma warning(disable : 4481) // warning C4481: nonstandard extension used: override specifier 'override'
00352 #pragma warning(disable : 4514) // unreferenced inline function has been removed (Level 4) optimizer
00353 #pragma warning(disable : 4660) // template-class specialization 'identifier' is already instantiated (Level 2) compiler
00354 #pragma warning(disable : 4710) // function (X) not expanded ??? may be good to know
00355 #pragma warning(disable : 4711) // function (X) selected for automatic inline expansion
00356 #pragma warning(disable : 4725) // instruction may be inaccurate on some Pentiums
00357 #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
00358
00359 #pragma warning(error : 4002) // too many actual parameters for macro 'identifier'
00360 #pragma warning(error : 4130) // warning C4130: '==' : logical operation on address of string constant
00361 #pragma warning(error : 4238) // warning C4238: nonstandard extension used : class rvalue used as lvalue
00362 #pragma warning(error : 4265) // warning C4265: 'class': class has virtual functions, but destructor is not virtual
00363 #pragma warning(error : 4289) // warning C4289: nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
00364 #pragma warning(error : 4311) // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
00365 #pragma warning(error : 4373) // warning C4373: '%$S': virtual function overrides '%$pS', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
00366 #pragma warning(error : 4431) // warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
00367 #pragma warning(error : 4510) // warning C4510: 'class' : default constructor could not be generated
00368 #pragma warning(error : 4551) // warning C4551: function call missing argument list
00369 #pragma warning(error : 4553) // warning C4553: '==' : operator has no effect; did you intend '='?
00370 #pragma warning(error : 4700) // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
00371 #pragma warning(error : 4701) // warning C4700: (level 4) local variable 'name' may be used without having been initialized
00372 #pragma warning(error : 4407) // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
00373 #pragma warning(error : 4946) // warning C4946: reinterpret_cast used between related classes: 'class1' and 'class2'
00374 #pragma warning(error : 4996) // warning C4996: 'function': was declared deprecated
00375 #endif
00376
00377 #define K_LOCAL_CLASS
00378
00379
00380
00381 #if defined(KARCH_DEV_GNUC) // GNU compiler
00382 #define K_DEPRECATED __attribute__((deprecated))
00383 #elif defined(KARCH_DEV_MSC) || defined(KARCH_DEV_INTEL) // Microsoft or Intel compiler
00384 #define K_DEPRECATED __declspec(deprecated)
00385 #else // Unknown compiler
00386 #define K_DEPRECATED
00387 #endif
00388
00389 #endif // _KAYDARA_H_
00390
00391
00392
00393