1 ///////////////////////////////////////////////////////////////////////////// 2 // Diagnostic Trace 3 // 4 #ifndef __TRACE_H__ 5 #define __TRACE_H__ 6 7 #ifdef _DEBUG 8 9 #ifdef _X86_ 10 #define BreakPoint() _asm { int 3h } 11 #else 12 #define BreakPoint() _DebugBreak() 13 #endif 14 15 #ifndef ASSERT 16 #define ASSERT(exp) \ 17 { \ 18 if (!(exp)) { \ 19 Assert(#exp, __FILE__, __LINE__, NULL); \ 20 BreakPoint(); \ 21 } \ 22 } \ 23 24 #define ASSERTMSG(msg, exp) \ 25 { \ 26 if (!(exp)) { \ 27 Assert(#exp, __FILE__, __LINE__, msg); \ 28 BreakPoint(); \ 29 } \ 30 } 31 #endif 32 33 //============================================================================= 34 // MACRO: TRACE() 35 //============================================================================= 36 37 #define TRACE Trace 38 39 40 #else // _DEBUG 41 42 //============================================================================= 43 // Define away MACRO's ASSERT() and TRACE() in non debug builds 44 //============================================================================= 45 46 #ifndef ASSERT 47 #define ASSERT(exp) 48 #define ASSERTMSG(msg, exp) 49 #endif 50 51 #define TRACE 0 ? (void)0 : Trace 52 53 #endif // !_DEBUG 54 55 56 void Assert(void* assert, TCHAR* file, int line, void* msg); 57 void Trace(TCHAR* lpszFormat, ...); 58 59 60 #endif // __TRACE_H__ 61 ///////////////////////////////////////////////////////////////////////////// 62