missing project/build files
[client-tools.git] / src / external / 3rd / library / DejaInsight / DejaPrivate.h
blobe49c47d098fc2b7294b7b55a5ca63a5b22f45d0d
1 //==============================================================================
2 //
3 // DejaPrivate.h
4 //
5 //==============================================================================
6 // Copyright (C) DejaTools, LLC. All rights reserved.
7 //==============================================================================
9 #ifndef DEJA_PRIVATE_H
10 #define DEJA_PRIVATE_H
12 //==============================================================================
13 // INCLUDES
14 //==============================================================================
16 #include <stdarg.h>
18 //==============================================================================
19 // DYNAMIC LINK LIBRARY MACROS
20 //==============================================================================
22 #ifdef DEJA_DLL
23 #ifdef DEJA_DLL_EXPORT
24 #define DEJA_V_DECL __declspec(dllexport)
25 #define DEJA_F_DECL __declspec(dllexport)
26 #else
27 #define DEJA_V_DECL __declspec(dllimport)
28 #define DEJA_F_DECL
29 #endif
30 #else
31 #define DEJA_V_DECL
32 #define DEJA_F_DECL
33 #endif
35 //==============================================================================
36 // WIDE CHARACTER SUPPORT IF 'wchar_t' IS NOT A BUILT IN TYPE
37 // (For example: DevStudio 2003 with default compiler settings.)
38 //==============================================================================
40 #define deja_wc unsigned short
42 //==============================================================================
43 // PULLED FROM DejaLib.h TEMPORARILY
44 //==============================================================================
46 struct deja_vector
48 float X;
49 float Y;
50 float Z;
53 //------------------------------------------------------------------------------
55 void DEJA_3D_CHANNEL ( const char* pChannel );
56 void DEJA_3D_COLOR ( unsigned char R,
57 unsigned char G,
58 unsigned char B,
59 unsigned char A = 255 );
61 void DEJA_3D_POINT ( float X, float Y, float Z );
62 void DEJA_3D_POINT ( const deja_vector& V );
63 void DEJA_3D_POINT_LIST ( const deja_vector* pVerts, int nVerts );
65 void DEJA_3D_LINE ( const deja_vector& V0,
66 const deja_vector& V1 );
67 void DEJA_3D_LINE_LIST ( const deja_vector* pVerts, int nVerts );
68 void DEJA_3D_LINE_STRIP ( const deja_vector* pVerts, int nVerts );
70 void DEJA_3D_TRI ( const deja_vector& V0,
71 const deja_vector& V1,
72 const deja_vector& V2 );
73 void DEJA_3D_TRI_LIST ( const deja_vector* pVerts, int nVerts );
74 void DEJA_3D_TRI_STRIP ( const deja_vector* pVerts, int nVerts );
76 void DEJA_3D_MARKER ( float X, float Y, float Z );
77 void DEJA_3D_MARKER ( const deja_vector& V );
79 void DEJA_3D_SPHERE ( float X, float Y, float Z, float Radius );
80 void DEJA_3D_SPHERE ( const deja_vector& Center, float Radius );
82 void DEJA_3D_BOX_LOCAL ( const deja_vector& Corner0,
83 const deja_vector& Corner1 );
84 void DEJA_3D_BOX ( const deja_vector& Anchor );
86 //==============================================================================
87 // PLATFORM AND COMPILER AWARENESS
88 //==============================================================================
90 // Check if the target has already been defined by the x_files.
91 #ifndef TARGET_DEFINED
93 #if (defined( DEJA_TARGET_WIN32 ))
94 #define TARGET_WIN32
96 #elif (defined( DEJA_TARGET_XBOX ))
97 #define TARGET_XBOX360
99 #elif (defined( DEJA_TARGET_PS3 ))
100 #define TARGET_PS3
102 #elif (defined( DEJA_TARGET_OSX ))
103 #define TARGET_PS3
105 #elif (defined( XBOX ) || defined( _XBOX ))
106 #define TARGET_XBOX360
108 #elif (defined( PS3 ) || defined( _PS3 ) || defined( __CELLOS_LV2__ ))
109 #define TARGET_PS3
111 #elif (defined( WIN32 ) || defined( _WIN32 ))
112 #define TARGET_WIN32
114 #elif (defined( __APPLE__ ))
115 #define TARGET_OSX
117 #else
118 #error Could not determine the compiler/platform.
119 #endif
121 #define TARGET_DEFINED
123 #endif
125 //------------------------------------------------------------------------------
126 // Does the compiler support "variadic macros"? That is, macros with variable
127 // arguments via an ellipsis such as:
128 // #define MACRO( Arg1, Arg2, ... )
129 //------------------------------------------------------------------------------
131 #if defined( _MSC_VER )
132 // Microsoft compilers.
133 #if _MSC_VER >= 1400
134 #define VARIADIC_MACROS
135 #endif
136 #else
137 // All other compilers.
138 #define VARIADIC_MACROS
139 #endif
141 //------------------------------------------------------------------------------
142 // Under Microsoft compilers, we can use a pragma to get the library linked
143 // into the target application. The customer will still have to provide path
144 // information to find the lib.
145 //------------------------------------------------------------------------------
147 //** Unfortunately, we can't figure out how to squelch runtime library mismatch
148 //** link warnings, so we're going to pass on the pragma technique for now.
149 //#ifdef TARGET_WIN32
150 //#pragma comment( lib, "DejaLib.Win32.lib" )
151 //#endif
153 //==============================================================================
154 // FUNCTIONS AND STRUCTURES
155 //==============================================================================
157 //------------------------------------------------------------------------------
158 // General
159 //------------------------------------------------------------------------------
161 struct deja_log_flag;
163 //------------------------------------------------------------------------------
165 DEJA_F_DECL void DejaLock ( const char* pFileName,
166 int Line,
167 deja_log_flag* pLogFlag,
168 int LogCode );
169 DEJA_F_DECL void DejaLock ( const char* pFileName,
170 int Line );
171 DEJA_F_DECL void DejaLock ( void );
172 DEJA_F_DECL void DejaUnlock ( void );
173 DEJA_F_DECL void DejaFlush ( bool Block = true );
174 DEJA_F_DECL void DejaAutoFlush ( void );
175 DEJA_F_DECL void DejaSetAutoFlush ( bool AutoFlush,
176 const char* pFileName,
177 int Line );
178 DEJA_F_DECL bool DejaLibConnected ( void );
179 DEJA_F_DECL void DejaAppLabel ( const char* pNLabelFormat, ... );
180 DEJA_F_DECL void DejaAppLabel ( const wchar_t* pWLabelFormat, ... );
181 DEJA_F_DECL void DejaAppLabel ( const deja_wc* pWLabelFormat, ... );
182 DEJA_F_DECL void DejaThreadLabel ( const char* pNLabelFormat, ... );
183 DEJA_F_DECL void DejaThreadLabel ( const wchar_t* pWLabelFormat, ... );
184 DEJA_F_DECL void DejaThreadLabel ( const deja_wc* pWLabelFormat, ... );
185 DEJA_F_DECL void DejaSetParameter ( deja_parameter Parameter, int Value );
186 DEJA_F_DECL void DejaSetValue ( const char* pVariable, int Value,
187 const char* pFileName, int Line );
188 DEJA_F_DECL void DejaSetValue ( const wchar_t* pVariable, int Value,
189 const char* pFileName, int Line );
190 DEJA_F_DECL void DejaSetValue ( const deja_wc* pVariable, int Value,
191 const char* pFileName, int Line );
192 DEJA_F_DECL void DejaScopeObject ( const void* pAddr );
193 DEJA_F_DECL void DejaNextFrame ( void );
194 DEJA_F_DECL void DejaThreadInit ( void );
195 DEJA_F_DECL void DejaThreadKill ( int ExitCode );
196 DEJA_F_DECL void DejaTerminate ( void );
197 DEJA_F_DECL void DejaEnumAlias ( const char* pType,
198 int Value,
199 const char* pNAlias,
200 bool bAlias );
201 DEJA_F_DECL void DejaEnumAlias ( const char* pType,
202 int Value,
203 const wchar_t* pWAlias,
204 bool bAlias );
205 DEJA_F_DECL void DejaEnumAlias ( const char* pType,
206 int Value,
207 const deja_wc* pWAlias,
208 bool bAlias );
210 DEJA_F_DECL void DejaSetMalloc ( deja_std_malloc_fn* );
211 DEJA_F_DECL void DejaSetMalloc ( deja_dbg_malloc_fn* );
212 DEJA_F_DECL void DejaSetRealloc ( deja_std_realloc_fn* );
213 DEJA_F_DECL void DejaSetRealloc ( deja_dbg_realloc_fn* );
214 DEJA_F_DECL void DejaSetFree ( deja_std_free_fn* );
215 DEJA_F_DECL void DejaSetFree ( deja_dbg_free_fn* );
217 DEJA_F_DECL void DejaLogMalloc ( void* pMemory, size_t Size );
218 DEJA_F_DECL void DejaLogMalloc ( void* pMemory, size_t Size,
219 const char* pFileName, int Line );
220 DEJA_F_DECL void DejaLogMalloc ( void* pMemory, size_t Size,
221 const wchar_t* pFileName, int Line );
222 DEJA_F_DECL void DejaLogMalloc ( void* pMemory, size_t Size,
223 const deja_wc* pFileName, int Line );
225 DEJA_F_DECL void DejaLogRealloc ( void* pNewMem, void* pOldMem, size_t NewSize );
226 DEJA_F_DECL void DejaLogRealloc ( void* pNewMem, void* pOldMem, size_t NewSize,
227 const char* pFileName, int Line );
228 DEJA_F_DECL void DejaLogRealloc ( void* pNewMem, void* pOldMem, size_t NewSize,
229 const wchar_t* pFileName, int Line );
230 DEJA_F_DECL void DejaLogRealloc ( void* pNewMem, void* pOldMem, size_t NewSize,
231 const deja_wc* pFileName, int Line );
233 DEJA_F_DECL void DejaLogFree ( void* pMemory );
234 DEJA_F_DECL void DejaLogFree ( void* pMemory,
235 const char* pFileName, int Line );
236 DEJA_F_DECL void DejaLogFree ( void* pMemory,
237 const wchar_t* pFileName, int Line );
238 DEJA_F_DECL void DejaLogFree ( void* pMemory,
239 const deja_wc* pFileName, int Line );
241 DEJA_F_DECL void DejaLogNew ( void* pMemory, size_t Size );
242 DEJA_F_DECL void DejaLogNew ( void* pMemory, size_t Size,
243 const char* pFileName, int Line );
244 DEJA_F_DECL void DejaLogNew ( void* pMemory, size_t Size,
245 const wchar_t* pFileName, int Line );
246 DEJA_F_DECL void DejaLogNew ( void* pMemory, size_t Size,
247 const deja_wc* pFileName, int Line );
249 DEJA_F_DECL void DejaLogDelete ( void* pMemory );
250 DEJA_F_DECL void DejaLogDelete ( void* pMemory,
251 const char* pFileName, int Line );
252 DEJA_F_DECL void DejaLogDelete ( void* pMemory,
253 const wchar_t* pFileName, int Line );
254 DEJA_F_DECL void DejaLogDelete ( void* pMemory,
255 const deja_wc* pFileName, int Line );
257 DEJA_F_DECL void DejaLogNewArray ( void* pMemory, size_t Size );
258 DEJA_F_DECL void DejaLogNewArray ( void* pMemory, size_t Size,
259 const char* pFileName, int Line );
260 DEJA_F_DECL void DejaLogNewArray ( void* pMemory, size_t Size,
261 const wchar_t* pFileName, int Line );
262 DEJA_F_DECL void DejaLogNewArray ( void* pMemory, size_t Size,
263 const deja_wc* pFileName, int Line );
265 DEJA_F_DECL void DejaLogDeleteArray ( void* pMemory );
266 DEJA_F_DECL void DejaLogDeleteArray ( void* pMemory,
267 const char* pFileName, int Line );
268 DEJA_F_DECL void DejaLogDeleteArray ( void* pMemory,
269 const wchar_t* pFileName, int Line );
270 DEJA_F_DECL void DejaLogDeleteArray ( void* pMemory,
271 const deja_wc* pFileName, int Line );
273 DEJA_F_DECL void DejaCommand ( const char* pCommand );
275 DEJA_F_DECL char* DejaGetLastError ( void );
277 DEJA_V_DECL extern bool DejaSystemActive;
279 struct deja_object_scope
281 deja_object_scope( const void* pAddr, const char* pFileName, int Line )
283 if( DejaSystemActive )
285 DejaLock( pFileName, Line );
286 DejaScopeObject( pAddr );
287 DejaUnlock();
290 ~deja_object_scope( void )
292 if( DejaSystemActive )
294 DejaLock();
295 DejaScopeObject( 0 );
296 DejaUnlock();
301 //------------------------------------------------------------------------------
302 // Logging
303 //------------------------------------------------------------------------------
305 struct deja_log_flag
307 deja_log_flag( void )
309 On = true;
310 Registered = false;
311 LiteralChannel = true;
312 LiteralFormat = true;
314 deja_log_flag( const char* pChannel, const char* pFormat )
316 On = true;
317 Registered = false;
318 LiteralChannel = (pChannel[0] == '"') || (pChannel[1] == '"');
319 LiteralFormat = (pFormat [0] == '"') || (pFormat [1] == '"');
321 deja_log_flag( const wchar_t* pChannel, const char* pFormat )
323 On = true;
324 Registered = false;
325 LiteralChannel = (pChannel[0] == '"') || (pChannel[1] == '"');
326 LiteralFormat = (pFormat [0] == '"') || (pFormat [1] == '"');
328 deja_log_flag( const char* pChannel, const wchar_t* pFormat )
330 On = true;
331 Registered = false;
332 LiteralChannel = (pChannel[0] == '"') || (pChannel[1] == '"');
333 LiteralFormat = (pFormat [0] == '"') || (pFormat [1] == '"');
335 deja_log_flag( const wchar_t* pChannel, const wchar_t* pFormat )
337 On = true;
338 Registered = false;
339 LiteralChannel = (pChannel[0] == '"') || (pChannel[1] == '"');
340 LiteralFormat = (pFormat [0] == '"') || (pFormat [1] == '"');
342 bool On : 1;
343 bool Registered : 1;
344 bool LiteralChannel : 1;
345 bool LiteralFormat : 1;
348 DEJA_F_DECL void DejaLog ( const char* pChannel, const char* pFormat, ... );
349 DEJA_F_DECL void DejaLog ( const wchar_t* pChannel, const char* pFormat, ... );
350 DEJA_F_DECL void DejaLog ( const char* pChannel, const wchar_t* pFormat, ... );
351 DEJA_F_DECL void DejaLog ( const wchar_t* pChannel, const wchar_t* pFormat, ... );
352 DEJA_F_DECL void DejaLog ( const deja_wc* pChannel, const char* pFormat, ... );
353 DEJA_F_DECL void DejaLog ( const char* pChannel, const deja_wc* pFormat, ... );
354 DEJA_F_DECL void DejaLog ( const deja_wc* pChannel, const deja_wc* pFormat, ... );
355 DEJA_F_DECL void DejaLog_VS7 ( const char* pChannel, const char* pFormat, ... );
356 DEJA_F_DECL void DejaLog_VS7 ( const wchar_t* pChannel, const char* pFormat, ... );
357 DEJA_F_DECL void DejaLog_VS7 ( const char* pChannel, const wchar_t* pFormat, ... );
358 DEJA_F_DECL void DejaLog_VS7 ( const wchar_t* pChannel, const wchar_t* pFormat, ... );
359 DEJA_F_DECL void DejaLog_VS7 ( const deja_wc* pChannel, const char* pFormat, ... );
360 DEJA_F_DECL void DejaLog_VS7 ( const char* pChannel, const deja_wc* pFormat, ... );
361 DEJA_F_DECL void DejaLog_VS7 ( const deja_wc* pChannel, const deja_wc* pFormat, ... );
363 //------------------------------------------------------------------------------
364 // Static 3D
365 //------------------------------------------------------------------------------
367 DEJA_F_DECL void Deja3DChannel ( const char* pChannel );
368 DEJA_F_DECL void Deja3DChannel ( const wchar_t* pChannel );
369 DEJA_F_DECL void Deja3DColor ( unsigned char R,
370 unsigned char G,
371 unsigned char B,
372 unsigned char A = 255 );
374 DEJA_F_DECL void Deja3DPoint ( float X, float Y, float Z );
375 DEJA_F_DECL void Deja3DPoint ( const deja_vector* pVerts );
376 DEJA_F_DECL void Deja3DPointList ( const deja_vector* pVerts, int nVerts );
378 DEJA_F_DECL void Deja3DLine ( const deja_vector& V0,
379 const deja_vector& V1 );
380 DEJA_F_DECL void Deja3DLineList ( const deja_vector* pVerts, int nVerts );
381 DEJA_F_DECL void Deja3DLineStrip ( const deja_vector* pVerts, int nVerts );
383 DEJA_F_DECL void Deja3DTri ( const deja_vector& V0,
384 const deja_vector& V1,
385 const deja_vector& V2 );
386 DEJA_F_DECL void Deja3DTriList ( const deja_vector* pVerts, int nVerts );
387 DEJA_F_DECL void Deja3DTriStrip ( const deja_vector* pVerts, int nVerts );
389 DEJA_F_DECL void Deja3DMarker ( float X, float Y, float Z );
390 DEJA_F_DECL void Deja3DMarker ( const deja_vector& V );
392 DEJA_F_DECL void Deja3DSphere ( float X, float Y, float Z, float Radius );
393 DEJA_F_DECL void Deja3DSphere ( const deja_vector& Center, float Radius );
395 DEJA_F_DECL void Deja3DBoxLocal ( const deja_vector& Corner0,
396 const deja_vector& Corner1 );
397 DEJA_F_DECL void Deja3DBox ( const deja_vector& Anchor );
399 //------------------------------------------------------------------------------
400 // Context
401 //------------------------------------------------------------------------------
403 class deja_context
405 private:
406 deja_context ( void ) { };
408 public:
409 DEJA_F_DECL deja_context ( const void* Address );
410 DEJA_F_DECL ~deja_context ( void );
413 class deja_context_reg
415 private:
416 deja_context_reg ( void ) { };
418 public:
419 DEJA_F_DECL deja_context_reg ( const char* pContext,
420 const char* pFileName,
421 int Line );
422 DEJA_F_DECL deja_context_reg ( const wchar_t* pContext,
423 const char* pFileName,
424 int Line );
427 //------------------------------------------------------------------------------
428 // Data posting
429 //------------------------------------------------------------------------------
431 #define DEJA_VLA_QUEUE_SIZE 100
433 typedef void (deja_d_fn)( const void* pV );
435 struct deja_type;
437 //------------------------------------------------------------------------------
439 DEJA_F_DECL int DejaReserveTypeSeq ( void );
440 DEJA_F_DECL void DejaObjectInfo ( const void* pAddr,
441 const char* pName );
442 DEJA_F_DECL void DejaObjectInit ( void );
443 DEJA_F_DECL void DejaObjectKill ( void );
444 DEJA_F_DECL void DejaObjectLabel ( const void* pAddr,
445 const char* pNLabelFormat, ... );
446 DEJA_F_DECL void DejaObjectLabel ( const void* pAddr,
447 const wchar_t* pWLabelFormat, ... );
448 DEJA_F_DECL void DejaTerminateType ( void );
449 DEJA_F_DECL bool DejaPostLogic ( deja_type& DT,
450 const void* pV );
451 DEJA_F_DECL void DejaOpenPost ( deja_type& DT );
452 DEJA_F_DECL void DejaOpenSubPost ( deja_type& DT );
453 DEJA_F_DECL void DejaClosePost ( void );
454 DEJA_F_DECL void DejaCompoundField ( void );
455 DEJA_F_DECL void DejaVLAField ( deja_d_fn* pVLAFn,
456 const void* pData );
457 DEJA_F_DECL void DejaPostFlush ( void );
458 DEJA_F_DECL int DejaStrLen ( const char* pString );
459 DEJA_F_DECL int DejaStrLen ( const wchar_t* pString );
460 DEJA_F_DECL int DejaStrLen ( const deja_wc* pString );
462 //------------------------------------------------------------------------------
464 DEJA_V_DECL extern int DejaArraySize;
465 DEJA_V_DECL extern int DejaPostPhase;
466 DEJA_V_DECL extern int DejaTypeSeq;
467 DEJA_V_DECL extern int DejaOwnerType;
468 DEJA_V_DECL extern bool DejaAtomicFlag;
469 DEJA_V_DECL extern const void* DejaFieldAddr;
470 DEJA_V_DECL extern const char* DejaFieldName;
471 DEJA_V_DECL extern const char* DejaEnumTypeName;
472 DEJA_V_DECL extern bool DejaIfPtrFlag;
473 DEJA_V_DECL extern int DejaVLAQCursor;
474 DEJA_V_DECL extern int DejaVLAQCount;
475 DEJA_V_DECL extern deja_d_fn* DejaVLAFnPtr[ DEJA_VLA_QUEUE_SIZE ];
476 DEJA_V_DECL extern const void* DejaVLAData [ DEJA_VLA_QUEUE_SIZE ];
477 DEJA_V_DECL extern int DejaVLACount[ DEJA_VLA_QUEUE_SIZE ];
479 //------------------------------------------------------------------------------
481 struct deja_type
483 deja_d_fn* pDescriptor;
484 const char* pTypeName;
485 int TypeSeq;
486 int TypeSize;
487 bool bDefined;
488 void* pNext;
489 deja_type( deja_d_fn* apDescriptor, int Size, const char* apTypeName )
491 pDescriptor = apDescriptor;
492 pTypeName = apTypeName;
493 TypeSeq = 0; // FIELD_UNKNOWN = 0
494 TypeSize = Size;
495 bDefined = false;
496 pNext = NULL;
500 //------------------------------------------------------------------------------
502 struct deja_owner
504 int PreviousOwnerType;
505 deja_type& DejaType;
506 deja_owner( deja_type& DT )
507 : DejaType(DT)
509 PreviousOwnerType = DejaOwnerType;
510 DejaOwnerType = DT.TypeSeq;
512 ~deja_owner( void )
514 if( DejaPostPhase == 1 )
516 DejaTerminateType();
517 DejaType.bDefined = true;
519 DejaOwnerType = PreviousOwnerType;
521 private:
522 deja_owner& operator = ( const deja_owner& ) { return(*this); };
525 //---------------------
526 #ifndef VARIADIC_MACROS
527 //------------------------------------------------------------------------------
528 // Without variadic macros, we must use a template function to both accept an
529 // arbitrary object and accept variable parameters. This approach is
530 // functionally equivalent to the variadic macro form. The only downside is
531 // the need to employ templates which generate more code.
532 //------------------------------------------------------------------------------
534 template< class T >
535 void DejaObjectLabelT( const T& Object,
536 const char* pNLabelFormat, ... );
538 template< class T >
539 void DejaObjectLabelT( const T& Object,
540 const wchar_t* pWLabelFormat, ... );
542 void DejaObjectLabel ( const void* pAddr,
543 const char* pNLabelFormat,
544 const wchar_t* pWLabelFormat,
545 va_list args );
547 //-----------------------
548 #endif // VARIADIC_MACROS
549 //------------------------------------------------------------------------------
550 // This form catches the following:
551 // - Arrays in DEJA_FIELD or DEJA_ENUM.
553 template< class T, int N >
554 void DejaField( const T(&V)[N] )
556 DejaArraySize = N;
557 DejaField( V[0] );
560 //------------------------------------------------------------------------------
561 // This form catches the following:
562 // - Non-predefined types, including enums.
563 // - Pointers to non-atomic types where T = "type*".
565 template< class T >
566 void DejaField( const T& V )
568 DejaDescriptor( V );
570 if( !DejaAtomicFlag )
572 if( DejaArraySize > 1 )
574 const T* pV = &V;
575 for( int i = 1; i < DejaArraySize; i++ )
577 DejaFieldAddr = &pV[i];
578 DejaDescriptor( pV[i] );
582 DejaCompoundField();
585 // Safe to clear the Atomic flag on this execution path.
586 DejaAtomicFlag = false;
589 //==============================================================================
591 template< class T >
592 void DejaVLAField( const T* pV )
594 void DejaDescriptor( const T& );
595 void (*pFn)( const T& ) = DejaDescriptor;
596 DejaVLAField( (deja_d_fn*)pFn, (void*)pV );
598 // Safe to clear the Atomic flag on this execution path.
599 DejaAtomicFlag = false;
602 //------------------------------------------------------------------------------
603 // Announce the explicit expansion for DejaVLAField<void>.
604 //------------------------------------------------------------------------------
606 DEJA_F_DECL void DejaVLAField( const void* pV );
608 //==============================================================================
609 // We need to announce an explicit expansion of template functions DejaField
610 // and DejaDescriptor for all atomic data types (char, int, float, etc).
611 //------------------------------------------------------------------------------
613 DEJA_F_DECL void DejaField( const void** );
614 DEJA_F_DECL void DejaField( const bool& );
615 DEJA_F_DECL void DejaField( const float& );
616 DEJA_F_DECL void DejaField( const double& );
617 DEJA_F_DECL void DejaField( const char& );
618 DEJA_F_DECL void DejaField( const signed char& );
619 DEJA_F_DECL void DejaField( const unsigned char& );
620 DEJA_F_DECL void DejaField( const wchar_t& );
621 DEJA_F_DECL void DejaField( const signed short& );
622 DEJA_F_DECL void DejaField( const unsigned short& );
623 DEJA_F_DECL void DejaField( const signed int& );
624 DEJA_F_DECL void DejaField( const unsigned int& );
625 DEJA_F_DECL void DejaField( const signed long& );
626 DEJA_F_DECL void DejaField( const unsigned long& );
627 DEJA_F_DECL void DejaField( const signed long long& );
628 DEJA_F_DECL void DejaField( const unsigned long long& );
630 //------------------------------------------------------------------------------
632 DEJA_F_DECL void DejaDescriptor( void* const& );
633 DEJA_F_DECL void DejaDescriptor( const void* );
634 DEJA_F_DECL void DejaDescriptor( const bool& );
635 DEJA_F_DECL void DejaDescriptor( const float& );
636 DEJA_F_DECL void DejaDescriptor( const double& );
637 DEJA_F_DECL void DejaDescriptor( const char& );
638 DEJA_F_DECL void DejaDescriptor( const signed char& );
639 DEJA_F_DECL void DejaDescriptor( const unsigned char& );
640 DEJA_F_DECL void DejaDescriptor( const wchar_t& );
641 DEJA_F_DECL void DejaDescriptor( const signed short& );
642 DEJA_F_DECL void DejaDescriptor( const unsigned short& );
643 DEJA_F_DECL void DejaDescriptor( const signed int& );
644 DEJA_F_DECL void DejaDescriptor( const unsigned int& );
645 DEJA_F_DECL void DejaDescriptor( const signed long& );
646 DEJA_F_DECL void DejaDescriptor( const unsigned long& );
647 DEJA_F_DECL void DejaDescriptor( const signed long long& );
648 DEJA_F_DECL void DejaDescriptor( const unsigned long long& );
650 //==============================================================================
652 template< class T, int N >
653 void DejaDescriptor( const T(&V)[N] )
655 DejaArraySize = N;
656 DejaDescriptor( V[0] );
659 //==============================================================================
660 // MACROS
661 //==============================================================================
663 //==============================================================================
664 #ifndef DEJA_DISABLED
665 //==============================================================================
667 //------------------------------------------------------------------------------
668 // Utility
669 //------------------------------------------------------------------------------
671 // The compiler in Visual Studio.NET 2003 does not properly compile constructs
672 // using the token splice preprocessor directive (##) and the predefined line
673 // number macro (__LINE__). This defect is present in SP1 as well. The macro
674 // __COUNTER__ can be used as a work-around as long as the generated symbol is
675 // only needed once. Also, the Edit and Continue features in Visual Studio
676 // are "unhappy" when static variables are renamed, which can happen if the
677 // __LINE__ macro is used to create unique names. So, on Microsoft compilers
678 // use the Microsoft specific macro __COUNTER__ and be certain not to need to
679 // reference the generated unique name more than once.
681 #if defined( _MSC_VER )
683 #define DEJA_UNIQUE_NAME(a) DEJA_SPLICE1( a, __COUNTER__ )
684 #define DEJA_SPLICE1(a,b) DEJA_SPLICE2( a, b )
685 #define DEJA_SPLICE2(a,b) a ## b
687 #else
689 #define DEJA_UNIQUE_NAME(a) DEJA_SPLICE1( a, __LINE__ )
690 #define DEJA_SPLICE1(a,b) DEJA_SPLICE2( a, b )
691 #define DEJA_SPLICE2(a,b) a ## b
693 #endif
695 //------------------------------------------------------------------------------
696 // General
697 //------------------------------------------------------------------------------
699 #define DEJA_FLUSH DejaFlush
700 #define DEJA_APP_LABEL DejaAppLabel
701 #define DEJA_THREAD_LABEL DejaThreadLabel
702 #define DEJA_SET_PARAMETER DejaSetParameter
703 #define DEJA_NEXT_FRAME DejaNextFrame
704 #define DEJA_SET_AUTO_FLUSH( F ) DejaSetAutoFlush( F, __FILE__, __LINE__ );
705 #define DEJA_LIB_CONNECTED DejaLibConnected
706 #define DEJA_LAST_ERROR DejaGetLastError
707 #define DEJA_COMMAND DejaCommand
708 #define DEJA_SET_VALUE( N, V ) DejaSetValue( N, V, __FILE__, __LINE__ );
710 #define DEJA_SET_MALLOC DejaSetMalloc
711 #define DEJA_SET_REALLOC DejaSetRealloc
712 #define DEJA_SET_FREE DejaSetFree
714 #define DEJA_LOG_MALLOC DejaLogMalloc
715 #define DEJA_LOG_REALLOC DejaLogRealloc
716 #define DEJA_LOG_FREE DejaLogFree
717 #define DEJA_LOG_NEW DejaLogNew
718 #define DEJA_LOG_DELETE DejaLogDelete
719 #define DEJA_LOG_NEW_ARRAY DejaLogNewArray
720 #define DEJA_LOG_DELETE_ARRAY DejaLogDeleteArray
722 #define DEJA_ENUM_VALUE( T, V ) DejaEnumAlias( #T, V, #V, false )
723 #define DEJA_ENUM_ALIAS( T, V, A ) DejaEnumAlias( #T, V, A, true )
725 #define DEJA_SCOPE_OBJECT( O ) \
726 deja_object_scope DEJA_UNIQUE_NAME(ObjScope)( &O, __FILE__, __LINE__ );
728 #define DEJA_THREAD_INIT( ) \
729 if( !DejaSystemActive ) { } else \
731 DejaLock( __FILE__, __LINE__ ); \
732 DejaThreadInit(); \
733 DejaUnlock(); \
736 #define DEJA_THREAD_KILL( Code ) \
737 if( !DejaSystemActive ) { } else \
739 DejaLock( __FILE__, __LINE__ ); \
740 DejaThreadKill( Code ); \
741 DejaUnlock(); \
744 #define DEJA_TERMINATE( ) \
745 if( !DejaSystemActive ) { } else \
747 DejaLock( __FILE__, __LINE__ ); \
748 DejaTerminate(); \
749 DejaUnlock(); \
752 //------------------------------------------------------------------------------
753 // Logging
754 //------------------------------------------------------------------------------
756 //====================
757 #ifdef VARIADIC_MACROS
758 //--------------------
760 #define DEJA_CREATE_LOG_FLAG( c, f ) static deja_log_flag DejaLogFlag( #c, #f )
762 #define DEJA_TRACE( Channel, Format, ... ) \
763 if( DejaSystemActive ) \
765 DEJA_CREATE_LOG_FLAG( Channel, Format ); \
766 if( DejaLogFlag.On ) \
768 DejaLock( __FILE__, __LINE__, &DejaLogFlag, 0 ); \
769 DejaLog( Channel, Format , ## __VA_ARGS__ ); \
771 else \
775 else \
779 #define DEJA_WARNING( Channel, Format, ... ) \
780 if( DejaSystemActive ) \
782 DEJA_CREATE_LOG_FLAG( Channel, Format ); \
783 if( DejaLogFlag.On ) \
785 DejaLock( __FILE__, __LINE__, &DejaLogFlag, 1 ); \
786 DejaLog( Channel, Format , ## __VA_ARGS__ ); \
788 else \
792 else \
796 #define DEJA_ERROR( Channel, Format, ... ) \
797 if( DejaSystemActive ) \
799 DEJA_CREATE_LOG_FLAG( Channel, Format ); \
800 if( DejaLogFlag.On ) \
802 DejaLock( __FILE__, __LINE__, &DejaLogFlag, 2 ); \
803 DejaLog( Channel, Format , ## __VA_ARGS__ ); \
805 else \
809 else \
813 #define DEJA_BOOKMARK( Channel, Format, ... ) \
814 if( DejaSystemActive ) \
816 DEJA_CREATE_LOG_FLAG( Channel, Format ); \
817 if( DejaLogFlag.On ) \
819 DejaLock( __FILE__, __LINE__, &DejaLogFlag, 3 ); \
820 DejaLog( Channel, Format , ## __VA_ARGS__ ); \
822 else \
826 else \
830 //-----------------------
831 #endif // VARIADIC_MACROS
832 //=======================
834 //=====================
835 #ifndef VARIADIC_MACROS
836 //---------------------
838 #if defined( _MSC_VER ) && (_MSC_VER >= 1300) && (_MSC_VER < 1400)
840 ////
841 //// if( Microsoft Visual Studio.NET 2003 ) (which doesn't have variadic)
842 ////
843 // The compiler in Visual Studio.NET 2003 does not properly compile constructs
844 // using the token splice preprocessor directive (##) and the predefined line
845 // number macro (__LINE__). This defect is present in SP1 as well. The
846 // standard work-around is to use __COUNTER__ instead. But, when using the
847 // __COUNTER__ macro, you cannot refer to a symbol more than once. This
848 // version of the DEJA_TRACE macro set is less efficient, but it completely
849 // avoids the issue by isolating the static variable to a localized scope.
851 #define DEJA_TRACE { \
852 static deja_log_flag LogFlag; \
853 DejaLock( __FILE__, __LINE__, &LogFlag, 0 ); \
855 DejaLog_VS7
857 #define DEJA_WARNING { \
858 static deja_log_flag LogFlag; \
859 DejaLock( __FILE__, __LINE__, &LogFlag, 1 ); \
861 DejaLog_VS7
863 #define DEJA_ERROR { \
864 static deja_log_flag LogFlag; \
865 DejaLock( __FILE__, __LINE__, &LogFlag, 2 ); \
867 DejaLog_VS7
869 #define DEJA_BOOKMARK { \
870 static deja_log_flag LogFlag; \
871 DejaLock( __FILE__, __LINE__, &LogFlag, 3 ); \
873 DejaLog_VS7
875 #else
877 ////
878 //// NOT( Microsoft Visual Studio.NET 2003 ) and NOT( variadic macro enabled )
879 ////
881 //------------------------------------------------------------------------------
883 // This form of the logging functions is slightly sensitive to syntactic
884 // placement. It is composed of multiple statements, but it cannot be wrapped
885 // in scope braces. Otherwise, the parameters would not bind to the DejaLog
886 // call. Consider:
888 // if( Expression )
889 // DEJA_TRACE( ... );
890 // else
891 // ASSERT( false );
893 // This example would compile; but, the ASSERT would always be executed,
894 // regardless of the value of Expression.
896 // Also, this form can present problems under Microsoft compilers when not
897 // enclosed in braces in switch case clauses. The following code will generate
898 // error C2361 at compile:
900 // switch( Value )
901 // {
902 // case 1: This(); break;
903 // case 2: That(); break;
904 // case 3: TheOther(); break;
905 // default: ASSERT(false); break;
906 // }
908 // Similarly, the following code will generate error C4533 at compile:
910 // void Function( void )
911 // {
912 // if( Expression )
913 // goto jump;
915 // ASSERT( Condition );
917 // jump:
918 // // Do something relevant here.
919 // }
921 // (Obviously, this example is contrived and could be implemented without using
922 // a goto statement.)
924 // Both examples have a workaround. Simply wrap the ASSERT statements in scope
925 // braces, like so:
927 // { ASSERT(false); }
929 // { ASSERT( Condition ); }
931 //------------------------------------------------------------------------------
933 #define DEJA_TRACE { } \
934 static deja_log_flag DEJA_UNIQUE_NAME(LogFlag); \
935 if( !DEJA_UNIQUE_NAME(LogFlag).On || \
936 !DejaSystemActive ) \
937 { } \
938 else \
939 DejaLock( __FILE__, __LINE__, \
940 &DEJA_UNIQUE_NAME(LogFlag), 0 ), \
941 DejaLog
943 #define DEJA_WARNING { } \
944 static deja_log_flag DEJA_UNIQUE_NAME(LogFlag); \
945 if( !DEJA_UNIQUE_NAME(LogFlag).On || \
946 !DejaSystemActive ) \
947 { } \
948 else \
949 DejaLock( __FILE__, __LINE__, \
950 &DEJA_UNIQUE_NAME(LogFlag), 1 ), \
951 DejaLog
953 #define DEJA_ERROR { } \
954 static deja_log_flag DEJA_UNIQUE_NAME(LogFlag); \
955 if( !DEJA_UNIQUE_NAME(LogFlag).On || \
956 !DejaSystemActive ) \
957 { } \
958 else \
959 DejaLock( __FILE__, __LINE__, \
960 &DEJA_UNIQUE_NAME(LogFlag), 2 ), \
961 DejaLog
963 #define DEJA_BOOKMARK { } \
964 static deja_log_flag DEJA_UNIQUE_NAME(LogFlag); \
965 if( !DEJA_UNIQUE_NAME(LogFlag).On || \
966 !DejaSystemActive ) \
967 { } \
968 else \
969 DejaLock( __FILE__, __LINE__, \
970 &DEJA_UNIQUE_NAME(LogFlag), 3 ), \
971 DejaLog
973 #endif // Work-arounds specific to Visual Studio.NET 2003.
975 //------------------------
976 #endif // !VARIADIC_MACROS
977 //========================
979 //------------------------------------------------------------------------------
980 // Static 3D
981 //------------------------------------------------------------------------------
983 #define DEJA_3D_CHANNEL if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DChannel
984 #define DEJA_3D_COLOR if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DColor
985 #define DEJA_3D_POINT if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DPoint
986 #define DEJA_3D_POINT_LIST if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DPointList
987 #define DEJA_3D_LINE if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DLine
988 #define DEJA_3D_LINE_LIST if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DLineList
989 #define DEJA_3D_LINE_STRIP if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DLineStrip
990 #define DEJA_3D_TRI if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DTri
991 #define DEJA_3D_TRI_LIST if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DTriList
992 #define DEJA_3D_TRI_STRIP if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DTriStrip
993 #define DEJA_3D_MARKER if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DMarker
994 #define DEJA_3D_SPHERE if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DSphere
995 #define DEJA_3D_BOX_LOCAL if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DBoxLocal
996 #define DEJA_3D_BOX if( !DejaSystemActive ) { } else DejaLock( __FILE__, __LINE__ ), Deja3DBox
998 //------------------------------------------------------------------------------
999 // Context
1000 //------------------------------------------------------------------------------
1002 #define DEJA_CONTEXT_REGISTRATION( C ) \
1003 static deja_context_reg DejaContextReg( #C, __FILE__, __LINE__ );
1005 #define DEJA_CONTEXT( ContextLabel ) \
1006 DEJA_CONTEXT_REGISTRATION( ContextLabel ) \
1007 deja_context DejaContext( &DejaContextReg )
1009 //------------------------------------------------------------------------------
1010 // Data posting
1011 //------------------------------------------------------------------------------
1013 #define DEJA_OBJECT_INIT( Object ) \
1014 if( !DejaSystemActive ) { } else \
1016 DejaLock( __FILE__, __LINE__ ); \
1017 DejaPostPhase = 2; \
1018 DejaObjectInfo( &Object, #Object ); \
1019 DejaDescriptor( Object ); \
1020 DejaObjectInit(); \
1021 DejaUnlock(); \
1024 //------------------------------------------------------------------------------
1026 #define DEJA_OBJECT_KILL( Object ) \
1027 if( !DejaSystemActive ) { } else \
1029 DejaLock( __FILE__, __LINE__ ); \
1030 DejaObjectInfo( &Object, #Object ); \
1031 DejaObjectKill(); \
1032 DejaUnlock(); \
1035 //------------------------------------------------------------------------------
1036 #ifdef VARIADIC_MACROS
1037 //--------------------
1039 #define DEJA_OBJECT_LABEL( Object, Label, ... ) \
1040 if( !DejaSystemActive ) { } else \
1042 DejaLock( __FILE__, __LINE__ ); \
1043 DejaObjectLabel( &Object, Label , ## __VA_ARGS__ ); \
1044 DejaUnlock(); \
1047 //----------------------
1048 #else // VARIADIC_MACROS
1049 //----------------------
1051 #define DEJA_OBJECT_LABEL \
1052 DejaLock( __FILE__, __LINE__ ), DejaObjectLabelT
1054 template< class T >
1055 void DejaObjectLabelT( const T& Object, const char* pNLabelFormat, ... )
1057 va_list args;
1058 va_start( args, pNLabelFormat );
1059 DejaObjectLabel( (void*)&Object, pNLabelFormat, NULL, args );
1060 DejaUnlock();
1063 template< class T >
1064 void DejaObjectLabelT( const T& Object, const wchar_t* pWLabelFormat, ... )
1066 va_list args;
1067 va_start( args, pWLabelFormat );
1068 DejaObjectLabel( (void*)&Object, NULL, pWLabelFormat, args );
1069 DejaUnlock();
1072 //-----------------------
1073 #endif // VARIADIC_MACROS
1074 //------------------------------------------------------------------------------
1076 #define DEJA_POST( Object ) \
1077 if( !DejaSystemActive ) { } else \
1079 DejaLock( __FILE__, __LINE__ ); \
1080 DejaPostPhase = 3; \
1081 DejaObjectInfo( &Object, #Object ); \
1082 DejaDescriptor( Object ); \
1083 DejaAtomicFlag = false; /* Atomic posts can't clear this. */ \
1084 DejaArraySize = 1; /* Atomic posts can't clear this. */ \
1085 DejaPostFlush(); \
1086 DejaAutoFlush(); \
1087 DejaUnlock(); \
1090 //------------------------------------------------------------------------------
1092 #define DEJA_TYPE( Object, Type ) \
1093 if( !DejaSystemActive ) \
1095 return; \
1097 void (*pDescriptor)( const Type& ) = DejaDescriptor; \
1098 static deja_type DejaType( (deja_d_fn*)pDescriptor, sizeof(Type), #Type ); \
1099 if( !DejaPostLogic( DejaType, (void*)&Object ) ) \
1100 return; \
1101 DejaType.pNext = (void*)( ((Type*)(&Object)) + 1 ); \
1102 deja_owner Owner( DejaType );
1104 //------------------------------------------------------------------------------
1106 #define DEJA_BASE( Object, BaseType ) \
1108 const void* pOldFieldAddr = DejaFieldAddr; \
1109 const char* pOldFieldName = DejaFieldName; \
1110 const char* pOldEnumTypeName = DejaEnumTypeName; \
1111 int OldArraySize = DejaArraySize; \
1112 int OldTypeSeq = DejaTypeSeq; \
1113 bool OldAtomicFlag = DejaAtomicFlag; \
1115 DejaFieldAddr = (void*)( (BaseType*)(&(Object)) ); \
1116 DejaFieldName = #BaseType; \
1117 DejaArraySize = 1; \
1118 DejaEnumTypeName = NULL; \
1120 DejaField( *(BaseType*)(&(Object)) ); \
1122 DejaFieldAddr = pOldFieldAddr; \
1123 DejaFieldName = pOldFieldName; \
1124 DejaEnumTypeName = pOldEnumTypeName; \
1125 DejaArraySize = OldArraySize; \
1126 DejaTypeSeq = OldTypeSeq; \
1127 DejaAtomicFlag = OldAtomicFlag; \
1130 //------------------------------------------------------------------------------
1132 #define DEJA_FIELD( Field ) \
1134 const void* pOldFieldAddr = DejaFieldAddr; \
1135 const char* pOldFieldName = DejaFieldName; \
1136 const char* pOldEnumTypeName = DejaEnumTypeName; \
1137 int OldArraySize = DejaArraySize; \
1138 int OldTypeSeq = DejaTypeSeq; \
1139 bool OldAtomicFlag = DejaAtomicFlag; \
1141 DejaFieldAddr = &(Field); \
1142 DejaFieldName = #Field; \
1143 DejaArraySize = 1; \
1144 DejaEnumTypeName = NULL; \
1146 DejaField( Field ); \
1148 DejaFieldAddr = pOldFieldAddr; \
1149 DejaFieldName = pOldFieldName; \
1150 DejaEnumTypeName = pOldEnumTypeName; \
1151 DejaArraySize = OldArraySize; \
1152 DejaTypeSeq = OldTypeSeq; \
1153 DejaAtomicFlag = OldAtomicFlag; \
1156 //------------------------------------------------------------------------------
1158 #define DEJA_ENUM( Field, EnumType ) \
1160 const void* pOldFieldAddr = DejaFieldAddr; \
1161 const char* pOldFieldName = DejaFieldName; \
1162 const char* pOldEnumTypeName = DejaEnumTypeName; \
1163 int OldArraySize = DejaArraySize; \
1164 int OldTypeSeq = DejaTypeSeq; \
1165 bool OldAtomicFlag = DejaAtomicFlag; \
1167 DejaFieldAddr = &(Field); \
1168 DejaFieldName = #Field; \
1169 DejaArraySize = 1; \
1170 DejaEnumTypeName = #EnumType; \
1172 DejaField( Field ); \
1174 DejaFieldAddr = pOldFieldAddr; \
1175 DejaFieldName = pOldFieldName; \
1176 DejaEnumTypeName = pOldEnumTypeName; \
1177 DejaArraySize = OldArraySize; \
1178 DejaTypeSeq = OldTypeSeq; \
1179 DejaAtomicFlag = OldAtomicFlag; \
1182 //------------------------------------------------------------------------------
1184 #define DEJA_VLARRAY( Pointer, Count ) \
1186 const void* pOldFieldAddr = DejaFieldAddr; \
1187 const char* pOldFieldName = DejaFieldName; \
1188 const char* pOldEnumTypeName = DejaEnumTypeName; \
1189 int OldArraySize = DejaArraySize; \
1190 int OldTypeSeq = DejaTypeSeq; \
1191 bool OldAtomicFlag = DejaAtomicFlag; \
1192 bool OldIfPtrFlag = DejaIfPtrFlag; \
1194 DejaFieldAddr = Pointer; \
1195 DejaFieldName = #Pointer; \
1196 DejaArraySize = Count; \
1197 DejaEnumTypeName = NULL; \
1198 DejaIfPtrFlag = false; \
1200 DejaVLAField( Pointer ); \
1202 DejaFieldAddr = pOldFieldAddr; \
1203 DejaFieldName = pOldFieldName; \
1204 DejaEnumTypeName = pOldEnumTypeName; \
1205 DejaArraySize = OldArraySize; \
1206 DejaTypeSeq = OldTypeSeq; \
1207 DejaAtomicFlag = OldAtomicFlag; \
1208 DejaIfPtrFlag = OldIfPtrFlag; \
1211 //------------------------------------------------------------------------------
1213 #define DEJA_IF_PTR( Pointer ) \
1215 const void* pOldFieldAddr = DejaFieldAddr; \
1216 const char* pOldFieldName = DejaFieldName; \
1217 const char* pOldEnumTypeName = DejaEnumTypeName; \
1218 int OldArraySize = DejaArraySize; \
1219 int OldTypeSeq = DejaTypeSeq; \
1220 bool OldAtomicFlag = DejaAtomicFlag; \
1221 bool OldIfPtrFlag = DejaIfPtrFlag; \
1223 DejaFieldAddr = Pointer; \
1224 DejaFieldName = #Pointer; \
1225 DejaArraySize = (Pointer ? 1 : 0); \
1226 DejaEnumTypeName = NULL; \
1227 DejaIfPtrFlag = true; \
1229 DejaVLAField( Pointer ); \
1231 DejaFieldAddr = pOldFieldAddr; \
1232 DejaFieldName = pOldFieldName; \
1233 DejaEnumTypeName = pOldEnumTypeName; \
1234 DejaArraySize = OldArraySize; \
1235 DejaTypeSeq = OldTypeSeq; \
1236 DejaAtomicFlag = OldAtomicFlag; \
1237 DejaIfPtrFlag = OldIfPtrFlag; \
1240 //------------------------------------------------------------------------------
1242 #define DEJA_CSTRING( pString ) DEJA_VLARRAY( pString, DejaStrLen( pString ) );
1244 //------------------------------------------------------------------------------
1245 // The DEJA_ARRAY command is deprecated. Use DEJA_FIELD going forward. The
1246 // following definition of DEJA_ARRAY provides backwards compatibility. It will
1247 // be removed in a near future version.
1249 #define DEJA_ARRAY( StaticArray ) DEJA_FIELD( StaticArray )
1251 //==============================================================================
1252 #else // DEJA_DISABLED
1253 //==============================================================================
1255 //==========================================================================
1256 #ifdef VARIADIC_MACROS
1257 //==========================================================================
1259 //--------------------------------------------------------------------------
1260 // General
1261 //--------------------------------------------------------------------------
1263 #define DEJA_FLUSH( ... )
1264 #define DEJA_APP_LABEL( ... )
1265 #define DEJA_THREAD_LABEL( ... )
1266 #define DEJA_SET_PARAMETER( ... )
1267 #define DEJA_NEXT_FRAME( ... )
1268 #define DEJA_SET_AUTO_FLUSH( ... )
1269 #define DEJA_LIB_CONNECTED( ) false
1270 #define DEJA_LAST_ERROR( ) ""
1271 #define DEJA_COMMAND( ... )
1272 #define DEJA_SET_VALUE( ... )
1274 #define DEJA_SET_MALLOC( ... )
1275 #define DEJA_SET_REALLOC( ... )
1276 #define DEJA_SET_FREE( ... )
1278 #define DEJA_LOG_MALLOC( ... )
1279 #define DEJA_LOG_REALLOC( ... )
1280 #define DEJA_LOG_FREE( ... )
1281 #define DEJA_LOG_NEW( ... )
1282 #define DEJA_LOG_DELETE( ... )
1283 #define DEJA_LOG_NEW_ARRAY( ... )
1284 #define DEJA_LOG_DELETE_ARRAY( ... )
1286 #define DEJA_ENUM_VALUE( ... )
1287 #define DEJA_ENUM_ALIAS( ... )
1289 #define DEJA_SCOPE_OBJECT( ... )
1291 #define DEJA_THREAD_INIT( ... )
1292 #define DEJA_THREAD_KILL( ... )
1293 #define DEJA_THREAD_KILL( ... )
1294 #define DEJA_TERMINATE( ... )
1296 //--------------------------------------------------------------------------
1297 // Logging
1298 //--------------------------------------------------------------------------
1300 #define DEJA_TRACE( Channel, Format, ... )
1301 #define DEJA_WARNING( Channel, Format, ... )
1302 #define DEJA_ERROR( Channel, Format, ... )
1303 #define DEJA_BOOKMARK( Channel, Format, ... )
1305 //--------------------------------------------------------------------------
1306 // Static 3D
1307 //--------------------------------------------------------------------------
1309 #define DEJA_3D_CHANNEL( ... )
1310 #define DEJA_3D_COLOR( ... )
1311 #define DEJA_3D_POINT( ... )
1312 #define DEJA_3D_POINT_LIST( ... )
1313 #define DEJA_3D_LINE( ... )
1314 #define DEJA_3D_LINE_LIST( ... )
1315 #define DEJA_3D_LINE_STRIP( ... )
1316 #define DEJA_3D_TRI( ... )
1317 #define DEJA_3D_TRI_LIST( ... )
1318 #define DEJA_3D_TRI_STRIP( ... )
1319 #define DEJA_3D_MARKER( ... )
1320 #define DEJA_3D_SPHERE( ... )
1321 #define DEJA_3D_BOX_LOCAL( ... )
1322 #define DEJA_3D_BOX( ... )
1324 //--------------------------------------------------------------------------
1325 // Context
1326 //--------------------------------------------------------------------------
1328 #define DEJA_CONTEXT( ... )
1330 //--------------------------------------------------------------------------
1331 // Data posting
1332 //--------------------------------------------------------------------------
1334 #define DEJA_OBJECT_INIT( ... )
1335 #define DEJA_OBJECT_KILL( ... )
1336 #define DEJA_OBJECT_LABEL( ... )
1337 #define DEJA_POST( ... )
1338 #define DEJA_TYPE( I, T ) (void)I
1339 #define DEJA_BASE( ... )
1340 #define DEJA_FIELD( ... )
1341 #define DEJA_ENUM( ... )
1342 #define DEJA_ARRAY( ... )
1343 #define DEJA_VLARRAY( ... )
1344 #define DEJA_CSTRING( ... )
1345 #define DEJA_IF_PTR( ... )
1347 //==========================================================================
1348 #else // #ifdef VARIADIC_MACROS
1349 //==========================================================================
1351 #define DEJA_NULL_FN __noop
1353 //--------------------------------------------------------------------------
1354 // General
1355 //--------------------------------------------------------------------------
1357 #define DEJA_FLUSH DEJA_NULL_FN
1358 #define DEJA_APP_LABEL DEJA_NULL_FN
1359 #define DEJA_THREAD_LABEL DEJA_NULL_FN
1360 #define DEJA_SET_PARAMETER( a, b )
1361 #define DEJA_NEXT_FRAME( )
1362 #define DEJA_SET_AUTO_FLUSH DEJA_NULL_FN
1363 #define DEJA_LIB_CONNECTED( ) false
1364 #define DEJA_LAST_ERROR( ) ""
1365 #define DEJA_COMMAND DEJA_NULL_FN
1366 #define DEJA_SET_VALUE DEJA_NULL_FN
1368 #define DEJA_SET_MALLOC DEJA_NULL_FN
1369 #define DEJA_SET_REALLOC DEJA_NULL_FN
1370 #define DEJA_SET_FREE DEJA_NULL_FN
1372 #define DEJA_LOG_MALLOC DEJA_NULL_FN
1373 #define DEJA_LOG_REALLOC DEJA_NULL_FN
1374 #define DEJA_LOG_FREE DEJA_NULL_FN
1375 #define DEJA_LOG_NEW DEJA_NULL_FN
1376 #define DEJA_LOG_DELETE DEJA_NULL_FN
1377 #define DEJA_LOG_NEW_ARRAY DEJA_NULL_FN
1378 #define DEJA_LOG_DELETE_ARRAY DEJA_NULL_FN
1380 #define DEJA_ENUM_VALUE( T, V )
1381 #define DEJA_ENUM_ALIAS( T, V, A )
1383 #define DEJA_SCOPE_OBJECT( O )
1385 #define DEJA_THREAD_INIT( )
1386 #define DEJA_THREAD_KILL( Code )
1387 #define DEJA_TERMINATE( )
1389 //--------------------------------------------------------------------------
1390 // Logging
1391 //--------------------------------------------------------------------------
1393 #define DEJA_TRACE DEJA_NULL_FN
1394 #define DEJA_WARNING DEJA_NULL_FN
1395 #define DEJA_ERROR DEJA_NULL_FN
1396 #define DEJA_BOOKMARK DEJA_NULL_FN
1398 //--------------------------------------------------------------------------
1399 // Static 3D
1400 //--------------------------------------------------------------------------
1402 #define DEJA_3D_CHANNEL DEJA_NULL_FN
1403 #define DEJA_3D_COLOR DEJA_NULL_FN
1404 #define DEJA_3D_POINT DEJA_NULL_FN
1405 #define DEJA_3D_POINT_LIST DEJA_NULL_FN
1406 #define DEJA_3D_LINE DEJA_NULL_FN
1407 #define DEJA_3D_LINE_LIST DEJA_NULL_FN
1408 #define DEJA_3D_LINE_STRIP DEJA_NULL_FN
1409 #define DEJA_3D_TRI DEJA_NULL_FN
1410 #define DEJA_3D_TRI_LIST DEJA_NULL_FN
1411 #define DEJA_3D_TRI_STRIP DEJA_NULL_FN
1412 #define DEJA_3D_MARKER DEJA_NULL_FN
1413 #define DEJA_3D_SPHERE DEJA_NULL_FN
1414 #define DEJA_3D_BOX_LOCAL DEJA_NULL_FN
1415 #define DEJA_3D_BOX DEJA_NULL_FN
1417 //--------------------------------------------------------------------------
1418 // Context
1419 //--------------------------------------------------------------------------
1421 #define DEJA_CONTEXT( C )
1423 //--------------------------------------------------------------------------
1424 // Data posting
1425 //--------------------------------------------------------------------------
1427 #define DEJA_OBJECT_INIT( E )
1428 #define DEJA_OBJECT_KILL( E )
1429 #define DEJA_OBJECT_LABEL DEJA_NULL_FN
1430 #define DEJA_POST( V )
1431 #define DEJA_TYPE( I, T ) (void)I
1432 #define DEJA_BASE( I, T )
1433 #define DEJA_FIELD( F )
1434 #define DEJA_ENUM( T, F )
1435 #define DEJA_ARRAY( A )
1436 #define DEJA_VLARRAY( A, C )
1437 #define DEJA_CSTRING( S )
1438 #define DEJA_IF_PTR( P )
1440 //==========================================================================
1441 #endif // #ifdef VARIADIC_MACROS
1442 //==========================================================================
1444 //==============================================================================
1445 #endif // #ifndef DEJA_DISABLED
1446 //==============================================================================
1448 //==============================================================================
1449 #endif // #ifndef DEJA_PRIVATE_H
1450 //==============================================================================