kaydara.h Source File

kaydara.h
Go to the documentation of this file.
1 #ifndef _KAYDARA_H
2 #define _KAYDARA_H
3 /**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12 
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16 
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25 
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
39 // *** if you update this version, make sure to update the other version value in src/motionbuilder/motionbuilder/resource.h
40 #define K_KERNEL_VERSION 18000
41 // ***
42 
43 #define K_NO_PROJECTSETTINGS
44 
45 /* Product definitions using the Kernel */
46 #if defined(FB_KERNEL)
47  #if defined(K_QUICKTIME_PLUGIN)
48  #define K_NO_FILTER
49  #define K_NO_PHYSICS
50  #endif
51 
52 #ifndef FB_KERNEL_WITH_UI
53  #define K_CONFIG_MEMORY
54  #define K_NO_MANIPULATOR
55  #define K_NO_UI
56  #define K_DISABLE_UI
57  #define K_NO_HUD
58 #endif
59 
60  #define K_NO_RENDERER
61  #define K_NO_VIEWCUBE
62  #define K_NO_STEERINGWHEEL
63  #define K_NO_ASSETMNG
64  #define K_NO_DECK
65  #define K_NO_FOLDER
66  #define K_NO_IMAGEOPERATOR
67  #define K_NO_NOTE
68  #define K_NO_OPTICAL
69  #define K_NO_PYTHON
70  #define K_NO_UNDO
71  #define K_NO_CONSTRUCTION_HISTORY
72  #define K_NO_CIP
73  #define K_NO_STEREO
74  #define K_NO_CGFX_SHADER
75  #define K_NO_ONECLICK
76 // #define K_NO_STATIC_FONTS // OpenGL fonts
77 // Others not used
78 // #define K_NO_ACTOR
79 // #define K_NO_CHARACTER
80 // #define K_NO_POSE
81 #endif
82 
83 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
84  #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
85  #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
86  #endif
87  #ifndef _CRT_NONSTDC_NO_WARNINGS
88  #define _CRT_NONSTDC_NO_WARNINGS 1
89  #endif
90  #ifndef _CRT_SECURE_NO_WARNINGS
91  #define _CRT_SECURE_NO_WARNINGS 1
92  #endif
93  #ifndef _CRT_SECURE_NO_DEPRECATE
94  #define _CRT_SECURE_NO_DEPRECATE 1
95  #endif
96 #endif
97 
98 // Memory extra debugging information
99 // Comment out the next line if a redefinition of the new operator is use.
100 #define MEMORY_DEBUG
101 
102 // Profiling for the application.
103 // Comment this to remove all profiling code.
104 #define KPROFILING_CODE_ENABLE
105 
106 #if defined(_DEBUG) && !defined(NDEBUG) && !defined(__CUDACC__)
107  #if defined(_MSC_VER) && !defined(_MFC_VER)
108  #ifdef MEMORY_DEBUG
109  #undef __cdecl
110  #define MEMORY_DEBUG_ACTIVE 1
111  #define _CRTDBG_MAP_ALLOC 1
112  #include <stdio.h>
113  #include <string.h>
114  #include <stdlib.h>
115  #include <crtdbg.h>
116  #include <malloc.h>
117  #include <new>
118  #include <xdebug>
119  #include <xlocale>
120  #include <xiosbase>
121  #include <xlocnum>
122  #include <xlocmon>
123  #include <xtree>
124 
125  #define KaydaraNew new( _NORMAL_BLOCK, __FILE__, __LINE__)
126  #ifndef new
127  #define new KaydaraNew
128  #endif
129  #else
130  #include <malloc.h>
131  #endif
132  #endif
133 #endif
134 
135 #ifndef FB_KERNEL
136  #if !defined(K_ENABLE_STREAM_FCURVE)
137  #define K_ENABLE_STREAM_FCURVE
138  #endif
139 #endif
140 
141 #include <karch/arch.h>
142 #include <karch/types.h>
143 
144 #ifndef K_NO_QUICKTIME
145  #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32) || (defined(KARCH_ENV_MACOSX) && defined(KARCH_ARCH_X64))
146  #define K_NO_QUICKTIME // No QuickTime implementions for those platforms
147  #endif
148 #endif
149 
150 #ifndef K_NO_ADVANCEDCONSTRAINTS
151  #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
152  #define K_NO_ADVANCEDCONSTRAINTS // No advance constraints
153  #endif
154 #endif
155 
156 #ifndef K_NO_PHYSICS
157  #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
158  #define K_NO_PHYSICS
159  #endif
160 #endif
161 
162 #ifndef NULL
163  #if defined __GNUG__
164  #define NULL (__null)
165  #else
166  #ifdef __cplusplus
167  #define NULL 0
168  #else
169  #define NULL ((void *)0)
170  #endif
171  #endif
172 #endif
173 
174 #if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
175  #define _MAX_PATH 1024
176 #endif
177 
178 #define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
179 
180 #define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
181 #define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
182 
183 #define K_SAFE_FREE_PTR( p ) if( p ){ free( p ); (p) = NULL; }
184 #define K_SAFE_DELETE_PTR( p ) if( p ){ delete (p); (p) = NULL; }
185 #define K_SAFE_DELETE_ARRAY_PTR( a ) if( a ){ delete [] (a); (a) = NULL; }
186 
187 #define K_SAFE_DESTROY_OBJECT( p ) { if( p ){ (p)->Destroy(); (p) = NULL; } }
188 
189 
190 #ifdef KARCH_ENV_WIN
191  #define snprintf _snprintf // for stdio.h platform compatibility
192  #ifndef WIN32_LEAN_AND_MEAN
193  #define WIN32_LEAN_AND_MEAN // Defined to speed up compilation
194  #endif
195 #else
196  #include <ctype.h>
197  #include <stdio.h>
198  #include <string.h>
199  #include <stdarg.h>
200  #include <assert.h>
201  #include <strings.h>
202 #endif
203 
204 #if defined(KARCH_DEV_MSC)
205  #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
206  //RR: macros defined for the conformant ISO C++ since now the following functions
207  // are deprecated
208 
209  #ifndef stricmp
210  #define stricmp _stricmp
211  #endif
212  #ifndef strnicmp
213  #define strnicmp _strnicmp
214  #endif
215  #ifndef itoa
216  #define itoa _itoa
217  #endif
218  #ifndef getcwd
219  #define getcwd _getcwd
220  #endif
221  #ifndef getpid
222  #define getpid _getpid
223  #endif
224  #ifndef fileno
225  #define fileno _fileno
226  #endif
227  #ifndef fdopen
228  #define fdopen _fdopen
229  #endif
230  #endif
231 #else
232  #define _MSC_EMULATOR
233 
234  #if (GCC_VERSION <= 40700) || !defined(__GXX_EXPERIMENTAL_CXX0X__) // override is supported in GCC 4.7 and higher
235  #define override // Indicates that a method must be an override of a base-class version
236  #endif
237 
238  #define sealed // Prevents classes from being used as base classes
239  #define abstract =0 // Indicates functions or classes are abstract
240 
241  #if !defined(_TRUNCATE)
242  #define _TRUNCATE ((size_t)-1)
243  #endif
244  inline int strcpy_s( char* dst,size_t bufsize,const char* src )
245  {
246  strcpy( dst,src );
247  return 0;
248  }
249  template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
250  {
251  return strcpy_s( dst,bufsize,src );
252  }
253 
254  inline int strncpy_s( char* dst,size_t bufsize,const char* src,size_t count )
255  {
256  strncpy( dst,src,count );
257  return 0;
258  }
259  template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
260  {
261  return strncpy_s( dst,bufsize,src,count );
262  }
263 
264  inline int vsprintf_s( char *buffer, size_t bufsize, const char *format, va_list args )
265  {
266  return vsprintf( buffer,format, args );
267  }
268  template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
269  {
270  return vsprintf_s( buffer,bufsize,format, args );
271  }
272 
273  inline int sprintf_s( char *buffer, size_t bufsize, const char *format, ... )
274  {
275  va_list Arguments;
276  va_start( Arguments, format); /* Initialize variable arguments. */
277  int result = vsprintf_s( buffer,bufsize,format, Arguments );
278  va_end( Arguments ); /* Reset variable arguments. */
279  return result;
280  }
281  template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
282  {
283  va_list Arguments;
284  va_start( Arguments, format); /* Initialize variable arguments. */
285  int result = vsprintf_s( buffer,bufsize,format, Arguments );
286  va_end( Arguments ); /* Reset variable arguments. */
287  return result;
288  }
289 
290  inline int strcat_s( char *dst, size_t bufsize, const char *src )
291  {
292  strcat( dst,src );
293  return 0;
294  }
295  template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
296  {
297  return strcat_s( dst,bufsize,src );
298  }
299 
300  #ifndef strtok_s
301  #define strtok_s( token,sep,context ) strtok( token,sep )
302  #endif
303 
304  #ifndef strncat_s
305  #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len )
306  #endif
307 
308  #ifndef localtime_s
309  #define localtime_s( _Tm,_Time ) _Tm = localtime( _Time )
310  #endif
311 
312  #ifndef _stricmp
313  #define _stricmp strcasecmp
314  #endif
315  #ifndef strcmpi
316  #define strcmpi strcasecmp
317  #endif
318  #ifndef _strcmpi
319  #define _strcmpi strcasecmp
320  #endif
321  #ifndef stricmp
322  #define stricmp strcasecmp
323  #endif
324  #ifndef strncmpi
325  #define strncmpi strncasecmp
326  #endif
327  #ifndef strnicmp
328  #define strnicmp strncasecmp
329  #endif
330 
331  #ifndef _atoi64
332  #define _atoi64( str ) strtoll( str,NULL,10 )
333  #endif
334 
335  #ifndef _isnan
336  #define _isnan( x ) isnan( x )
337  #endif
338 
339  inline char* _itoa(int pValue, char* pString, int pRadix)
340  {
341  assert(pRadix==10);
342  if (pString) sprintf(pString,"%d", pValue);
343  return pString;
344  }
345 
346  #ifndef itoa
347  #define itoa _itoa
348  #endif
349 #endif
350 
351 #if defined(KARCH_ENV_LINUX)
352  #include <malloc.h>
353 #endif
354 
355 #if defined(KARCH_ENV_MACOSX)
356  #include <stdlib.h>
357 #endif
358 
359 // Compiler specific
360 #if defined(KARCH_DEV_MSC) && !defined(KARCH_DEV_INTEL)
361  #pragma warning(disable : 4097) // warning C4097: typedef-name 'ClassType' used as synonym for class-name 'KTextTag'
362  #pragma warning(disable : 4100) // warning C4100: '?' : unreferenced formal parameter
363  #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union (Level 4) portability
364  #pragma warning(disable : 4244) // conversion from 'const double' to 'float', possible loss of data
365  #pragma warning(disable : 4481) // warning C4481: nonstandard extension used: override specifier 'override'
366  #pragma warning(disable : 4514) // unreferenced inline function has been removed (Level 4) optimizer
367  #pragma warning(disable : 4660) // template-class specialization 'identifier' is already instantiated (Level 2) compiler
368  #pragma warning(disable : 4710) // function (X) not expanded ??? may be good to know
369  #pragma warning(disable : 4711) // function (X) selected for automatic inline expansion
370  #pragma warning(disable : 4725) // instruction may be inaccurate on some Pentiums
371  #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
372 
373  #pragma warning(error : 4002) // too many actual parameters for macro 'identifier'
374  #pragma warning(error : 4130) // warning C4130: '==' : logical operation on address of string constant
375  #pragma warning(error : 4238) // warning C4238: nonstandard extension used : class rvalue used as lvalue
376  #pragma warning(error : 4265) // warning C4265: 'class': class has virtual functions, but destructor is not virtual
377  #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
378  #pragma warning(error : 4311) // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
379  #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
380  #pragma warning(error : 4431) // warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
381  #pragma warning(error : 4510) // warning C4510: 'class' : default constructor could not be generated
382  #pragma warning(error : 4551) // warning C4551: function call missing argument list
383  #pragma warning(error : 4553) // warning C4553: '==' : operator has no effect; did you intend '='?
384  #pragma warning(error : 4700) // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
385  #pragma warning(error : 4701) // warning C4700: (level 4) local variable 'name' may be used without having been initialized
386  #pragma warning(error : 4407) // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
387  #pragma warning(error : 4946) // warning C4946: reinterpret_cast used between related classes: 'class1' and 'class2'
388  #pragma warning(error : 4996) // warning C4996: 'function': was declared deprecated
389 #endif
390 
391 #define K_LOCAL_CLASS
392 
393 // Deprecated macro, to remind people to stop using certain functions / attributes.
394 // Retirement policy, instead of directly remove certain functions / attributes, we
395 // should declare them to be deprecated first, and then safely removed them at next
396 // major release. We add major release version number suffix to the macro to indicate
397 // the timing.
398 
399 #if defined(KARCH_DEV_GNUC) // GNU compiler
400  #define K_DEPRECATED_2014 __attribute__((deprecated))
401  #define K_DEPRECATED_2015 __attribute__((deprecated))
402  #define K_DEPRECATED_2016 __attribute__((deprecated))
403  #define K_DEPRECATED_2017 __attribute__((deprecated))
404  #define K_DEPRECATED_2018 __attribute__((deprecated))
405 #elif defined(KARCH_DEV_MSC) || defined(KARCH_DEV_INTEL) // Microsoft or Intel compiler
406  #define K_DEPRECATED_2014 __declspec(deprecated)
407  #define K_DEPRECATED_2015 __declspec(deprecated)
408  #define K_DEPRECATED_2016 __declspec(deprecated)
409  #define K_DEPRECATED_2017 __declspec(deprecated)
410  #define K_DEPRECATED_2018 __declspec(deprecated)
411 #else // Unknown compiler
412  #define K_DEPRECATED_2014
413  #define K_DEPRECATED_2015
414  #define K_DEPRECATED_2016
415  #define K_DEPRECATED_2017
416  #define K_DEPRECATED_2018
417 #endif
418 
419 #endif // _KAYDARA_H_
420 
421 
422 
423 
va_list
Definition: modsupport.h:23
const char ** buffer
Definition: abstract.h:477
int strncpy_s(char *dst, size_t bufsize, const char *src, size_t count)
Definition: kaydara.h:254
PyObject * args
Definition: abstract.h:305
int vsprintf_s(char *buffer, size_t bufsize, const char *format, va_list args)
Definition: kaydara.h:264
PyObject * src
Definition: abstract.h:588
int strcat_s(char *dst, size_t bufsize, const char *src)
Definition: kaydara.h:290
char * format
Definition: abstract.h:327
int sprintf_s(char *buffer, size_t bufsize, const char *format,...)
Definition: kaydara.h:273
int strcpy_s(char *dst, size_t bufsize, const char *src)
Definition: kaydara.h:244
char * _itoa(int pValue, char *pString, int pRadix)
Definition: kaydara.h:339
PyObject int * result
Definition: abstract.h:231
Py_ssize_t count
Definition: abstract.h:1077