2002-07-09 19:46:14 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-02-21 16:23:11 +00:00
|
|
|
// Diagnostic Trace
|
2002-07-09 19:46:14 +00:00
|
|
|
//
|
|
|
|
#ifndef __TRACE_H__
|
|
|
|
#define __TRACE_H__
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
|
|
#ifdef _X86_
|
|
|
|
#define BreakPoint() _asm { int 3h }
|
|
|
|
#else
|
|
|
|
#define BreakPoint() _DebugBreak()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ASSERT
|
|
|
|
#define ASSERT(exp) \
|
|
|
|
{ \
|
2003-02-21 16:23:11 +00:00
|
|
|
if (!(exp)) { \
|
|
|
|
Assert(#exp, __FILE__, __LINE__, NULL); \
|
2002-07-09 19:46:14 +00:00
|
|
|
BreakPoint(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
|
|
|
|
#define ASSERTMSG(exp, msg) \
|
|
|
|
{ \
|
2003-02-21 16:23:11 +00:00
|
|
|
if (!(exp)) { \
|
|
|
|
Assert(#exp, __FILE__, __LINE__, msg); \
|
2002-07-09 19:46:14 +00:00
|
|
|
BreakPoint(); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// MACRO: TRACE()
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#define TRACE Trace
|
2003-02-21 16:23:11 +00:00
|
|
|
|
2002-07-09 19:46:14 +00:00
|
|
|
|
|
|
|
#else // _DEBUG
|
|
|
|
|
2003-02-21 16:23:11 +00:00
|
|
|
//=============================================================================
|
|
|
|
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
|
|
|
//=============================================================================
|
|
|
|
|
2002-07-09 19:46:14 +00:00
|
|
|
#ifndef ASSERT
|
|
|
|
#define ASSERT(exp)
|
|
|
|
#define ASSERTMSG(exp, msg)
|
|
|
|
#endif
|
|
|
|
|
2003-02-21 16:23:11 +00:00
|
|
|
#define TRACE 0 ? (void)0 : Trace
|
2002-07-09 19:46:14 +00:00
|
|
|
|
2003-02-21 16:23:11 +00:00
|
|
|
#endif // !_DEBUG
|
2002-07-09 19:46:14 +00:00
|
|
|
|
|
|
|
|
2003-02-21 16:23:11 +00:00
|
|
|
void Assert(void* assert, const char* file, int line, void* msg);
|
|
|
|
void Trace(TCHAR* lpszFormat, ...);
|
2002-07-09 19:46:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif // __TRACE_H__
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|