#if !defined(__AECDEBUG_H__) #define __AECDEBUG_H__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 void _cdecl AecTrace(const TCHAR* lpszFormat, ...); #ifdef _DEBUG #define AecTrace ::AecTrace #define AECASSERT(f) assert(f) #ifndef _WINBASE_ //extracted from winbase.h so that we don't have to pull in the whole header extern "C" void _stdcall OutputDebugStringA(const TCHAR* lpOutputString); extern "C" void _stdcall OutputDebugStringW(const unsigned short* lpOutputString); #ifdef UNICODE #define OutputDebugString OutputDebugStringW #else #define OutputDebugString OutputDebugStringA #endif // !UNICODE #endif //_WINBASE // determine number of elements in an array (not bytes) #define _count_of(array) (sizeof(array)/sizeof(array[0])) inline void _cdecl AecTrace(LPCTSTR lpszFormat, ...) { va_list args; va_start(args, lpszFormat); int nBuf; TCHAR szBuffer[512]; nBuf = _vsntprintf(szBuffer, _count_of(szBuffer), lpszFormat, args); // was there an error? AECASSERT(nBuf >= 0); ::OutputDebugString(szBuffer); va_end(args); } #else #define AecTrace 1?(void)0: ::AecTrace #define AECASSERT(f) ((void)0) #endif // _DEBUG #endif // __AECACAD_H__