-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrxdebug.cpp
58 lines (47 loc) · 1.18 KB
/
rxdebug.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "StdAfx.h"
#if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
//#error _DEBUG should not be defined except in internal Adesk debug builds
#endif
#ifdef _DEBUG
#include "rxdebug.h"
#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
//VC8:resolved the redefinition error, macro is already defined in stdlib.h
#ifdef _countof
#undef _countof
#endif
// determine number of elements in an array (not bytes)
#define _countof(array) (sizeof(array)/sizeof(array[0]))
inline void _cdecl RxTrace(const TCHAR* lpszFormat, ...)
{
va_list args;
va_start(args, lpszFormat);
int nBuf;
TCHAR szBuffer[512];
nBuf = _vsnwprintf_s(szBuffer, _countof(szBuffer), lpszFormat, args);
// was there an error?
RXASSERT(nBuf >= 0);
::OutputDebugString(szBuffer);
va_end(args);
}
#endif //_DEBUG, entire file