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 12000
00041
00042
00043
00044
00045 #define K_NO_PROJECTSETTINGS
00046
00047
00048 #if defined(K_STD)
00049 #define K_NO_NLE
00050 #define K_NO_ASSETMNG
00051 #define K_NO_DECK
00052 #define K_NO_IMAGEOPERATOR
00053 #endif
00054
00055
00056 #if defined(FB_KERNEL)
00057 #if defined(K_QUICKTIME_PLUGIN)
00058 #define K_NO_FILTER
00059 #define K_NO_PHYSICS
00060 #endif
00061
00062 #define K_CONFIG_MEMORY
00063
00064 #define K_NO_VIEWCUBE
00065 #define K_NO_STEERINGWHEEL
00066 #define K_NO_ASSETMNG
00067 #define K_NO_DECK
00068 #define K_NO_FOLDER
00069 #define K_NO_IMAGEOPERATOR
00070 #define K_NO_MANIPULATOR
00071 #define K_NO_NOTE
00072 #define K_NO_OPTICAL
00073 #define K_NO_RENDERER
00074 #define K_NO_PYTHON
00075 #define K_NO_UI
00076 #define K_DISABLE_UI
00077 #define K_NO_UNDO
00078 #define K_NO_CIP
00079 #define K_NO_STEREO
00080
00081
00082
00083
00084
00085 #endif
00086
00087 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00088 #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
00089 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00090 #endif
00091 #ifndef _CRT_NONSTDC_NO_WARNINGS
00092 #define _CRT_NONSTDC_NO_WARNINGS 1
00093 #endif
00094 #ifndef _CRT_SECURE_NO_WARNINGS
00095 #define _CRT_SECURE_NO_WARNINGS 1
00096 #endif
00097 #ifndef _CRT_SECURE_NO_DEPRECATE
00098 #define _CRT_SECURE_NO_DEPRECATE 1
00099 #endif
00100 #endif
00101
00102
00103
00104 #define MEMORY_DEBUG
00105
00106
00107
00108 #define KPROFILING_CODE_ENABLE
00109
00110 #if defined(_DEBUG) && !defined(NDEBUG)
00111 #if defined(_MSC_VER) && !defined(_MFC_VER)
00112 #ifdef MEMORY_DEBUG
00113 #undef __cdecl
00114 #define MEMORY_DEBUG_ACTIVE 1
00115 #define _CRTDBG_MAP_ALLOC 1
00116 #include <stdio.h>
00117 #include <string.h>
00118 #include <stdlib.h>
00119 #include <crtdbg.h>
00120 #include <malloc.h>
00121 #include <new>
00122 #include <xdebug>
00123 #include <xlocale>
00124 #include <xiosbase>
00125 #include <xlocnum>
00126 #include <xlocmon>
00127 #include <xtree>
00128
00129 #define KaydaraNew new( _NORMAL_BLOCK, __FILE__, __LINE__)
00130 #ifndef new
00131 #define new KaydaraNew
00132 #endif
00133 #else
00134 #include <malloc.h>
00135 #endif
00136 #endif
00137 #endif
00138
00139 #ifndef FB_KERNEL
00140 #if !defined(K_ENABLE_STREAM_FCURVE)
00141 #define K_ENABLE_STREAM_FCURVE
00142 #endif
00143 #endif
00144
00145 #include <karch/arch.h>
00146 #include <karch/types.h>
00147
00148 #ifndef K_NO_QUICKTIME
00149 #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_WIN64) || defined(KARCH_ARCH_X64) || defined(KARCH_ENV_MING32)
00150 #define K_NO_QUICKTIME // No QuickTime implementions for those platforms
00151 #endif
00152 #endif
00153
00154 #ifndef NULL
00155 #if defined __GNUG__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
00156 #define NULL (__null)
00157 #else
00158 #ifdef __cplusplus
00159 #define NULL 0
00160 #else
00161 #define NULL ((void *)0)
00162 #endif
00163 #endif
00164 #endif
00165
00166 #if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
00167 #define _MAX_PATH 1024
00168 #endif
00169
00170 #define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
00171
00172 #define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
00173 #define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
00174
00175 #define K_SAFE_FREE_PTR( p ) if( p ){ free( p ); (p) = NULL; }
00176 #define K_SAFE_DELETE_PTR( p ) if( p ){ delete (p); (p) = NULL; }
00177 #define K_SAFE_DELETE_ARRAY_PTR( a ) if( a ){ delete [] (a); (a) = NULL; }
00178
00179 #define K_SAFE_DESTROY_OBJECT( p ) { if( p ){ (p)->Destroy(); (p) = NULL; } }
00180
00181
00182 #ifdef KARCH_ENV_WIN
00183 #define snprintf _snprintf // for stdio.h platform compatibility
00184 #ifndef WIN32_LEAN_AND_MEAN
00185 #define WIN32_LEAN_AND_MEAN // Defined to speed up compilation
00186 #endif
00187 #else
00188 #include <ctype.h>
00189 #include <stdio.h>
00190 #include <string.h>
00191 #include <stdarg.h>
00192 #include <assert.h>
00193 #endif
00194
00195 #if defined(KARCH_DEV_MSC)
00196 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00197
00198
00199
00200 #ifndef stricmp
00201 #define stricmp _stricmp
00202 #endif
00203 #ifndef strnicmp
00204 #define strnicmp _strnicmp
00205 #endif
00206 #ifndef itoa
00207 #define itoa _itoa
00208 #endif
00209 #ifndef getcwd
00210 #define getcwd _getcwd
00211 #endif
00212 #ifndef getpid
00213 #define getpid _getpid
00214 #endif
00215 #ifndef tempnam
00216 #define tempnam _tempnam
00217 #endif
00218 #ifndef fileno
00219 #define fileno _fileno
00220 #endif
00221 #ifndef fdopen
00222 #define fdopen _fdopen
00223 #endif
00224 #endif
00225 #else
00226 #define _MSC_EMULATOR
00227
00228 #define override // Indicates that a method must be an override of a base-class version
00229 #define sealed // Prevents classes from being used as base classes
00230 #define abstract =0 // Indicates functions or classes are abstract
00231
00232 #if !defined(_TRUNCATE)
00233 #define _TRUNCATE ((size_t)-1)
00234 #endif
00235 inline int strcpy_s( char* dst,size_t bufsize,const char* src )
00236 {
00237 strcpy( dst,src );
00238 return 0;
00239 }
00240 template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
00241 {
00242 return strcpy_s( dst,bufsize,src );
00243 }
00244
00245 inline int strncpy_s( char* dst,size_t bufsize,const char* src,size_t count )
00246 {
00247 strncpy( dst,src,count );
00248 return 0;
00249 }
00250 template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
00251 {
00252 return strncpy_s( dst,bufsize,src,count );
00253 }
00254
00255 inline int vsprintf_s( char *buffer, size_t bufsize, const char *format, va_list args )
00256 {
00257 return vsprintf( buffer,format, args );
00258 }
00259 template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
00260 {
00261 return vsprintf_s( buffer,bufsize,format, args );
00262 }
00263
00264 inline int sprintf_s( char *buffer, size_t bufsize, const char *format, ... )
00265 {
00266 va_list Arguments;
00267 va_start( Arguments, format);
00268 int result = vsprintf_s( buffer,bufsize,format, Arguments );
00269 va_end( Arguments );
00270 return result;
00271 }
00272 template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
00273 {
00274 va_list Arguments;
00275 va_start( Arguments, format);
00276 int result = vsprintf_s( buffer,bufsize,format, Arguments );
00277 va_end( Arguments );
00278 return result;
00279 }
00280
00281 inline int strcat_s( char *dst, size_t bufsize, const char *src )
00282 {
00283 strcat( dst,src );
00284 return 0;
00285 }
00286 template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
00287 {
00288 return strcat_s( dst,bufsize,src );
00289 }
00290
00291 #ifndef strtok_s
00292 #define strtok_s( token,sep,context ) strtok( token,sep )
00293 #endif
00294
00295 #ifndef strncat_s
00296 #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len )
00297 #endif
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(error : 4002) // too many actual parameters for macro 'identifier'
00358 #pragma warning(error : 4130) // warning C4130: '==' : logical operation on address of string constant
00359 #pragma warning(error : 4238) // warning C4238: nonstandard extension used : class rvalue used as lvalue
00360 #pragma warning(error : 4311) // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
00361 #pragma warning(error : 4551) // warning C4551: function call missing argument list
00362 #pragma warning(error : 4553) // warning C4553: '==' : operator has no effect; did you intend '='?
00363 #pragma warning(error : 4700) // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
00364 #pragma warning(error : 4701) // warning C4700: (level 4) local variable 'name' may be used without having been initialized
00365
00366
00367 #pragma warning( disable : 4251 )// needs to have dll-interface to be used by clients of class
00368
00369
00370 #endif
00371
00372 #define K_LOCAL_CLASS
00373
00374
00375
00376 #if defined(KARCH_DEV_GNUC) || defined(KARCH_DEV_GNUC_MACOSX) || defined(KARCH_DEV_GNUC_EE) // GNU compiler
00377 #define K_DEPRECATED __attribute__((deprecated))
00378
00379 #elif defined(KARCH_DEV_INTEL) // Intel compiler
00380 #if (__INTEL_COMPILER >= 810) // Maybe we could use an earlier version, we should check this some day
00381 #define K_DEPRECATED __declspec(deprecated)
00382 #else
00383 #define K_DEPRECATED
00384 #endif
00385
00386 #elif defined(KARCH_DEV_MSC) // Microsoft compiler
00387 #if (_MSC_VER >= 1300) // 7.1
00388 #define K_DEPRECATED __declspec(deprecated)
00389 #else
00390 #define K_DEPRECATED
00391 #endif
00392
00393 #elif defined(KARCH_DEV_MACOSX) // Metrowerks compiler
00394 #define K_DEPRECATED
00395
00396 #else // Unknown compiler
00397 #define K_DEPRECATED
00398
00399 #endif
00400
00401
00402 #endif // _KAYDARA_H_
00403
00404
00405
00406