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 19000
41 // ***
42 
43 #define K_NO_PROJECTSETTINGS
44 #define K_NO_NAMESPACE_UPGRADE // Support for NamespaceUpgradeToFileReference and NamespaceDowngradeFromFileReference
45 #define K_NO_PYTHON_CODE_GENERATION // Python code generator
46 #define K_NO_LIVE // No video input/output support, no fullscreen, Live camera switcher ...
47 
48 /* Product definitions using the Kernel */
49 #if defined(FB_KERNEL)
50 
51 #ifndef FB_KERNEL_WITH_UI
52  #define K_CONFIG_MEMORY
53  #define K_NO_MANIPULATOR
54  #define K_NO_UI
55  #define K_DISABLE_UI
56  #define K_NO_HUD
57 #endif
58 
59  #define K_NO_RENDERER
60  #define K_NO_VIEWCUBE
61  #define K_NO_STEERINGWHEEL
62  #define K_NO_ASSETMNG
63  #define K_NO_DECK
64  #define K_NO_FOLDER
65  #define K_NO_IMAGEOPERATOR
66  #define K_NO_NOTE
67  #define K_NO_OPTICAL
68  #define K_NO_PYTHON
69  #define K_NO_UNDO
70  #define K_NO_CONSTRUCTION_HISTORY
71  #define K_NO_CIP
72  #define K_NO_STEREO
73  #define K_NO_CGFX_SHADER
74  #define K_NO_ONECLICK
75  #define K_NO_NVAPI
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 #else
82  // API availability
83  #ifdef K_NO_CG
84  #define K_NO_CGFX_SHADER
85  #define K_NO_STEREO
86  #endif
87  #ifdef K_NO_NVAPI
88  #endif
89 #endif
90 
91 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
92  #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
93  #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
94  #endif
95  #ifndef _CRT_NONSTDC_NO_WARNINGS
96  #define _CRT_NONSTDC_NO_WARNINGS 1
97  #endif
98  #ifndef _CRT_SECURE_NO_WARNINGS
99  #define _CRT_SECURE_NO_WARNINGS 1
100  #endif
101  #ifndef _CRT_SECURE_NO_DEPRECATE
102  #define _CRT_SECURE_NO_DEPRECATE 1
103  #endif
104 #endif
105 
106 // Memory extra debugging information
107 // Comment out the next line if a redefinition of the new operator is use.
108 #define MEMORY_DEBUG
109 
110 // Profiling for the application.
111 // Comment this to remove all profiling code.
112 #define KPROFILING_CODE_ENABLE
113 
114 #if defined(_DEBUG) && !defined(NDEBUG) && !defined(__CUDACC__)
115  #if defined(_MSC_VER) && !defined(_MFC_VER)
116  #ifdef MEMORY_DEBUG
117  #undef __cdecl
118  #define MEMORY_DEBUG_ACTIVE 1
119  #define _CRTDBG_MAP_ALLOC 1
120  #include <stdio.h>
121  #include <string.h>
122  #include <stdlib.h>
123  #include <crtdbg.h>
124  #include <malloc.h>
125  #include <new>
126  #if (_MSC_VER<1900)
127  #include <xdebug>
128  #endif
129  #include <xlocale>
130  #include <xiosbase>
131  #include <xlocnum>
132  #include <xlocmon>
133  #include <xtree>
134 
135  #define KaydaraNew new( _NORMAL_BLOCK, __FILE__, __LINE__)
136  #ifndef new
137  #define new KaydaraNew
138  #endif
139  #else
140  #include <malloc.h>
141  #endif
142  #endif
143 #endif
144 
145 #ifndef FB_KERNEL
146  #if !defined(K_ENABLE_STREAM_FCURVE)
147  #define K_ENABLE_STREAM_FCURVE
148  #endif
149 #endif
150 
151 #include <karch/arch.h>
152 #include <karch/types.h>
153 
154 #ifndef K_NO_QUICKTIME
155  #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32) || (defined(KARCH_ENV_MACOSX) && defined(KARCH_ARCH_X64))
156  #define K_NO_QUICKTIME // No QuickTime implementions for those platforms
157  #endif
158 #endif
159 
160 #ifndef K_NO_ADVANCEDCONSTRAINTS
161  #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
162  #define K_NO_ADVANCEDCONSTRAINTS // No advance constraints
163  #endif
164 #endif
165 
166 #ifndef K_NO_PHYSICS
167  #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
168  #define K_NO_PHYSICS
169  #endif
170 #endif
171 
172 #ifndef NULL
173  #if defined __GNUG__
174  #define NULL (__null)
175  #else
176  #ifdef __cplusplus
177  #define NULL 0
178  #else
179  #define NULL ((void *)0)
180  #endif
181  #endif
182 #endif
183 
184 #if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
185  #define _MAX_PATH 1024
186 #endif
187 
188 #define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
189 
190 #define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
191 #define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
192 
193 #define K_SAFE_FREE_PTR( p ) if( p ){ free( p ); (p) = NULL; }
194 #define K_SAFE_DELETE_PTR( p ) if( p ){ delete (p); (p) = NULL; }
195 #define K_SAFE_DELETE_ARRAY_PTR( a ) if( a ){ delete [] (a); (a) = NULL; }
196 
197 #define K_SAFE_DESTROY_OBJECT( p ) { if( p ){ (p)->Destroy(); (p) = NULL; } }
198 
199 
200 #ifdef KARCH_ENV_WIN
201  #if _MSC_VER < 1900 // < VS2015
202  #define snprintf _snprintf // for stdio.h platform compatibility
203  #endif
204  #ifndef WIN32_LEAN_AND_MEAN
205  #define WIN32_LEAN_AND_MEAN // Defined to speed up compilation
206  #endif
207 #else
208  #include <ctype.h>
209  #include <stdio.h>
210  #include <string.h>
211  #include <stdarg.h>
212  #include <assert.h>
213  #include <strings.h>
214 #endif
215 
216 #if defined(KARCH_DEV_MSC)
217  #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
218  //RR: macros defined for the conformant ISO C++ since now the following functions
219  // are deprecated
220 
221  #ifndef stricmp
222  #define stricmp _stricmp
223  #endif
224  #ifndef strnicmp
225  #define strnicmp _strnicmp
226  #endif
227  #ifndef itoa
228  #define itoa _itoa
229  #endif
230  #ifndef getcwd
231  #define getcwd _getcwd
232  #endif
233  #ifndef getpid
234  #define getpid _getpid
235  #endif
236  #ifndef fileno
237  #define fileno _fileno
238  #endif
239  #ifndef fdopen
240  #define fdopen _fdopen
241  #endif
242  #endif
243 #else
244  #define _MSC_EMULATOR
245 
246  #define sealed // Prevents classes from being used as base classes
247  #define abstract =0 // Indicates functions or classes are abstract
248 
249  #if !defined(_TRUNCATE)
250  #define _TRUNCATE ((size_t)-1)
251  #endif
252  inline int strcpy_s( char* dst,size_t /*bufsize*/,const char* src )
253  {
254  strcpy( dst,src );
255  return 0;
256  }
257  template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
258  {
259  return strcpy_s( dst,bufsize,src );
260  }
261 
262  inline int strncpy_s( char* dst,size_t /*bufsize*/,const char* src,size_t count )
263  {
264  strncpy( dst,src,count );
265  return 0;
266  }
267  template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
268  {
269  return strncpy_s( dst,bufsize,src,count );
270  }
271 
272  inline int vsprintf_s( char *buffer, size_t /*bufsize*/, const char *format, va_list args )
273  {
274  return vsprintf( buffer,format, args );
275  }
276  template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
277  {
278  return vsprintf_s( buffer,bufsize,format, args );
279  }
280 
281  inline int sprintf_s( char *buffer, size_t 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  template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
290  {
291  va_list Arguments;
292  va_start( Arguments, format); /* Initialize variable arguments. */
293  int result = vsprintf_s( buffer,bufsize,format, Arguments );
294  va_end( Arguments ); /* Reset variable arguments. */
295  return result;
296  }
297 
298  inline int strcat_s( char *dst, size_t /*bufsize*/, const char *src )
299  {
300  strcat( dst,src );
301  return 0;
302  }
303  template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
304  {
305  return strcat_s( dst,bufsize,src );
306  }
307 
308  #ifndef strtok_s
309  #define strtok_s( token,sep,context ) strtok( token,sep )
310  #endif
311 
312  #ifndef strncat_s
313  #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len )
314  #endif
315 
316  #ifndef localtime_s
317  #define localtime_s( _Tm,_Time ) _Tm = localtime( _Time )
318  #endif
319 
320  #ifndef _stricmp
321  #define _stricmp strcasecmp
322  #endif
323  #ifndef strcmpi
324  #define strcmpi strcasecmp
325  #endif
326  #ifndef _strcmpi
327  #define _strcmpi strcasecmp
328  #endif
329  #ifndef stricmp
330  #define stricmp strcasecmp
331  #endif
332  #ifndef strncmpi
333  #define strncmpi strncasecmp
334  #endif
335  #ifndef strnicmp
336  #define strnicmp strncasecmp
337  #endif
338 
339  #ifndef _atoi64
340  #define _atoi64( str ) strtoll( str,NULL,10 )
341  #endif
342 
343  inline char* _itoa(int pValue, char* pString, int pRadix)
344  {
345  assert(pRadix==10);
346  if (pString) sprintf(pString,"%d", pValue);
347  return pString;
348  }
349 
350  #ifndef itoa
351  #define itoa _itoa
352  #endif
353 #endif
354 
355 #if defined(KARCH_ENV_LINUX)
356  #include <malloc.h>
357  #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
358 #endif
359 
360 #if defined(KARCH_ENV_MACOSX)
361  #include <stdlib.h>
362 #endif
363 
364 // Compiler specific
365 #if defined(KARCH_DEV_MSC) && !defined(KARCH_DEV_INTEL)
366  #pragma warning(disable : 4097) // warning C4097: typedef-name 'ClassType' used as synonym for class-name 'KTextTag'
367  #pragma warning(disable : 4100) // warning C4100: '?' : unreferenced formal parameter
368  #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union (Level 4) portability
369  #pragma warning(disable : 4244) // conversion from 'const double' to 'float', possible loss of data
370  #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
371  #pragma warning(disable : 4481) // warning C4481: nonstandard extension used: override specifier 'override'
372  #pragma warning(disable : 4514) // unreferenced inline function has been removed (Level 4) optimizer
373  #pragma warning(disable : 4660) // template-class specialization 'identifier' is already instantiated (Level 2) compiler
374  #pragma warning(disable : 4710) // function (X) not expanded ??? may be good to know
375  #pragma warning(disable : 4711) // function (X) selected for automatic inline expansion
376  #pragma warning(disable : 4725) // instruction may be inaccurate on some Pentiums
377 
378  #pragma warning(error : 4002) // too many actual parameters for macro 'identifier'
379  #pragma warning(error : 4018) // warning C4018: '>': signed/unsigned mismatch
380  #pragma warning(error : 4130) // warning C4130: '==' : logical operation on address of string constant
381  #pragma warning(error : 4189) // warning C4189: local variable is initialized but not referenced
382  #pragma warning(error : 4238) // warning C4238: nonstandard extension used : class rvalue used as lvalue
383  #pragma warning(error : 4265) // warning C4265: 'class': class has virtual functions, but destructor is not virtual
384  #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
385  #pragma warning(error : 4311) // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
386  #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
387  #pragma warning(error : 4407) // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
388  #pragma warning(error : 4431) // warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
389  #pragma warning(error : 4510) // warning C4510: 'class' : default constructor could not be generated
390  #pragma warning(error : 4551) // warning C4551: function call missing argument list
391  #pragma warning(error : 4553) // warning C4553: '==' : operator has no effect; did you intend '='?
392  #pragma warning(error : 4700) // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
393  #pragma warning(error : 4701) // warning C4701: (level 4) local variable 'name' may be used without having been initialized
394  #pragma warning(error : 4946) // warning C4946: reinterpret_cast used between related classes: 'class1' and 'class2'
395  #pragma warning(error : 4996) // warning C4996: 'function': was declared deprecated
396 #endif
397 
398 #define K_LOCAL_CLASS
399 
400 // Deprecated macro, to remind people to stop using certain functions / attributes.
401 // Retirement policy, instead of directly remove certain functions / attributes, we
402 // should declare them to be deprecated first, and then safely removed them at next
403 // major release. We add major release version number suffix to the macro to indicate
404 // the timing.
405 
406 #if defined(KARCH_DEV_GNUC) // GNU compiler
407  #define K_DEPRECATED_2016 __attribute__((deprecated))
408  #define K_DEPRECATED_2017 __attribute__((deprecated))
409  #define K_DEPRECATED_2018 __attribute__((deprecated))
410  #define K_DEPRECATED_2019 __attribute__((deprecated))
411 #elif defined(KARCH_DEV_MSC) || defined(KARCH_DEV_INTEL) // Microsoft or Intel compiler
412  #define K_DEPRECATED_2016 __declspec(deprecated)
413  #define K_DEPRECATED_2017 __declspec(deprecated)
414  #define K_DEPRECATED_2018 __declspec(deprecated)
415  #define K_DEPRECATED_2019 __declspec(deprecated)
416 #else // Unknown compiler
417  #define K_DEPRECATED_2016
418  #define K_DEPRECATED_2017
419  #define K_DEPRECATED_2018
420  #define K_DEPRECATED_2019
421 #endif
422 
423 #endif // _KAYDARA_H_
424 
425 
426 
427 
va_list
Definition: modsupport.h:23
const char ** buffer
Definition: abstract.h:477
int strncpy_s(char *dst, size_t, const char *src, size_t count)
Definition: kaydara.h:262
PyObject * args
Definition: abstract.h:305
PyObject * src
Definition: abstract.h:588
int strcat_s(char *dst, size_t, const char *src)
Definition: kaydara.h:298
int vsprintf_s(char *buffer, size_t, const char *format, va_list args)
Definition: kaydara.h:272
char * format
Definition: abstract.h:327
int strcpy_s(char *dst, size_t, const char *src)
Definition: kaydara.h:252
int sprintf_s(char *buffer, size_t bufsize, const char *format,...)
Definition: kaydara.h:281
const char void * pValue
Definition: fbcontrols.h:2116
char * _itoa(int pValue, char *pString, int pRadix)
Definition: kaydara.h:343
PyObject int * result
Definition: abstract.h:231
Py_ssize_t count
Definition: abstract.h:1077