ReactOS 0.4.15-dev-8614-gbc76250
trace.c
Go to the documentation of this file.
1
2// Diagnostic Trace
3//
4#include <stdio.h>
5#include <stdarg.h>
6#define WIN32_LEAN_AND_MEAN
7#include <windows.h>
8#include <tchar.h>
9#include "trace.h"
10
11
12#ifdef _DEBUG
13
14#undef THIS_FILE
15static char THIS_FILE[] = __FILE__;
16
17void _DebugBreak(void)
18{
19 DebugBreak();
20}
21
22void Trace(TCHAR* lpszFormat, ...)
23{
25 int nBuf;
26 TCHAR szBuffer[512];
27
28 va_start(args, lpszFormat);
29 nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
30 OutputDebugString(szBuffer);
31 // was there an error? was the expanded string too long?
32 //ASSERT(nBuf >= 0);
33 va_end(args);
34}
35
36void Assert(void* assert, TCHAR* file, int line, void* msg)
37{
38 if (msg == NULL) {
39 printf("ASSERT -- %s occured on line %u of file %s.\n",
40 assert, line, file);
41 } else {
42 printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
43 assert, line, file, msg);
44 }
45}
46
47#else
48
49void Trace(TCHAR* lpszFormat, ...) { };
50void Assert(void* assert, TCHAR* file, int line, void* msg) { };
51
52#endif //_DEBUG
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define msg(x)
Definition: auth_time.c:54
#define NULL
Definition: types.h:112
#define Assert(cond, msg)
Definition: inflate.c:41
#define Trace(x)
Definition: inflate.c:42
#define assert(x)
Definition: debug.h:53
#define printf
Definition: freeldr.h:97
#define args
Definition: format.c:66
Definition: match.c:390
Definition: fci.c:127
Definition: parser.c:49
void WINAPI DebugBreak(void)
#define OutputDebugString
Definition: winbase.h:3890
char TCHAR
Definition: xmlstorage.h:189
#define _vsntprintf
Definition: xmlstorage.h:203